Changeset 13612
- Timestamp:
- Jun 4, 2007, 10:11:28 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/stack_skycell.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/stack_skycell.pl
r13275 r13612 18 18 use PS::IPP::Metadata::List qw( parse_md_list ); 19 19 use Data::Dumper; 20 use File::Temp qw( tempfile ); 20 21 21 22 use PS::IPP::Config qw($PS_EXIT_SUCCESS … … 51 52 my $missing_tools; 52 53 my $stacktool = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1); 53 my $ppStac = can_run('ppStac') or (warn "Can't find ppStac" and $missing_tools = 1);54 my $ppStack = can_run('ppStack') or (warn "Can't find ppStack" and $missing_tools = 1); 54 55 if ($missing_tools) { 55 56 warn("Can't find required tools."); … … 79 80 scalar @$files >= 2; 80 81 81 # Parse the list of input files, and get the skycell identifier 82 my $inputList; # List of input files 82 # Parse the list of input files to get the tesselation, skycell identifiers and camera 83 83 my $skycell_id; # Skycell identifier 84 84 my $tess_id; # Tesselation identifier 85 85 my $camera; # Camera 86 86 foreach my $file (@$files) { 87 $inputList .= $file->{uri} . ' ';88 87 if (defined $tess_id) { 89 88 &my_die("Tesselation identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless … … 107 106 &my_die("Can't find camera", $stack_id, $PS_EXIT_SYS_ERROR) unless $camera; 108 107 $ipprc->define_camera($camera); 108 109 # Generate MDC file with the inputs 110 my ($listFile, $listName) = tempfile( "$tess_id.$skycell_id.stk$stack_id.list.XXXX", UNLINK => 1 ); 111 my $num = 0; 112 foreach my $file (@$files) { 113 print $listFile "INPUT$num\tMETADATA\n"; 114 $num++; 115 print $listFile "\tIMAGE\tSTR\t" . $file->{uri} . "\n"; 116 117 ### XXX NEED TO UPDATE THESE appropriately 118 print $listFile "\tMASK\tSTR\t" . "NULL" . "\n"; 119 print $listFile "\tSEEING\tF32\t" . 1.0 . "\n"; 120 print $listFile "\tWEIGHT\tF32\t" . 1.0 . "\n"; 121 print $listFile "\tSCALE\tF32\t" . 1.0 . "\n"; 122 123 print $listFile "END\n\n"; 124 } 109 125 110 126 # Get the output filenames … … 119 135 my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser 120 136 unless ($no_op) { 121 my $command = "$ppStac $outputName $inputList"; # Command to run pois137 my $command = "$ppStack $listName $outputName -stat $outputStats"; # Command to run pois 122 138 123 139 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 130 146 # &my_die("Couldn't find expected output file: $bin1Name", $stack_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($bin1Name); 131 147 # &my_die("Couldn't find expected output file: $bin2Name", $stack_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($bin2Name); 132 # &my_die("Couldn't find expected output file: $outputStats", $stack_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputStats); 133 134 # Get the statistics on the residual image 135 if (0) { ### Disabled because ppStac doesn't output stats yet 136 my $statsFile; # File handle 137 open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $stack_id, $PS_EXIT_SYS_ERROR); 138 my @contents = <$statsFile>; # Contents of file 139 close $statsFile; 140 my $metadata = $mdcParser->parse(join "", @contents) or 141 &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR); 142 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $stack_id, $PS_EXIT_PROG_ERROR); 143 } 148 &my_die("Couldn't find expected output file: $outputStats", $stack_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputStats); 149 150 # Get the statistics on the stacked image 151 my $statsFile; # File handle 152 open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $stack_id, $PS_EXIT_SYS_ERROR); 153 my @contents = <$statsFile>; # Contents of file 154 close $statsFile; 155 my $metadata = $mdcParser->parse(join "", @contents) or 156 &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR); 157 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $stack_id, $PS_EXIT_PROG_ERROR); 144 158 } 145 159
Note:
See TracChangeset
for help on using the changeset viewer.
