Skip to content
Snippets Groups Projects
Commit 9e4559ed authored by tomrink's avatar tomrink
Browse files

more work on generalization

parent a4ef3f5f
Branches
No related tags found
No related merge requests found
......@@ -1838,5 +1838,5 @@ def run_make_images(ckpt_dir_s_path='/Users/tomrink/tf_model/', prob_thresh=0.5,
obs_times, obs_lons, obs_lats, _ = time_filter_3(ice_dict, ts_0, ts_1)
_, ice_lons, ice_lats = run_evaluate_static(filename=fname, ckpt_dir_s_path=ckpt_dir_s_path,
prob_thresh=prob_thresh, satellite=satellite, domain=domain)
make_icing_image(fname, ice_lons, ice_lats, clvrx_str_time, ice_lons_vld=obs_lons, ice_lats_vld=obs_lats, extent=extent)
make_icing_image(fname, ice_lons, ice_lats, clvrx_str_time, satellite, domain, ice_lons_vld=obs_lons, ice_lats_vld=obs_lats, extent=extent)
print('Done: ', clvrx_str_time)
......@@ -15,7 +15,7 @@ import cartopy.crs as ccrs
import xarray as xr
import os
import h5py
from util.util import get_grid_values_all
from util.util import get_grid_values_all, get_cartopy_crs
from util.setup import home_dir
......@@ -227,20 +227,21 @@ def plot_image3(image, cmap='Greys'):
plt.title('GOES-16', loc='left', fontweight='bold', fontsize=15)
def make_icing_image(clvrx_file, ice_lons, ice_lats, clvrx_str_time, ice_lons_vld=None, ice_lats_vld=None, imagename='icing', extent=[-110, -60, 10, 55]):
def make_icing_image(clvrx_file, ice_lons, ice_lats, clvrx_str_time, satellite, domain, ice_lons_vld=None, ice_lats_vld=None, imagename='icing', extent=[-110, -60, 10, 55]):
h5f = h5py.File(clvrx_file, 'r')
image = get_grid_values_all(h5f, 'temp_10_4um_nom')
exmpl_ds = xr.open_dataset(exmp_file)
mdat = exmpl_ds.metpy.parse_cf('Rad')
geos = mdat.metpy.cartopy_crs
x = mdat.x
y = mdat.y
# exmpl_ds = xr.open_dataset(exmp_file)
# mdat = exmpl_ds.metpy.parse_cf('Rad')
# geos = mdat.metpy.cartopy_crs
# x = mdat.x
# y = mdat.y
geos, xlen, xmin, xmax, ylen, ymin, ymax = get_cartopy_crs(satellite, domain)
fig = plt.figure(figsize=(48, 30))
ax = fig.add_subplot(1, 1, 1, projection=geos)
ax.set_extent(extent, crs=ccrs.PlateCarree())
ax.imshow(image, origin='upper', extent=(x.min(), x.max(), y.min(), y.max()), cmap='Greys', transform=geos)
ax.imshow(image, origin='upper', extent=(xmin, xmax, ymin, ymax), cmap='Greys', transform=geos)
ax.coastlines(resolution='50m', color='black', linewidth=0.25)
ax.add_feature(ccrs.cartopy.feature.STATES, linewidth=0.25)
if ice_lons is not None:
......
......@@ -406,19 +406,21 @@ exmp_file_conus = '/Users/tomrink/data/OR_ABI-L1b-RadC-M6C14_G16_s20193140811215
exmp_file_fd = '/Users/tomrink/data/OR_ABI-L1b-RadF-M6C16_G16_s20212521800223_e20212521809542_c20212521809596.nc'
def make_for_full_domain_predict(clvrx_file, name_list=None, domain='FD'):
def make_for_full_domain_predict(clvrx_file, name_list=None, satellite='GOES16', domain='FD'):
w_x = 16
w_y = 16
if domain == 'CONUS':
exmpl_ds = xr.open_dataset(exmp_file_conus)
elif domain == 'FD':
exmpl_ds = xr.open_dataset(exmp_file_fd)
mdat = exmpl_ds.metpy.parse_cf('Rad')
geos = mdat.metpy.cartopy_crs
xlen = mdat.x.values.size
ylen = mdat.y.values.size
exmpl_ds.close()
# if domain == 'CONUS':
# exmpl_ds = xr.open_dataset(exmp_file_conus)
# elif domain == 'FD':
# exmpl_ds = xr.open_dataset(exmp_file_fd)
# mdat = exmpl_ds.metpy.parse_cf('Rad')
# geos = mdat.metpy.cartopy_crs
# xlen = mdat.x.values.size
# ylen = mdat.y.values.size
# exmpl_ds.close()
geos, xlen, xmin, xmax, ylen, ymin, ymax = get_cartopy_crs(satellite, domain)
h5f = h5py.File(clvrx_file, 'r')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment