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

snapshot...

parent 44e11706
Branches
No related tags found
No related merge requests found
......@@ -102,14 +102,17 @@ def match_calipso_clavrx_to_amvs(calipso_clavrx_ds, calipso_clavrx_file, amv_fil
if num_amvs == 0:
continue
dist = haversine_np(lon, lat, amv_lons[in_box], amv_lats[in_box])
s_idxs = np.argsort(dist)
param_nd = np.vstack(param_s)
param_nd = param_nd[:, in_box]
param_nd = param_nd[:, s_idxs]
dist_to_amvs = dist[s_idxs]
amvs_da = xr.DataArray(param_nd, coords=coords, dims=dims)
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))
match_dict[nom_time].append((cc, ll, lon, lat, f_idx, data_da, amvs_da, dist_to_amvs))
return match_dict
......@@ -175,9 +178,9 @@ def create_file(match_dct, output_path, target_filepath, caliop_clavrx_params, a
amv_file_names = rootgrp.createVariable('amv_file_names', str, ['num_amv_files'])
# ---- CALIOP variables ---------------
prf_lon = rootgrp.createVariable('prof_longitude', 'f4', ['num_caliop_profs'])
prf_lon = rootgrp.createVariable('caliop_longitude', 'f4', ['num_caliop_profs'])
prf_lon.units = 'degrees east'
prf_lat = rootgrp.createVariable('prof_latitude', 'f4', ['num_caliop_profs'])
prf_lat = rootgrp.createVariable('caliop_latitude', 'f4', ['num_caliop_profs'])
prf_lat.units = 'degrees north'
prf_time.units = 'seconds since 1970-01-1 00:00:00'
prf_elem = rootgrp.createVariable('FD_elem', 'f4', ['num_caliop_profs'])
......@@ -209,6 +212,7 @@ def create_file(match_dct, output_path, target_filepath, caliop_clavrx_params, a
amv_elem = rootgrp.createVariable('amv_elem', 'f4', ['num_caliop_profs', 'max_num_amvs'])
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'])
nc4_vars = []
var_s = rg_exmpl.variables
......@@ -242,6 +246,7 @@ def create_file(match_dct, output_path, target_filepath, caliop_clavrx_params, a
for tup in tup_s:
data_nd = tup[5]
amvs_nd = tup[6]
dist = tup[7]
for pidx, param in enumerate(caliop_clavrx_params):
nda = data_nd[pidx]
......@@ -263,6 +268,8 @@ def create_file(match_dct, output_path, target_filepath, caliop_clavrx_params, a
cnt = nda.shape[0]
amv_line[idx, 0:cnt] = nda
dst_to_amvs[idx, 0:cnt] = dist
for pidx, param in enumerate(amv_params):
nda = amvs_nd[pidx+4,]
cnt = nda.shape[0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment