IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 19, 2009, 5:32:10 PM (17 years ago)
Author:
bills
Message:

change "params" file for get_image jobs to be mdc doc that contains "all" of
the data for the component. Various other changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/pstampparse.pl

    r26151 r26204  
    394394        print ARGSLIST "$args\n";
    395395        close ARGSLIST or my_die("failed to close $argslist", $PS_EXIT_UNKNOWN_ERROR);
     396
     397        write_params($output_base, $image);
    396398
    397399        my $newState = "run";
     
    638640        my $exp_id = $image->{exp_id};
    639641           
    640         my $output_base = "$out_dir/${rownum}_${job_num}_";
    641         my $params = "${output_base}.params";
    642 
    643         # copy the argument list to a file
    644         open PARAMS, ">$params" or my_die("failed to open $params", $PS_EXIT_UNKNOWN_ERROR);
    645         print PARAMS "$stage $image->{stage_id} $image->{component} $image->{path_base} $image->{camera}\n";
    646         close PARAMS or my_die("failed to close $params", $PS_EXIT_UNKNOWN_ERROR);
     642        my $output_base = "$out_dir/${rownum}_${job_num}";
     643
     644        write_params($output_base, $image);
    647645
    648646        my $newState = "run";
     
    877875}
    878876
     877sub write_params {
     878    my $output_base = shift;
     879    my $image = shift;
     880
     881    # write the contents of this "image" as a metadata config doc
     882    # Simply treat all values as strings. This is ok since we are only going to
     883    # read it from another perl script
     884    my $mdc_file = "${output_base}.mdc";
     885    open P, ">$mdc_file" or my_die("failed to open $mdc_file", $PS_EXIT_UNKNOWN_ERROR);
     886
     887    print P "params METADATA\n";
     888
     889    foreach my $key (keys %$image) {
     890        my $value = $image->{$key};
     891        if (defined $value) {
     892            printf P "  %-20s STR     %s\n", $key, $value;
     893        } else {
     894            printf STDERR "skipping undefined value for $key\n";
     895        }
     896    }
     897
     898    print P "END\n";
     899    close P or my_die("failed to close $mdc_file", $PS_EXIT_UNKNOWN_ERROR);
     900}
     901
    879902sub my_die
    880903{
Note: See TracChangeset for help on using the changeset viewer.