IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 13, 2008, 10:43:34 AM (17 years ago)
Author:
Paul Price
Message:

Adding support for retrieving specific products. Fixing bug that was
attempting to pull out even ignored warps.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/warp_outputs.pl

    r20657 r20721  
    2222my ($skycell_id);               # Skycell of interest
    2323my ($input);                    # Input list
     24my ($products);                 # Products of interest
    2425
    2526GetOptions(
     
    3031           'warp_id=s' => \$warp_id, # Warp identifier
    3132           'skycell_id=s' => \$skycell_id, # Skycell identifier
     33           'products=s' => \$products, # Products of interest
    3234           ) or die "Unable to parse arguments.\n";
    3335die "Unknown option: @ARGV\n" if @ARGV;
     
    4749
    4850# Query to run
    49 my $sql = "SELECT path_base FROM warpSkyfile WHERE warp_id = $warp_id";
     51my $sql = "SELECT path_base FROM warpSkyfile WHERE warp_id = $warp_id AND ignored = 0";
    5052$sql .= " AND skycell_id = $skycell_id" if defined $skycell_id;
    5153
     
    5557                                     ) or die "Unable to execute SQL: $DBI::errstr";
    5658
     59my @products;                   # Array of products
     60if (defined $products) {
     61    @products = split /,/, $products;
     62} else {
     63    @products = keys %{EXTENSIONS()};
     64}
     65
    5766foreach my $warp ( @$warps ) {
    58     copy_extensions( $warp, EXTENSIONS() );
     67    foreach my $product ( @products ) {
     68        copy_extension( $warp, ${EXTENSIONS()}{$product} );
     69    }
    5970}
    6071
     
    6273
    6374
    64 sub copy_extensions
     75sub copy_extension
    6576{
    6677    my $path = shift;           # Path to copy
    67     my $extensions = shift;     # Extensions structure
     78    my $ext = shift;            # Extension to copy
    6879
    69     foreach my $type ( keys %$extensions ) {
    70         my $ext = $$extensions{$type}; # Extension
    71         my $file = "$path$ext"; # File
    72         my $source = `ipp_datapath.pl $file` or die "Unable to locate $file\n"; # Actual file
    73         chomp $source;
    74         my ($target) = $source =~ m|^.*[:/](.*)|; # Target name
    75         !system "cp $source $target" or die "Unable to copy $source\n";
    76     }
     80    my $file = "$path$ext"; # File
     81    my $source = `ipp_datapath.pl $file` or die "Unable to locate $file\n"; # Actual file
     82    chomp $source;
     83    my ($target) = $source =~ m|^.*[:/](.*)|; # Target name
     84    !system "cp $source $target" or die "Unable to copy $source\n";
    7785}
Note: See TracChangeset for help on using the changeset viewer.