diff --git a/modules/util/util.py b/modules/util/util.py index b39304335813a650f42eeef4b1be160a35630899..2eff662006a1bb844bce5cb724830c99971e7786 100644 --- a/modules/util/util.py +++ b/modules/util/util.py @@ -7,6 +7,7 @@ from metpy.calc import thickness_hydrostatic from collections import namedtuple import os import h5py +import pickle LatLonTuple = namedtuple('LatLonTuple', ['lat', 'lon']) @@ -354,6 +355,49 @@ def normalize(data, param, mean_std_dict, add_noise=False, noise_scale=1.0, seed return data + +f = open('/Users/tomrink/geos_crs_goes16_FD.pkl', 'rb') +geos_goes16_fd = pickle.load(f) +f.close() + +f = open('/Users/tomrink/geos_crs_goes16_CONUS.pkl', 'rb') +geos_goes16_conus = pickle.load(f) +f.close() + +f = open('/Users/tomrink/geos_crs_H08_FD.pkl', 'rb') +geos_h08_fd = pickle.load(f) +f.close() + + +def get_cartopy_crs(satellite, domain): + if satellite == 'GOES16': + if domain == 'FD': + geos = geos_goes16_fd + xlen = 5424 + xmin = -5433893.0 + xmax = 5433893. + ylen = 5424 + ymin = -5433893.0 + ymax = 5433893.0 + elif domain == 'CONUS': + geos = geos_goes16_conus + xlen = 2500 + xmin = -3626269.5 + xmax = 1381770.0 + ylen = 1500 + ymin = 1584175.9 + ymax = 4588198.0 + elif satellite == 'H08': + geos = geos_h08_fd + xlen = 5500 + xmin = -5498.99990119 + xmax = 5498.99990119 + ylen = 5500 + ymin = -5498.99990119 + ymax = 5498.99990119 + + return geos, xlen, xmin, xmax, ylen, ymin, ymax + # ------------ This code will not be needed when we implement a Fully Connected CNN ----------------------------------- # Example GOES file to retrieve GEOS parameters in MetPy form (CONUS) exmp_file_conus = '/Users/tomrink/data/OR_ABI-L1b-RadC-M6C14_G16_s20193140811215_e20193140813588_c20193140814070.nc'