Skip to content
Snippets Groups Projects
Commit fc08fdd3 authored by tomrink's avatar tomrink
Browse files

snapshot...

parent e6197afa
No related branches found
No related tags found
No related merge requests found
......@@ -46,10 +46,8 @@ def setup():
def get_clavrx_datasource(timestamp):
dt_obj, time_tup = get_time_tuple_utc(timestamp)
date_dir_str = dt_obj.strftime(dir_fmt)
print(dt_obj)
ds = ds_dct.get(date_dir_str)
if ds is None:
print(' new datasource: ', date_dir_str)
ds = CLAVRx(clavrx_dir + date_dir_str + '/')
ds_dct[date_dir_str] = ds
return ds
......@@ -188,36 +186,63 @@ def run(pirep_dct, outfile=None, outfile_l1b=None, dt_str_start=None, dt_str_end
continue
if time > t_end:
continue
dt_obj, time_tup = get_time_tuple_utc(time)
print(dt_obj)
try:
clvr_ds = get_clavrx_datasource(time)
except Exception:
continue
reports = pirep_dct[time]
for tup in reports:
lat, lon, fl, I, id, rpt_str = tup
lat_s[0] = lat
lon_s[0] = lon
clvr_file = clvr_ds.get_file(time)[0]
if clvr_file is None:
continue
print(clvr_file, last_clvr_file)
if clvr_file != last_clvr_file:
try:
clvr_ds = get_clavrx_datasource(time)
h5f = h5py.File(clvr_file, 'r')
except Exception:
if h5f is not None:
h5f.close()
print('Problem with file: ', clvr_file)
continue
if last_h5f is not None:
last_h5f.close()
last_h5f = h5f
last_clvr_file = clvr_file
print('new file')
else:
h5f = last_h5f
clvr_file = clvr_ds.get_file(time)[0]
if clvr_file is None:
continue
reports = pirep_dct[time]
for tup in reports:
lat, lon, fl, I, id, rpt_str = tup
lat_s[0] = lat
lon_s[0] = lon
if clvr_file != last_clvr_file:
try:
h5f = h5py.File(clvr_file, 'r')
except Exception:
if h5f is not None:
h5f.close()
print('Problem with file: ', clvr_file)
continue
if last_h5f is not None:
last_h5f.close()
last_h5f = h5f
last_clvr_file = clvr_file
else:
h5f = last_h5f
# try:
# clvr_ds = get_clavrx_datasource(time)
# except Exception:
# continue
#
# clvr_file = clvr_ds.get_file(time)[0]
# if clvr_file is None:
# continue
#
# if clvr_file != last_clvr_file:
# try:
# h5f = h5py.File(clvr_file, 'r')
# except Exception:
# if h5f is not None:
# h5f.close()
# print('Problem with file: ', clvr_file)
# continue
# if last_h5f is not None:
# last_h5f.close()
# last_h5f = h5f
# last_clvr_file = clvr_file
# else:
# h5f = last_h5f
cc, ll = nav.earth_to_lc_s(lon_s, lat_s)
if cc[0] < 0:
......
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