IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19721


Ignore:
Timestamp:
Sep 23, 2008, 3:06:53 PM (18 years ago)
Author:
eugene
Message:

add sun/moon data

File:
1 edited

Legend:

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

    r17964 r19721  
    2121use PS::IPP::Metadata::Config;
    2222use PS::IPP::Metadata::Stats;
     23
     24my $PI = 3.141592653589793238462643383279502;
    2325
    2426my $ipprc = PS::IPP::Config->new(); # IPP configuration
     
    7476       { name => "FPA.TELESCOPE",  type => "constant", flag => "-telescope",       dtype => "string" }, # Telescope
    7577       { name => "FPA.CAMERA",     type => "constant", flag => "-inst",            dtype => "string" }, # Instrument
     78       { name => "FPA.LONGITUDE",  type => "constant", flag => "-longitude",       dtype => "float"  }, # Site longitude
     79       { name => "FPA.LATITUDE",   type => "constant", flag => "-latitude",        dtype => "float"  }, # Site latitude
     80       { name => "FPA.ELEVATION",  type => "constant", flag => "-elevation",       dtype => "float"  }, # Site elevation
    7681       { name => "FPA.M1X",        type => "constant", flag => "-m1_x",            dtype => "float"  }, # M1X
    7782       { name => "FPA.M1Y",        type => "constant", flag => "-m1_y",            dtype => "float"  }, # M1Y
     
    172177$command .= $stats->cmdflags();
    173178
     179# determine solar-system parameters
     180my $longitude = $stats->value_for_flag ("-longitude");
     181my $latitude  = $stats->value_for_flag ("-latitude");
     182my $elevation = $stats->value_for_flag ("-elevation");
     183my $ra        = $stats->value_for_flag ("-ra");
     184my $dec       = $stats->value_for_flag ("-decl");
     185my $dateobs   = $stats->value_for_flag ("-dateobs");
     186
     187# if the needed data is available, pass it to sunmoon:
     188if ($longitude && $latitude && $ra && $dec && $dateobs) {
     189   
     190    $longitude *= 12.0 / $PI; # longitude is reported in West radians; sunmoon wants it in West Hours
     191    $latitude *= 180.0 / $PI; # latitude is reported in North radians; sunmoon wants it in North Degrees
     192    $ra *= 180.0 / $PI; # ra is reported in radians; sunmoon wants it in degrees
     193    $dec *= 180.0 / $PI; # dec is reported in radians; sunmoon wants it in degrees
     194
     195    my $sunmoon_cmd = "sunmoon -latitude $latitude -longitude $longitude -elevation $elevation $ra $dec $dateobs";
     196    my $sunmoon_data = `$sunmoon_cmd`;
     197    chomp $sunmoon_data;
     198
     199    # print STDERR "run: $sunmoon_cmd\n";
     200    # print STDERR "got: $sunmoon_data\n";
     201
     202    if ($?) {
     203        warn ("failure running $sunmoon_cmd, not supplying\n");
     204    } else {
     205        $command .= " $sunmoon_data";
     206    }
     207}
     208
    174209$now_time = localtime();
    175210printf STDERR "\nrunning regtool update: %s\n", $now_time if $verbose;
Note: See TracChangeset for help on using the changeset viewer.