From 49877046ac3306f6b78ca0ab5d5089ba1aa3e3e3 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 1 Aug 2024 20:26:13 -0400 Subject: [PATCH] Update ocean post-processing triggers (#2784) This PR: - replaces `check_netcdf.sh` checker for ocean post-processing with with ocean output at the next forecast hour or finishing of the forecast job for ocean prod - removes no longer needed `ush/check_netcdf.sh` --- ush/check_netcdf.sh | 15 --------------- workflow/rocoto/gefs_tasks.py | 10 ++++++---- workflow/rocoto/gfs_tasks.py | 18 ++++++++---------- 3 files changed, 14 insertions(+), 29 deletions(-) delete mode 100755 ush/check_netcdf.sh diff --git a/ush/check_netcdf.sh b/ush/check_netcdf.sh deleted file mode 100755 index 5f56a38aba..0000000000 --- a/ush/check_netcdf.sh +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env bash - -# shellcheck disable=SC2155,SC2312 -HOMEgfs=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )/.." && pwd -P) -declare -rx HOMEgfs - -source "${HOMEgfs}/ush/load_fv3gfs_modules.sh" 1>/dev/null 2>&1 - -ncfile=${1?} - -(( $(ncdump "${ncfile}" 2> /dev/null | grep -Po '(?<=time = UNLIMITED ; // \()\d+(?= currently)' || echo 0) > 0 )) # redirect stdout and stderr to /dev/null to suppress output in cron -rc=$? -# If there is no error, rc=0, else rc!=0 - -exit "${rc}" diff --git a/workflow/rocoto/gefs_tasks.py b/workflow/rocoto/gefs_tasks.py index 2041853352..1b357d8ee3 100644 --- a/workflow/rocoto/gefs_tasks.py +++ b/workflow/rocoto/gefs_tasks.py @@ -218,7 +218,7 @@ def _atmosoceaniceprod(self, component: str): 'history_file_tmpl': f'{self.run}.t@Hz.master.grb2f#fhr#'}, 'ocean': {'config': 'oceanice_products', 'history_path_tmpl': 'COM_OCEAN_HISTORY_TMPL', - 'history_file_tmpl': f'{self.run}.ocean.t@Hz.{fhout_ocn_gfs}hr_avg.f#fhr#.nc'}, + 'history_file_tmpl': f'{self.run}.ocean.t@Hz.{fhout_ocn_gfs}hr_avg.f#fhr_next#.nc'}, 'ice': {'config': 'oceanice_products', 'history_path_tmpl': 'COM_ICE_HISTORY_TMPL', 'history_file_tmpl': f'{self.run}.ice.t@Hz.{fhout_ice_gfs}hr_avg.f#fhr#.nc'}} @@ -236,10 +236,9 @@ def _atmosoceaniceprod(self, component: str): if component in ['ocean']: dep_dict = {'type': 'data', 'data': data, 'age': 120} deps.append(rocoto.add_dependency(dep_dict)) - command = f"{self.HOMEgfs}/ush/check_netcdf.sh {history_path}/{history_file_tmpl}" - dep_dict = {'type': 'sh', 'command': command} + dep_dict = {'type': 'task', 'name': 'fcst_mem#member#'} deps.append(rocoto.add_dependency(dep_dict)) - dependencies = rocoto.create_dependency(dep=deps, dep_condition='and') + dependencies = rocoto.create_dependency(dep=deps, dep_condition='or') elif component in ['ice']: command = f"{self.HOMEgfs}/ush/check_ice_netcdf.sh @Y @m @d @H #fhr# &ROTDIR; #member# {fhout_ice_gfs}" dep_dict = {'type': 'sh', 'command': command} @@ -281,6 +280,9 @@ def _atmosoceaniceprod(self, component: str): fhrs.remove(0) fhr_var_dict = {'fhr': ' '.join([f"{fhr:03d}" for fhr in fhrs])} + if component in ['ocean']: + fhrs_next = fhrs[1:] + [fhrs[-1] + (fhrs[-1] - fhrs[-2])] + fhr_var_dict['fhr_next'] = ' '.join([f"{fhr:03d}" for fhr in fhrs_next]) fhr_metatask_dict = {'task_name': f'{component}_prod_#member#', 'task_dict': task_dict, diff --git a/workflow/rocoto/gfs_tasks.py b/workflow/rocoto/gfs_tasks.py index 1e4fbfc0fa..b2b121ebc1 100644 --- a/workflow/rocoto/gfs_tasks.py +++ b/workflow/rocoto/gfs_tasks.py @@ -1084,7 +1084,7 @@ def _atmosoceaniceprod(self, component: str): 'history_file_tmpl': f'{self.run}.t@Hz.master.grb2f#fhr#'}, 'ocean': {'config': 'oceanice_products', 'history_path_tmpl': 'COM_OCEAN_HISTORY_TMPL', - 'history_file_tmpl': f'{self.run}.ocean.t@Hz.6hr_avg.f#fhr#.nc'}, + 'history_file_tmpl': f'{self.run}.ocean.t@Hz.6hr_avg.f#fhr_next#.nc'}, 'ice': {'config': 'oceanice_products', 'history_path_tmpl': 'COM_ICE_HISTORY_TMPL', 'history_file_tmpl': f'{self.run}.ice.t@Hz.6hr_avg.f#fhr#.nc'}} @@ -1104,13 +1104,9 @@ def _atmosoceaniceprod(self, component: str): data = f'{history_path}/{history_file_tmpl}' dep_dict = {'type': 'data', 'data': data, 'age': 120} deps.append(rocoto.add_dependency(dep_dict)) - if component in ['ocean']: - command = f"{self.HOMEgfs}/ush/check_netcdf.sh {history_path}/{history_file_tmpl}" - dep_dict = {'type': 'sh', 'command': command} - deps.append(rocoto.add_dependency(dep_dict)) - dependencies = rocoto.create_dependency(dep=deps, dep_condition='and') - else: - dependencies = rocoto.create_dependency(dep=deps) + dep_dict = {'type': 'task', 'name': f'{self.cdump}fcst'} + deps.append(rocoto.add_dependency(dep_dict)) + dependencies = rocoto.create_dependency(dep=deps, dep_condition='or') cycledef = 'gdas_half,gdas' if self.run in ['gdas'] else self.run resources = self.get_resource(component_dict['config']) @@ -1134,10 +1130,12 @@ def _atmosoceaniceprod(self, component: str): fhrs.remove(0) fhr_var_dict = {'fhr': ' '.join([f"{fhr:03d}" for fhr in fhrs])} + if component in ['ocean']: + fhrs_next = fhrs[1:] + [fhrs[-1] + (fhrs[-1] - fhrs[-2])] + fhr_var_dict['fhr_next'] = ' '.join([f"{fhr:03d}" for fhr in fhrs_next]) metatask_dict = {'task_name': f'{self.run}{component}_prod', 'task_dict': task_dict, - 'var_dict': fhr_var_dict - } + 'var_dict': fhr_var_dict} task = rocoto.create_task(metatask_dict)