IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 26, 2012, 3:23:03 PM (14 years ago)
Author:
Serge CHASTEL
Message:

ppMops new parameters

File:
1 edited

Legend:

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

    r30376 r34475  
    3232my $pubtool = can_run('pubtool') or (warn "Can't find pubtool" and $missing_tools = 1);
    3333my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1);
     34my $regtool = can_run('regtool') or (warn "Can't find regtool" and $missing_tools = 1);
    3435my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1);
    3536my $ppMops = can_run('ppMops') or (warn "Can't find ppMops" and $missing_tools = 1);
     
    4445my ( $pub_id, $camera, $stage, $stage_id, $fileset, $format, $product, $workdir, $need_magic );
    4546my ( $dbname, $verbose, $no_update, $no_op, $save_temps, $redirect );
    46 my ( $output_format );
     47my ( $output_format, $difftype );
    4748
    4849GetOptions(
     
    6263    'redirect-output'   => \$redirect,   # Redirect output to log file?
    6364    'output_format=i'   => \$output_format, # Output format for ppMops
     65    'difftype=s'        => \$difftype,    # "WW" / "WS" / "SW"
    6466    ) or pod2usage( 2 );
    6567
     
    195197        $filename = $resolved;
    196198
     199        my $cam_id = $comp->{cam_id_1};
     200        my $cam_command =  "$camtool -processedexp -cam_id $cam_id";
     201        $cam_command .= " -dbname $dbname" if defined $dbname;
     202        my ( $cam_success, $cam_error_code, $cam_full_buf, $cam_stdout_buf, $cam_stderr_buf ) =
     203            run(command => $cam_command, verbose => $verbose);
     204        &my_die( "Unable to retrieve filename", $pub_id, $PS_EXIT_SYS_ERROR) unless $cam_success;
     205        my $cam_metadata = $mdcParser->parse(join "", @$cam_stdout_buf) or
     206            &my_die("Unable to parse metadata config", $pub_id, $PS_EXIT_PROG_ERROR);
     207        my $cam_components = parse_md_list($cam_metadata) or
     208            &my_die("Unable to parse metadata list", $pub_id, $PS_EXIT_PROG_ERROR);
     209        &my_die("More than one entry for cam_id $stage_id", $pub_id, $PS_EXIT_PROG_ERROR) if scalar @$cam_components > 1;
     210        my $cam_comp = $$cam_components[0];
     211
     212        my $exp_id = $comp->{exp_id_1};
     213        my $reg_command =  "$regtool -processedimfile -exp_id $exp_id";
     214        $reg_command .= " -dbname $dbname" if defined $dbname;
     215        my ( $reg_success, $reg_error_code, $reg_full_buf, $reg_stdout_buf, $reg_stderr_buf ) =
     216            run(command => $reg_command, verbose => $verbose);
     217        &my_die( "Unable to retrieve filename", $pub_id, $PS_EXIT_SYS_ERROR) unless $reg_success;
     218        my $reg_metadata = $mdcParser->parse(join "", @$reg_stdout_buf) or
     219            &my_die("Unable to parse metadata config", $pub_id, $PS_EXIT_PROG_ERROR);
     220        my $reg_components = parse_md_list($reg_metadata) or
     221            &my_die("Unable to parse metadata list", $pub_id, $PS_EXIT_PROG_ERROR);
     222        my $reg_comp = $$reg_components[0];
     223
    197224        my $data = { zp => $zp,
    198225                     zp_err => $comp->{zpt_stdev},
     
    207234                     output_format => $comp->{output_format},
    208235                     direction => 1,
     236                     comment => $reg_comp->{comment},
     237                     obsmode => $reg_comp->{obs_mode},
     238                     difftype => $difftype,
     239                     sky => $cam_comp->{bg},
     240                     shutoutc => $comp->{dateobs},
    209241        };
    210242
     
    239271                         diff_id => $comp->{diff_id},
    240272                         direction => 0,
     273                         comment => $reg_comp->{comment},
     274                         obsmode => $reg_comp->{obs_mode},
     275                         difftype => $difftype,
     276                         sky => $cam_comp->{bg},
     277                         shutoutc => $comp->{dateobs},
    241278            };
    242279
     
    288325    &my_die( "Unable to register with data store", $pub_id, $PS_EXIT_SYS_ERROR) unless $success;
    289326}
    290 
    291 
    292327
    293328### Pau.
     
    311346    $data->{diff_id} = $comp->{diff_id} unless defined $data->{diff_id};
    312347    $data->{direction} = $comp->{direction} unless defined $data->{direction};
     348    $data->{comment} = $comp->{comment} unless defined $data->{comment};
     349    $data->{obsmode} = $comp->{obsmode} unless defined $data->{obsmode};
     350    $data->{difftype} = $comp->{difftype} unless defined $data->{difftype};
     351    $data->{sky} = $comp->{sky} unless defined $data->{sky};
     352    $data->{shutoutc} = $comp->{shutoutc} unless defined $data->{shutoutc};
    313353
    314354    &my_die("zp value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{zp} and $comp->{zp} != $data->{zp};
     
    323363    &my_die("diff_id value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{diff_id} and $comp->{diff_id} != $data->{diff_id};
    324364    &my_die("direction value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{direction} and $comp->{direction} != $data->{direction};
     365    &my_die("comment value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{comment} and $comp->{comment} != $data->{comment};
     366    &my_die("obsmode value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{obsmode} and $comp->{obsmode} != $data->{obsmode};
     367    &my_die("difftype value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{difftype} and $comp->{difftype} != $data->{difftype};
     368    &my_die("sky value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{sky} and $comp->{sky} != $data->{sky};
     369    &my_die("shutoutc value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{shutoutc} and $comp->{shutoutc} != $data->{shutoutc};
    325370
    326371    return 1;
     
    350395    $command .= " -astrom_rms " . $data->{astrom} if defined $data->{astrom};
    351396    $command .= " -version " . $data->{output_format} if defined $data->{output_format};
     397    $command .= " -comment " . $data->{comment} if defined $data->{comment};
     398    $command .= " -obsmode " . $data->{obsmode} if defined $data->{obsmode};
     399    $command .= " -difftype " . $data->{difftype} if defined $data->{difftype};
     400    $command .= " -sky " . $data->{sky} if defined $data->{sky};
     401    $command .= " -shutoutc " . $data->{shutoutc} if defined $data->{shutoutc};
    352402
    353403    unless ($no_op) {
Note: See TracChangeset for help on using the changeset viewer.