opendrift.readers.operators.readerops

Classes

Combined

A combination of two readers.

Functions

none_or_cmp(a, b, cmp)

Module Contents

opendrift.readers.operators.readerops.none_or_cmp(a, b, cmp)[source]
class opendrift.readers.operators.readerops.Combined(a, b, op, op_type='easy', external_params=None)[source]

Bases: opendrift.readers.basereader.BaseReader

A combination of two readers.

Combine two readers a and b followinf the operator op. If needed, you can ad an op_type that will enable you to use the external parameters you want in your op between lines 63 and 73.

a: opendrift.readers.basereader.BaseReader
b: opendrift.readers.basereader.BaseReader
op: types.LambdaType
op_type = 'easy'
external_params = None
xmin = -180
xmax = 180
ymin = -90
ymax = 90
proj4 = '+proj=latlong'
projected = None
covers_positions(lon, lat)[source]

Return indices of input points covered by reader.

covers_time(time)[source]
get_variables_interpolated(variables, profiles=None, profiles_depth=None, time=None, lon=None, lat=None, z=None, rotate_to_proj=None)[source]

get_variables_interpolated is the main interface to opendrift.basemodel.OpenDriftSimulation, and is responsible for returning variables at the correct positions.

Readers should implement _get_variables_interpolated_().

Arguments:
variables: string, or list of strings (standard_name) of

requested variables. These must be provided by reader.

profiles: List of variable names that should be returned for the range in profiles_depth.

profiles_depth: Profiles variables will be retrieved from surface and down to this depth. The exact z-depth are given by the reader and returned as z variable in env_profiles.

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

Can be None (default) if reader/variable has no time dimension (e.g. climatology or landmask).

lon: longitude, 1d array.

lat: latitude, 1d array, same length as lon.

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

of requested points. either scalar or same length as lon, lat. default: 0 m (unless otherwise documented by reader)

block: bool, see return below

rotate_to_proj: N/A

Returns:

(env, env_profiles)

Interpolated variables at x, y and z. env contains values at a fixed depth (z), while env_profiles contains depth-profiles in the range profile_depth for the variables listed in profiles for each element (in x, y). The exact depth is determined by the reader and specified in env_profiles[‘z’]. Thus variables in env_profiles are not interpolated in z-direction.

See also

get_variables_interpolated_xy().

get_variables(requested_variables, time=None, x=None, y=None, z=None)[source]