Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Template/template_forcing_engine.config
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ RetroFlag = 0
# NOTE - Dates are given in YYYYMMDDHHMM format
# If in real-time forecasting mode, leave as -9999.
# These dates get over-ridden in lookBackHours.
# For CFS forecasts: These are the beginning and end forecast
# *init times* to be processed. The forecast lenth or max lead
# time is in ForecastInputHorizions
BDateProc = 201810010000
EDateProc = 201810020000

Expand Down Expand Up @@ -144,6 +147,8 @@ ForecastShift = 780
# forecast cycle. See documentation for examples. The length of
# this array must match the input forcing choices.
#ForecastInputHorizons = [22980]
# This would also be known as the maximum lead time for a forecast cycle
# Init time + max lead time = final valid time in cycle
ForecastInputHorizons = [7740]

# This option is for applying an offset to input forcings to use a different
Expand Down
14 changes: 11 additions & 3 deletions core/regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,14 +570,22 @@ def regrid_cfsv2(input_forcings, config_options, wrf_hydro_geo_meta, mpi_config)
if mpi_config.rank == 0:
config_options.statusMsg = "Converting CFSv2 Variable: " + grib_var
err_handler.log_msg(config_options, mpi_config)
fields.append(':' + grib_var + ':' +
input_forcings.grib_levels[force_count] + ':'
+ str(input_forcings.fcst_hour2) + " hour fcst:")
fields.append(':' + grib_var + ':')
# +
# input_forcings.grib_levels[force_count] + ':' +
# str(input_forcings.fcst_hour2) + " hour fcst:")

# Does this field not have a time? I guess it is just the surface height.
fields.append(":(HGT):(surface):")

# Create a temporary NetCDF file from the GRIB2 file.
cmd = '$WGRIB2 -match "(' + '|'.join(fields) + ')" ' + input_forcings.file_in2 + \
" -netcdf " + input_forcings.tmpFile

#with open('/glade/u/home/jamesmcc/wgrib_cmd.txt', 'w') as opened_file:
# opened_file.write(cmd)
print(cmd)

id_tmp = ioMod.open_grib2(input_forcings.file_in2, input_forcings.tmpFile, cmd,
config_options, mpi_config, inputVar=None)
err_handler.check_program_status(config_options, mpi_config)
Expand Down
27 changes: 15 additions & 12 deletions core/time_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,20 +761,22 @@ def find_cfsv2_neighbors(input_forcings, config_options, d_current, mpi_config):
prev_cfs_date = next_cfs_date

# Calculate expected file paths.
tmp_file1 = input_forcings.inDir + "/cfs." + \
current_cfs_cycle.strftime('%Y%m%d') + "/" + \
current_cfs_cycle.strftime('%H') + "/" + \
"6hrly_grib_" + ens_str + "/flxf" + \
tmp_file1 = input_forcings.inDir + "/flxf" + \
prev_cfs_date.strftime('%Y%m%d%H') + "." + \
ens_str + "." + current_cfs_cycle.strftime('%Y%m%d%H') + \
input_forcings.file_ext
tmp_file2 = input_forcings.inDir + "/cfs." + \
current_cfs_cycle.strftime('%Y%m%d') + "/" + \
current_cfs_cycle.strftime('%H') + "/" + \
"6hrly_grib_" + ens_str + "/flxf" + \
ens_str + "." + current_cfs_cycle.strftime('%Y%m%d%H') + '.grb2'
# input_forcings.file_ext
#"/cfs." + \
#current_cfs_cycle.strftime('%Y%m%d') + "/" + \
#current_cfs_cycle.strftime('%H') + "/" + \
#"6hrly_grib_" + ens_str + "/flxf" + \
tmp_file2 = input_forcings.inDir + "/flxf" + \
next_cfs_date.strftime('%Y%m%d%H') + "." + \
ens_str + "." + current_cfs_cycle.strftime('%Y%m%d%H') + \
input_forcings.file_ext
ens_str + "." + current_cfs_cycle.strftime('%Y%m%d%H') + '.grb2'
# input_forcings.file_ext
# "/cfs." + \
# current_cfs_cycle.strftime('%Y%m%d') + "/" + \
# current_cfs_cycle.strftime('%H') + "/" + \
# "6hrly_grib_" + ens_str + "/flxf" + \

# Check to see if files are already set. If not, then reset, grids and
# regridding objects to communicate things need to be re-established.
Expand Down Expand Up @@ -823,6 +825,7 @@ def find_cfsv2_neighbors(input_forcings, config_options, d_current, mpi_config):
config_options.statusMsg = "Expected input CFSv2 file: " + \
input_forcings.file_in2 + " not found. Will not use in final layering."
err_handler.log_warning(config_options, mpi_config)

err_handler.check_program_status(config_options, mpi_config)

# If the file is missing, set the local slab of arrays to missing.
Expand Down