opendrift.readers.reader_shape

Attributes

logger

Classes

Reader

The shape reader can be used to load generic shapes as the 'landmask' variable.

Module Contents

opendrift.readers.reader_shape.logger
class opendrift.readers.reader_shape.Reader(shapes, proj4_str='+proj=lonlat +ellps=WGS84', invert=False)[source]

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

The shape reader can be used to load generic shapes as the ‘landmask’ variable.

Args:
param shapes:

shapely geometries.

type shapes:

iterable.

param proj4_str:

Proj.4 string of shape file projection coordinates (default: ‘+proj=lonlat +ellps=WGS84’).

type proj4_str:

string.

Common constructor for all readers

name = 'shape'
variables = ['land_binary_mask']
proj4 = None
crs = None
polys = None
land = None
always_valid = True
static from_shpfiles(shpfiles, proj4_str='+proj=lonlat +ellps=WGS84', invert=False)[source]

Construct a shape-reader from shape-files (.shp)

Args:
param shapes:

shape-file or files (.shp)

type shapes:

string or list of file names as strings.

param proj4_str:

Proj.4 string of shape file projection coordinates (default: ‘+proj=lonlat +ellps=WGS84’).

type proj4_str:

string.

invert = False
z = None
xmin
xmax
ymin
ymax
__on_land__(x, y)[source]
get_variables(requestedVariables, time=None, x=None, y=None, z=None)[source]

Get binary mask of whether elements are on land or not.

Args:

x (deg[]): longitude (decimal degrees) y (deg[]): latitude (decimal degrees) …

x, y is given in reader local projection.

Returns:

Binary mask of point x, y on land.