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

snapshot...

parent 74b7acdf
No related branches found
No related tags found
No related merge requests found
......@@ -91,7 +91,7 @@ def get_grid_values(h5f, grid_name, j_c, i_c, half_width, scale_factor_name='sca
return grd_vals
def create_file(filename, data_dct, ds_list):
def create_file(filename, data_dct, ds_list, lon_c, lat_c, time_s):
#h5f_expl = h5py.File(a_clvr_file, 'r')
hf5 = h5py.File(filename, 'w')
......@@ -99,6 +99,10 @@ def create_file(filename, data_dct, ds_list):
data = data_dct[ds_name]
hf5.create_dataset(ds_name, data=data)
hf5.create_dataset('longitude', data=lon_c)
hf5.create_dataset('latitude', data=lat_c)
hf5.create_dataset('time', data=time_s)
hf5.close()
......@@ -115,6 +119,9 @@ def run(pirep_dct, outfile=None):
cnt = 0
miss_a = 0
miss_b = 0
lon_c = []
lat_c = []
time_s = []
for idx, time in enumerate(time_keys):
reports = pirep_dct[time]
for tup in reports:
......@@ -149,21 +156,30 @@ def run(pirep_dct, outfile=None):
h5f = last_h5f
cc, ll = nav.earth_to_lc_s(lon_s, lat_s)
if cc[0] < 0:
continue
for didx, ds_name in enumerate(ds_list):
gvals = get_grid_values(h5f, ds_name, ll[0], cc[0], 20)
if gvals is not None:
ds_grd_dct[ds_name].append(gvals)
lon_c.append(lon_s[0])
lat_c.append(lat_c[0])
time_s.append(time)
cnt += 1
data_dct = {}
for ds_name in ds_list:
data_dct[ds_name] = np.array(ds_grd_dct[ds_name])
lon_c = np.array(lon_c)
lat_c = np.array(lat_c)
time_s = np.array(time_s)
print('num images: ', cnt, len(time_keys), miss_a, miss_b)
create_file(outfile, data_dct, ds_list)
create_file(outfile, data_dct, ds_list, lon_c, lat_c, time_s)
def analyze(ice_dct, no_ice_dct):
......
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