Skip to content
Snippets Groups Projects
Commit 27308d25 authored by rink's avatar rink
Browse files

remove dead code

parent bc302211
No related branches found
No related tags found
No related merge requests found
...@@ -14,11 +14,6 @@ num_elems = 5424 ...@@ -14,11 +14,6 @@ num_elems = 5424
num_lines = 5424 num_lines = 5424
first_time = True
ftimes = []
flist = None
class MyGenericException(Exception): class MyGenericException(Exception):
def __init__(self, message): def __init__(self, message):
self.message = message self.message = message
...@@ -141,70 +136,6 @@ class CarrStereo(AMVFiles): ...@@ -141,70 +136,6 @@ class CarrStereo(AMVFiles):
return self.meta_dict return self.meta_dict
def get_datetime(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
def get_datetime_ops(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_datetime_carr(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_file_containing_time(timestamp, files_path, file_time_span, amv_source='OPS', band='14'):
global first_time, ftimes, flist
if first_time is True:
if amv_source == 'OPS':
flist = glob.glob(files_path + 'OR_ABI-L2-DMWF*'+'C'+band+'*.nc')
dto_func = get_datetime_ops
elif amv_source == 'SSEC':
flist = glob.glob(files_path + '*WINDS_AMV_EN-'+band+'*.nc')
dto_func = get_datetime
elif amv_source == 'CARR':
flist = glob.glob(files_path + 'tdw_qc_GOES*'+'ch_'+band+'.nc')
dto_func = get_datetime_carr
for pname in flist: # TODO: make better with regular expressions (someday)
dto = dto_func(pname)
dto_start = dto
dto_end = dto + datetime.timedelta(minutes=file_time_span)
ftimes.append((dto_start.timestamp(), dto_end.timestamp()))
first_time = False
k = -1
for i in range(len(ftimes)):
if (timestamp >= ftimes[i][0]) and (timestamp < ftimes[i][1]):
k = i
break
if k < 0:
return None, None, None
return flist[k], ftimes[k], k
# imports the S4 NOAA output # imports the S4 NOAA output
# filename: full path as a string, '/home/user/filename' # filename: full path as a string, '/home/user/filename'
# returns a dict: time -> list of profiles (a profile is a list of levels) # returns a dict: time -> list of profiles (a profile is a list of levels)
...@@ -380,26 +311,6 @@ def get_search_box(nav, lon, lat): ...@@ -380,26 +311,6 @@ def get_search_box(nav, lon, lat):
return c_rng, l_rng return c_rng, l_rng
# Framework
amv_dir_name = 'Wind_Dir'
amv_spd_name = 'Wind_Speed'
amv_lon_name = 'Longitude'
amv_lat_name = 'Latitude'
amv_elem_name = 'Element'
amv_line_name = 'Line'
amv_press_name = 'MedianPress'
# -------------------------------
# Carr stereo
amv_lon_name = 'Lon'
amv_lat_name = 'Lat'
amv_press_name = 'pres'
amv_h3d_name = 'H_3D'
amv_alt_name = 'Altitude'
# -------------------------------
sub_lon = -137.0 # GOES-17
# sub_lon = -75.0 # GOES-16
# aeolus_dict: time -> profiles # aeolus_dict: time -> profiles
# amv_files_path: directory containing AMVs, '/home/user/amvdir/' # amv_files_path: directory containing AMVs, '/home/user/amvdir/'
# return dict: aeolus time -> tuple (amv_lon, amv_lat, amv_pres, amv_spd, amv_dir) # return dict: aeolus time -> tuple (amv_lon, amv_lat, amv_pres, amv_spd, amv_dir)
...@@ -592,7 +503,7 @@ def create_amv_to_aeolus_match_file(aeolus_files_dir, amv_files_dir, outfile=Non ...@@ -592,7 +503,7 @@ def create_amv_to_aeolus_match_file(aeolus_files_dir, amv_files_dir, outfile=Non
# match_file: pathname for the product file # match_file: pathname for the product file
# dt_str_0: start time (YYYY-MM-DD_HH:MM) # dt_str_0: start time (YYYY-MM-DD_HH:MM)
# dt_str_1: end time (YYYY-MM-DD_HH:MM) # dt_str_1: end time (YYYY-MM-DD_HH:MM)
# amv_var_names: list of amv parameters (see match_file) to subset # amv_var_names: list of amv parameters (see match_file ncdump) to subset
# returns: Xarray.DataArray # returns: Xarray.DataArray
# amvs[nprofs, max_num_amvs_per_prof, num_of_params], profs[nprofs, max_num_levs_per_prof, num_of_params], # amvs[nprofs, max_num_amvs_per_prof, num_of_params], profs[nprofs, max_num_levs_per_prof, num_of_params],
# prof_locs[nprofs, (lon, lat) # prof_locs[nprofs, (lon, lat)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment