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

snapshot...

parent f22f5704
No related branches found
No related tags found
No related merge requests found
......@@ -99,25 +99,26 @@ 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, lon_c, lat_c, time_s):
def create_file(filename, data_dct, ds_list, lon_c, lat_c, time_s, fl_alt_s):
h5f_expl = h5py.File(a_clvr_file, 'r')
hf5 = h5py.File(filename, 'w')
h5f = h5py.File(filename, 'w')
for ds_name in ds_list:
data = data_dct[ds_name]
hf5.create_dataset(ds_name, data=data)
h5f.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)
h5f.create_dataset('longitude', data=lon_c)
h5f.create_dataset('latitude', data=lat_c)
h5f.create_dataset('time', data=time_s)
h5f.create_dataset('icing_altitude', data=fl_alt_s)
# copy relevant attributes
for ds_name in ds_list:
hf5[ds_name].attrs.create('standard_name', data=h5f_expl[ds_name].attrs.get('standard_name'))
hf5[ds_name].attrs.create('long_name', data=h5f_expl[ds_name].attrs.get('long_name'))
hf5[ds_name].attrs.create('units', data=h5f_expl[ds_name].attrs.get('units'))
h5f[ds_name].attrs.create('standard_name', data=h5f_expl[ds_name].attrs.get('standard_name'))
h5f[ds_name].attrs.create('long_name', data=h5f_expl[ds_name].attrs.get('long_name'))
h5f[ds_name].attrs.create('units', data=h5f_expl[ds_name].attrs.get('units'))
hf5.close()
h5f.close()
def run(pirep_dct, outfile=None, outfile_l1b=None):
......@@ -133,6 +134,7 @@ def run(pirep_dct, outfile=None, outfile_l1b=None):
lon_c = []
lat_c = []
time_s = []
fl_alt_s = []
for idx, time in enumerate(time_keys):
reports = pirep_dct[time]
for tup in reports:
......@@ -191,6 +193,7 @@ def run(pirep_dct, outfile=None, outfile_l1b=None):
lon_c.append(lon_s[0])
lat_c.append(lat_s[0])
time_s.append(time)
fl_alt_s.append(fl)
data_dct = {}
for ds_name in ds_list:
......@@ -198,6 +201,7 @@ def run(pirep_dct, outfile=None, outfile_l1b=None):
lon_c = np.array(lon_c)
lat_c = np.array(lat_c)
time_s = np.array(time_s)
fl_alt_s = np.array(fl_alt_s)
if outfile is not None:
create_file(outfile, data_dct, ds_list, lon_c, lat_c, time_s)
......@@ -207,7 +211,7 @@ def run(pirep_dct, outfile=None, outfile_l1b=None):
data_dct[ds_name] = np.array(l1b_grd_dct[ds_name])
if outfile_l1b is not None:
create_file(outfile_l1b, data_dct, l1b_ds_list, lon_c, lat_c, time_s)
create_file(outfile_l1b, data_dct, l1b_ds_list, lon_c, lat_c, time_s, fl_alt_s)
def analyze(ice_dct, no_ice_dct):
......@@ -273,5 +277,6 @@ def analyze(ice_dct, no_ice_dct):
print(dt_str[2:])
def apply_qc_icing_pireps():
def apply_qc_icing_pireps(icing_dct):
new_dct = {}
pass
\ No newline at end of file
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