& /htmlheader &>
<& fieldmap.js, tjd => $tjd, show_plan => 's23456' &>
<& modelheader &>
|
<% $tjd_str %>
<% "$utdate_str OC $ocnum" %>
Chunks Ingested
% foreach my $ch (sort keys %chunky) {
- <% "$ch ($chunky{$ch})" %>
% }
Czaring
Efficiency
|
|
<& /htmlfooter &>
<%args>
$today => undef
$nn => undef
$tjd => undef
$utdate => undef
%args>
<%init>
use Astro::Time;
use PS::MOPS::Lib;
use PS::MOPS::DC::Field;
my $inst = $m->notes('INST');
my $mc = $inst->getConfig();
my $model = $m->notes('MODEL');
my $dbh = $inst->dbh;
# Today's info.
my ($year, $mon, $day);
my $today_nn;
my $today_tjd;
my @schmoo = gmtime;
$year = $schmoo[5] + 1900;
$mon = $schmoo[4] + 1;
$day = $schmoo[3];
$today_tjd = int(cal2mjd($day, $mon, $year, 0)) - 50000;
$today_nn = $today_tjd - 1 + 50000;
my $today_tjd_str = sprintf "TJD %d", $today_nn + 1 - 50000;
my $today_utdate_str = mopslib_mjd2utctimestr($tjd + 50000);
$today_utdate_str =~ s/T.*//; # trim everything after date
my $today_oc = mopslib_mjd2ocnum($today_nn);
# User info.
if ($tjd) {
$nn = $tjd - 1 + 50000;
}
elsif ($utdate) {
if ($utdate =~ /today/) {
$nn = $today_nn;
}
elsif ($utdate =~ /^(\d\d\d\d)[\/.-]?(\d\d)[\/.-]?(\d\d)$/) {
($year, $mon, $day) = ($1, $2, $3);
$nn = int(cal2mjd($day, $mon, $year, 0)) - 1;
}
}
else {
# nothing specified, use latest.
($nn) = $dbh->selectrow_array('select nn from fields order by nn desc limit 1');
$nn = $today_nn unless $nn; # no fields, oh well
}
$tjd = $nn - 50000 + 1;
my $tjd_str = sprintf "TJD %d", $nn + 1 - 50000;
my $utdate_str = mopslib_mjd2utctimestr($tjd + 50000);
$utdate_str =~ s/T.*//; # trim everything after date
$utdate_str .= ' UT';
my $ocnum = mopslib_mjd2ocnum($nn);
my $next_tjd = $tjd + 1;
my $next_nn = $nn + 1;
my $next_tjd_str = sprintf "TJD %d", $next_tjd;
my $next_utdate_str = mopslib_mjd2utctimestr($next_tjd + 50000);
$next_utdate_str =~ s/T.*//; # trim everything after date
$next_utdate_str .= ' UT';
my $next_oc = mopslib_mjd2ocnum($next_tjd + 50000);
my $prev_tjd = $tjd - 1;
my $prev_nn = $nn - 1;
my $prev_tjd_str = sprintf "TJD %d", $prev_tjd;
my $prev_utdate_str = mopslib_mjd2utctimestr($prev_tjd + 50000);
$prev_utdate_str =~ s/T.*//; # trim everything after date
$prev_utdate_str .= ' UT';
my $prev_oc = mopslib_mjd2ocnum($prev_tjd + 50000);
# Now get some field/chunk information.
my $sth = $dbh->prepare(<<"SQL") or die $dbh->errstr;
select survey_mode, count(*) ct from fields
where nn=?
group by survey_mode
SQL
$sth->execute($tjd + 50000 - 1) or die $sth->errstr;
my $have_mds;
my $have_quads;
my %chunky;
while (my $href = $sth->fetchrow_hashref) {
if ($href->{survey_mode} =~ /^MD/) {
$have_mds = 1;
}
else {
$have_quads = 1;
}
$chunky{$href->{survey_mode}} = $href->{ct};
}
%init>