diff --git a/modules/aeolus/aeolus_amv.py b/modules/aeolus/aeolus_amv.py index c307d86d0864c402e616c9eddd82f467e3a5c134..378b5879fcb9f4d61318d81f992f362822f427db 100644 --- a/modules/aeolus/aeolus_amv.py +++ b/modules/aeolus/aeolus_amv.py @@ -23,215 +23,6 @@ num_elems = 5424 num_lines = 5424 -# class AMVFiles: -# -# def __init__(self, files_path, file_time_span, pattern, band='14'): -# self.flist = glob.glob(files_path + pattern) -# if len(self.flist) == 0: -# raise GenericException('no matching files found in: ' + files_path) -# self.band = band -# self.ftimes = [] -# self.span_seconds = datetime.timedelta(minutes=file_time_span).seconds -# for pname in self.flist: -# dto = self.get_datetime(pname) -# dto_start = dto -# dto_end = dto + datetime.timedelta(minutes=file_time_span) -# self.ftimes.append((dto_start.timestamp(), dto_end.timestamp())) -# self.ftimes = np.array(self.ftimes) -# self.flist = np.array(self.flist) -# sidxs = np.argsort(self.ftimes[:, 0]) -# self.ftimes = self.ftimes[sidxs, :] -# self.flist = self.flist[sidxs] -# -# def get_datetime(self, pathname): -# pass -# -# def get_navigation(self): -# pass -# -# def get_file_containing_time(self, timestamp): -# k = -1 -# for i in range(len(self.ftimes.shape[0])): -# if (timestamp >= self.ftimes[i, 0]) and (timestamp < self.ftimes[i, 1]): -# k = i -# break -# if k < 0: -# return None, None, None -# -# return self.flist[k], self.ftimes[k, 0], k -# -# def get_file(self, timestamp): -# diff = self.ftimes[:, 0] - timestamp -# midx = np.argmin(np.abs(diff)) -# if np.abs(self.ftimes[midx, 0] - timestamp) < self.span_seconds: -# return self.flist[midx], self.ftimes[midx, 0], midx -# else: -# return None, None, None -# -# def get_parameters(self): -# pass -# -# def get_out_parameters(self): -# pass -# -# def get_meta_dict(self): -# pass -# -# -# class Framework(AMVFiles): -# def __init__(self, files_path, file_time_span, band='14'): -# super().__init__(files_path, file_time_span, '*WINDS_AMV_EN-'+band+'*.nc', band) -# -# self.elem_name = 'Element' -# self.line_name = 'Line' -# self.lon_name = 'Longitude' -# self.lat_name = 'Latitude' -# -# self.out_params = ['Lon', 'Lat', 'Element', 'Line', 'pressure', 'wind_speed', 'wind_direction', 'BestFitPresLvl'] -# self.params = ['MedianPress', 'Wind_Speed', 'Wind_Dir', 'BestFitPresLvl'] -# self.meta_dict = {'Lon': ('degrees east', 'f4'), 'Lat': ('degrees north', 'f4'), 'Element': (None, 'i4'), 'Line': (None, 'i4'), -# 'pressure': ('hPa', 'f4'), 'wind_speed': ('m s-1', 'f4'), 'wind_direction': ('degrees', 'f4'), -# 'BestFitPresLvl': ('hPa', 'f4')} -# -# def get_parameters(self): -# return self.params -# -# def get_out_parameters(self): -# return self.out_params -# -# def get_meta_dict(self): -# return self.meta_dict -# -# def get_navigation(self): -# return GEOSNavigation(sub_lon=-75.0) -# -# def get_datetime(self, pathname): -# fname = os.path.split(pathname)[1] -# toks = fname.split('_') -# dstr = toks[4] -# tstr = toks[5] -# dtstr = dstr + tstr -# dto = datetime.datetime.strptime(dtstr, '%Y%j%H%M').replace(tzinfo=timezone.utc) -# -# return dto -# -# -# class FrameworkCloudHeight(AMVFiles): -# def __init__(self, files_path, file_time_span): -# super().__init__(files_path, file_time_span, '*_CLOUD_HEIGHT_EN'+'*.nc', None) -# -# self.elem_name = 'Element' -# self.line_name = 'Line' -# self.lon_name = 'Longitude' -# self.lat_name = 'Latitude' -# -# self.out_params = ['CldTopPres', 'CldTopHght', 'CldOptDpth'] -# self.params = ['CldTopPres', 'CldTopHght', 'CldOptDpth'] -# self.meta_dict = {'CldTopPres': ('hPa', 'f4'), 'CldTopHght': ('km', 'f4'), 'CldOptDpth': ('km', 'f4')} -# -# def get_parameters(self): -# return self.params -# -# def get_out_parameters(self): -# return self.out_params -# -# def get_meta_dict(self): -# return self.meta_dict -# -# def get_navigation(self): -# return GEOSNavigation(sub_lon=-75.0) -# -# def get_datetime(self, pathname): -# fname = os.path.split(pathname)[1] -# toks = fname.split('_') -# dstr = toks[4] -# tstr = toks[5] -# dtstr = dstr + tstr -# dto = datetime.datetime.strptime(dtstr, '%Y%j%H%M').replace(tzinfo=timezone.utc) -# -# return dto -# -# -# class OPS(AMVFiles): -# def __init__(self, files_path, file_time_span, band='14'): -# super().__init__(files_path, file_time_span, 'OR_ABI-L2-DMWF*'+'C'+band+'*.nc', band) -# -# self.elem_name = None -# self.line_name = None -# self.lon_name = 'lon' -# self.lat_name = 'lat' -# -# self.out_params = ['Lon', 'Lat', 'Element', 'Line', 'pressure', 'wind_speed', 'wind_direction'] -# self.params = ['pressure', 'wind_speed', 'wind_direction'] -# self.meta_dict = {'Lon': ('degrees east', 'f4'), 'Lat': ('degrees north', 'f4'), 'Element': (None, 'i4'), 'Line': (None, 'i4'), -# 'pressure': ('hPa', 'f4'), 'wind_speed': ('m s-1', 'f4'), 'wind_direction': ('degrees', 'f4')} -# -# def get_navigation(self): -# # return GEOSNavigation(sub_lon=-75.2) ? -# return GEOSNavigation(sub_lon=-75.0) -# -# def get_datetime(self, pathname): -# fname = os.path.split(pathname)[1] -# toks = fname.split('_') -# dtstr = toks[3] -# dtstr = dtstr[:-3] -# dto = datetime.datetime.strptime(dtstr, 's%Y%j%H%M').replace(tzinfo=timezone.utc) -# -# return dto -# -# def get_parameters(self): -# return self.params -# -# def get_out_parameters(self): -# return self.out_params -# -# def get_meta_dict(self): -# return self.meta_dict -# -# -# class CarrStereo(AMVFiles): -# def __init__(self, files_path, file_time_span, band='14'): -# super().__init__(files_path, file_time_span, 'tdw_qc_GOES*'+'ch_'+band+'.nc', band) -# -# self.elem_name = 'Element' -# self.line_name = 'Line' -# self.lon_name = 'Lon' -# self.lat_name = 'Lat' -# -# self.out_params = ['Lon', 'Lat', 'Element', 'Line', 'V_3D_u', 'V_3D_v', 'H_3D', 'pres', 'Fcst_Spd', 'Fcst_Dir', 'SatZen', -# 'InversionFlag', 'CloudPhase', 'CloudType'] -# -# self.params = ['V_3D', 'H_3D', 'pres', 'Fcst_Spd', 'Fcst_Dir', 'SatZen', -# 'InversionFlag', 'CloudPhase', 'CloudType'] -# -# self.meta_dict = {'H_3D': ('m', 'f4'), 'pres': ('hPa', 'f4'), 'Fcst_Spd': ('m s-1', 'f4'), -# 'Fcst_Dir': ('degree', 'f4'), -# 'SatZen': ('degree', 'f4'), 'InversionFlag': (None, 'u1'), -# 'CloudPhase': (None, 'u1'), 'CloudType': (None, 'u1'), -# 'V_3D_u': ('m s-1', 'f4'), 'V_3D_v': ('m s-1', 'f4'), 'Lon': ('degrees east', 'f4'), -# 'Lat': ('degrees north', 'f4'), 'Element': (None, 'i4'), 'Line': (None, 'i4')} -# -# def get_navigation(self): -# return GEOSNavigation(sub_lon=-137.0) -# -# def get_datetime(self, pathname): -# fname = os.path.split(pathname)[1] -# toks = fname.split('_') -# dtstr = toks[3] -# dto = datetime.datetime.strptime(dtstr, '%Y%j.%H%M.ch').replace(tzinfo=timezone.utc) -# -# return dto -# -# def get_parameters(self): -# return self.params -# -# def get_out_parameters(self): -# return self.out_params -# -# def get_meta_dict(self): -# return self.meta_dict - - def get_amvs(amv_files, timestamp, filepath=None): if filepath is None: filepath, ftime, f_idx = amv_files.get_file(timestamp)