Changeset 12021 for trunk/ippScripts/scripts/warp_imfile.pl
- Timestamp:
- Feb 23, 2007, 3:12:46 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/warp_imfile.pl (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/warp_imfile.pl
r12013 r12021 32 32 use Pod::Usage qw( pod2usage ); 33 33 34 my ($ p4_id, $skycell_id, $camera, $dbname, $workdir, $no_update, $no_op);34 my ($warp_id, $skycell_id, $camera, $dbname, $workdir, $no_update, $no_op); 35 35 GetOptions( 36 ' p4_id|i=s' => \$p4_id, # Phase 4identifier36 'warp_id|i=s' => \$warp_id, # Warp identifier 37 37 'skycell_id|s=s' => \$skycell_id, # Skycell identifier 38 38 'camera|c=s' => \$camera, # Camera name … … 45 45 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 46 46 pod2usage( 47 -msg => "Required options: -- p4_id --skycell_id --camera",47 -msg => "Required options: --warp_id --skycell_id --camera", 48 48 -exitval => 3, 49 ) unless defined $ p4_id49 ) unless defined $warp_id 50 50 and defined $skycell_id 51 51 and defined $camera; … … 55 55 # Look for programs we need 56 56 my $missing_tools; 57 my $warptool = can_run(' p4tool') or (warn "Can't find p4tool" and $missing_tools = 1);57 my $warptool = can_run('warptool') or (warn "Can't find warptool" and $missing_tools = 1); 58 58 my $pswarp = can_run('pswarp') or (warn "Can't find pswarp" and $missing_tools = 1); 59 59 if ($missing_tools) { … … 66 66 my $imfiles; 67 67 { 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"; 69 69 $command .= " -dbname $dbname" if defined $dbname; 70 70 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 72 72 unless ($success) { 73 73 $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); 75 75 } 76 76 77 77 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); 79 79 $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); 81 81 } 82 82 … … 88 88 $workdir = $dir; 89 89 } 90 my $outputFile = "$skycell_id.warp.$ p4_id"; # Root name90 my $outputFile = "$skycell_id.warp.$warp_id"; # Root name 91 91 my $outputRoot = File::Spec->catfile( $workdir, $outputFile ); 92 92 my $outputImage = $ipprc->filename("PSWARP.OUTPUT", $outputRoot, $skycell_id ); … … 113 113 unless ($success) { 114 114 $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); 116 116 } 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; 121 121 122 122 # Get the statistics on the warped image … … 126 126 close $statsFile; 127 127 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); 130 130 } 131 131 … … 140 140 # Add the processed file to the database 141 141 unless ($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" . 143 143 " -uri $outputImage -b1_uri $outputRoot"; # Command to run dettool 144 144 $command .= " -bg $bg -bg_stdev $bg_stdev"; … … 159 159 { 160 160 my $msg = shift; # Warning message on die 161 my $ p4_id = shift; # Phase 4identifier161 my $warp_id = shift; # Warp identifier 162 162 my $skycell_id = shift; # Skycell identifier 163 163 my $exit_code = shift; # Exit code to add 164 164 165 165 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"; 168 168 $command .= " -dbname $dbname" if defined $dbname; 169 169 system ($command);
Note:
See TracChangeset
for help on using the changeset viewer.
