diff --git a/modules/util/gfs_reader.py b/modules/util/gfs_reader.py index 0550cb39dbe5e76158a517b2dc8e8e9e080736dd..4281bd15e6b00b2909b60492c38e6e1f18f2385a 100644 --- a/modules/util/gfs_reader.py +++ b/modules/util/gfs_reader.py @@ -157,8 +157,6 @@ def get_time_interpolated_layer(xr_dataset_s, time_s, time, fld_name, press, lon lyr = lyr.assign_coords(time=time_s) intrp_lyr = lyr.interp(time=time, method=method) - intrp_lyr = intrp_lyr.expand_dims('channel') - intrp_lyr = intrp_lyr.assign_coords(channel=[fld_name]) return intrp_lyr @@ -252,7 +250,7 @@ def get_time_interpolated_vert_profile(xr_dataset_s, time_s, fld_name, time, lon def get_time_interpolated_vert_profile_s(xr_dataset_s, time_s, fld_name_s, time, lons, lats, method='linear'): prof_s = [] for ds in xr_dataset_s: - vp = get_vert_profile(ds, fld_name_s, lons, lats) + vp = get_vert_profile_s(ds, fld_name_s, lons, lats) prof_s.append(vp) prof = xr.concat(prof_s, 'time') @@ -278,6 +276,20 @@ def get_time_interpolated_point(ds_0, ds_1, time0, time1, fld_name, time, lons, return intrp_vals +def get_time_interpolated_voxel(xr_dataset_s, time_s, time, fld_name, lon, lat, press, x_width=5, y_width=5, z_width=3, method='linear'): + vox_s = [] + for ds in xr_dataset_s: + vox = get_voxel(ds, fld_name, lon, lat, press, x_width=x_width, y_width=y_width, z_width=z_width) + vox_s.append(vox) + + vox = xr.concat(vox_s, 'time') + vox = vox.assign_coords(time=time_s) + + intrp_vox = vox.interp(time=time, method=method) + + return intrp_vox + + def get_voxel(xr_dataset, fld_name, lon, lat, press, x_width=5, y_width=5, z_width=3): if lon360: if lon < 0: @@ -301,6 +313,20 @@ def get_voxel(xr_dataset, fld_name, lon, lat, press, x_width=5, y_width=5, z_wid return sub_fld +def get_time_interpolated_voxel_s(xr_dataset_s, time_s, time, fld_name_s, lon, lat, press, x_width=5, y_width=5, z_width=3, method='linear'): + vox_s = [] + for ds in xr_dataset_s: + vox = get_voxel_s(ds, fld_name_s, lon, lat, press, x_width=x_width, y_width=y_width, z_width=z_width) + vox_s.append(vox) + + vox = xr.concat(vox_s, 'time') + vox = vox.assign_coords(time=time_s) + + intrp_vox = vox.interp(time=time, method=method) + + return intrp_vox + + def get_voxel_s(xr_dataset, fld_name_s, lon, lat, press, x_width=5, y_width=5, z_width=3): if lon360: if lon < 0: