Skip to content

Commit

Permalink
Fix interval_gfs conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidHuber-NOAA committed Oct 23, 2024
1 parent 69fb251 commit 2d4139b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
3 changes: 1 addition & 2 deletions workflow/applications/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Dict, List, Any
from hosts import Host
from wxflow import Configuration, to_timedelta
from wxflow import Configuration
from abc import ABC, ABCMeta, abstractmethod

__all__ = ['AppConfig']
Expand Down Expand Up @@ -41,7 +41,6 @@ def __init__(self, conf: Configuration) -> None:
f'{", ".join(self.VALID_MODES)}\n')

self.net = base['NET']
self.interval_gfs = to_timedelta(f"{base.get('INTERVAL_GFS')}H")
print(f"Generating the XML for a {self.mode}_{self.net} case")

def _init_finalize(self, conf: Configuration):
Expand Down
4 changes: 2 additions & 2 deletions workflow/applications/gfs_cycled.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from applications.applications import AppConfig
from typing import Dict, Any
from wxflow import Configuration, to_timedelta
from wxflow import Configuration


class GFSCycledAppConfig(AppConfig):
Expand All @@ -26,7 +26,7 @@ def __init__(self, conf: Configuration):
# Now construct self.runs the desired XML order (gdas, enkfgdas, gfs, enkfgfs)
self.runs = ["gdas"] # We always have a 'gdas' run
self.runs.append('enkfgdas') if 'gdas' in self.ens_runs else 0
self.runs.append("gfs") if base['interval_gfs'] > to_timedelta("0H") else 0
self.runs.append("gfs") if base['INTERVAL_GFS'] > 0 else 0
self.runs.append('enkfgfs') if 'gfs' in self.ens_runs and "gfs" in self.runs else 0

def _get_run_options(self, conf: Configuration) -> Dict[str, Any]:
Expand Down
2 changes: 1 addition & 1 deletion workflow/rocoto/gefs_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(self, app_config: AppConfig, rocoto_config: Dict) -> None:
def get_cycledefs(self):
sdate = self._base['SDATE_GFS']
edate = self._base['EDATE']
interval = self._app_config.interval_gfs
interval = to_timedelta("{self._base['INTERVAL_GFS']}H")
sdate_str = sdate.strftime("%Y%m%d%H%M")
edate_str = edate.strftime("%Y%m%d%H%M")
interval_str = timedelta_to_HMS(interval)
Expand Down
2 changes: 1 addition & 1 deletion workflow/rocoto/gfs_cycled_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_cycledefs(self):
sdate_str = sdate.strftime("%Y%m%d%H%M")
strings.append(f'\t<cycledef group="gdas">{sdate_str} {edate_str} {interval_str}</cycledef>')

interval_gfs = self._app_config.interval_gfs
interval_gfs = to_timedelta("{self._base['INTERVAL_GFS']}H")

if interval_gfs > to_timedelta("0H"):
sdate_gfs = self._base['SDATE_GFS']
Expand Down
6 changes: 3 additions & 3 deletions workflow/rocoto/gfs_forecast_only_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ def __init__(self, app_config: AppConfig, rocoto_config: Dict) -> None:
def get_cycledefs(self):
sdate_gfs = self._base['SDATE_GFS']
edate_gfs = self._base['EDATE']
interval_gfs = self._app_config.interval_gfs
interval_gfs = to_timedelta("{self._base['INTERVAL_GFS']}H")
strings = []
sdate_gfs_str = sdate_gfs.strftime("%Y%m%d%H%M")
edate_gfs_str = edate_gfs.strftime("%Y%m%d%H%M")
interval_gfs_str = timedelta_to_HMS(interval_gfs)
strings.append(f'\t<cycledef group="gfs">{sdate_gfs_str} {edate_gfs_str} {interval_gfs_str}</cycledef>')

date2 = sdate_gfs + interval_gfs
if date2 <= edate_gfs:
date2_gfs = sdate_gfs + interval_gfs
if date2_gfs <= edate_gfs:
date2_gfs_str = date2_gfs.strftime("%Y%m%d%H%M")
strings.append(f'\t<cycledef group="gfs_seq">{date2_gfs_str} {edate_gfs_str} {interval_gfs_str}</cycledef>')

Expand Down
8 changes: 4 additions & 4 deletions workflow/rocoto/gfs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def atmanlinit(self):
dependencies = rocoto.create_dependency(dep=deps)

interval_gfs = self._base["INTERVAL_GFS"]
gfs_enkf = True if self.options['do_hybvar'] and 'gfs' in self.options['ens_runs'] else False
gfs_enkf = True if self.options['do_hybvar'] and 'gfs' in self.app_config.ens_runs else False

cycledef = self.run
if self.run in ['gfs'] and gfs_enkf and interval_gfs != 6:
Expand Down Expand Up @@ -875,7 +875,7 @@ def _fcst_forecast_only(self):
# Calculate offset based on RUN = gfs | gdas
interval = None
if self.run in ['gfs']:
interval = to_timedelta(f"{self._base['INTERVAL_GFS']}H")
interval = self._base['INTERVAL_GFS']
elif self.run in ['gdas']:
interval = self._base['assim_freq']
offset = timedelta_to_HMS(-interval)
Expand Down Expand Up @@ -1832,8 +1832,8 @@ def metp(self):
deps = []
dep_dict = {'type': 'task', 'name': f'{self.run}_arch'}
deps.append(rocoto.add_dependency(dep_dict))
if self.app_config.interval_gfs < to_timedelta('24H'):
n_lookback = self.app_config.interval_gfs // to_timedelta('6H')
if self._base["interval_gfs"] < to_timedelta("24H"):
n_lookback = self._base["interval_gfs"] // to_timedelta("6H")
for lookback in range(1, n_lookback + 1):
deps2 = []
dep_dict = {'type': 'taskvalid', 'name': f'{self.run}_arch', 'condition': 'not'}
Expand Down

0 comments on commit 2d4139b

Please sign in to comment.