NEDAS.models.nextsim.v1.gmshlib module

class NEDAS.models.nextsim.v1.gmshlib.MeshPhysicalName(name, ident, topodim)[source]

Bases: object

Class used to distinguish coastal or open boundaries

MeshPhysicalName(name,ident,topodim)

Parameters:

namestring

eg ‘coast’ or ‘open’

identint

eg edge number

topodimint

eg 2 (2D space) or 3 (3D space)

write(fid)[source]

add a physical name to the output file

Parameters:

fid (_io.TextIOWrapper)

class NEDAS.models.nextsim.v1.gmshlib.MeshElement(ident, eltype, tags, node_ids, node_indices)[source]

Bases: object

Class used for both individual triangles and edges

get_coords(xnod, ynod)[source]

clist = self.get_coords(xnod,ynod)

Parameters:
  • xnod (np.ndarray) – x coords of nodes

  • ynod (np.ndarray) – y coords of nodes

Returns:

clist – list of tuples with x,y coords of nodes for the element

Return type:

list

write(fid)[source]

add the element info to the output file

Parameters:

fid (_io.TextIOWrapper)

class NEDAS.models.nextsim.v1.gmshlib.GmshBoundary(exterior, islands=None, open_boundaries=None, coastal_boundaries=None)[source]

Bases: object

Class for handling mesh boundaries

static points_in_polygon(poly, coords)[source]

Test if coords are inside a polygon

Parameters:
  • poly (shapely.geometry.Polygon)

  • coords (numpy.ndarray) – shape (num_points, 2) with x in 1st column and y in 2nd

Returns:

inside – length is num_points

Return type:

numpy.ndarray(bool)

iswet(x, y)[source]

use matplotlib.path to test if multiple points are contained inside the polygon self.exterior_polygon

Parameters:
  • x (numpy.ndarray) – x coordinates to test

  • y (numpy.ndarray) – y coordinates to test

Returns:

wet – mask of same shape as x and y; True if the point is inside the mesh (inside external polygon but outside island polygons), False otherwise.

Return type:

numpy.ndarray

NEDAS.models.nextsim.v1.gmshlib.xyz_to_lonlat(x, y, z)[source]
NEDAS.models.nextsim.v1.gmshlib.lonlat_to_xyz(lon, lat)[source]
NEDAS.models.nextsim.v1.gmshlib.read_mshfile(filename)[source]
NEDAS.models.nextsim.v1.gmshlib.read_version_info(f)[source]
NEDAS.models.nextsim.v1.gmshlib.read_physical_names(f)[source]
NEDAS.models.nextsim.v1.gmshlib.read_nodes(f)[source]
NEDAS.models.nextsim.v1.gmshlib.parse_element_string(lin, nodes_map)[source]
NEDAS.models.nextsim.v1.gmshlib.read_elements(f, nodes_map)[source]
NEDAS.models.nextsim.v1.gmshlib.write_mshfile(filename, mesh_info)[source]
NEDAS.models.nextsim.v1.gmshlib.write_version_info(f, mesh_info)[source]
NEDAS.models.nextsim.v1.gmshlib.write_physical_names(f, mesh_info)[source]
NEDAS.models.nextsim.v1.gmshlib.write_nodes(f, mesh_info)[source]
NEDAS.models.nextsim.v1.gmshlib.write_elements(f, mesh_info)[source]