Skip to content

Commit

Permalink
Merge pull request #178 from GEOS-ESM/bugfix/jstassi/#177/write_month…
Browse files Browse the repository at this point in the history
…ly_rc_arc.pl

The script was modified to add an hourtype value for the traj_lcv_rst…
  • Loading branch information
rtodling authored May 12, 2022
2 parents 1a67213 + 36a75e8 commit 238e98f
Showing 1 changed file with 24 additions and 33 deletions.
57 changes: 24 additions & 33 deletions src/Applications/GEOSdas_App/write_monthly_rc_arc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@
#
# => %list: keys = analysis products, e.g. "ana.eta", and names of model
# collections found in $histfile, e.g. "inst1_2d_asm_Nx"
# value = a single code containing one or more of the following
# values = a single code containing one or more of the following
# letters, {C, M, T, P}, with the following meanings:
# C => comment entry in monthly.rc
# M => create monthly products
# T => tar this product
# P => create monthly plots for this product
# the code, except for the 'C', is written to the monthly.rc file
# the code, except for the 'C', is written to the monthly.rc file
# => %freq: keys = names of collections found in $histfile
# values = hour frequency (e.g. 1, 3, or 6) as specified in $histfile
# => %mode: keys = names of collections found in $histfile
# values = mode ("inst" or "tavg") as specified in $histfile
#
# key local variables in main program:
# => @outRcArr: lines to write to the $outRc file (monthly.rc)
Expand All @@ -56,9 +60,11 @@

# global variables
#-----------------
my ($histfile, $siloarc, $ncana, %list);
my ($histfile, $siloarc, $ncana);
my ($outRc, $outArc, $outArk);
my ($rcFLG, $arcFLG, $arkFLG);
my (%list, %freq, %mode);

my $script = basename $0;

# analysis and aod output names with default hour types
Expand Down Expand Up @@ -183,15 +189,8 @@ sub init {
#=======================================================================
# name - get_list_from_HIST
# purpose - add collection names from $histfile to list
#
# key local variables
# => %freq: keys = names of collections found in $histfile
# values = hour frequency (e.g. 1, 3, or 6) as specified in $histfile
# => %mode: keys = names of collections found in $histfile
# values = mode ("inst" or "tavg") as specified in $histfile
#=======================================================================
sub get_list_from_HIST {
my (%freq, %mode);
my ($colFLG, $extFLG);
my ($colon, $doublecolon);

Expand Down Expand Up @@ -227,8 +226,8 @@ sub get_list_from_HIST {

# get frequency and mode information
#-----------------------------------
extract_freq($_, \%freq) if /\.frequency\s*$colon/;
extract_mode($_, \%mode) if /\.mode\s*$colon/;
extract_freq($_) if /\.frequency\s*$colon/;
extract_mode($_) if /\.mode\s*$colon/;
}
close HIST;
}
Expand Down Expand Up @@ -302,18 +301,12 @@ sub plots_type {
#
# input parameter
# => $line: line from $histfile containing frequency information for a collection
#
# input/output parameter
# => $freqAddr: address of %freq hash containing collection frequency info
#=======================================================================
sub extract_freq {
my ($line, $freqAddr);

my ($line);
$line = shift;
$freqAddr = shift;

if ( $line =~ /^\s*(\S*)\.frequency\s*:\s*(\d{6})\s*,/ ) {
$$freqAddr{$1} = $2 / 10000;
$freq{$1} = $2 / 10000;
}
}

Expand All @@ -323,22 +316,14 @@ sub extract_freq {
#
# input parameter
# => $line: line from $histfile containing mode information for a collection
#
# input/output parameter
# => $modeAddr: address of %mode hash containing collection mode info
#=======================================================================
sub extract_mode {
my ($line, $modeAddr);
my ($name);

my ($line, $name);
$line = shift;
$modeAddr = shift;

$name = undef;
$name = $1 if $line =~ /^\s*(\S*)\.mode\s*:/;
if ($name) {
$$modeAddr{$name} = "inst" if $line =~ /instantaneous/;
$$modeAddr{$name} = "tavg" if $line =~ /time-averaged/;
if ( $line =~ /^\s*(\S*)\.mode\s*:/ ) {
$name = $1;
$mode{$name} = "inst" if $line =~ /instantaneous/;
$mode{$name} = "tavg" if $line =~ /time-averaged/;
}
}

Expand Down Expand Up @@ -401,6 +386,12 @@ sub get_info_from_SILO {
}
close SILO;

# add additional hourtype requirements
#-------------------------------------
foreach (qw(traj_lcv_rst)) {
$hourtype{$_} = "$mode{$_}$freq{$_}";
}

# entries for monthly.rc file
#----------------------------
@$outRcArrAddr = ();
Expand Down

0 comments on commit 238e98f

Please sign in to comment.