opendrift.readers.reader_telemac_selafin

Attributes

logger

pytel

Classes

Reader

A reader for unstructured (irregularily gridded) Telemac3D files.

Module Contents

opendrift.readers.reader_telemac_selafin.logger
opendrift.readers.reader_telemac_selafin.pytel
class opendrift.readers.reader_telemac_selafin.Reader(filename=None, name=None, proj4=None, start_time=None)[source]

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

A reader for unstructured (irregularily gridded) Telemac3D files. Args:

param filename:

A single Selafin file

type filename:

string, required.

param name:

Name of reader

type name:

string, optional

param proj4:

PROJ.4 string describing projection of data.

type proj4:

string, optional

See also

py:mod:opendrift.readers.basereader.unstructured.

Common constructor for all readers

name
slf
proj4
boundary
tree
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.

end_time
altitude_ID
meshID
plot_mesh()[source]

Plot the grid mesh. Does not automatically show the figure.

get_variables(requested_variables, time=None, x=None, y=None, z=None)[source]
  • Query variables based on the particle coordinates x, y, z

  • find the nearest node in the KD tree

  • extract the z array corresponding.

  • extract the index of the node within the 3D mesh

  • extract the variables at the point

Args:
x,y,z: np.arrays(float)

3D coordinates of the particles

time: np.datetime64

age of the particle set

variables: np.array(int)

indexes of variables

Returns:

variables: dictionary of numpy arrays

static __nearest_idx__(array, value)[source]

we are looking for a tuple describing where the sample is and at which distance. So we can calculate the FE solution of the variable value. input:

array: a 1D numpy array monotonic array

output:

bounds: a tupple tupple describing the bounding indexes dist = tupple the distance between the sample and the index values so that dist[0]+dist[1]=0

__extractslf__(frames, duration, index_var, index_nodes)[source]

extract variables from slf files index_var must be a list of integer