From 4210fa088d64c868b9be6fd261e7ee4ca55463a6 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Wed, 21 Sep 2022 15:49:00 -0500 Subject: [PATCH] snapshot... --- modules/amv/caliop_clavrx_amv.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/amv/caliop_clavrx_amv.py b/modules/amv/caliop_clavrx_amv.py index 7cbe64f0..adce1b39 100644 --- a/modules/amv/caliop_clavrx_amv.py +++ b/modules/amv/caliop_clavrx_amv.py @@ -124,14 +124,14 @@ def match_calipso_clavrx_to_amvs(nom_time, calipso_clavrx_nc4, amv_files, calips lons = param_nd[0, :] lats = param_nd[1, :] - temp_prof = get_vert_profile_s(gfs_xr, ['temperature'], lons, lats, method='nearest') + temp_prof = get_vert_profile_s(gfs_xr, ['temperature'], lons, lats, method='linear') 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, :]) - alt_s.append(alt.magnitude) + 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)) @@ -236,6 +236,8 @@ def create_file(match_dct, output_path, target_filepath, caliop_clavrx_params, a 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']) + amv_geom_hgt.units = 'meter' + amv_geom_hgt.long_name = 'AMV pressure converted to height from GFS temperature vs pressure' nc4_vars = [] var_s = rg_exmpl.variables @@ -357,7 +359,7 @@ new_header = ' TARG LAT LON BOX SRCH SPD DIR PW LL num_fmts = ['%6i', '%7.2f', '%8.2f', '%4i', '%4i', '%7.2f', '%7.2f', '%8.2f', '%4i', '%7.2f', '%7.2f', '%8.2f', '%7.2f', '%4i', '%7.2f', '%4i', '%4i', '%6i', '%6i', '%9.2f'] -def get_temp_prof_s(gfs_ds, nom_time, amv_lons, amv_lats): +def get_temp_prof_s(gfs_ds, nom_time, lons, lats): gfs_fname, _, _ = gfs_ds.get_file(nom_time, window=180.0) if gfs_fname is None: return None @@ -365,21 +367,21 @@ def get_temp_prof_s(gfs_ds, nom_time, amv_lons, amv_lats): gfs_press = gfs_xr['pressure levels'] gfs_press = gfs_press.values - temp_prof = get_vert_profile_s(gfs_xr, ['temperature'], amv_lons, amv_lats, method='linear') + temp_prof = get_vert_profile_s(gfs_xr, ['temperature'], lons, lats, method='linear') temp_prof = temp_prof.values temp_prof_s = temp_prof[0, :, :] return temp_prof_s, gfs_press -def get_temp_prof_s_intrp(nom_time, amv_lons, amv_lats): +def get_temp_prof_s_intrp(nom_time, lons, lats): gfs_fname_left, nom_time_left, gfs_fname_rght, nom_time_rght = get_bounding_gfs_files(nom_time) gfs_xr_left = xr.open_dataset(gfs_fname_left) gfs_xr_rght = xr.open_dataset(gfs_fname_rght) gfs_press = gfs_xr_left['pressure levels'].values - temp_prof = get_time_interpolated_vert_profile([gfs_xr_left, gfs_xr_rght], [nom_time_left, nom_time_rght], 'temperature', nom_time, amv_lons, amv_lats) - pt_s = get_time_interpolated_point_s([gfs_xr_left, gfs_xr_rght], [nom_time_left, nom_time_rght], ['surface pressure', 'surface temperature', 'surface height'], nom_time, amv_lons, amv_lats) + temp_prof = get_time_interpolated_vert_profile([gfs_xr_left, gfs_xr_rght], [nom_time_left, nom_time_rght], 'temperature', nom_time, lons, lats) + pt_s = get_time_interpolated_point_s([gfs_xr_left, gfs_xr_rght], [nom_time_left, nom_time_rght], ['surface pressure', 'surface temperature', 'surface height'], nom_time, lons, lats) return temp_prof, gfs_press, pt_s[0,], pt_s[1,], pt_s[2,] -- GitLab