From b51f175c70746484f6292029d045429fdcc6fded Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Tue, 6 Jul 2021 12:46:08 -0500 Subject: [PATCH] snapshot... --- modules/aeolus/aeolus_amv.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/aeolus/aeolus_amv.py b/modules/aeolus/aeolus_amv.py index 6471f3ca..76718c0e 100644 --- a/modules/aeolus/aeolus_amv.py +++ b/modules/aeolus/aeolus_amv.py @@ -1366,13 +1366,18 @@ def time_dict_to_nd_0(time_dict): # # make each profile at a timestamp a numpy array def time_dict_to_nd(time_dict): + params = ['latitude', 'longitude', 'hhh', 'hht', 'hhb', 'azimuth', 'wind_speed'] + coords = {'num_params': params} + dims = ['num_levels', 'num_params'] + keys = list(time_dict.keys()) for key in keys: prof_s = time_dict[key] if prof_s is not None: for i in range(len(prof_s)): nda = np.stack(prof_s[i]) - prof_s[i] = nda + nda_da = xr.DataArray(nda, coords=coords, dims=dims) + prof_s[i] = nda_da return time_dict @@ -1493,7 +1498,6 @@ def match_aeolus_to_clavrx(aeolus_dict, clvrx_files): keys = list(aeolus_dict.keys()) - #cnt = 0 last_f_idx = -1 param_nd = None dataset = None @@ -1534,7 +1538,6 @@ def match_aeolus_to_clavrx(aeolus_dict, clvrx_files): param_nd = np.stack(data, axis=0) match_dict[key].append((cc, ll, f_idx, prof, param_nd)) - #cnt += 1 for ds in dataset_s: ds.close() @@ -1688,6 +1691,8 @@ def match_amvs_to_aeolus_fast(aeolus_dict, amv_files_path, amv_source='OPS', ban amv_params = amv_files.get_parameters() all_params = [amv_files.lon_name, amv_files.lat_name, amv_files.elem_name, amv_files.line_name] + amv_params match_dict = {} + coords = {'num_params': all_params} + dims = ['num_params', 'num_amvs'] keys = list(aeolus_dict.keys()) @@ -1749,8 +1754,7 @@ def match_amvs_to_aeolus_fast(aeolus_dict, amv_files_path, amv_source='OPS', ban # dist = haversine_np(lon, lat, amv_lons[in_box], amv_lats[in_box]) param_nd = np.vstack(param_s) param_nd = param_nd[:, in_box] - coords = {'num_params': all_params} - amvs_da = xr.DataArray(param_nd, coords=coords, dims=['num_params', 'num_amvs']) + amvs_da = xr.DataArray(param_nd, coords=coords, dims=dims) match_dict[key].append((cc_prf, ll_prf, f_idx, prof, amvs_da)) return match_dict @@ -1763,7 +1767,10 @@ def match_amvs_to_aeolus(aeolus_dict, amv_files_path, amv_source='OPS', band='14 amv_files = get_datasource(amv_files_path, amv_source, band=band) nav = amv_files.get_navigation() amv_params = amv_files.get_parameters() + all_params = [amv_files.lon_name, amv_files.lat_name, amv_files.elem_name, amv_files.line_name] + amv_params match_dict = {} + coords = {'num_params': all_params} + dims = ['num_params', 'num_amvs'] keys = list(aeolus_dict.keys()) @@ -1826,7 +1833,8 @@ def match_amvs_to_aeolus(aeolus_dict, amv_files_path, amv_source='OPS', band='14 param_s.append(ds[param][in_box]) param_nd = np.vstack(param_s) - match_dict[key].append(param_nd) + amvs_da = xr.DataArray(param_nd, coords=coords, dims=dims) + match_dict[key].append(amvs_da) for ds in dataset_s: -- GitLab