IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 23, 2007, 3:12:46 PM (19 years ago)
Author:
Paul Price
Message:

More fixes following the name change.

File:
1 edited

Legend:

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

    r12013 r12021  
    3232use Pod::Usage qw( pod2usage );
    3333
    34 my ($p4_id, $skycell_id, $camera, $dbname, $workdir, $no_update, $no_op);
     34my ($warp_id, $skycell_id, $camera, $dbname, $workdir, $no_update, $no_op);
    3535GetOptions(
    36     'p4_id|i=s'         => \$p4_id, # Phase 4 identifier
     36    'warp_id|i=s'       => \$warp_id, # Warp identifier
    3737    'skycell_id|s=s'    => \$skycell_id, # Skycell identifier
    3838    'camera|c=s'        => \$camera, # Camera name
     
    4545pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    4646pod2usage(
    47     -msg => "Required options: --p4_id --skycell_id --camera",
     47    -msg => "Required options: --warp_id --skycell_id --camera",
    4848    -exitval => 3,
    49 ) unless defined $p4_id
     49) unless defined $warp_id
    5050    and defined $skycell_id
    5151    and defined $camera;
     
    5555# Look for programs we need
    5656my $missing_tools;
    57 my $warptool = can_run('p4tool') or (warn "Can't find p4tool" and $missing_tools = 1);
     57my $warptool = can_run('warptool') or (warn "Can't find warptool" and $missing_tools = 1);
    5858my $pswarp = can_run('pswarp') or (warn "Can't find pswarp" and $missing_tools = 1);
    5959if ($missing_tools) {
     
    6666my $imfiles;
    6767{
    68     my $command = "$warptool -imfile -p4_id $p4_id -skycell_id $skycell_id";
     68    my $command = "$warptool -imfile -warp_id $warp_id -skycell_id $skycell_id";
    6969    $command .= " -dbname $dbname" if defined $dbname;
    7070    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    7272    unless ($success) {
    7373        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    74         &my_die("Unable to perform warptool -imfile: $error_code", $p4_id, $skycell_id, $error_code);
     74        &my_die("Unable to perform warptool -imfile: $error_code", $warp_id, $skycell_id, $error_code);
    7575    }
    7676
    7777    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    78         &my_die("Unable to parse metadata config doc", $p4_id, $skycell_id, $PS_EXIT_PROG_ERROR);
     78        &my_die("Unable to parse metadata config doc", $warp_id, $skycell_id, $PS_EXIT_PROG_ERROR);
    7979    $imfiles = parse_md_list($metadata) or
    80         &my_die("Unable to parse metadata list", $p4_id, $skycell_id, $PS_EXIT_PROG_ERROR);
     80        &my_die("Unable to parse metadata list", $warp_id, $skycell_id, $PS_EXIT_PROG_ERROR);
    8181}
    8282
     
    8888    $workdir = $dir;
    8989}
    90 my $outputFile = "$skycell_id.warp.$p4_id"; # Root name
     90my $outputFile = "$skycell_id.warp.$warp_id"; # Root name
    9191my $outputRoot = File::Spec->catfile( $workdir, $outputFile );
    9292my $outputImage = $ipprc->filename("PSWARP.OUTPUT", $outputRoot, $skycell_id );
     
    113113    unless ($success) {
    114114        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    115         &my_die("Unable to perform pswarp: $error_code", $p4_id, $skycell_id, $error_code);
     115        &my_die("Unable to perform pswarp: $error_code", $warp_id, $skycell_id, $error_code);
    116116    }
    117     &my_die("Couldn't find expected output file: $outputImage", $p4_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputImage;
    118     &my_die("Couldn't find expected output file: $outputStats", $p4_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;
    119     &my_die("Couldn't find expected output file: $outputBin1", $p4_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1;
    120     &my_die("Couldn't find expected output file: $outputBin2", $p4_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2;
     117    &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputImage;
     118    &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;
     119    &my_die("Couldn't find expected output file: $outputBin1", $warp_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1;
     120    &my_die("Couldn't find expected output file: $outputBin2", $warp_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2;
    121121
    122122    # Get the statistics on the warped image
     
    126126    close $statsFile;
    127127    my $metadata = $mdcParser->parse(join "", @contents)
    128         or &my_die("Unable to parse metadata config", $p4_id, $skycell_id, $PS_EXIT_PROG_ERROR);
    129     $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $p4_id, $skycell_id, $PS_EXIT_PROG_ERROR);
     128        or &my_die("Unable to parse metadata config", $warp_id, $skycell_id, $PS_EXIT_PROG_ERROR);
     129    $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $warp_id, $skycell_id, $PS_EXIT_PROG_ERROR);
    130130}
    131131
     
    140140# Add the processed file to the database
    141141unless ($no_update) {
    142     my $command = "$warptool -warped -p4_id $p4_id -skycell_id $skycell_id" .
     142    my $command = "$warptool -warped -warp_id $warp_id -skycell_id $skycell_id" .
    143143        " -uri $outputImage -b1_uri $outputRoot";  # Command to run dettool
    144144    $command .= " -bg $bg -bg_stdev $bg_stdev";
     
    159159{
    160160    my $msg = shift;            # Warning message on die
    161     my $p4_id = shift;          # Phase 4 identifier
     161    my $warp_id = shift;        # Warp identifier
    162162    my $skycell_id = shift;     # Skycell identifier
    163163    my $exit_code = shift;      # Exit code to add
    164164
    165165    warn($msg);
    166     if ($p4_id and $skycell_id and not $no_update) {
    167         my $command = "$warptool -warped -p4_id $p4_id -skycell_id $skycell_id -code $exit_code";
     166    if ($warp_id and $skycell_id and not $no_update) {
     167        my $command = "$warptool -warped -warp_id $warp_id -skycell_id $skycell_id -code $exit_code";
    168168        $command .= " -dbname $dbname" if defined $dbname;
    169169        system ($command);
Note: See TracChangeset for help on using the changeset viewer.