Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move component modification of output times #10

Merged
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
16 changes: 1 addition & 15 deletions workflow/rocoto/gfs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,21 +929,7 @@ def atmanlprod(self):
@staticmethod
def _get_ufs_postproc_grps(cdump, config, component='atmos'):

# Make a local copy of the config to avoid modifying the original
local_config = config.copy()

# Ocean/Ice components do not have a HF output option like the atmosphere
if component in ['ocean', 'ice']:
local_config['FHMAX_HF_GFS'] = config['FHMAX_GFS']
local_config['FHOUT_HF_GFS'] = config['FHOUT_OCNICE_GFS']
local_config['FHOUT_GFS'] = config['FHOUT_OCNICE_GFS']
local_config['FHOUT'] = config['FHOUT_OCNICE']

fhrs = Tasks._get_forecast_hours(cdump, local_config)

# ocean/ice components do not have fhr 0 as they are averaged output
if component in ['ocean', 'ice']:
fhrs.remove(0)
fhrs = Tasks._get_forecast_hours(cdump, config, component=component)

nfhrs_per_grp = config.get('NFHRS_PER_GROUP', 1)
ngrps = len(fhrs) // nfhrs_per_grp if len(fhrs) % nfhrs_per_grp == 0 else len(fhrs) // nfhrs_per_grp + 1
Expand Down
30 changes: 22 additions & 8 deletions workflow/rocoto/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,37 @@ def _template_to_rocoto_cycstring(self, template: str, subs_dict: dict = {}) ->
rocoto_conversion_dict.get)

@staticmethod
def _get_forecast_hours(cdump, config) -> List[str]:
fhmin = config['FHMIN']
fhmax = config['FHMAX']
fhout = config['FHOUT']
def _get_forecast_hours(cdump, config, component='atmos') -> List[str]:
# Make a local copy of the config to avoid modifying the original
local_config = config.copy()

# Ocean/Ice components do not have a HF output option like the atmosphere
if component in ['ocean', 'ice']:
local_config['FHMAX_HF_GFS'] = config['FHMAX_GFS']
local_config['FHOUT_HF_GFS'] = config['FHOUT_OCNICE_GFS']
local_config['FHOUT_GFS'] = config['FHOUT_OCNICE_GFS']
local_config['FHOUT'] = config['FHOUT_OCNICE']

fhmin = local_config['FHMIN']
fhmax = local_config['FHMAX']
fhout = local_config['FHOUT']

# Get a list of all forecast hours
fhrs = []
if cdump in ['gdas']:
fhrs = list(range(fhmin, fhmax + fhout, fhout))
elif cdump in ['gfs', 'gefs']:
fhmax = config['FHMAX_GFS']
fhout = config['FHOUT_GFS']
fhmax_hf = config['FHMAX_HF_GFS']
fhout_hf = config['FHOUT_HF_GFS']
fhmax = local_config['FHMAX_GFS']
fhout = local_config['FHOUT_GFS']
fhmax_hf = local_config['FHMAX_HF_GFS']
fhout_hf = local_config['FHOUT_HF_GFS']
fhrs_hf = range(fhmin, fhmax_hf + fhout_hf, fhout_hf)
fhrs = list(fhrs_hf) + list(range(fhrs_hf[-1] + fhout, fhmax + fhout, fhout))

# ocean/ice components do not have fhr 0 as they are averaged output
if component in ['ocean', 'ice']:
fhrs.remove(0)

return fhrs

def get_resource(self, task_name):
Expand Down
Loading