Changeset 241

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

Changes: Added fixed-profiler processing via cdl_profiler_adcp.pl.

Files:

Legend:

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

    r233 r241  
    11############################################################################### 
    22# Revisions 
     3# Rev: 1.2.0.0 
     4# Author: DWR 
     5# Changes: Added fixed-profiler processing via cdl_profiler_adcp.pl. 
    36# Rev: 1.1.2.0 
    47# Author: DWR 
     
    4245use Time::Local; 
    4346use obsKMLSubRoutines; 
     47use Math::Trig; 
    4448 
    4549use constant USE_DEBUG_PRINTS => 1; 
     
    5963do 'cdl_grid_jpl.pl'; 
    6064do 'cdl_fixed_map.pl'; 
     65do 'cdl_fixed_profile_adcp.pl'; 
     66do 'cdl_profiler_adcp.pl'; 
    6167 
    6268# oldest incoming time stamp tolerated (14 days) 
     
    9096       "Parameter 1 is an optional parameter. Valid values are: 0 Write only SQL files, 1 Write only obsKML file, or 2 Write both SQL files and obsKML file. Default value is 0.\n". 
    9197       "Parameter 2 is the directory where the obsKML file is stored. If not provided the default directory is the current directory.\n". 
    92        "Parameter 3 is the optional number of last N time stamps to use.\n"  
     98       "Parameter 3 is the optional number of last N time stamps to use.\n" . 
     99       "Parameter 4 is the option organization/last N time stamps to use for organization. Format is \"Org1;NTimes,Org2,NTimes\"\n" 
    93100     ); 
    94101} 
     
    113120    $iLastNTimeStamps = @ARGV[3]; 
    114121  } 
    115 
     122  #DWR v1.2.0.0 9/17/2008 
     123  if( @ARGV >= 5 ) 
     124  { 
     125    $strLastNTimeStampsPerOrg = @ARGV[4]; 
     126  } 
     127
     128  
     129#DWR v1.2.0.0 9/17/2008 
     130my %UpdatePerOrg; 
     131my $refUpdatePerOrg = \%UpdatePerOrg; 
     132if( length( $strLastNTimeStampsPerOrg ) ) 
     133{  
     134  my @OrgList = split( /\,/, $strLastNTimeStampsPerOrg ); 
     135  foreach my $Org (@OrgList) 
     136  { 
     137    my @Data = split( /\;/, $Org ); 
     138    $refUpdatePerOrg->{@Data[0]} = @Data[1]; 
     139    print( "Org: @Data[0] LastNUpdates: @Data[1]\n" ); 
     140  } 
     141
     142 
    116143print( "---------------------------------------------------------------------------------------------------------\n" ); 
    117 print( "Command Line Args: net_cdf_file: $net_cdf_file FileType=$FileCreationOption ObsKMLPath=$strObsKMLFilePath LastNTimes=$iLastNTimeStamps\n" ); 
     144print( "Command Line Args: net_cdf_file: $net_cdf_file FileType=$FileCreationOption ObsKMLPath=$strObsKMLFilePath LastNTimes=$iLastNTimeStamps LastNTimeStampsPerOrg=$strLastNTimeStampsPerOrg LastNTimeStampsPerOrg=$strLastNTimeStampsPerOrg\n" ); 
     145my $strStartTime = `date +%s`; 
     146print( "Start Time: $strStartTime\n" ); 
    118147# 
    119148# Turn off fatal error aborts.  We need to allow some attributes to error out w/o crashing. 
     
    203232  && !($format_category_value eq 'Seacoos_grid') 
    204233  && !($format_category_value eq 'jpl_grid') 
    205   && !($format_category_value eq 'fixed-map')) {die "ABORT! $format_category_value is not a supported format.\n";} 
     234  && !($format_category_value eq 'fixed-map') 
     235  && !($format_category_value eq 'fixed-profiler')) {die "ABORT! $format_category_value is not a supported format.\n";} 
    206236 
    207237# get latest timestamp for this station_id if there is one 
     
    234264    } 
    235265  }  
    236   # Added parameters $FileCreationOption and $strObsKMLFilePath. 
    237   #DWR v1.1.0.0 6/2/2008 
    238   #Added use of $iLastNTimeStamps. 
    239   #fixed_point_1($this_station_id_top_ts, $FileCreationOption, $strObsKMLDir, $iLastNTimeStamps ); 
     266   
     267  #DWR v1.2.0.0 9/17/2008 
     268  #Are we using per organization last N time stamps? If so see if this org is in the list. 
     269  if( length( $strLastNTimeStampsPerOrg ) ) 
     270  { 
     271    print( "Org code: $institution_code_value\n" ); 
     272    my $iNTimeStamps = -1; 
     273    if( exists $refUpdatePerOrg->{$institution_code_value} ) 
     274    { 
     275      $iNTimeStamps = $refUpdatePerOrg->{$institution_code_value}; 
     276      $iLastNTimeStamps = $iNTimeStamps; 
     277      print( "LastNTimeStamps: $iLastNTimeStamps\n" ); 
     278    }     
     279  } 
    240280  fixed_point($this_station_id_top_ts, $FileCreationOption, $strObsKMLDir, $iLastNTimeStamps ); 
     281} 
     282elsif( $format_category_value eq 'fixed-profiler') 
     283{ 
     284  #Check to see if the institution specific directory exists. 
     285  my $strObsKMLDir = "$strObsKMLFilePath/profiler"; 
     286  if( ( -d "$strObsKMLDir" ) == 0 ) 
     287  { 
     288    if( mkdir( "$strObsKMLDir", 0777 ) == 0 ) 
     289    { 
     290      print( "ERROR::Unable to create directory: $strObsKMLDir.\n" ); 
     291      $strObsKMLDir = $strObsKMLFilePath; 
     292    } 
     293    else 
     294    { 
     295      print( "Created directory: $strObsKMLDir\n" ); 
     296    } 
     297  }  
     298  #Are we using per organization last N time stamps? If so see if this org is in the list. 
     299  if( length( $strLastNTimeStampsPerOrg ) ) 
     300  { 
     301    print( "Org code: $institution_code_value\n" ); 
     302    my $iNTimeStamps = -1; 
     303    if( exists $refUpdatePerOrg->{$institution_code_value} ) 
     304    { 
     305      $iNTimeStamps = $refUpdatePerOrg->{$institution_code_value}; 
     306      $iLastNTimeStamps = $iNTimeStamps; 
     307      print( "LastNTimeStamps: $iLastNTimeStamps\n" ); 
     308    }     
     309  } 
     310  fixed_profiler($this_station_id_top_ts, $FileCreationOption, $strObsKMLDir, $iLastNTimeStamps ); 
    241311} 
    242312elsif ($format_category_value eq 'moving-point-2D') { 
     
    252322  fixed_map(); 
    253323} 
     324 
     325my $strEndTime = `date +%s`; 
     326print( "End Time: $strEndTime\n" );