IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20689


Ignore:
Timestamp:
Nov 11, 2008, 1:29:12 PM (17 years ago)
Author:
bills
Message:

take warp_id as argument and look up the exposure id

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/magic_definerun.pl

    r20677 r20689  
    4343
    4444pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    45 pod2usage( -msg => "Required options: --exp_id --workdir",
     45pod2usage( -msg => "Required options: --warp_id --workdir",
    4646           -exitval => 3) unless
    47     defined $exp_id and
    48     defined $workdir;
     47    defined $workdir and
     48    defined $warp_id;
    4949
    5050# $ipprc->define_camera($camera);
     
    5454my $magictool = can_run('magictool') or (warn "Can't find magictool" and $missing_tools = 1);
    5555my $difftool  = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1);
     56my $warptool  = can_run('warptool') or (warn "Can't find warptool" and $missing_tools = 1);
    5657if ($missing_tools) {
    5758    warn("Can't find required tools.");
     
    6061
    6162my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
     63
     64if (!$exp_id) {
     65    my $command = "$warptool -warped -warp_id $warp_id -limit 1";
     66    $command .= " -dbname $dbname" if defined $dbname;
     67    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     68        run(command => $command, verbose => $verbose);
     69    unless ($success) {
     70        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     71        &my_die("Unable to perform warptool -warped error_code: $error_code", $error_code);
     72    }
     73
     74    my $warptool_output = join "", @$stdout_buf;
     75
     76    my $warpskyfiles = parse_md_fast($mdcParser, $warptool_output);
     77    &my_die("Unable to parse metadata list", $PS_EXIT_UNKNOWN_ERROR) unless $warpskyfiles;
     78
     79    my $warped = $warpskyfiles->[0];
     80    $exp_id = $warped->{exp_id};
     81    &my_die("failed to get exp_id for warp: $warp_id", $PS_EXIT_UNKNOWN_ERROR) unless $exp_id;
     82}
    6283
    6384### Get a list of inputs
Note: See TracChangeset for help on using the changeset viewer.