Changeset 12043 for trunk/ippScripts/scripts/warp_imfile.pl
- Timestamp:
- Feb 23, 2007, 6:07:01 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/warp_imfile.pl (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/warp_imfile.pl
r12021 r12043 16 16 use PS::IPP::Metadata::Config; 17 17 use PS::IPP::Metadata::Stats; 18 use PS::IPP::Metadata::List qw( parse_md_list ); 18 19 19 20 use PS::IPP::Config qw( … … 32 33 use Pod::Usage qw( pod2usage ); 33 34 34 my ($warp_id, $skycell_id, $ camera, $dbname, $workdir, $no_update, $no_op);35 my ($warp_id, $skycell_id, $tess_id, $camera, $dbname, $workdir, $no_update, $no_op); 35 36 GetOptions( 36 37 'warp_id|i=s' => \$warp_id, # Warp identifier 37 38 'skycell_id|s=s' => \$skycell_id, # Skycell identifier 39 'tess_id|s=s' => \$tess_id, # Tesselation identifier 38 40 'camera|c=s' => \$camera, # Camera name 39 41 'dbname|d=s' => \$dbname, # Database name … … 45 47 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 46 48 pod2usage( 47 -msg => "Required options: --warp_id --skycell_id -- camera",49 -msg => "Required options: --warp_id --skycell_id --tess_id --camera", 48 50 -exitval => 3, 49 51 ) unless defined $warp_id 50 52 and defined $skycell_id 53 and defined $tess_id 51 54 and defined $camera; 52 55 … … 66 69 my $imfiles; 67 70 { 68 my $command = "$warptool - imfile -warp_id $warp_id -skycell_id $skycell_id";71 my $command = "$warptool -scmap -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id"; 69 72 $command .= " -dbname $dbname" if defined $dbname; 70 73 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 72 75 unless ($success) { 73 76 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 74 &my_die("Unable to perform warptool - imfile: $error_code", $warp_id, $skycell_id, $error_code);77 &my_die("Unable to perform warptool -scmap: $error_code", $warp_id, $skycell_id, $tess_id, $error_code); 75 78 } 76 79 77 80 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 78 &my_die("Unable to parse metadata config doc", $warp_id, $skycell_id, $ PS_EXIT_PROG_ERROR);81 &my_die("Unable to parse metadata config doc", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR); 79 82 $imfiles = parse_md_list($metadata) or 80 &my_die("Unable to parse metadata list", $warp_id, $skycell_id, $ PS_EXIT_PROG_ERROR);83 &my_die("Unable to parse metadata list", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR); 81 84 } 82 85 … … 85 88 $workdir = $ipprc->convert_filename_absolute( $workdir ); 86 89 } else { 87 my ($vol, $dir, $file) = File::Spec->splitpath( $$imfiles[0]->{uri} ); 90 my $example = $ipprc->convert_filename_absolute( $$imfiles[0]->{uri} ); 91 my ($vol, $dir, $file) = File::Spec->splitpath( $example ); 88 92 $workdir = $dir; 89 93 } … … 97 101 98 102 # Get list of filenames 99 open my $listFile, '>' . $listName;103 open my $listFile, "> $listName" or &my_die("Unable to open $listName", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR); 100 104 foreach my $imfile (@$imfiles) { 101 105 my $uri = $ipprc->convert_filename_absolute( $imfile->{uri} ); … … 115 119 &my_die("Unable to perform pswarp: $error_code", $warp_id, $skycell_id, $error_code); 116 120 } 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 &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless -f $outputImage; 122 &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats; 123 &my_die("Couldn't find expected output file: $outputBin1", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1; 124 &my_die("Couldn't find expected output file: $outputBin2", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2; 121 125 122 126 # Get the statistics on the warped image … … 126 130 close $statsFile; 127 131 my $metadata = $mdcParser->parse(join "", @contents) 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);132 or &my_die("Unable to parse metadata config", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR); 133 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR); 130 134 } 131 135 … … 140 144 # Add the processed file to the database 141 145 unless ($no_update) { 142 my $command = "$warptool - warped -warp_id $warp_id -skycell_id $skycell_id" .143 " -uri $outputImage -b1_uri $outputRoot"; # Command to run dettool146 my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id" . 147 " -uri $outputImage"; # -b1_uri $outputRoot"; # Command to run dettool 144 148 $command .= " -bg $bg -bg_stdev $bg_stdev"; 145 149 $command .= " -dbname $dbname" if defined $dbname; … … 149 153 unless ($success) { 150 154 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 151 warn("Unable to perform warptool -addwarped imfile: $error_code\n");155 warn("Unable to perform warptool -addwarped: $error_code\n"); 152 156 exit($error_code); 153 157 } … … 161 165 my $warp_id = shift; # Warp identifier 162 166 my $skycell_id = shift; # Skycell identifier 167 my $tess_id = shift; # Tesselation identifier 163 168 my $exit_code = shift; # Exit code to add 164 169 165 170 warn($msg); 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";171 if ($warp_id and $skycell_id and $tess_id and not $no_update) { 172 my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id -code $exit_code"; 168 173 $command .= " -dbname $dbname" if defined $dbname; 169 174 system ($command);
Note:
See TracChangeset
for help on using the changeset viewer.
