3 from pyproj
import Transformer
7 lons = np.linspace(-98, -70, 1000)
8 lats = np.linspace(15, 35, 1000)
9 LON, LAT = np.meshgrid(lons, lats)
12 proj_str =
"+proj=aea +lon_0=-84 +lat_1=18.3333333 +lat_2=31.6666667 +lat_0=25 +datum=WGS84 +units=m +no_defs"
13 transformer = Transformer.from_crs(proj_str,
"EPSG:4326", always_xy=
True)
20 lon_reconstructed, lat_reconstructed = transformer.transform(X, Y)
22 lon_diff = lon_reconstructed - LON
25 lat_diff = lat_reconstructed - LAT
def test_array_within_threshold(arr, lower_threshold=-1e-8, upper_threshold=1e-8)