Skip to content

Commit

Permalink
Update rocoto generation for new stage_ic and add GEFS from WalterKol…
Browse files Browse the repository at this point in the history
…czynski-NOAA:feature/stage_gefs
  • Loading branch information
AnilKumar-NOAA committed Oct 6, 2023
1 parent 0967029 commit bd148ca
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 68 deletions.
1 change: 1 addition & 0 deletions parm/config/gefs/config.base.emc.dyn
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export FIXreg2grb2=${HOMEgfs}/fix/reg2grb2
export PACKAGEROOT="@PACKAGEROOT@" # TODO: set via prod_envir in Ops
export COMROOT="@COMROOT@" # TODO: set via prod_envir in Ops
export COMINsyn="@COMINsyn@"
export BASE_CPLIC="@BASE_CPLIC@"

# USER specific paths
export HOMEDIR="@HOMEDIR@"
Expand Down
43 changes: 0 additions & 43 deletions parm/config/gefs/config.coupled_ic

This file was deleted.

12 changes: 6 additions & 6 deletions parm/config/gefs/config.resources
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [[ $# -ne 1 ]]; then

echo "Must specify an input task argument to set resource variables!"
echo "argument can be any one of the following:"
echo "coupled_ic aerosol_init"
echo "stage_ic aerosol_init"
echo "atmanlinit atmanlrun atmanlfinal"
echo "atmensanlinit atmensanlrun atmensanlfinal"
echo "landanlprep landanlinit landanlrun landanlfinal"
Expand Down Expand Up @@ -718,12 +718,12 @@ elif [[ ${step} = "arch" || ${step} = "earc" ]]; then
eval "export memory_${step}=50GB"
fi

elif [[ ${step} = "coupled_ic" ]]; then
elif [[ ${step} = "stage_ic" ]]; then

export wtime_coupled_ic="00:15:00"
export npe_coupled_ic=1
export npe_node_coupled_ic=1
export nth_coupled_ic=1
export wtime_stage_ic="00:15:00"
export npe_stage_ic=1
export npe_node_stage_ic=1
export nth_stage_ic=1
export is_exclusive=True

elif [[ "${step}" = "atmensanlinit" ]]; then
Expand Down
23 changes: 23 additions & 0 deletions parm/config/gefs/config.stage_ic
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#! /usr/bin/env bash

########## config.stage_ic ##########

echo "BEGIN: config.stage_ic"

# Get task specific resources
source "${EXPDIR}/config.resources" stage_ic

case "${CASE}" in
"C48")
export CPL_ATMIC="gefs_test"
export CPL_ICEIC="gefs_test"
export CPL_OCNIC="gefs_test"
export CPL_WAVIC="gefs_test"
;;
*)
echo "FATAL ERROR Unrecognized resolution: ${CASE}"
exit 1
;;
esac

echo "END: config.stage_ic"
8 changes: 4 additions & 4 deletions parm/config/gfs/config.stage_ic
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ source "${EXPDIR}/config.resources" stage_ic

case "${CASE}" in
"C48" | "C96")
export CPL_ATMIC=workflowtest
export CPL_ICEIC=workflowtest
export CPL_OCNIC=workflowtest
export CPL_WAVIC=workflowtest
export CPL_ATMIC="workflow_${CASE}"
export CPL_ICEIC="workflow_${CASE}"
export CPL_OCNIC="workflow_${CASE}"
export CPL_WAVIC="workflow_${CASE}"
;;
"C384")
export CPL_ATMIC=GEFS-NoahMP-aerosols-p8c
Expand Down
4 changes: 2 additions & 2 deletions workflow/applications/gefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def _get_app_configs(self):
"""
Returns the config_files that are involved in gefs
"""
configs = ['fcst']
configs = ['stage_ic','fcst']

if self.nens > 0:
configs += ['efcs']
Expand All @@ -32,7 +32,7 @@ def _update_base(base_in):

def get_task_names(self):

tasks = ['fcst']
tasks = ['stage_ic', 'fcst']

if self.nens > 0:
tasks += ['efcs']
Expand Down
2 changes: 1 addition & 1 deletion workflow/hosts/hera.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BASE_GIT: '/scratch1/NCEPDEV/global/glopara/git'
DMPDIR: '/scratch1/NCEPDEV/global/glopara/dump'
BASE_CPLIC: '/scratch1/NCEPDEV/climate/role.ufscpara/IC'
BASE_CPLIC: '/scratch2/NCEPDEV/ensemble/noscrub/Walter.Kolczynski/global-workflow/alt_prototype_ICs'
PACKAGEROOT: '/scratch1/NCEPDEV/global/glopara/nwpara'
COMROOT: '/scratch1/NCEPDEV/global/glopara/com'
COMINsyn: '${COMROOT}/gfs/prod/syndat'
Expand Down
59 changes: 57 additions & 2 deletions workflow/rocoto/gefs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,64 @@ class GEFSTasks(Tasks):
def __init__(self, app_config: AppConfig, cdump: str) -> None:
super().__init__(app_config, cdump)

def stage_ic(self):

cpl_ic = self._configs['stage_ic']

deps = []

# Atm ICs
if self.app_config.do_atm:
prefix = f"{cpl_ic['BASE_CPLIC']}/{cpl_ic['CPL_ATMIC']}/@Y@m@d@H/mem000/atmos"
for file in ['gfs_ctrl.nc'] + \
[f'{datatype}_data.tile{tile}.nc'
for datatype in ['gfs', 'sfc']
for tile in range(1, self.n_tiles + 1)]:
data = f"{prefix}/{file}"
dep_dict = {'type': 'data', 'data': data}
deps.append(rocoto.add_dependency(dep_dict))

# Ocean ICs
if self.app_config.do_ocean:
ocn_res = f"{self._base.get('OCNRES', '025'):03d}"
prefix = f"{cpl_ic['BASE_CPLIC']}/{cpl_ic['CPL_OCNIC']}/@Y@m@d@H/mem000/ocean"
data = f"{prefix}/@Y@m@[email protected]"
dep_dict = {'type': 'data', 'data': data}
deps.append(rocoto.add_dependency(dep_dict))
if ocn_res in ['025']:
# 0.25 degree ocean model also has these additional restarts
for res in [f'res_{res_index}' for res_index in range(1, 4)]:
data = f"{prefix}/@Y@m@[email protected].{res}.nc"
dep_dict = {'type': 'data', 'data': data}
deps.append(rocoto.add_dependency(dep_dict))

# Ice ICs
if self.app_config.do_ice:
prefix = f"{cpl_ic['BASE_CPLIC']}/{cpl_ic['CPL_ICEIC']}/@Y@m@d@H/mem000/ice"
data = f"{prefix}/@Y@m@[email protected]_model.res.nc"
dep_dict = {'type': 'data', 'data': data}
deps.append(rocoto.add_dependency(dep_dict))

# Wave ICs
if self.app_config.do_wave:
prefix = f"{cpl_ic['BASE_CPLIC']}/{cpl_ic['CPL_WAVIC']}/@Y@m@d@H/mem000/wave"
for wave_grid in self._configs['waveinit']['waveGRD'].split():
data = f"{prefix}/{wave_grid}/@Y@m@[email protected].{wave_grid}"
dep_dict = {'type': 'data', 'data': data}
deps.append(rocoto.add_dependency(dep_dict))

dependencies = rocoto.create_dependency(dep_condition='and', dep=deps)

resources = self.get_resource('stage_ic')
task = create_wf_task('stage_ic', resources, cdump=self.cdump, envar=self.envars, dependency=dependencies)

return task

def fcst(self):
# TODO: Add real dependencies
dependencies = []

dep_dict = {'type': 'task', 'name': f'{self.cdump}stage_ic'}
dependencies.append(rocoto.add_dependency(dep_dict))
resources = self.get_resource('fcst')
task = create_wf_task('fcst', resources, cdump=self.cdump, envar=self.envars, dependency=dependencies)

Expand All @@ -20,7 +74,8 @@ def fcst(self):
def efcs(self):
# TODO: Add real dependencies
dependencies = []

dep_dict = {'type': 'task', 'name': f'{self.cdump}stage_ic'}
dependencies.append(rocoto.add_dependency(dep_dict))
efcsenvars = self.envars.copy()
efcsenvars.append(rocoto.create_envar(name='ENSGRP', value='#grp#'))

Expand Down
17 changes: 8 additions & 9 deletions workflow/rocoto/gfs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ def stage_ic(self):

# Atm ICs
if self.app_config.do_atm:
atm_res = self._base.get('CASE', 'C384')
prefix = f"{cpl_ic['BASE_CPLIC']}/{cpl_ic['CPL_ATMIC']}/@Y@m@d@H/{self.cdump}"
prefix = f"{cpl_ic['BASE_CPLIC']}/{cpl_ic['CPL_ATMIC']}/@Y@m@d@H/atmos"
for file in ['gfs_ctrl.nc'] + \
[f'{datatype}_data.tile{tile}.nc'
for datatype in ['gfs', 'sfc']
for tile in range(1, self.n_tiles + 1)]:
data = f"{prefix}/{atm_res}/INPUT/{file}"
data = f"{prefix}/{file}"
dep_dict = {'type': 'data', 'data': data}
deps.append(rocoto.add_dependency(dep_dict))
else: # data-atmosphere
Expand All @@ -42,14 +41,14 @@ def stage_ic(self):
# Ocean ICs
if self.app_config.do_ocean:
ocn_res = f"{self._base.get('OCNRES', '025'):03d}"
prefix = f"{cpl_ic['BASE_CPLIC']}/{cpl_ic['CPL_OCNIC']}/@Y@m@d@H/ocn"
data = f"{prefix}/{ocn_res}/MOM.res.nc"
prefix = f"{cpl_ic['BASE_CPLIC']}/{cpl_ic['CPL_OCNIC']}/@Y@m@d@H/ocean"
data = f"{prefix}/@Y@m@d.@H0000.MOM.res.nc"
dep_dict = {'type': 'data', 'data': data}
deps.append(rocoto.add_dependency(dep_dict))
if ocn_res in ['025']:
# 0.25 degree ocean model also has these additional restarts
for res in [f'res_{res_index}' for res_index in range(1, 4)]:
data = f"{prefix}/{ocn_res}/MOM.{res}.nc"
data = f"{prefix}/@Y@m@d.@H0000.MOM.{res}.nc"
dep_dict = {'type': 'data', 'data': data}
deps.append(rocoto.add_dependency(dep_dict))

Expand All @@ -58,15 +57,15 @@ def stage_ic(self):
ice_res = f"{self._base.get('ICERES', '025'):03d}"
ice_res_dec = f'{float(ice_res) / 100:.2f}'
prefix = f"{cpl_ic['BASE_CPLIC']}/{cpl_ic['CPL_ICEIC']}/@Y@m@d@H/ice"
data = f"{prefix}/{ice_res}/cice5_model_{ice_res_dec}.res_@Y@m@d@H.nc"
data = f"{prefix}/@Y@m@d[email protected]_model.res.nc"
dep_dict = {'type': 'data', 'data': data}
deps.append(rocoto.add_dependency(dep_dict))

# Wave ICs
if self.app_config.do_wave:
prefix = f"{cpl_ic['BASE_CPLIC']}/{cpl_ic['CPL_WAVIC']}/@Y@m@d@H/wav"
prefix = f"{cpl_ic['BASE_CPLIC']}/{cpl_ic['CPL_WAVIC']}/@Y@m@d@H/wave"
for wave_grid in self._configs['waveinit']['waveGRD'].split():
data = f"{prefix}/{wave_grid}/@Y@m@[email protected].{wave_grid}"
data = f"{prefix}/@Y@m@[email protected].{wave_grid}"
dep_dict = {'type': 'data', 'data': data}
deps.append(rocoto.add_dependency(dep_dict))

Expand Down
2 changes: 1 addition & 1 deletion workflow/setup_expt.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def fill_COMROT_forecasts(host, inputs):
"""
Implementation of 'fill_COMROT' for forecast-only mode
"""
print('forecast-only mode treats ICs differently and cannot be staged here')
print('forecast-only mode treats ICs differently and cannot be staged here')


def fill_EXPDIR(inputs):
Expand Down

0 comments on commit bd148ca

Please sign in to comment.