opendrift.readers.reader_grib2

Attributes

logger

Classes

Reader

A structured reader. Data is gridded on a regular grid. Used by e.g.:

Module Contents

opendrift.readers.reader_grib2.logger
class opendrift.readers.reader_grib2.Reader(filename, proj4=None, engine='cfgrib')[source]

Bases: opendrift.readers.basereader.structured.StructuredReader

A structured reader. Data is gridded on a regular grid. Used by e.g.: opendrift.readers.reader_netCDF_CF_generic.Reader.

Attributes:

projected: is True if fakeproj.fakeproj is used because of missing projection information. The data points are assumed to be approximately equidistant on the surface (i.e. in meters).

clipped: pixels to to remove along boundary (e.g. in case of bad data).

Grib file reader

Args:

filename: path to grib or grib2 file.

proj4: Optional projection override.

engine: grib engine used by xarray, default is cfgrib.

Returns: Grib-file reader.

dataset = None
variables = None
name
times

Setting this to True overrides temporal and spatial bounds checks. Also useful for readers that are constant and do not have a temporal dimension.

start_time
end_time
proj4 = None
variable_mapping
lon
lat
get_variables(requested_variables, time=None, x=None, y=None, z=None)[source]

Obtain a _block_ of values of the requested variables at all positions (x, y, z) closest to given time. These will be stored in opendrift.readers.interpolation.structured.ReaderBlock and accessed from there.

Arguments:

variables: list of variables.

time: datetime or None, time at which data are requested.

x, y: float or ndarrays; coordinates of requested points.

z: float or ndarray; vertical position (in meters, positive up)

Returns:

Dictionary

keywords: variables (string) values: 2D ndarray bounding x and y.