From 3c78a2090f7dfe93854e92b86d95a68c9dba354e Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Wed, 14 Sep 2022 14:26:00 -0500 Subject: [PATCH] snaphot... --- modules/amv/caliop_clavrx_amv.py | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/modules/amv/caliop_clavrx_amv.py b/modules/amv/caliop_clavrx_amv.py index 0fccbf50..00d8d481 100644 --- a/modules/amv/caliop_clavrx_amv.py +++ b/modules/amv/caliop_clavrx_amv.py @@ -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 - - - - - - -- GitLab