I'm opening this grib file using rioxarray and reprojecting to WGS84 in the following manner with the goal of grabbing pixel values by coordinates.
import rioxarray
url = 'https://noaa-hrrr-bdp-pds.s3.amazonaws.com/hrrr.20220511/conus/hrrr.t00z.wrfsubhf01.grib2'
src = rioxarray.open_rasterio(url)
reproj = src.rio.reproject("EPSG:4326")
This reprojectoin takes a little while, so I've pivoted to converting lat,lon coordinates to LCC2SP using this method
from pyproj import Transformer
x, y = -99, 43
transformer = Transformer.from_crs("EPSG:4326", src.rio.crs.to_proj4(), always_xy=True)
xm, ym = transformer.transform(x, y)
now when I select the the data using the two respective coordinate systems, I get two different values.
lcc_val = src.sel(x=xm, y=ym, method='nearest')[13] # note: I use the original projection 'src' dataset here
coord_val = reproj.sel(x=x, y=y, method='nearest')[13] # note: I use the new reprojected dataset here
the values are
lcc_val = array(22.60875854)
coord_val = array(20.73375854)
Can anyone see why this is happening?
EDIT: On testing the edges of the grid, the values being returned are the same. It's near the center where there are slight differences. I'm guessing it's some sort of reprojection error?