Grid Editting Tools#

vispipe._gridedit#

These functions are used by the plot backend to cut pieces out of triangulated and gridded meshes given a bbox. This keeps irrelavent data from effecting the colormap generated by countor plots.

Triangular Meshes#

tri_bbox_prep#

vispipe._gridedit.tri_bbox_prep(mesh, bbox, vals)#

Frontend for trigridtrim() that widens bbox used to trim the mesh to prevent whitespace in the plotted bbox.

Parameters:
  • mesh (Triangulation) – The triangulated mesh that will be plotted.

  • bbox (tuple[float, float, float, float] | None) – typing.Iterable containing x0,y0,x1,y1 where point 0 is the bottem left and point 1 is the top right of the bounding box.

  • vals (Optional[ndarray]) – Values that will be plotted.

Return type:

ndarray | tuple[ndarray, ndarray]

Returns:

The mesh, and vals if passed, with the adjustedbbox.

trigridtrim#

vispipe._gridedit.trigridtrim(elemcomps, nodes, bbox, vals=None, returnindex=False)#

Funtion to cut out a portion of the elements from a unstructured triangular mesh.

Parameters:
  • elemcomps (ndarray) – (m,3) array with indexes to the nodes in the element.

  • nodes (ndarray) – x and y coordinates of mesh with shape (n,2).

  • bbox (list | tuple) – Iterable containing x0,y0,x1,y1 where point 0 is the bottem left and point 1 is the top right of the bounding box.

  • vals (ndarray | None) – Z values of nodes.

  • returnindex (bool) – Return the indexs used to cut the original element array.

Return type:

ndarray | list[ndarray]

Returns:

Returns the trimmed array of elements or list of arrays based on kwargs.

trigridcut#

vispipe._gridedit.trigridcut(nodes, bbox, elemcomps=None, vals=None, returnindex=False)#

Funtion to cut out a portion of the x and y coordinates from a unstructured triangular.

Parameters:
  • nodes (ndarray) – x and y coordinates of mesh with shape (n,2).

  • bbox (list) – Iterable containing x0,y0,x1,y1 where point 0 is the bottem left and point 1 is the top right of the bounding box.

  • vals (ndarray | None) – Z values of nodes.

  • elemcomps (ndarray | None) – (m,3) array with indexes to the nodes in the element. If present, elemcomps will be trimmed and and renumbered to match new node indexes.

  • returnindex (bool) – Return the indexs used to cut the original element array.

Return type:

ndarray | list[ndarray]

Returns:

Returns the trimmed array of nodes or list of arrays based on kwargs.

Gridded Meshes#

meshgridcut#

vispipe._gridedit.meshgridcut(mesh, bbox, vals=None)#

Cuts out the x and y from a np.meshgrid. Used for stwave data.

Parameters:
  • mesh (ndarray) – Mesh generated from np.meshgrid where mesh[0] is the x coordinates and mesh[1] is the y coordinates.

  • bbox (list) – Iterable containing x0,y0,x1,y1 where point 0 is the bottem left and point 1 is the top right of the bounding box.

  • vals (ndarray | None) – Z values of nodes.

Return type:

ndarray | tuple[ndarray, ndarray]

Returns:

Returns the trimmed array of nodes or list of arrays based on kwargs.