fastwater.otm_gpl.parser_selafin module

@author Christopher J. Cawthorn and Sebastien E. Bourban

@brief Tools for handling SELAFIN files and

TELEMAC binary related in python

@details Contains read/write functions for

binary (big-endian) SELAFIN files

fastwater.otm_gpl.parser_selafin.get_edges_slf(ikle, meshx, meshy, showbar=True)[source]

Returns the list of edges of the mesh

@param ikle (np.array) Connectivity table @param meshx (np.array) X coordinates of the mesh points @param meshy (np.array) Y coordinates of the mesh points @param showbar (boolean) If True display a progress bar

@returns (list) The list of edges

fastwater.otm_gpl.parser_selafin.get_endian_from_char(f, nchar)[source]

Returns endianess of the file by trying to read a value in the file and comparing it to nchar

@param f (file descriptor) File descriptor @param nchar (string) String to compare to

@returns (string) String for endianess (“<” for little “>” for big)

fastwater.otm_gpl.parser_selafin.get_float_type_from_float(f, endian, nfloat)[source]

Identifies float precision from the file (single or double)

@param f (file descriptor) File descriptor @param endian (string) Endianess type (“<” for little “>” for big) @param nfloat (float) Float to compare to

@return (string, integer) Returns the string to be used for readinf ans the number of byte on which the float is encoded (‘f’, 4) for single (‘d’,8) for double precision

fastwater.otm_gpl.parser_selafin.get_neighbours_slf(ikle, meshx, meshy, showbar=True)[source]

Return a list containing for each element the list of elements that are neighbours to that element

@param ikle (np.array) Connectivity table @param meshx (np.array) X coordinates of the mesh points @param meshy (np.array) Y coordinates of the mesh points @param showbar (boolean) If True display a progress bar

@returns (list) The list of neighbours

fastwater.otm_gpl.parser_selafin.get_value_history(slf, times, support, vrs)[source]

Extraction of time series at points. A point could be: (a) A point could be a node 2D associated with one or more plan number (b) A pair (x,y) associated with one or more plan number Warning: Vertical interpolation has not been implemented yet.

@param slf (TelemacFile) Serafin file structure @param times (list) the discrete list of time frame

to extract from the time history

@param support (list) the list of points @param vrs (list) the index in the nvar-list to the variable to

extract

fastwater.otm_gpl.parser_selafin.get_value_history_slf(hook, tags, time, support, nvar, npoin3, nplan, t1)[source]

Extraction of time series at points. A point could be: (a) A point could be a node 2D associated with one or more plan number (b) A pair (x,y) associated with one or more plan number

/! Vertical interpolation has not been implemented yet.

Arguments: - time: the discrete list of time frame to extract

from the time history

  • support: the list of points

  • vars_indexes: the index in the nvar-list to the variable to extract

fastwater.otm_gpl.parser_selafin.get_value_polyline(slf, times, support, vrs)[source]

Extraction of longitudinal profiles along lines. A line is made of points extracted from slice_mesh: A point is a pair (x,y) associated with one or more plan number Warning: Vertical interpolation has not been implemented yet.

@param slf (TelemacFile) Telemac file class @param times (list) the discrete list of time frame to extract

from the time

history @param support (list): the list of points intersecting th mesh @param vrs (tuple of list): the index, names in the nvar-list to the variable to extract

fastwater.otm_gpl.parser_selafin.get_value_polyline_slf(hook, tags, time, support, nvar, npoin3, nplan, t1)[source]

Extraction of longitudinal profiles along lines. A line is made of points extracted from slice_mesh: A point is a pair (x,y) associated with one or more plan number

/! Vertical interpolation has not been implemented yet.

Arguments: - time: the discrete list of time frame to extract

from the time history

  • support: the list of points intersecting th mesh

  • vars_indexes: the index in the nvar-list to the variable to extract

fastwater.otm_gpl.parser_selafin.get_value_polyplan(slf, times, support, vrs)[source]

Extraction of variables at a list of times on a list of planes. A plane is an integer Warning: Vertical interpolation has not been implemented yet. Arguments: - time: the discrete list of time frame to extract from the time history - support: the list of planes - vars_indexes: the index in the nvar-list to the variable to extract

fastwater.otm_gpl.parser_selafin.get_value_polyplan_slf(hook, tags, time, support, nvar, npoin3, nplan, t1)[source]

Extraction of variables at a list of times on a list of planes. A plane is an integer

/! Vertical interpolation has not been implemented yet.

Arguments: - time: the discrete list of time frame to extract

from the time history

  • support: the list of planes

  • vars_indexes: the index in the nvar-list to the variable to extract

fastwater.otm_gpl.parser_selafin.subset_variables_slf(vrs, all_vars)[source]

Take a string in the format “var1:object;var2:object;var3;var4” and returns two list one of index and one of values of all the variables in all_vars that match var.

@param vrs (string) String contain ; separated var:object values @param all_vars (list) List of the variables to match with

@return (list) list of index of the matching variables @return (list) list of names of the matching variables