Changeset 25712 for trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
- Timestamp:
- Oct 1, 2009, 10:07:51 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
r25323 r25712 34 34 my $img_type = shift; # required 35 35 my $id = shift; # required unless req_type eq bycoord or byskycell 36 my $tess_id = shift; 36 37 my $component= shift; # class_id or skycell_id 37 38 my $inverse = shift; 39 my $need_magic = shift; 38 40 my $x = shift; 39 41 my $y = shift; … … 41 43 my $mjd_max = shift; 42 44 my $filter = shift; 45 my $label = shift; 43 46 my $verbose = shift; 44 47 45 48 46 49 # we die in response to bad data in request files 47 die "Unknown req_type: $req_type" if ($req_type ne "byid") and ($req_type ne "byexp") 48 and ($req_type ne "bycoord") and ($req_type ne "bydiff"); 50 die "Unknown req_type: $req_type" 51 if ($req_type ne "byid") and 52 ($req_type ne "byexp") and 53 ($req_type ne "bycoord") and 54 ($req_type ne "bydiff") and 55 ($req_type ne "byskycell"); 56 57 my $dateobs_begin; 58 my $dateobs_end; 59 if (!iszero($mjd_min)) { 60 $dateobs_begin = mjd_to_dateobs($mjd_min); 61 } 62 if (!iszero($mjd_max)) { 63 $dateobs_end = mjd_to_dateobs($mjd_max); 64 } 49 65 50 66 if (($req_type eq "byid") and ($img_type eq "diff")) { … … 95 111 # regtool -dbname $image_db -processedimfile -time_begin $mjd_min -time_end = $mjd_max -filter $filter 96 112 # 97 my $results = lookup_bycoord($ipprc, $image_db, $x, $y, $ mjd_min, $mjd_max, $filter, $verbose);113 my $results = lookup_bycoord($ipprc, $image_db, $x, $y, $dateobs_begin, $dateobs_end, $filter, $verbose); 98 114 99 115 # now take the results and lookup byexp … … 102 118 $req_type = "byexp"; 103 119 $id = $results->{exp_name}; 104 } 105 106 my $results = lookup($ipprc, $image_db, $req_type, $img_type, $id, $component, $verbose); 120 } elsif ($req_type eq "byskycell") { 121 if (($img_type eq "raw") or ($img_type eq "chip")) { 122 print STDERR "REQ_TYPE byskycell not supported for IMG_TYPE raw or chip\n"; 123 return undef; 124 } 125 if (!$tess_id or !$component) { 126 print STDERR "component and tess_id are required for REQ_TYPE byskycell\n"; 127 return undef; 128 } 129 } 130 131 my $results = lookup($ipprc, $image_db, $req_type, $img_type, $id, $tess_id, $component, $need_magic, $dateobs_begin, $dateobs_end, $filter, $label, $verbose); 107 132 108 133 return $results; … … 115 140 my $img_type = shift; 116 141 my $id = shift; 142 my $tess_id = shift; 117 143 my $component= shift; 144 my $need_magic = shift; 145 my $dateobs_begin = shift; 146 my $dateobs_end = shift; 147 my $filter = shift; 148 my $label = shift; 118 149 my $verbose = shift; 119 150 … … 139 170 my $skycell_id; 140 171 141 # special class_id value "null" means ignore 142 if ($component and ($component eq "null")) { 172 if (isnull($component)) { 143 173 $component = undef; 144 174 } 145 175 176 my $magic_arg = $need_magic ? " -destreaked" : ""; 146 177 if ($img_type eq "raw") { 147 178 $class_id = $component; … … 196 227 } elsif ($req_type eq "byexp") { 197 228 $command .= " -exp_name $id"; 229 } elsif ($req_type eq "byskycell") { 230 $command .= " -tess_id $tess_id -skycell_id $skycell_id"; 198 231 } else { 199 232 die "Unknown req_type supplied: $req_type"; 200 233 } 234 235 if ($img_type ne "stack") { 236 $command .= $magic_arg; 237 $command .= " -dateobs_begin $dateobs_begin" if $dateobs_begin; 238 $command .= " -dateobs_end $dateobs_end" if $dateobs_end; 239 } 240 241 $command .= " -filter $filter" if !isnull($filter); 242 $command .= " -label $label" if !isnull($label); 201 243 202 244 # run the tool and parse the output … … 386 428 my $x = shift; 387 429 my $y = shift; 388 my $ mjd_min = shift;389 my $ mjd_max= shift;430 my $dateobs_begin = shift; 431 my $dateobs_end = shift; 390 432 my $filter = shift; 391 433 my $verbose = shift; … … 403 445 404 446 my $args; 405 if ($mjd_min) { 406 my $dateobs_min = mjd_to_dateobs($mjd_min); 407 $args .= " -dateobs_begin $dateobs_min"; 408 } 409 if ($mjd_max) { 410 my $dateobs_max = mjd_to_dateobs($mjd_max); 411 $args .= " -dateobs_end $dateobs_max"; 412 } 413 if ($filter) { 447 if (!isnull($dateobs_begin)) { 448 $args .= " -dateobs_begin $dateobs_begin"; 449 } 450 if (!isnull($dateobs_end)) { 451 $args .= " -dateobs_end $dateobs_end"; 452 } 453 if (!isnull($filter)) { 414 454 $args .= " -filter $filter"; 415 455 } … … 567 607 my ($sec, $min, $hr, $day, $mon, $year) = gmtime($ticks); 568 608 569 return sprintf "'%4d-%02d-%02d %02d:%02d:%02d'", $year+1900, $mon+1, $day, $hr, $min, $sec; 609 return sprintf "'%4d-%02d-%02dT%02d:%02d:%02dZ'", $year+1900, $mon+1, $day, $hr, $min, $sec; 610 } 611 612 sub isnull { 613 my $val = shift; 614 615 return (!defined($val) or (lc($val) eq "null")); 616 } 617 618 sub iszero { 619 my $val = shift; 620 return (!defined($val) or ($val == 0)); 570 621 } 571 622
Note:
See TracChangeset
for help on using the changeset viewer.
