IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23540


Ignore:
Timestamp:
Mar 25, 2009, 6:55:57 PM (17 years ago)
Author:
eugene
Message:

add default response to value_for_flag; check for NULL for the required strings (numerical cond test fails on valid string)

File:
1 edited

Legend:

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

    r23501 r23540  
    112112
    113113# we require at a minimum: -telescope, -inst, -filelevel, -class_id, -exp_type
    114 if (uc(&value_for_flag ($cmdflags, "-telescope")) == 0) { &my_die ("telescope not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
    115 if (uc(&value_for_flag ($cmdflags, "-inst"))      == 0) { &my_die ("inst      not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
    116 if (uc(&value_for_flag ($cmdflags, "-filelevel")) == 0) { &my_die ("filelevel not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
    117 if (uc(&value_for_flag ($cmdflags, "-class_id"))  == 0) { &my_die ("class_id  not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
    118 if (uc(&value_for_flag ($cmdflags, "-exp_type"))  == 0) { &my_die ("exp_type  not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
     114if (uc(&value_for_flag ($cmdflags, "NULL", "-telescope")) eq "NULL") { &my_die ("telescope not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
     115if (uc(&value_for_flag ($cmdflags, "NULL", "-inst"))      eq "NULL") { &my_die ("inst      not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
     116if (uc(&value_for_flag ($cmdflags, "NULL", "-filelevel")) eq "NULL") { &my_die ("filelevel not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
     117if (uc(&value_for_flag ($cmdflags, "NULL", "-class_id"))  eq "NULL") { &my_die ("class_id  not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
     118if (uc(&value_for_flag ($cmdflags, "NULL", "-exp_type"))  eq "NULL") { &my_die ("exp_type  not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
    119119
    120120my $command = "$regtool -addprocessedimfile";
     
    128128
    129129# determine solar-system parameters
    130 my $longitude = &value_for_flag($cmdflags, "-longitude");
    131 my $latitude  = &value_for_flag($cmdflags, "-latitude");
    132 my $elevation = &value_for_flag($cmdflags, "-elevation");
    133 my $ra        = &value_for_flag($cmdflags, "-ra");
    134 my $dec       = &value_for_flag($cmdflags, "-decl");
    135 my $dateobs   = &value_for_flag($cmdflags, "-dateobs");
     130my $longitude = &value_for_flag($cmdflags, 0.0, "-longitude");
     131my $latitude  = &value_for_flag($cmdflags, 0.0, "-latitude");
     132my $elevation = &value_for_flag($cmdflags, 0.0, "-elevation");
     133my $ra        = &value_for_flag($cmdflags, 0.0, "-ra");
     134my $dec       = &value_for_flag($cmdflags, 0.0, "-decl");
     135my $dateobs   = &value_for_flag($cmdflags, 0.0, "-dateobs");
    136136
    137137# if the needed data is available, pass it to sunmoon:
     
    193193{
    194194    my $cmdflags = shift;
     195    my $default = shift;
    195196    my $flag = shift;
    196197
    197     my $value = 0.0;
     198    my $value = $default;
    198199    if ($cmdflags =~ m|$flag|) {
    199200        ($value) = $cmdflags =~ m|$flag\s+(\S+)|;
Note: See TracChangeset for help on using the changeset viewer.