IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 23, 2007, 6:07:01 PM (19 years ago)
Author:
Paul Price
Message:

Getting scripts to talk to ippTools. warp_overlap.pl and warp_imfile.pl both cooperate (i.e., work with --no-op). Haven't tried diff or stack yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/warp_imfile.pl

    r12021 r12043  
    1616use PS::IPP::Metadata::Config;
    1717use PS::IPP::Metadata::Stats;
     18use PS::IPP::Metadata::List qw( parse_md_list );
    1819
    1920use PS::IPP::Config qw(
     
    3233use Pod::Usage qw( pod2usage );
    3334
    34 my ($warp_id, $skycell_id, $camera, $dbname, $workdir, $no_update, $no_op);
     35my ($warp_id, $skycell_id, $tess_id, $camera, $dbname, $workdir, $no_update, $no_op);
    3536GetOptions(
    3637    'warp_id|i=s'       => \$warp_id, # Warp identifier
    3738    'skycell_id|s=s'    => \$skycell_id, # Skycell identifier
     39    'tess_id|s=s'       => \$tess_id, # Tesselation identifier
    3840    'camera|c=s'        => \$camera, # Camera name
    3941    'dbname|d=s'        => \$dbname, # Database name
     
    4547pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    4648pod2usage(
    47     -msg => "Required options: --warp_id --skycell_id --camera",
     49    -msg => "Required options: --warp_id --skycell_id --tess_id --camera",
    4850    -exitval => 3,
    4951) unless defined $warp_id
    5052    and defined $skycell_id
     53    and defined $tess_id
    5154    and defined $camera;
    5255
     
    6669my $imfiles;
    6770{
    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";
    6972    $command .= " -dbname $dbname" if defined $dbname;
    7073    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    7275    unless ($success) {
    7376        $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);
    7578    }
    7679
    7780    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);
    7982    $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);
    8184}
    8285
     
    8588    $workdir = $ipprc->convert_filename_absolute( $workdir );
    8689} 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 );
    8892    $workdir = $dir;
    8993}
     
    97101
    98102# Get list of filenames
    99 open my $listFile, '>' . $listName;
     103open my $listFile, "> $listName" or &my_die("Unable to open $listName", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR);
    100104foreach my $imfile (@$imfiles) {
    101105    my $uri = $ipprc->convert_filename_absolute( $imfile->{uri} );
     
    115119        &my_die("Unable to perform pswarp: $error_code", $warp_id, $skycell_id, $error_code);
    116120    }
    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;
    121125
    122126    # Get the statistics on the warped image
     
    126130    close $statsFile;
    127131    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);
    130134}
    131135
     
    140144# Add the processed file to the database
    141145unless ($no_update) {
    142     my $command = "$warptool -warped -warp_id $warp_id -skycell_id $skycell_id" .
    143         " -uri $outputImage -b1_uri $outputRoot";  # Command to run dettool
     146    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
    144148    $command .= " -bg $bg -bg_stdev $bg_stdev";
    145149    $command .= " -dbname $dbname" if defined $dbname;
     
    149153    unless ($success) {
    150154        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    151         warn("Unable to perform warptool -addwarpedimfile: $error_code\n");
     155        warn("Unable to perform warptool -addwarped: $error_code\n");
    152156        exit($error_code);
    153157    }
     
    161165    my $warp_id = shift;        # Warp identifier
    162166    my $skycell_id = shift;     # Skycell identifier
     167    my $tess_id = shift;        # Tesselation identifier
    163168    my $exit_code = shift;      # Exit code to add
    164169
    165170    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";
    168173        $command .= " -dbname $dbname" if defined $dbname;
    169174        system ($command);
Note: See TracChangeset for help on using the changeset viewer.