Changeset 24553
- Timestamp:
- Jun 25, 2009, 1:50:29 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/magic_destreak.pl (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/magic_destreak.pl
r24378 r24553 16 16 use IPC::Cmd 0.36 qw( can_run run ); 17 17 use File::Temp qw( tempfile ); 18 use File::Basename qw( basename );18 use File::Basename qw( basename dirname ); 19 19 use PS::IPP::Metadata::Config; 20 20 use PS::IPP::Metadata::List qw( parse_md_list ); … … 37 37 my ($magic_ds_id, $camera, $streaks, $stage, $stage_id, $component, $uri, $path_base, $inverse, $cam_path_base); 38 38 my ($outroot, $recoveryroot); 39 my ($replace, $re move, $release);39 my ($replace, $release); 40 40 my ($dbname, $save_temps, $verbose, $no_update, $no_op, $logfile); 41 41 … … 54 54 'recoveryroot=s' => \$recoveryroot,# "directory" for saving the images of excised pixels 55 55 'replace=s' => \$replace, # replace the input images with the results. 56 'remove=s' => \$remove, # remove the original images when done YIKES!57 56 'release' => \$release, # NAN masked pixels for release 58 57 'save-temps' => \$save_temps, # Save temporary files? … … 96 95 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 97 96 97 my $dirname = dirname($path_base); 98 98 my $basename = basename($path_base); 99 100 # 101 # parse the replace and remove arguments check for errors and set up99 my $nebulousInput = inNebulous($dirname); 100 101 # parse replace arguments check for errors and set up 102 102 # the appropriate paths 103 103 if (defined($replace) and ($replace eq "T")) { … … 117 117 } 118 118 119 if (defined($remove) and ($remove eq "T")) {120 $remove = 1;121 } else {122 $remove = 0;123 }124 125 if ($remove and !$replace) {126 &my_die("cannot remove without replace", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);127 }128 129 119 # create the output directories if it is not a nebulous path and it doesn't exist 130 if ( index($outroot, "neb://") != 0) {120 if (!inNebulous($outroot)) { 131 121 if (! -e $outroot ) { 132 122 my $code = system "mkdir -p $outroot"; … … 134 124 $code >> 8) if $code; 135 125 } 126 #} elsif ($replace) { 127 # if input is in nebulous and we've been asked to replace the input with the destreaked 128 # version the output must be in nebulous as well 129 # XXX Is this necessary? if ($replace) the outputs are going to the nebulous "directory" of the 130 # input anyways. Why require that other files (log) be in nebulous 136 131 } 137 132 138 133 my $backup_path_base; 139 if (! $remove) { 140 $backup_path_base = "$outroot/$basename"; 134 my $tmproot; 135 if ($replace) { 136 # in replace mode, we place the output files in the same "directory" as the inputs 137 # Nebulous requires this for the two inputs to nebSwap which we use 138 # We prepend the path with SR_ This causes the filenames for instances of the swapped files to 139 # have SR in them. 140 $tmproot = $dirname . "/SR_"; 141 $backup_path_base = $tmproot . "$basename"; 142 } else { 143 # note: trailing / is necessary 144 $tmproot = "$outroot/"; 145 $backup_path_base = $tmproot . $basename; 141 146 } 142 147 143 148 my $recovery_path_base; 144 149 if ($recoveryroot) { 145 if ( index($recoveryroot, "neb://") != 0) {150 if (!inNebulous($recoveryroot)) { 146 151 if (! -e $recoveryroot ) { 147 152 my $code = system "mkdir -p $recoveryroot"; … … 150 155 } 151 156 } 152 $recovery_path_base = "$recoveryroot/$basename"; 157 # note: trailing / is necessary 158 $recovery_path_base = "$recoveryroot/$basename/"; 153 159 } 154 160 … … 209 215 210 216 { 211 my $command = "$streaksremove -stage $stage -tmproot $ outroot -streaks $streaks -image $image";217 my $command = "$streaksremove -stage $stage -tmproot $tmproot -streaks $streaks -image $image"; 212 218 213 219 $command .= " -class_id $class_id" if defined $class_id; … … 219 225 $command .= " -skycelllist $skycell_list" if defined $skycell_list; 220 226 $command .= " -replace" if $replace; 221 $command .= " -remove" if $remove;222 227 $command .= " -release" if $release; 223 228 $command .= " -dbname $dbname" if defined $dbname; … … 272 277 } 273 278 279 sub inNebulous 280 { 281 my $path = shift; 282 283 my $scheme = file_scheme($path); 284 285 return $scheme and ($scheme eq "neb"); 286 } 287 288 274 289 sub my_die 275 290 {
Note:
See TracChangeset
for help on using the changeset viewer.
