Skip to content

Commit

Permalink
Move section until when sim_yr0 is determined and use it rather than …
Browse files Browse the repository at this point in the history
…sim_year as sime_year can be a range. Also correct comment about loop over future scenarios
  • Loading branch information
ekluzek committed Apr 20, 2020
1 parent a2bc697 commit 0e2490b
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tools/mksurfdata_map/mksurfdata.pl
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ sub write_namelist_file {
#
my $double = ".true.";
#
# Loop over each sim_year
# Loop over each SSP-RCP scenario
#
RCP: foreach my $ssp_rcp ( @rcpaths ) {
#
Expand All @@ -719,24 +719,6 @@ sub write_namelist_file {
next SIM_YEAR;
}
#
# Find the file for each of the types
#
foreach my $typ ( @typlist ) {
my $hgrid = $hgrd{$typ};
my $lmask = $lmsk{$typ};
my $filnm = $filnm{$typ};
my $typ_cmd = "$scrdir/../../bld/queryDefaultNamelist.pl $mkopts -options " .
"hgrid=$hgrid,lmask=$lmask,mergeGIS=$merge_gis$mkcrop,sim_year=$sim_year -var $filnm";
$datfil{$typ} = `$typ_cmd`;
$datfil{$typ} = trim($datfil{$typ});
if ( $datfil{$typ} !~ /[^ ]+/ ) {
die "ERROR: could NOT find a $filnm data file for this resolution: $hgrid and type: $typ and $lmask.\n$typ_cmd\n\n";
}
if ( ! defined($opts{'allownofile'}) && ! -f $datfil{$typ} ) {
die "ERROR: data file for this resolution does NOT exist ($datfil{$typ}).\n";
}
}
#
# If year is 1850-2000 actually run 1850-2015
#
if ( $sim_year eq "1850-2000" ) {
Expand All @@ -755,6 +737,24 @@ sub write_namelist_file {
$sim_yrn = $2;
$transient = 1;
}
#
# Find the file for each of the types
#
foreach my $typ ( @typlist ) {
my $hgrid = $hgrd{$typ};
my $lmask = $lmsk{$typ};
my $filnm = $filnm{$typ};
my $typ_cmd = "$scrdir/../../bld/queryDefaultNamelist.pl $mkopts -options " .
"hgrid=$hgrid,lmask=$lmask,mergeGIS=$merge_gis$mkcrop,sim_year=$sim_yr0 -var $filnm";
$datfil{$typ} = `$typ_cmd`;
$datfil{$typ} = trim($datfil{$typ});
if ( $datfil{$typ} !~ /[^ ]+/ ) {
die "ERROR: could NOT find a $filnm data file for this resolution: $hgrid and type: $typ and $lmask.\n$typ_cmd\n\n";
}
if ( ! defined($opts{'allownofile'}) && ! -f $datfil{$typ} ) {
die "ERROR: data file for this resolution does NOT exist ($datfil{$typ}).\n";
}
}
# determine simulation year to use for the surface dataset:
my $sim_yr_surfdat = "$sim_yr0";

Expand Down

0 comments on commit 0e2490b

Please sign in to comment.