Changeset 242

Show
Ignore:
Timestamp:
10/03/08 15:20:38
Author:
dan
Message:

Changes: Added new command line option to specifiy a specific providers last N records.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • scout/trunk/GetLatestData.pl

    r235 r242  
     1############################################################################### 
     2#Rev: 1.2.0.0 
     3#Author: DWR 
     4#Changes: Added new command line option to specifiy a specific providers last N records. 
     5############################################################################### 
     6 
    17#!/usr/bin/perl  
    28 
     
    1723else 
    1824{ 
    19   $Minute = `\\UnixUtils\\usr\\local\\wbin\\date %M`; 
     25  $Minute = `\\Unix 
     26Utils\\usr\\local\\wbin\\date %M`; 
    2027} 
    2128=cut 
     
    2835            "DownloadDir:s",        #Optional. Directory to store the downloaded netcdf files in. Default is ./latest_netcdf_files. 
    2936            "FetchLogDir:s",        #Optional. Directory for log files we use to determine what the new netcdf files are to download. Default is ./fetch_logs. 
    30             "UseLastNTimeStamps:s"  #Optional. Integer representing the last N time entries to use when converting the data to obsKML. DWR v1.1.0.0 6/2/2008 
     37            "UseLastNTimeStamps:s",  #Optional. Integer representing the last N time entries to use when converting the data to obsKML. DWR v1.1.0.0 6/2/2008 
     38            "UseLastNTimeStampsForOrg:s"  #Optional. List specifing orginization and the last N time entries to use for them. Whereas the UseLastNTimeStamps is applied 
     39                                    #to every organization, this can tailor to the specific. If not provided and UseLastNTimeStamps is provided, it is used. 
    3140             ); 
    3241 
     
    3847my $strFetchLogDir     = $CommandLineOptions{"FetchLogDir"}; 
    3948my $strLastNTimeStamps   = $CommandLineOptions{"UseLastNTimeStamps"}; #DWR v1.1.0.0 6/2/2008 
     49my $strLastNTimeStampsPerOrg = $CommandLineOptions{"UseLastNTimeStampsForOrg"}; #DWR v1.2.0.0 9/17/2008 
    4050if( length( $strURLControlFile ) == 0 ) 
    4151{ 
     
    4858              "--DownloadDir is the directory to store the downloaded files. Optional, default is ./latest_netcdf_files.\n". 
    4959              "--FetchLogDir is the directory were the file time stamps are stored. The script uses these files to determine which files are really the latest. Optional, default is ./fetch_logs.\n". 
    50               "--UseLastNTimeStamps Integer representing the last N time entries to use when converting the data to obsKML. Optional.\n" ); 
     60              "--UseLastNTimeStamps Integer representing the last N time entries to use when converting the data to obsKML. Optional.\n". 
     61              "--UseLastNTimeStampsForOrg Optional. List specifing orginization and the last N time entries to use for them. Whereas the UseLastNTimeStamps is applied to every organization, this can tailor to the specific. If not provided and UseLastNTimeStamps is provided, it is used.\n"             
     62            ); 
    5163} 
    5264if( length( $strNetCDFDir) == 0 ) 
     
    102114} 
    103115 
    104 print( "Command Line Options: strURLControlFile = $strURLControlFile strFilter = $strFilter strDirForObsKml = $strDirForObsKml strDelete = $strDelete strNetCDFDir = $strNetCDFDir strFetchLogDir = $strFetchLogDir UseLastNTimeStamps = $strLastNTimeStamps\n" ); 
     116print( "Command Line Options: strURLControlFile = $strURLControlFile strFilter = $strFilter strDirForObsKml = $strDirForObsKml strDelete = $strDelete strNetCDFDir = $strNetCDFDir strFetchLogDir = $strFetchLogDir UseLastNTimeStamps = $strLastNTimeStamps UseLastNTimeStampsForOrg=$strLastNTimeStampsPerOrg\n" ); 
    105117 
    106118# qs needs its own individual cycle 
    107119#my $qs_only = @ARGV[0]; 
    108120 
     121my $strStartTime = `date +%s`; 
     122print( "Start Time: $strStartTime\n" ); 
    109123 
    110124 
     
    115129{ 
    116130  my $cmd = "rm /home/dramage/log/cdl_0master.log"; 
    117 #  print( "Remove Log: $cmd\n" ); 
    118 #  `$cmd`;       
     131  print( "Remove Log: $cmd\n" ); 
     132  `$cmd`;       
    119133  #Open up a new log file. 
    120134  $cmd = "echo cdl_0master log opened >> /home/dramage/log/cdl_0master.log"; 
     
    184198      { 
    185199        my $last_fetch_time = <LAST_FETCH>; 
    186         print( "\t".'Fetch log file: '.$strLogFile.' last modified on record  = '.scalar localtime($last_fetch_time)."\n" ); 
    187200        chop($last_fetch_time); 
    188201        if ($modified_time > $last_fetch_time) 
    189202        { 
    190203          $bDownloadFile = 1; 
     204          print( "\t".'File modified: Remote file mod time: '. scalar localtime( $modified_time ) .' Fetch log file: '.$strLogFile.' last modified on record  = '.scalar localtime($last_fetch_time)."\n" );        
     205        } 
     206        else 
     207        { 
     208          print( "\t".'Fetch log file: '.$strLogFile.' last modified on record  = '.scalar localtime($last_fetch_time)."\n" );        
    191209        } 
    192210      } 
     
    243261          #DWR v1.1.0.0 6/2/2008  
    244262          #Added the passing of $strLastNTimeStamps onto the command line. 
    245           $cmd = "cd /home/dramage/netcdf; /usr/bin/perl /home/dramage/netcdf/cdl_0master.pl $strDestFile 1 $strDirForObsKml $strLastNTimeStamps >> /home/dramage/log/cdl_0master.log 2>&1"; 
     263          $cmd = "cd /home/dramage/netcdf; /usr/bin/perl /home/dramage/netcdf/cdl_0master.pl $strDestFile 1 $strDirForObsKml $strLastNTimeStamps \"$strLastNTimeStampsPerOrg\" >> /home/dramage/log/cdl_0master.log 2>&1"; 
    246264          print( "\tObsKML Script: $cmd\n" ); 
    247265          `$cmd`;       
     
    316334      #`\\UnixUtils\\usr\\local\\wbin\\zip -j $strZipName $strDir\\*.kml`;        
    317335    } 
    318   }   
     336  } 
     337  my $strEndTime = `date +%s`; 
     338  print( "End Time: $strEndTime\n" );   
    319339} 
    320340