opendrift.readers.reader_grib

Attributes

logger

grib_variable_mapping

Classes

Reader

An abstract reader. Implementors provide a method to read data and specify how it is interpolated.

Module Contents

opendrift.readers.reader_grib.logger
opendrift.readers.reader_grib.grib_variable_mapping
class opendrift.readers.reader_grib.Reader(filename=None, name=None)[source]

Bases: opendrift.readers.basereader.BaseReader, opendrift.readers.basereader.StructuredReader

An abstract reader. Implementors provide a method to read data and specify how it is interpolated.

This class inherits variables.Variables which inherits variables.ReaderDomain. ReaderDomain is responsible for the extent and domain of the reader, including checking for out-of-bounds and projection conversion. Variables is responsible for returning interpolated data at the requests positions or profiles. Apart from coercing the returned data into the right type for opendrift.models.basemodel, it defines the abstract interface to variables.Variables._get_variables_interpolated_() which reader-implementations must provide (_usually_ through one of the main reader-types, see: opendrift.readers).

Common constructor for all readers

xmin
xmax
ymin
ymax
delta_x
delta_y
marsParams
variables
indices
levels
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.