Re: [python-users] metpy.parse_cf doesn't set metpy_crs w/ nomads grib2 hrrr ?

  • To: Ken Harris <kjh@xxxxxxxxxxx>
  • Subject: Re: [python-users] metpy.parse_cf doesn't set metpy_crs w/ nomads grib2 hrrr ?
  • From: Ryan May <rmay@xxxxxxxx>
  • Date: Wed, 31 Aug 2022 14:23:38 -0600
Greetings!

The short answer here is that the problem is due to there being no CF
projection ("grid mapping") metadata for MetPy to parse, so it cannot
generate the CRS object.

There are indeed lat/lon coordinates that can be used for some basic
plotting--but these are 2-dimensional and thus cannot be treated as primary
coordinates. The native projection for the HRRR grid is Lambert Conformal.

There's an open issue on MetPy to add some support for the cfgrib metadata:

  https://github.com/Unidata/MetPy/issues/2473

but no movement thus far and not likely to be a priority for us any time
soon. There are also open issues on cfgrib related to this:

  https://github.com/ecmwf/cfgrib/issues/251
  https://github.com/ecmwf/cfgrib/issues/77

To work-around this, you can create the appropriate CRS manually or inject
the appropriate CF metadata manually.

Cheers,

Ryan

On Tue, Aug 30, 2022 at 1:07 AM Ken Harris <kjh@xxxxxxxxxxx> wrote:

> People :
>
> I'm trying to plot HRRR data from a nomads grib2 file, but
> metpy.parse_cf doesn't set metpy_crs .  There seems to be enough
> attributes (eg : GRIB_gridType, etc).  Attached is some python code
> that fetches a grib2 file from nomads (and writes it into the local
> directory) , then reads (w/ xarray w/ cfgrib) then metpy.parse_cf,
> then prints metpy_crs.  It's works OK w/ GFS ( Projection:
> latitude_longitude ), but the HRRR files gives an error : KeyError:
> 'metpy_crs'
>
> Do I have to call assign_crs / assign_latitude_longitude or should
> parse_cf do this ?
>
> Thanks,
> Ken
> _______________________________________________
> NOTE: All exchanges posted to Unidata maintained email lists are
> recorded in the Unidata inquiry tracking system and made publicly
> available through the web.  Users who post to any of the lists we
> maintain are reminded to remove any personal information that they
> do not want to be made public.
>
>
> python-users mailing list
> python-users@xxxxxxxxxxxxxxxx
> For list information, to unsubscribe, or change your membership options,
> visit: https://www.unidata.ucar.edu/mailing_lists/
>


-- 
Ryan May
Unidata Deputy Director
UCAR
Boulder, CO
  • 2022 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the python-users archives: