Skip to content

Commit

Permalink
Adds FBWINDS support to global-workflow (#2082)
Browse files Browse the repository at this point in the history
This PR addresses issue #1221. The following was accomplished:

- A new Rocoto job is added; `jobs/rocoto/fbwinds.sh`;
- `workflow/applications/gfs_cycled.py` is updated to include the `fbwinds` task;
- `workflow/applications/gfs_forecast_only.py` is updated to include the `fbwinds` task;
-  A new function is added to `workflow/rocoto/gfs_tasks.py`, `fbwinds` is added as new GFS (only) task;
- `workflow/rocoto/tasks.py` is updated to include the `fbwinds` task.

Resolves #1221
  • Loading branch information
HenryRWinterbottom authored Nov 23, 2023
1 parent 513db19 commit 8c11eeb
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 2 deletions.
17 changes: 17 additions & 0 deletions jobs/rocoto/fbwinds.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#! /usr/bin/env bash

source "${HOMEgfs}/ush/preamble.sh"

###############################################################
. "${HOMEgfs}/ush/load_fv3gfs_modules.sh"
status=$?
if (( status != 0 )); then exit "${status}"; fi

export job="fbwinds"
export jobid="${job}.$$"

# Execute the JJOB
"${HOMEgfs}/jobs/JGFS_ATMOS_FBWINDS"

status=$?
exit "${status}"
1 change: 1 addition & 0 deletions workflow/applications/gfs_cycled.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ def get_task_names(self):

if self.do_awips:
gfs_tasks += ['awips']
gfs_tasks += ['fbwinds']

if self.do_npoess:
gfs_tasks += ['npoess']
Expand Down
1 change: 1 addition & 0 deletions workflow/applications/gfs_forecast_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def get_task_names(self):

if self.do_awips:
tasks += ['awips']
tasks += ['fbwinds']

if self.do_wafs:
tasks += ['wafs', 'wafsgcip', 'wafsgrib2', 'wafsgrib20p25', 'wafsblending', 'wafsblending0p25']
Expand Down
26 changes: 26 additions & 0 deletions workflow/rocoto/gfs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,32 @@ def postsnd(self):

return task

def fbwinds(self):

atmos_prod_path = self._template_to_rocoto_cycstring(self._base["COM_ATMOS_GRIB_GRID_TMPL"], {'RUN': self.cdump, 'GRID': '0p25'})
deps = []
data = f'{atmos_prod_path}/{self.cdump}[email protected]'
dep_dict = {'type': 'data', 'data': data, 'age': 120}
deps.append(rocoto.add_dependency(dep_dict))
data = f'{atmos_prod_path}/{self.cdump}[email protected]'
dep_dict = {'type': 'data', 'data': data, 'age': 120}
deps.append(rocoto.add_dependency(dep_dict))
data = f'{atmos_prod_path}/{self.cdump}[email protected]'
dep_dict = {'type': 'data', 'data': data, 'age': 120}
deps.append(rocoto.add_dependency(dep_dict))
dependencies = rocoto.create_dependency(dep=deps, dep_condition='and')

resources = self.get_resource('awips')

# TODO: It would be better to use task dependencies on the
# individual post jobs rather than data dependencies to avoid
# prematurely starting with partial files. Unfortunately, the
# ability to "group" post would make this more convoluted than
# it should be and not worth the complexity.
task = create_wf_task('fbwinds', resources, cdump=self.cdump, envar=self.envars, dependency=dependencies)

return task

def awips(self):

def _get_awipsgroups(cdump, config):
Expand Down
6 changes: 5 additions & 1 deletion workflow/rocoto/rocoto.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ def _add_data_tag(dep_dict: Dict[str, Any]) -> str:
dep_type = dep_dict.get('type', None)
dep_data = dep_dict.get('data', None)
dep_offset = dep_dict.get('offset', None)
dep_age = dep_dict.get('age', None)

if dep_data is None:
msg = f'a data value is necessary for {dep_type} dependency'
Expand All @@ -206,7 +207,10 @@ def _add_data_tag(dep_dict: Dict[str, Any]) -> str:

assert len(dep_data) == len(dep_offset)

strings = ['<datadep>']
if dep_age is None:
strings = ['<datadep>']
else:
strings = [f'<datadep age="{dep_age}">']
for data, offset in zip(dep_data, dep_offset):
if '@' in data:
offset_str = '' if offset in [None, ''] else f' offset="{offset}"'
Expand Down
2 changes: 1 addition & 1 deletion workflow/rocoto/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Tasks:
'fcst', 'post', 'ocnpost',
'verfozn', 'verfrad', 'vminmon', 'metp',
'tracker', 'genesis', 'genesis_fsu',
'postsnd', 'awips', 'gempak',
'postsnd', 'awips', 'fbwinds', 'gempak',
'waveawipsbulls', 'waveawipsgridded', 'wavegempak', 'waveinit',
'wavepostbndpnt', 'wavepostbndpntbll', 'wavepostpnt', 'wavepostsbs', 'waveprep',
'npoess']
Expand Down

0 comments on commit 8c11eeb

Please sign in to comment.