herbie.accessors.HerbieAccessor#
- class herbie.accessors.HerbieAccessor(xarray_obj)[source]#
Accessor for xarray Datasets opened with Herbie
Methods
__init__
(xarray_obj)nearest_points
(points[, names, verbose])Get the nearest latitude/longitude points from a xarray Dataset.
plot
([ax, common_features_kw, vars])Plot data on a map.
Attributes
Return the geographic center point of this dataset.
Cartopy coordinate reference system (crs) from a cfgrib Dataset.
Get a polygon of the domain boundary.
Methods:
__init__
(xarray_obj)nearest_points
(points[, names, verbose])Get the nearest latitude/longitude points from a xarray Dataset.
plot
([ax, common_features_kw, vars])Plot data on a map.
Attributes:
Return the geographic center point of this dataset.
Cartopy coordinate reference system (crs) from a cfgrib Dataset.
Get a polygon of the domain boundary.
- property center#
Return the geographic center point of this dataset.
- property crs#
Cartopy coordinate reference system (crs) from a cfgrib Dataset.
Projection information is from the grib2 message for each variable.
- Parameters:
ds (xarray.Dataset) – An xarray.Dataset from a GRIB2 file opened by the cfgrib engine.
- nearest_points(points, names=None, verbose=True)[source]#
Get the nearest latitude/longitude points from a xarray Dataset.
Stack Overflow: https://stackoverflow.com/questions/58758480/xarray-select-nearest-lat-lon-with-multi-dimension-coordinates
MetPy Details: https://unidata.github.io/MetPy/latest/tutorials/xarray_tutorial.html?highlight=assign_y_x
- Parameters:
ds (xr.Dataset) – A Herbie-friendly xarray Dataset
points (tuple (lon, lat) or list of tuples) – The longitude and latitude (lon, lat) coordinate pair (as a tuple) for the points you want to pluck from the gridded Dataset. A list of tuples may be given to return the values from multiple points.
names (list) – A list of names for each point location (i.e., station name). None will not append any names. names should be the same length as points.
Benchmark –
--------- – This is much faster than my old “pluck_points” method. For matchign 1,948 points: - nearest_points completed in 7.5 seconds. - pluck_points completed in 2 minutes.
- plot(ax=None, common_features_kw={}, vars=None, **kwargs)[source]#
Plot data on a map.
- Parameters:
vars (list) – List of variables to plot. Default None will plot all variables in the DataSet.
- property polygon#
Get a polygon of the domain boundary.