From 7b44687e3591afb504163907460f54f45223e977 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Tue, 31 Oct 2023 13:24:11 -0500 Subject: [PATCH] snapshot... --- modules/util/util.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/modules/util/util.py b/modules/util/util.py index c0807e79..c4b2b13d 100644 --- a/modules/util/util.py +++ b/modules/util/util.py @@ -15,6 +15,7 @@ from scipy.interpolate import RectBivariateSpline, interp2d from scipy.ndimage import gaussian_filter from scipy.signal import medfilt2d from cartopy.crs import Geostationary, Globe +import geos_nav LatLonTuple = namedtuple('LatLonTuple', ['lat', 'lon']) @@ -679,23 +680,26 @@ def add_noise(data, noise_scale=0.01, seed=None, copy=True): # geos_h08_fd = pickle.load(f) # f.close() -geos_goes16_fd = Geostationary(central_longitude=-75.0, satellite_height=35786023.0, sweep_axis='x', +crs_goes16_fd = Geostationary(central_longitude=-75.0, satellite_height=35786023.0, sweep_axis='x', globe=Globe(ellipse=None, semimajor_axis=6378137.0, semiminor_axis=6356752.31414, inverse_flattening=298.2572221)) -geos_goes16_conus = Geostationary(central_longitude=-75.0, satellite_height=35786023.0, sweep_axis='x', +crs_goes16_conus = Geostationary(central_longitude=-75.0, satellite_height=35786023.0, sweep_axis='x', globe=Globe(ellipse=None, semimajor_axis=6378137.0, semiminor_axis=6356752.31414, inverse_flattening=298.2572221)) -geos_h08_fd = Geostationary(central_longitude=140.7, satellite_height=35785.863, sweep_axis='y', +crs_h08_fd = Geostationary(central_longitude=140.7, satellite_height=35785.863, sweep_axis='y', globe=Globe(ellipse=None, semimajor_axis=6378.137, semiminor_axis=6356.7523, inverse_flattening=298.25702)) +geos_goes16_fd = geos_nav.GEOSNavigation() +geos_goes16_conus = geos_nav.GEOSNavigation(CFAC=5.6E-05, LFAC=-5.6E-05, COFF=-0.101332, LOFF=0.128212, num_elems=2500, num_lines=1500) + def get_cartopy_crs(satellite, domain): if satellite == 'GOES16': if domain == 'FD': - geos = geos_goes16_fd + geos = crs_goes16_fd xlen = 5424 xmin = -5433893.0 xmax = 5433893.0 @@ -703,7 +707,7 @@ def get_cartopy_crs(satellite, domain): ymin = -5433893.0 ymax = 5433893.0 elif domain == 'CONUS': - geos = geos_goes16_conus + geos = crs_goes16_conus xlen = 2500 xmin = -3626269.5 xmax = 1381770.0 @@ -711,7 +715,7 @@ def get_cartopy_crs(satellite, domain): ymin = 1584175.9 ymax = 4588198.0 elif satellite == 'H08': - geos = geos_h08_fd + geos = crs_h08_fd xlen = 5500 xmin = -5498.99990119 xmax = 5498.99990119 @@ -719,7 +723,7 @@ def get_cartopy_crs(satellite, domain): ymin = -5498.99990119 ymax = 5498.99990119 elif satellite == 'H09': - geos = geos_h08_fd + geos = crs_h08_fd xlen = 5500 xmin = -5498.99990119 xmax = 5498.99990119 @@ -840,7 +844,8 @@ taiwain_extent = [-3342, -502, 1470, 3510] # GEOS coordinates, not line, elem # ------------ This code will not be needed when we implement a Fully Convolutional CNN ----------------------------------- # Generate and return tiles of name_list parameters -def make_for_full_domain_predict(h5f, name_list=None, satellite='GOES16', domain='FD', res_fac=1): +def make_for_full_domain_predict(h5f, name_list=None, satellite='GOES16', domain='FD', res_fac=1, + data_extent=None): w_x = 16 w_y = 16 i_0 = 0 @@ -849,6 +854,11 @@ def make_for_full_domain_predict(h5f, name_list=None, satellite='GOES16', domain s_y = int(w_y / res_fac) geos, xlen, xmin, xmax, ylen, ymin, ymax = get_cartopy_crs(satellite, domain) + if satellite == 'GOES16': + if data_extent is not None: + ll_pt_a = data_extent[0] + ll_pt_b = data_extent[1] + if satellite == 'H08': xlen = taiwan_lenx ylen = taiwan_leny -- GitLab