I'd like to get snow accumulation data for specific GPS coordinates (hiking peaks in the south east) using netCDF4 data from NOAA's snowfall analysis available here.
According to the metadata (at the very bottom of post), the data uses a Lambert Conformal Conic 1SP projection (which is ESPG 9801 from what I've read). However, this CRS doesn't seem to be supported by Python. Additionally, while y/x seem to be the Lambert projection, I can't make sense of the lat/lon values in the data. The lat ranges from ~20 to ~52 and the lon from ~230 to ~299. Should I use the y/x or lat/lon, and how could I make the conversion from GPS?
import numpy as np
import netCDF4
import pyproj
fn = '/sfav2_CONUS_72h_2024012912_grid184.nc'
nc = netCDF4.Dataset(fn, mode="r")
# Look at data
plt.contourf(nc['Data'][:,:])
plt.colorbar()
# Convert GPS to Lambert conformal conic projection
gps_coords = (-83.436715, 35.65435) # Mount LeConte
target_crs = 'epsg:9801'
source_crs = 'epsg:4326'
to_lambert = pyproj.Transformer.from_crs(source_crs, target_crs)
coord_x, coord_y = to_lambert.transform(gps_coords[0], gps_coords[1])
CRSError: Invalid projection: EPSG:9801: (Internal Proj Error: proj_create: crs not found)
(np.min(nc['lon']), np.max(nc['lon']))
Out[]: (229.89661431820417, 299.11409209512004)
(np.min(nc['lat']), np.max(nc['lat']))
Out[]: (20.191999999999986, 52.807544344820116)
(np.min(nc['x']), np.max(nc['x']))
Out[]: (-2763216.9521579794, 2681906.2798420205)
(np.min(nc['y']), np.max(nc['y']))
Out[]: (-263790.580335455, 3230840.7476645447)
nc['Lambert_conformal_conic']
Out[263]:
<class 'netCDF4._netCDF4.Variable'>
|S1 Lambert_conformal_conic()
grid_mapping_name: lambert_conformal_conic
standard_parallel: 25.0
longitude_of_central_meridian: 265.0
latitude_of_projection_origin: 25.0
false_easting: 0.0
false_northing: 0.0
semi_major_axis: 6371229.0
inverse_flattening: 0.0
unlimited dimensions:
current shape = ()
filling on, default _FillValue of used