IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29868


Ignore:
Timestamp:
Nov 26, 2010, 3:28:00 PM (15 years ago)
Author:
rhenders
Message:

improvments to date handling, using new more meaningful arg for 'day'; option to create index file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/czarmetrics.pl

    r29803 r29868  
    99
    1010use czartool::DayMetrics;
     11use czartool::MultiDayMetrics;
     12use czartool::MetricsIndex;
    1113use czartool::CzarDb;
    1214use czartool::Gpc1Db;
     
    1618my $begin = undef;
    1719my $end = undef;
     20my $cumulative = undef;
     21my $index = undef;
    1822my $verbose = undef;
    1923my $save_temps = undef;
     
    2327        "begin|b=s" => \$begin,
    2428        "end|e=s" => \$end,
    25         "day|y=s" => \$day,
     29        "day|d=s" => \$day,
     30        "index|i" => \$index,
     31        "cumulative|c" => \$cumulative,
    2632        "verbose|v" => \$verbose,
    2733        );
     
    3541}
    3642if (!$day) {
    37     print "* OPTIONAL: choose a single day             -y <date>               (default=today)\n";
     43    print "* OPTIONAL: choose a single day                -d <date>               (default=today)\n";
    3844}
    39 if (!$begin) {
    40     print "* OPTIONAL: choose a begin date             -b <date>               (default=today)\n";}
    41 if (!$end)
    42 {
    43     print "* OPTIONAL: choose an end date              -e <date>               (default=today)\n";
     45if (!$begin) {
     46    print "* OPTIONAL: choose a begin date                -b <date>               (default=today)\n";
     47}
     48if (!$end) {
     49    print "* OPTIONAL: choose an end date                 -e <date>               (default=today)\n";
     50}
     51if (!$cumulative) {
     52    print "* OPTIONAL: cumulative metrics for date range  -c                      (default=off)\n";
     53}
     54if (!$index) {
     55    print "* OPTIONAL: create index file for all metrics  -i                      (default=off)\n";
    4456}
    4557
     
    5264$czarDb->setDateFormat("%Y%m%d-%H%i%s");
    5365
     66if ($index) {
     67
     68    my $metricsIndex = new czartool::MetricsIndex($gpc1Db, $czarDb, "/data/ipp004.0/ipp/ippMetrics/", 1, 0);
     69    $metricsIndex->writeHTML();
     70    exit;
     71}
    5472
    5573if (!$day && !$begin && !$end) {
     
    6179
    6280my $thisDay = $begin;
    63 while (1) {
    6481
    65     my $dayMetrics = new czartool::DayMetrics($gpc1Db, $czarDb, "/data/ipp004.0/ipp/ippMetrics/", 1, 0, $thisDay);
    66     $dayMetrics->writeHTML();
     82if ($cumulative) {
    6783
    68     $thisDay = $czarDb->addInterval($thisDay, "1 DAY");
    69     if ($czarDb->isBefore($end, $thisDay)) {last;}
     84        my $multiDayMetrics = new czartool::MultiDayMetrics($gpc1Db, $czarDb, "/data/ipp004.0/ipp/ippMetrics/", 1, 0, $begin, $end);
     85        $multiDayMetrics->writeHTML();
    7086}
     87else {
     88
     89    while (1) {
     90
     91        my $dayMetrics = new czartool::DayMetrics($gpc1Db, $czarDb, "/data/ipp004.0/ipp/ippMetrics/", 1, 0, $thisDay);
     92        $dayMetrics->writeHTML();
     93
     94        $thisDay = $czarDb->addInterval($thisDay, "1 DAY");
     95        if ($czarDb->isBefore($end, $thisDay)) {last;}
     96    }
     97}
     98
Note: See TracChangeset for help on using the changeset viewer.