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

snapshot...

parent b36c2816
No related branches found
No related tags found
No related merge requests found
...@@ -513,6 +513,7 @@ taiwain_extent = [-3342, -502, 1470, 3510] # GEOS coordinates, not line, elem ...@@ -513,6 +513,7 @@ taiwain_extent = [-3342, -502, 1470, 3510] # GEOS coordinates, not line, elem
# ------------ This code will not be needed when we implement a Fully Connected CNN ----------------------------------- # ------------ This code will not be needed when we implement a Fully Connected CNN -----------------------------------
# Generate and return tiles of name_list parameters
def make_for_full_domain_predict(h5f, name_list=None, satellite='GOES16', domain='FD'): def make_for_full_domain_predict(h5f, name_list=None, satellite='GOES16', domain='FD'):
w_x = 16 w_x = 16
w_y = 16 w_y = 16
...@@ -560,6 +561,29 @@ def make_for_full_domain_predict(h5f, name_list=None, satellite='GOES16', domain ...@@ -560,6 +561,29 @@ def make_for_full_domain_predict(h5f, name_list=None, satellite='GOES16', domain
grd_dct[ds_name] = np.stack(grd_dct_n[ds_name]) grd_dct[ds_name] = np.stack(grd_dct_n[ds_name])
return grd_dct, ll, cc return grd_dct, ll, cc
def make_for_full_domain_predict2(h5f, satellite='GOES16', domain='FD'):
w_x = 16
w_y = 16
i_0 = 0
j_0 = 0
s_x = w_x
s_y = w_y
geos, xlen, xmin, xmax, ylen, ymin, ymax = get_cartopy_crs(satellite, domain)
if satellite == 'H08':
xlen = taiwan_lenx
ylen = taiwan_leny
i_0 = taiwan_i0
j_0 = taiwan_j0
solzen = get_grid_values(h5f, 'solar_zenith_angle', j_0, i_0, num_j=ylen, num_i=xlen)
satzen = get_grid_values(h5f, 'sensor_zenith_angle', j_0, i_0, num_j=ylen, num_i=xlen)
solzen = solzen[0:ylen:s_y, 0:xlen:s_x]
satzen = satzen[0:ylen:s_y, 0:xlen:s_x]
return solzen, satzen
# ------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------
...@@ -571,7 +595,7 @@ flt_level_ranges_str[3] = '6000_8000' ...@@ -571,7 +595,7 @@ flt_level_ranges_str[3] = '6000_8000'
flt_level_ranges_str[4] = '8000_15000' flt_level_ranges_str[4] = '8000_15000'
def write_icing_file(clvrx_str_time, output_dir, preds_dct, probs_dct, x, y, lons, lats, lat_range=[-63.0, 63.0]): def write_icing_file(clvrx_str_time, output_dir, preds_dct, probs_dct, x, y, lons, lats):
outfile_name = output_dir + 'icing_prediction_'+clvrx_str_time+'.h5' outfile_name = output_dir + 'icing_prediction_'+clvrx_str_time+'.h5'
h5f_out = h5py.File(outfile_name, 'w') h5f_out = h5py.File(outfile_name, 'w')
...@@ -581,8 +605,6 @@ def write_icing_file(clvrx_str_time, output_dir, preds_dct, probs_dct, x, y, lon ...@@ -581,8 +605,6 @@ def write_icing_file(clvrx_str_time, output_dir, preds_dct, probs_dct, x, y, lon
flt_lvls = list(preds_dct.keys()) flt_lvls = list(preds_dct.keys())
for flvl in flt_lvls: for flvl in flt_lvls:
preds = preds_dct[flvl] preds = preds_dct[flvl]
keep = np.logical_or(lats < lat_range[0], lats > lat_range[1])
np.where(keep, preds, -1)
icing_pred_ds = h5f_out.create_dataset('icing_prediction_level_'+flt_level_ranges_str[flvl], data=preds, dtype='i2') icing_pred_ds = h5f_out.create_dataset('icing_prediction_level_'+flt_level_ranges_str[flvl], data=preds, dtype='i2')
icing_pred_ds.attrs.create('coordinates', data='y x') icing_pred_ds.attrs.create('coordinates', data='y x')
icing_pred_ds.attrs.create('grid_mapping', data='Projection') icing_pred_ds.attrs.create('grid_mapping', data='Projection')
...@@ -592,8 +614,6 @@ def write_icing_file(clvrx_str_time, output_dir, preds_dct, probs_dct, x, y, lon ...@@ -592,8 +614,6 @@ def write_icing_file(clvrx_str_time, output_dir, preds_dct, probs_dct, x, y, lon
for flvl in flt_lvls: for flvl in flt_lvls:
probs = probs_dct[flvl] probs = probs_dct[flvl]
keep = np.logical_or(lats < lat_range[0], lats > lat_range[1])
np.where(keep, probs, -1.0)
icing_prob_ds = h5f_out.create_dataset('icing_probability_level_'+flt_level_ranges_str[flvl], data=probs, dtype='f4') icing_prob_ds = h5f_out.create_dataset('icing_probability_level_'+flt_level_ranges_str[flvl], data=probs, dtype='f4')
icing_prob_ds.attrs.create('coordinates', data='y x') icing_prob_ds.attrs.create('coordinates', data='y x')
icing_prob_ds.attrs.create('grid_mapping', data='Projection') icing_prob_ds.attrs.create('grid_mapping', data='Projection')
......
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