Skip to content
Snippets Groups Projects
Commit 6aea0cda authored by tomrink's avatar tomrink
Browse files

snaphot...

parent 754e87e0
No related branches found
No related tags found
No related merge requests found
......@@ -350,3 +350,36 @@ def analyze(filename):
amv_press_avg = np.nanmean(amv_press, axis=1)
return cc_ctp, acha_ctp, amv_press_avg, lats
def compute_and_add_geo_hgt(path_to_amvs, path_to_gfs, amv_source, band='14'):
gfs_ds = get_datasource(path_to_gfs, 'GFS')
amv_ds = get_datasource(path_to_amvs, amv_source, file_time_span=20, band=band)
amv_filenames = amv_ds.flist
for fname in amv_filenames:
print(fname)
nom_time = amv_ds.get_datetime(fname).timestamp()
amvs_nd = get_amv_nd(fname, delimiter=',')
amvs_nd = filter_amvs(amvs_nd)
amv_lons = amvs_nd[:, amv_lon_idx]
amv_lats = amvs_nd[:, amv_lat_idx]
num_amvs = amvs_nd.shape[0]
gfs_fname, _, _ = gfs_ds.get_file(nom_time, window=180.0)
if gfs_fname is None:
return None
print(gfs_fname)
gfs_xr = xr.open_dataset(gfs_fname)
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='nearest')
temp_prof = temp_prof.values
temp_prof_s = temp_prof[0, :, :]
alt_s = []
for k in range(num_amvs):
alt = pressure_to_altitude(amvs_nd[k, amv_pres_idx], None, gfs_press, temp_prof_s[k, :])
alt_s.append(alt.magnitude)
alt_s = np.array(alt_s)
\ No newline at end of file
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