From 38816f34441e50139768ffe7e23746051f6b8c6f Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Wed, 18 Nov 2020 16:06:03 -0600 Subject: [PATCH] snapshot... --- modules/util/gfs_reader.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/util/gfs_reader.py b/modules/util/gfs_reader.py index 4281bd15..3b000a0a 100644 --- a/modules/util/gfs_reader.py +++ b/modules/util/gfs_reader.py @@ -25,6 +25,13 @@ class MyGenericException(Exception): self.message = message +def get_timestamp(filename): + toks = filename.split('.') + tstr = toks[1].split('_')[0] + dto = datetime.datetime.strptime(tstr, gfs_date_format + '%H').replace(tzinfo=timezone.utc) + return dto.timestamp() + + def get_time_tuple_utc(timestamp): dt_obj = datetime.datetime.fromtimestamp(timestamp, timezone.utc) return dt_obj, dt_obj.timetuple() -- GitLab