Skip to content
Snippets Groups Projects
Commit 4210fa08 authored by tomrink's avatar tomrink
Browse files

snapshot...

parent 20dfaa05
No related branches found
No related tags found
No related merge requests found
......@@ -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,]
......
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