Skip to content

Commit

Permalink
replace check_netcdf.sh checker with ocean output at the next forecas…
Browse files Browse the repository at this point in the history
…t hour or finishing of the forecast job for ocean prod
  • Loading branch information
aerorahul committed Jul 22, 2024
1 parent 71dc33c commit e3aa495
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
10 changes: 6 additions & 4 deletions workflow/rocoto/gefs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def _atmosoceaniceprod(self, component: str):
'history_file_tmpl': f'{self.cdump}.t@Hz.master.grb2f#fhr#'},
'ocean': {'config': 'oceanice_products',
'history_path_tmpl': 'COM_OCEAN_HISTORY_TMPL',
'history_file_tmpl': f'{self.cdump}.ocean.t@Hz.{fhout_ocn_gfs}hr_avg.f#fhr#.nc'},
'history_file_tmpl': f'{self.cdump}.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.cdump}.ice.t@Hz.{fhout_ice_gfs}hr_avg.f#fhr#.nc'}}
Expand All @@ -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': f'{self.cdump}fcst'}
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}
Expand Down Expand Up @@ -271,6 +270,9 @@ def _atmosoceaniceprod(self, component: str):

fhrs = self._get_forecast_hours('gefs', self._configs[config], component)
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,
Expand Down
18 changes: 8 additions & 10 deletions workflow/rocoto/gfs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ def _atmosoceaniceprod(self, component: str):
'history_file_tmpl': f'{self.cdump}.t@Hz.master.grb2f#fhr#'},
'ocean': {'config': 'oceanice_products',
'history_path_tmpl': 'COM_OCEAN_HISTORY_TMPL',
'history_file_tmpl': f'{self.cdump}.ocean.t@Hz.6hr_avg.f#fhr#.nc'},
'history_file_tmpl': f'{self.cdump}.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.cdump}.ice.t@Hz.6hr_avg.f#fhr#.nc'}}
Expand All @@ -1099,13 +1099,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.cdump in ['gdas'] else self.cdump
resources = self.get_resource(component_dict['config'])
Expand All @@ -1124,10 +1120,12 @@ def _atmosoceaniceprod(self, component: str):

fhrs = self._get_forecast_hours(self.cdump, self._configs[config], component)
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.cdump}{component}_prod',
'task_dict': task_dict,
'var_dict': fhr_var_dict
}
'var_dict': fhr_var_dict}

task = rocoto.create_task(metatask_dict)

Expand Down

0 comments on commit e3aa495

Please sign in to comment.