Skip to content

Commit

Permalink
Correct metp cycledefs
Browse files Browse the repository at this point in the history
To avoid running metp on days where there is no gfs, the cycledefs
are adjusted somewhat. First, if the interval is >= 24h, the metp
cycledef will be identical to gfs. If the interval is < 24h, it
remains 18z every day (except the last). Second, a last_gfs is
added so metp will run on for the last gfs cycle even if it there
is no gdas cycle for 18z that day. This required computing the real
gfs end date to use as the last cycle.
  • Loading branch information
WalterKolczynski-NOAA committed Sep 28, 2024
1 parent 94aef55 commit 60ce0aa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
24 changes: 16 additions & 8 deletions workflow/rocoto/gfs_cycled_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_cycledefs(self):

if interval_gfs > to_timedelta("0H"):
sdate_gfs = self._base['SDATE_GFS']
edate_gfs = edate
edate_gfs = sdate_gfs + (edate - sdate_gfs)//interval_gfs * interval_gfs
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)
Expand All @@ -40,14 +40,22 @@ def get_cycledefs(self):
strings.append(f'\t<cycledef group="gfs_seq">{date2_gfs_str} {edate_gfs_str} {interval_gfs_str}</cycledef>')

if self._base['DO_METP']:
# Run verification at 18z, no matter what
sdate_metp = sdate_gfs.replace(hour=18)
edate_metp = edate_gfs.replace(hour=18)
interval_metp = to_timedelta('24H')
sdate_metp_str = sdate_metp.strftime("%Y%m%d%H%M")
edate_metp_str = edate_metp.strftime("%Y%m%d%H%M")
interval_metp_str = timedelta_to_HMS(interval_metp)
if interval_gfs < to_timedelta('24H'):
# Run verification at 18z, no matter what if there is more than one gfs per day
sdate_metp = sdate_gfs.replace(hour=18)
edate_metp = (edate_gfs - to_timedelta('24H')).replace(hour=18)
interval_metp = to_timedelta('24H')
sdate_metp_str = sdate_metp.strftime("%Y%m%d%H%M")
edate_metp_str = edate_metp.strftime("%Y%m%d%H%M")
interval_metp_str = timedelta_to_HMS(interval_metp)
else:
# Use same cycledef as gfs if there is no more than one per day
sdate_metp_str = sdate_gfs.strftime("%Y%m%d%H%M")
edate_metp_str = edate_gfs.strftime("%Y%m%d%H%M")
interval_metp_str = timedelta_to_HMS(interval_gfs)

strings.append(f'\t<cycledef group="metp">{sdate_metp_str} {edate_metp_str} {interval_metp_str}</cycledef>')
strings.append(f'\t<cycledef group="last_gfs">{edate_gfs_str} {edate_gfs_str} 24:00:00</cycledef>')

strings.append('')
strings.append('')
Expand Down
2 changes: 1 addition & 1 deletion workflow/rocoto/gfs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,7 @@ def metp(self):
'resources': resources,
'dependency': dependencies,
'envars': metpenvars,
'cycledef': 'metp',
'cycledef': 'metp,last_gfs',
'command': f'{self.HOMEgfs}/jobs/rocoto/metp.sh',
'job_name': f'{self.pslot}_{task_name}_@H',
'log': f'{self.rotdir}/logs/@Y@m@d@H/{task_name}.log',
Expand Down

0 comments on commit 60ce0aa

Please sign in to comment.