Herbie
Herbie copied to clipboard
'fast_Herbie_xarray' unable to grab 'gribfile_projection'
Hello,
I am downloading multiple forecasts using fast_Herbie_xarray()
, and so far I have successfully used it to download HRRR data. Now I am attempting to grab GFS data, but I get the error:
Traceback (most recent call last):
File "/var/folders/r9/_yc_yf6d5k38whv10mx_tzkd15bsjb/T/ipykernel_20173/4263070027.py", line 4, in <cell line: 1>
ds = fast_Herbie_xarray(DATES=total_date_range, fxx=fxx, model=json_file[mod]['model_name'],
File "/Users/akumler/miniconda3/envs/naerm/lib/python3.8/site-packages/herbie/tools.py", line 247, in fast_Herbie_xarray
ds["gribfile_projection"] = ds.gribfile_projection[0][0]
File "/Users/akumler/miniconda3/envs/naerm/lib/python3.8/site-packages/xarray/core/common.py", line 239, in __getattr__
raise AttributeError(
AttributeError: 'Dataset' object has no attribute 'gribfile_projection'
Looking at some example GFS data via xarray, we see that 'gribfile_projection' is a data variable, but not an attribute.
<xarray.Dataset>
Dimensions: (latitude: 721, longitude: 1440)
Coordinates:
time datetime64[ns] 2021-07-11
step timedelta64[ns] 00:00:00
heightAboveGround float64 2.0
* latitude (latitude) float64 90.0 89.75 89.5 ... -89.75 -90.0
* longitude (longitude) float64 0.0 0.25 0.5 ... 359.2 359.5 359.8
valid_time datetime64[ns] 2021-07-11
Data variables:
t2m (latitude, longitude) float32 273.7 273.7 ... 221.6
aptmp (latitude, longitude) float32 269.0 269.0 ... 202.0
gribfile_projection object None
Attributes:
GRIB_edition: 2
GRIB_centre: kwbc
GRIB_centreDescription: US National Weather Service - NCEP
GRIB_subCentre: 0
Conventions: CF-1.7
institution: US National Weather Service - NCEP
model: gfs
product: pgrb2.0p25
description: Global Forecast System
remote_grib: https://noaa-gfs-bdp-pds.s3.amazonaws.com/gfs.20...
local_grib: /Users/akumler/data/gfs/20210711/subset_446869af...
searchString: TMP:2 m above
Digging deeper, it appears there is a projection, but the way that 'fast_Herbie_xarray' is currently set up doesn't recognize this? Am I missing something? Thanks!
x.gribfile_projection
Out[25]:
<xarray.DataArray 'gribfile_projection' ()>
array(None, dtype=object)
Coordinates:
time datetime64[ns] 2021-07-11
step timedelta64[ns] 00:00:00
heightAboveGround float64 2.0
valid_time datetime64[ns] 2021-07-11
Attributes:
crs_wkt: GEOGCRS["unknown",DATUM["unknown",ELLIPSOID...
semi_major_axis: 6371229.0
semi_minor_axis: 6371229.0
inverse_flattening: 0.0
reference_ellipsoid_name: unknown
longitude_of_prime_meridian: 0.0
prime_meridian_name: Greenwich
geographic_crs_name: unknown
grid_mapping_name: latitude_longitude
long_name: GFS model grid projection
Hi @akumler,
Thanks for pointing out this issue. I started writing a new FastHerbie()
class that might not have this problem. I haven't found time to add documentation for it yet, but here is a notebook that shows how to use the FastHerbie()
class...
https://github.com/blaylockbk/Herbie/blob/main/notebooks/New_FastHerbie.ipynb
If that doesn't help, can you share more about the arguments you are using to help me debug the issue. I'll try to find time to add documentation for FastHerbie()
in the next week or so.
I'm closing this for now since I think the FastHerbie class addresses this (and is better documented). If you continue to have issues, please feel free to reopon.