Changeset 242
- Timestamp:
- 10/03/08 15:20:38
- Files:
-
- scout/trunk/GetLatestData.pl (modified) (10 diffs)
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 1 7 #!/usr/bin/perl 2 8 … … 17 23 else 18 24 { 19 $Minute = `\\UnixUtils\\usr\\local\\wbin\\date %M`; 25 $Minute = `\\Unix 26 Utils\\usr\\local\\wbin\\date %M`; 20 27 } 21 28 =cut … … 28 35 "DownloadDir:s", #Optional. Directory to store the downloaded netcdf files in. Default is ./latest_netcdf_files. 29 36 "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. 31 40 ); 32 41 … … 38 47 my $strFetchLogDir = $CommandLineOptions{"FetchLogDir"}; 39 48 my $strLastNTimeStamps = $CommandLineOptions{"UseLastNTimeStamps"}; #DWR v1.1.0.0 6/2/2008 49 my $strLastNTimeStampsPerOrg = $CommandLineOptions{"UseLastNTimeStampsForOrg"}; #DWR v1.2.0.0 9/17/2008 40 50 if( length( $strURLControlFile ) == 0 ) 41 51 { … … 48 58 "--DownloadDir is the directory to store the downloaded files. Optional, default is ./latest_netcdf_files.\n". 49 59 "--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 ); 51 63 } 52 64 if( length( $strNetCDFDir) == 0 ) … … 102 114 } 103 115 104 print( "Command Line Options: strURLControlFile = $strURLControlFile strFilter = $strFilter strDirForObsKml = $strDirForObsKml strDelete = $strDelete strNetCDFDir = $strNetCDFDir strFetchLogDir = $strFetchLogDir UseLastNTimeStamps = $strLastNTimeStamps \n" );116 print( "Command Line Options: strURLControlFile = $strURLControlFile strFilter = $strFilter strDirForObsKml = $strDirForObsKml strDelete = $strDelete strNetCDFDir = $strNetCDFDir strFetchLogDir = $strFetchLogDir UseLastNTimeStamps = $strLastNTimeStamps UseLastNTimeStampsForOrg=$strLastNTimeStampsPerOrg\n" ); 105 117 106 118 # qs needs its own individual cycle 107 119 #my $qs_only = @ARGV[0]; 108 120 121 my $strStartTime = `date +%s`; 122 print( "Start Time: $strStartTime\n" ); 109 123 110 124 … … 115 129 { 116 130 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`; 119 133 #Open up a new log file. 120 134 $cmd = "echo cdl_0master log opened >> /home/dramage/log/cdl_0master.log"; … … 184 198 { 185 199 my $last_fetch_time = <LAST_FETCH>; 186 print( "\t".'Fetch log file: '.$strLogFile.' last modified on record = '.scalar localtime($last_fetch_time)."\n" );187 200 chop($last_fetch_time); 188 201 if ($modified_time > $last_fetch_time) 189 202 { 190 203 $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" ); 191 209 } 192 210 } … … 243 261 #DWR v1.1.0.0 6/2/2008 244 262 #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"; 246 264 print( "\tObsKML Script: $cmd\n" ); 247 265 `$cmd`; … … 316 334 #`\\UnixUtils\\usr\\local\\wbin\\zip -j $strZipName $strDir\\*.kml`; 317 335 } 318 } 336 } 337 my $strEndTime = `date +%s`; 338 print( "End Time: $strEndTime\n" ); 319 339 } 320 340
