Changeset 12021 for trunk/ippScripts/scripts/warp_overlap.pl
- Timestamp:
- Feb 23, 2007, 3:12:46 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/warp_overlap.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/warp_overlap.pl
r12013 r12021 32 32 use Pod::Usage qw( pod2usage ); 33 33 34 my ($ p4_id, $dbname, $workdir, $no_update, $no_op);34 my ($warp_id, $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 'dbname|d=s' => \$dbname, # Database name 38 38 'workdir|w=s' => \$workdir, # Working directory, for output files … … 43 43 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 44 44 pod2usage( 45 -msg => "Required options: -- p4_id",45 -msg => "Required options: --warp_id", 46 46 -exitval => 3, 47 ) unless defined $ p4_id;47 ) unless defined $warp_id; 48 48 49 49 # Look for programs we need 50 50 my $missing_tools; 51 my $warptool = can_run(' p4tool') or (warn "Can't find p4tool" and $missing_tools = 1);51 my $warptool = can_run('warptool') or (warn "Can't find warptool" and $missing_tools = 1); 52 52 #my $overlap = can_run('overlap') or (warn "Can't find overlap" and $missing_tools = 1); 53 53 if ($missing_tools) { … … 59 59 my $imfiles; 60 60 { 61 my $command = "$warptool -imfile - p4_id $p4_id";61 my $command = "$warptool -imfile -warp_id $warp_id"; 62 62 $command .= " -dbname $dbname" if defined $dbname; 63 63 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 65 65 unless ($success) { 66 66 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 67 &my_die("Unable to perform warptool -imfile: $error_code", $ p4_id, $error_code);67 &my_die("Unable to perform warptool -imfile: $error_code", $warp_id, $error_code); 68 68 } 69 69 70 70 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 71 71 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 72 &my_die("Unable to parse metadata config doc", $ p4_id, $PS_EXIT_PROG_ERROR);72 &my_die("Unable to parse metadata config doc", $warp_id, $PS_EXIT_PROG_ERROR); 73 73 $imfiles = parse_md_list($metadata) or 74 &my_die("Unable to parse metadata list", $ p4_id, $PS_EXIT_PROG_ERROR);74 &my_die("Unable to parse metadata list", $warp_id, $PS_EXIT_PROG_ERROR); 75 75 } 76 76 … … 90 90 # Generate a MDC file with the overlaps 91 91 $workdir = $ipprc->convert_filename_absolute( $workdir ); 92 my $overlapName = File::Spec->catfile( $workdir, $ p4_id . '.overlap.mdc' );92 my $overlapName = File::Spec->catfile( $workdir, $warp_id . '.overlap.mdc' ); 93 93 open my $overlapFile, "> $overlapName" or 94 &my_die("Unable to open mdc file $overlapName", $ p4_id, $PS_EXIT_DATA_ERROR);95 print $overlapFile " p4SkyCellMap MULTI\n\n";94 &my_die("Unable to open mdc file $overlapName", $warp_id, $PS_EXIT_DATA_ERROR); 95 print $overlapFile "warpSkyCellMap MULTI\n\n"; 96 96 foreach my $imfile (@$imfiles) { 97 print $overlapFile " p4_id\t\tS32\t" . $imfile->{p4_id} . "\n";97 print $overlapFile "warp_id\t\tS32\t" . $imfile->{warp_id} . "\n"; 98 98 print $overlapFile "skycell_id\tSTR\t" . $imfile->{skycell_id} . "\n"; 99 99 print $overlapFile "tess_id\t\tSTR\t" . $imfile->{tess_id} . "\n"; … … 106 106 # Add the processed file to the database 107 107 unless ($no_update) { 108 my $command = "$warptool -addoverlap - p4_id $p4_id -info $overlapName"; # Command to run p4tool108 my $command = "$warptool -addoverlap -warp_id $warp_id -info $overlapName"; # Command to run warptool 109 109 $command .= " -dbname $dbname" if defined $dbname; 110 110 … … 125 125 { 126 126 my $msg = shift; # Warning message on die 127 my $ p4_id = shift; # Phase 4identifier127 my $warp_id = shift; # Warp identifier 128 128 my $exit_code = shift; # Exit code to add 129 129 130 130 warn($msg); 131 if ($ p4_id and not $no_update) {132 my $command = "$warptool -addoverlap - p4_id $p4_id -code $exit_code";131 if ($warp_id and not $no_update) { 132 my $command = "$warptool -addoverlap -warp_id $warp_id -code $exit_code"; 133 133 $command .= " -dbname $dbname" if defined $dbname; 134 134 system ($command);
Note:
See TracChangeset
for help on using the changeset viewer.
