IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21091


Ignore:
Timestamp:
Jan 8, 2009, 10:57:15 AM (17 years ago)
Author:
Paul Price
Message:

Adding ability to pull out only particular products.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/stack_outputs.pl

    r20885 r21091  
    2525my ($stack_id);                  # Stack of interest
    2626my ($input);                    # Input list
     27my ($products);                 # Products of interest
    2728
    2829GetOptions(
     
    3233           'dbpass=s' => \$db_pw, # Database p/w
    3334           'stack_id=s' => \$stack_id, # Stack identifier
     35           'products=s' => \$products, # Products of interest
    3436           ) or die "Unable to parse arguments.\n";
    3537die "Unknown option: @ARGV\n" if @ARGV;
     
    5658                                     ) or die "Unable to execute SQL: $DBI::errstr";
    5759
     60my @products;                   # Array of products
     61if (defined $products) {
     62    @products = split /,/, $products;
     63} else {
     64    @products = keys %{EXTENSIONS()};
     65}
     66
    5867foreach my $stack ( @$stacks ) {
    59     copy_extensions( $stack, EXTENSIONS() );
     68    foreach my $product ( @products ) {
     69        copy_extension( $stack, ${EXTENSIONS()}{$product} );
     70    }
    6071}
    6172
     
    6374
    6475
    65 sub copy_extensions
     76sub copy_extension
    6677{
    6778    my $path = shift;           # Path to copy
    68     my $extensions = shift;     # Extensions structure
     79    my $ext = shift;            # Extension to copy
    6980
    70     foreach my $type ( keys %$extensions ) {
    71         my $ext = $$extensions{$type}; # Extension
    72         my $neb = "$path$ext"; # Nebulous file
    73         my $source = `neb-locate --path $neb` or die "Unable to locate $neb\n"; # Actual file
    74         chomp $source;
    75         my ($target) = $source =~ m|^.*:(.*)|; # Target name
    76         !system "cp $source $target" or die "Unable to copy $source\n";
    77     }
     81    my $file = "$path$ext"; # File
     82    my $source = `ipp_datapath.pl $file` or die "Unable to locate $file\n"; # Actual file
     83    chomp $source;
     84    my ($target) = $source =~ m|^.*[:/](.*)|; # Target name
     85    !system "cp $source $target" or die "Unable to copy $source\n";
    7886}
Note: See TracChangeset for help on using the changeset viewer.