diff --git a/Template/template_forcing_engine.config b/Template/template_forcing_engine.config index d0ea687..d433677 100755 --- a/Template/template_forcing_engine.config +++ b/Template/template_forcing_engine.config @@ -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 @@ -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 diff --git a/core/regrid.py b/core/regrid.py index ed7ea78..365e52c 100755 --- a/core/regrid.py +++ b/core/regrid.py @@ -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) diff --git a/core/time_handling.py b/core/time_handling.py index 51c7eb3..5a331de 100755 --- a/core/time_handling.py +++ b/core/time_handling.py @@ -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. @@ -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.