NOAA-MDL / grib2io

Python interface to the NCEP G2C Library for reading and writing GRIB2 messages.

Home Page:https://noaa-mdl.github.io/grib2io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide lats and lons as attributes or property

EricEngle-NOAA opened this issue · comments

A common pattern when using grib2io is to get latitudes and longitudes for the GRIB2 message via the latlons() method. This is especially true when plotting. Therefore grib2io.Grib2Message class should have attributes or properties to access these data.

This should not cause any performance hit since lats and lons are only computed once -- they'll simply just be returned.

Expected access pattern:

import grib2io
g = grib2io.open("file.grib2")
msg = g[0]
msg.lats # Latitudes
msg.lons # Longitudes
msg.data # Data