From 9af2ad9a5fca561fd3b6538d6a2a5e3b76978c30 Mon Sep 17 00:00:00 2001 From: Theodlz Date: Wed, 27 Mar 2024 09:41:31 -0700 Subject: [PATCH] wntr topic date is local, so UTC minus 1 --- kowalski/alert_brokers/alert_broker_winter.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kowalski/alert_brokers/alert_broker_winter.py b/kowalski/alert_brokers/alert_broker_winter.py index b433bd34..aaec8af8 100644 --- a/kowalski/alert_brokers/alert_broker_winter.py +++ b/kowalski/alert_brokers/alert_broker_winter.py @@ -584,7 +584,11 @@ def watchdog(obs_date: str = None, test: bool = False): try: if obs_date is None: - datestr = datetime.datetime.utcnow().strftime("%Y%m%d") + # for WNTR, the date that the data is sent to is the date of observation in local time + # not UTC, which is essentially UTC - 1 day + datestr = ( + datetime.datetime.utcnow() - datetime.timedelta(days=1) + ).strftime("%Y%m%d") else: datestr = obs_date @@ -592,7 +596,7 @@ def watchdog(obs_date: str = None, test: bool = False): if not test: # Production Kafka stream at IPAC - # as of 20220801, the naming convention is winter_%Y%m% + # as of 20220801, the naming convention is winter_%Y%m%d topics_tonight = [f"winter_{datestr}"] else: # Local test stream