Skip to content
Snippets Groups Projects
Commit 9b761859 authored by rink's avatar rink
Browse files

add support for Carr stereo winds

parent 08e862ff
No related branches found
No related tags found
No related merge requests found
...@@ -46,6 +46,15 @@ def get_datetime_ops(pathname): ...@@ -46,6 +46,15 @@ def get_datetime_ops(pathname):
return dto 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').replace(tzinfo=timezone.utc)
return dto
def get_file_containing_time(timestamp, files_path, file_time_span, amv_source='OPS', band='14'): def get_file_containing_time(timestamp, files_path, file_time_span, amv_source='OPS', band='14'):
global first_time, ftimes, flist global first_time, ftimes, flist
...@@ -57,6 +66,9 @@ def get_file_containing_time(timestamp, files_path, file_time_span, amv_source=' ...@@ -57,6 +66,9 @@ def get_file_containing_time(timestamp, files_path, file_time_span, amv_source='
elif amv_source == 'SSEC': elif amv_source == 'SSEC':
flist = glob.glob(files_path + '*WINDS_AMV_EN-'+band+'*.nc') flist = glob.glob(files_path + '*WINDS_AMV_EN-'+band+'*.nc')
dto_func = get_datetime 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) for pname in flist: # TODO: make better with regular expressions (someday)
dto = dto_func(pname) dto = dto_func(pname)
...@@ -219,6 +231,15 @@ def get_search_box(nav, lon, lat): ...@@ -219,6 +231,15 @@ def get_search_box(nav, lon, lat):
return c_rng, l_rng return c_rng, l_rng
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'
# 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)
...@@ -250,13 +271,13 @@ def match_amvs_to_aelous(aeolus_dict, amv_files_path, amv_source='OPS', band='14 ...@@ -250,13 +271,13 @@ def match_amvs_to_aelous(aeolus_dict, amv_files_path, amv_source='OPS', band='14
if f_idx != last_f_idx: if f_idx != last_f_idx:
last_f_idx = f_idx last_f_idx = f_idx
ds = Dataset(fname) ds = Dataset(fname)
amv_lons = ds['Longitude'][:] amv_lons = ds[amv_lon_name][:]
amv_lats = ds['Latitude'][:] amv_lats = ds[amv_lat_name][:]
amv_spd = ds['Wind_Speed'][:] amv_spd = ds[amv_spd_name][:]
amv_dir = ds['Wind_Dir'][:] amv_dir = ds[amv_dir_name][:]
amv_pres = ds['MedianPress'][:] amv_pres = ds[amv_press_name][:]
cc = ds['Element'][:] cc = ds[amv_elem_name][:]
ll = ds['Line'][:] ll = ds[amv_line_name][:]
# cc, ll = nav.earth_to_lc_s(amv_lons, amv_lats) # cc, ll = nav.earth_to_lc_s(amv_lons, amv_lats)
ds.close() ds.close()
......
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