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

snaphot...

parent 89d28872
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,6 @@ def get_search_box(cc, ll):
return c_rng, l_rng
#def match_calipso_clavrx_to_amvs(calipso_clavrx_ds, calipso_clavrx_file, amv_files, calipso_clavrx_params, gfs_ds):
def match_calipso_clavrx_to_amvs(nom_time, calipso_clavrx_nc4, amv_files, calipso_clavrx_params, gfs_ds):
nav = amv_files.get_navigation()
amv_params = amv_files.get_parameters()
......@@ -50,11 +49,6 @@ def match_calipso_clavrx_to_amvs(nom_time, calipso_clavrx_nc4, amv_files, calips
coords = {'num_params': all_params}
dims = ['num_params', 'num_amvs']
#nom_time = calipso_clavrx_ds.get_datetime(calipso_clavrx_file).timestamp()
#calipso_clavrx_nc4 = Dataset(calipso_clavrx_file)
#print('start processing: ', calipso_clavrx_file)
amv_fname, ftime, f_idx = amv_files.get_file(nom_time)
if f_idx is None:
return None
......@@ -127,17 +121,19 @@ def match_calipso_clavrx_to_amvs(nom_time, calipso_clavrx_nc4, amv_files, calips
data_nd = np.vstack(calipso_clavrx_data)
data_da = xr.DataArray(data_nd[:, idx], coords=coords_a, dims=dims_a)
match_dict[nom_time].append((cc, ll, lon, lat, f_idx, data_da, amvs_da, dist_to_amvs))
lons = param_nd[0, :]
lats = param_nd[1, :]
temp_prof = get_vert_profile_s(gfs_xr, ['temperature'], lons, lats, method='nearest')
temp_prof = temp_prof.values
temp_prof_s = temp_prof[0, :, :]
alt_s = []
for k in range(num_amvs):
alt = pressure_to_altitude(param_nd[4, k], None, gfs_press, temp_prof_s[k, :])
# print(param_nd[4, k], alt)
alt_s.append(alt)
alt_s = np.array(alt_s)
match_dict[nom_time].append((cc, ll, lon, lat, f_idx, data_da, amvs_da, dist_to_amvs, alt_s))
return match_dict
......@@ -238,6 +234,7 @@ def create_file(match_dct, output_path, target_filepath, caliop_clavrx_params, a
amv_line = rootgrp.createVariable('amv_line', 'f4', ['num_caliop_profs', 'max_num_amvs'])
amv_fidx = rootgrp.createVariable('amv_file_index', 'i4', ['num_caliop_profs'])
dst_to_amvs = rootgrp.createVariable('distance_to_amvs', 'f4', ['num_caliop_profs', 'max_num_amvs'])
amv_geom_hgt = rootgrp.createVariable('amv_geom_hgt', 'f4', ['num_caliop_profs', 'max_num_amvs'])
nc4_vars = []
var_s = rg_exmpl.variables
......@@ -272,6 +269,7 @@ def create_file(match_dct, output_path, target_filepath, caliop_clavrx_params, a
data_nd = tup[5]
amvs_nd = tup[6]
dist = tup[7]
alt = tup[8]
for pidx, param in enumerate(caliop_clavrx_params):
nda = data_nd[pidx]
......@@ -294,6 +292,7 @@ def create_file(match_dct, output_path, target_filepath, caliop_clavrx_params, a
amv_line[idx, 0:cnt] = nda
dst_to_amvs[idx, 0:cnt] = dist
amv_geom_hgt[idx, 0:cnt] = alt
for pidx, param in enumerate(amv_params):
nda = amvs_nd[pidx+4,]
......@@ -351,9 +350,3 @@ def analyze(filename):
amv_press_avg = np.nanmean(amv_press, axis=1)
return cc_ctp, acha_ctp, amv_press_avg, lats
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