geovista.core#

Core geovista behaviour for processing geolocated meshes.

Notes#

Added in version 0.1.0.

Module Contents#

Classes#

MeridianSlice

Remesh geolocated mesh along a meridian, from the north-pole to the south-pole.

SliceBias

Enumerate meridian slice bias.

Functions#

add_texture_coords(mesh[, meridian, antimeridian])

Compute and attach texture coordinates, in UV space, to the mesh.

combine(*meshes[, data, clean])

Combine two or more meshes into one mesh.

resize(mesh[, radius, zlevel, zscale, inplace])

Change the radius of the spherical mesh.

slice_cells(mesh[, meridian, antimeridian, rtol, atol])

Cut a cell-based mesh along a meridian, breaking cell connectivity.

slice_lines(mesh[, n_points, copy])

Cut a line-based mesh along the Antimeridian, breaking line connectivity.

slice_mesh(mesh[, rtol, atol])

Cut a mesh along the Antimeridian, breaking connectivities.

Attributes#

CUT_OFFSET

Cartesian west/east bias offset of a slice.

SPLINE_N_POINTS

The default number of interpolation points along a spline.

class geovista.core.MeridianSlice(mesh, meridian, offset=None)[source]#

Remesh geolocated mesh along a meridian, from the north-pole to the south-pole.

Remeshing involves introducing a seam into the mesh along the meridian of choice, splitting cells bisected by the meridian, which will be triangulated.

Create a meridian seam in the mesh.

The seam extends from the north-pole to the south-pole in a great circle, breaking cell connectivity and thus allowing the geolocated mesh to be correctly projected or texture mapped.

Cells bisected by the meridian of choice will be remeshed i.e., split and triangulated.

Parameters:
meshPolyData

The geolocated mesh to be remeshed along the meridian.

meridianfloat

The meridian (degrees longitude) along which to create the mesh seam.

offsetfloat, optional

Offset buffer around the meridian, used to determine those cells west and east of that are coincident or bisected by the meridian. Defaults to CUT_OFFSET.

Notes

Added in version 0.1.0.

extract(bias=None, split_cells=False, clip=True)[source]#

Reduce mesh to only the cells intersecting with the meridian.

Extract the cells participating in the intersection between the meridian (with or without bias) and the mesh.

Parameters:
biasSliceBias, optional

Whether to extract the west, east or exact intersection cells. Defaults to SliceBias.WEST.

split_cellsbool, default=False

Determine whether to return coincident whole cells (=False) or bisected cells (=True) of the meridian.

clipbool, default=True

Determine whether to return the cells of intersection only along the pole-to-pole meridian (=True) or along full great circle for this meridian’s longitude (=False).

Returns:
PolyData

The mesh cells from the intersection.

Notes

Added in version 0.1.0.

east_ids#
meridian#
mesh#
n_cells#
offset#
radius#
slices#
split_ids#
west_ids#
class geovista.core.SliceBias(*args, **kwds)[source]#

Bases: enum.Enum

Enumerate meridian slice bias.

EAST#

Preference for a slice to bias cells east of the chosen meridian.

EXACT#

Preference for a slice to be true to the chosen meridian.

WEST#

Preference for a slice to bias cells west of the chosen meridian.

geovista.core.add_texture_coords(mesh, meridian=None, antimeridian=False)[source]#

Compute and attach texture coordinates, in UV space, to the mesh.

Note that, the mesh will be sliced along the meridian to ensure that cell connectivity is appropriately disconnected prior to texture mapping.

Parameters:
meshPolyData

The mesh that requires texture coordinates.

meridianfloat, optional

The meridian (degrees longitude) to slice along. Defaults to geovista.common.CENTRAL_MERIDIAN.

antimeridianbool, default=False

Whether to flip the given meridian to use its anti-meridian instead.

Returns:
PolyData

The original mesh with inplace texture coordinates attached.

Notes

Added in version 0.1.0.

geovista.core.combine(*meshes, data=True, clean=False)[source]#

Combine two or more meshes into one mesh.

Only meshes with cells will be combined. Support is not yet provided for combining meshes that consist of only points or lines.

Note that, no check is performed to ensure that mesh cells do not overlap. However, meshes may share coincident points. Coincident point data from the first input mesh will overwrite all other mesh data sharing the same coincident point in the resultant mesh.

Parameters:
*meshesiterable of PolyData

The meshes to be combined into a single PolyData mesh.

databool, default=True

Whether to also combine and attach common data from the meshes onto the resultant mesh.

cleanbool, default=False

Specify whether to merge duplicate points, remove unused points, and/or remove degenerate cells in the resultant mesh. See pyvista.PolyDataFilters.clean().

Returns:
PolyData

The input meshes combined into a single PolyData.

Notes

Added in version 0.1.0.

geovista.core.resize(mesh, radius=None, zlevel=None, zscale=None, inplace=False)[source]#

Change the radius of the spherical mesh.

Parameters:
meshPolyData

The mesh to be resized to the provided radius.

radiusfloat, optional

The target radius of the mesh. Defaults to geovista.common.RADIUS.

zlevelint, default=0

The z-axis level. Used in combination with the zscale to offset the radius by a proportional amount i.e., radius * zlevel * zscale.

zscalefloat, optional

The proportional multiplier for z-axis zlevel. Defaults to geovista.common.ZLEVEL_SCALE.

inplacebool, default=False

Update mesh in-place.

Returns:
PolyData

The resized mesh.

Notes

Added in version 0.1.0.

geovista.core.slice_cells(mesh, meridian=None, antimeridian=False, rtol=None, atol=None)[source]#

Cut a cell-based mesh along a meridian, breaking cell connectivity.

Create a seam along the meridian of the geolocated mesh, from the north-pole to the south-pole, breaking cell connectivity thus allowing the mesh to be correctly transformed (projected) or texture mapped.

Cells bisected by the meridian of choice will be remeshed i.e., split and triangulated.

Parameters:
meshPolyData

The mesh to be sliced along the meridian.

meridianfloat, optional

The meridian (degrees longitude) to slice along. Defaults to geovista.common.CENTRAL_MERIDIAN.

antimeridianbool, default=False

Whether to flip the given meridian to use its anti-meridian instead.

rtolfloat, optional

The relative tolerance for longitudes close to the ‘wrap meridian’ - see geovista.common.wrap() for more.

atolfloat, optional

The absolute tolerance for longitudes close to the ‘wrap meridian’ - see geovista.common.wrap() for more.

Returns:
PolyData

The mesh with a seam along the meridian and remeshed cells, if bisected.

Notes

Added in version 0.1.0.

geovista.core.slice_lines(mesh, n_points=None, copy=False)[source]#

Cut a line-based mesh along the Antimeridian, breaking line connectivity.

The connectivity of any line segment in the mesh traversing the Antimeridian will be broken. Each end-point of the segment will be connected to a new interior point, located at the point of intersection between the line segment and the Antimeridian i.e., the segment will be split into two separate, disjointed segments. If the end-point of a segment lies on the Antimeridian, then it is replaced with an identical but distinct co-located point.

This operation is typically performed prior to reprojection in order to create a seam in the line segments.

The mesh is sliced with a z-x plane formed by extruding a line on the x-axis along the z-axis.

Parameters:
meshPolyData

The line mesh that requires to be sliced.

n_pointsint, optional

The number of intermediate points for the line that will be extruded to form a plane which will slice the mesh e.g., with n_points=1, a mid-point will be calculated for the line, which will then consist of 2 line segments i.e., the 2 end-points and 1 mid-point. Defaults to SPLINE_N_POINTS.

copybool, default=False

Return a deepcopy of the mesh when there are no points of intersection with the Antimeridian. Otherwise, the original mesh is returned.

Returns:
PolyData

The line mesh with a seam along the Antimeridian, if bisected.

Notes

Added in version 0.3.0.

geovista.core.slice_mesh(mesh, rtol=None, atol=None)[source]#

Cut a mesh along the Antimeridian, breaking connectivities.

A point-cloud cannot be sliced as there are no cells or lines, and will be returned unaltered. Otherwise, a new instance of the mesh will be returned regardless of whether it has been bisected or not.

Basically calls slice_cells() or slice_lines(), depending on the mesh type.

Parameters:
meshPolyData

The mesh that requires to be sliced.

rtolfloat, optional

The relative tolerance for longitudes close to the ‘wrap meridian’ - see geovista.common.wrap() for more.

atolfloat, optional

The absolute tolerance for longitudes close to the ‘wrap meridian’ - see geovista.common.wrap() for more.

Returns:
PolyData

The mesh with a seam along the Antimeridian, if bisected.

Notes

Added in version 0.3.0.

geovista.core.CUT_OFFSET: float = 1e-05#

Cartesian west/east bias offset of a slice.

geovista.core.SPLINE_N_POINTS: int = 1#

The default number of interpolation points along a spline.