RAiDER
RAiDER copied to clipboard
[BUG] Read HRRR projection system from source grib file
Describe the bug
- Just remembered that the projection system is hardcoded currently here: https://github.com/dbekaert/RAiDER/blob/0d3af08917e171318bac1694d1663ede8e3fc974/tools/RAiDER/models/hrrr.py#L57-L70
- This is only true for CONUS and not for other flavors like Alaska, Hawaii, Puerto Rico
To Reproduce For CONUS, this hard-coded values appears to be correct
> gdalsrsinfo -o proj4 ~/Downloads/hrrr.t00z.wrfprsf00.grib2
+proj=lcc +lat_0=38.5 +lon_0=-97.5 +lat_1=38.5 +lat_2=38.5 +x_0=0 +y_0=0 +R=6371229 +units=m +no_defs
Is not correct for Alaska
> gdalsrsinfo -o proj4 ~/Downloads/hrrr.t00z.wrfprsf00.ak.grib2
+proj=stere +lat_0=90 +lat_ts=60 +lon_0=225 +x_0=0 +y_0=0 +R=6371229 +units=m +no_defs
Additional context
- This might need some testing with rasterio, to see if it can interpret CRS correctly when using profile()
- Else, might have to parse attributes of a variable in the grib file to interpret the system correctly.
Should we not just extract the projection when we are loading the model. Similar to what @piyushrpt shows above from GRIBB file. Is there a need to have the proj defined in the init ?
Thats the right thing to do - but still to be determined if rasterio can read the projection correctly, or you need to write a custom function to parse the grib attributes etc.
The zarr data has geo-metadata that can be successfully read by rasterio. You could potentially save the constant CRS depending the geographic region that's required, and assign it.
@jlmaurer @bbuzz31 We need to add a check that only HRRR conus is supported with a hard-coded projection, or change our code to read it from the file directly. We are at risk if HYP3 plug in ask data for hawaii to use conus hard-coded projection.
We should also check if the model validity period needs to change for HRRR conus versus HRRR alaska. Especially the start date.