diff --git a/modules/aeolus/datasource.py b/modules/aeolus/datasource.py index 34ca065e2577a79ebbb9bdd72802c179adeb21dc..d85cf761cfd7a23672815a66d9e08f35cafa0a45 100644 --- a/modules/aeolus/datasource.py +++ b/modules/aeolus/datasource.py @@ -4,6 +4,8 @@ import glob import numpy as np import re from netCDF4 import Dataset +import pathlib +from pathlib import Path from aeolus.geos_nav import GEOSNavigation from util.util import GenericException @@ -47,6 +49,10 @@ def get_parameters_fmwk_amvs(filename='/ships19/cloud/scratch/4TH_AMV_INTERCOMPA class Files: def __init__(self, files_path, file_time_span, pattern): + if os.path.isdir(files_path): + self.flist = [] + for path in Path(files_path).rglob(pattern): + self.flist.append(path) self.flist = glob.glob(files_path + pattern) if len(self.flist) == 0: raise GenericException('no matching files found in: ' + files_path + pattern) @@ -124,6 +130,22 @@ class CLAVRx(Files): return self.params +class CLAVRx_VIIRS(Files): + def __init__(self, files_path): + super().__init__(files_path, 10, 'clavrx*viirs*level2.h5') + self.params = get_parameters_clavrx() + + def get_datetime(self, pathname): + filename = os.path.split(pathname)[1] + so = re.search('_s\\d{11}', filename) + dt_str = so.group() + dto = datetime.datetime.strptime(dt_str, '_s%Y%j%H%M').replace(tzinfo=timezone.utc) + return dto + + def get_parameters(self): + return self.params + + class RAOBfiles(Files): def __init__(self, files_path, file_time_span=10): super().__init__(files_path, file_time_span, 'raob_soundings*.cdf')