From dff8132776970c6cd74a881d39946481d7b96182 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Mon, 1 Jul 2024 13:30:02 -0500 Subject: [PATCH] snapshot... --- modules/aeolus/datasource.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/modules/aeolus/datasource.py b/modules/aeolus/datasource.py index 3dbcf702..66a785b4 100644 --- a/modules/aeolus/datasource.py +++ b/modules/aeolus/datasource.py @@ -83,11 +83,8 @@ class Files: self.ftimes = [] self.dto_s = [] - if os.path.isdir(files_path): - for path in glob.glob(files_path + pattern, recursive=True): - self.flist.append(path) - elif fnmatch.fnmatch(os.path.basename(files_path), pattern): # check if this single file matches pattern - self.flist.append(files_path) + for path in glob.glob(files_path + pattern, recursive=True): + self.flist.append(path) if len(self.flist) == 0: raise GenericException('no matching files found in: ' + files_path + ' matching: ' + pattern) @@ -291,6 +288,17 @@ class GFSfiles(Files): return dto +class CrIS_Retrieval(Files): + def __init__(self, files_path, file_time_span=8, pattern='CrIS_*atm_prof_rtv.h5'): + super().__init__(files_path, file_time_span, pattern) + + def get_datetime(self, pathname): + filename = os.path.split(pathname)[1] + dt_str = re.search('_d.{14}', filename).group(0) + dto = datetime.datetime.strptime(dt_str, '_d%Y%m%d_t%H%M').replace(tzinfo=timezone.utc) + return dto + + class AMVFiles: def __init__(self, files_path, file_time_span, pattern, band='14', elem_name=None, line_name=None, lat_name=None, -- GitLab