:py:mod:`geovista.core`
=======================

.. py:module:: geovista.core

.. autoapi-nested-parse::

   Core :mod:`geovista` behaviour for processing geolocated meshes.

   Notes
   -----
   .. versionadded:: 0.1.0

   ..
       !! processed by numpydoc !!


Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   geovista.core.MeridianSlice
   geovista.core.SliceBias



Functions
~~~~~~~~~

.. autoapisummary::

   geovista.core.add_texture_coords
   geovista.core.combine
   geovista.core.resize
   geovista.core.slice_cells
   geovista.core.slice_lines
   geovista.core.slice_mesh



Attributes
~~~~~~~~~~

.. autoapisummary::

   geovista.core.CUT_OFFSET
   geovista.core.SPLINE_N_POINTS


.. py:class:: MeridianSlice(mesh, meridian, offset = None)

   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:

       **mesh** : :class:`~pyvista.PolyData`
           The geolocated mesh to be remeshed along the `meridian`.

       **meridian** : :class:`python:float`
           The meridian (degrees longitude) along which to create the mesh seam.

       **offset** : :class:`python:float`, 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 :data:`CUT_OFFSET`.











   .. rubric:: Notes

   .. versionadded:: 0.1.0



   ..
       !! processed by numpydoc !!


   .. py:method:: extract(bias = None, split_cells = False, clip = True)

      
      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:

          **bias** : :obj:`SliceBias`, optional
              Whether to extract the west, east or exact intersection cells.
              Defaults to :attr:`SliceBias.WEST`.

          **split_cells** : :class:`python:bool`, default=False
              Determine whether to return coincident whole cells (``=False``) or
              bisected cells (``=True``) of the meridian.

          **clip** : :class:`python:bool`, 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:

          :class:`~pyvista.PolyData`
              The mesh cells from the intersection.








      .. rubric:: Notes

      .. versionadded:: 0.1.0



      ..
          !! processed by numpydoc !!


   .. py:attribute:: east_ids


   .. py:attribute:: meridian


   .. py:attribute:: mesh


   .. py:attribute:: n_cells


   .. py:attribute:: offset


   .. py:attribute:: radius


   .. py:attribute:: slices


   .. py:attribute:: split_ids


   .. py:attribute:: west_ids


.. py:class:: SliceBias(*args, **kwds)

   Bases: :py:obj:`enum.Enum`


   
   Enumerate meridian slice bias.
















   ..
       !! processed by numpydoc !!

   .. py:attribute:: EAST

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
















      ..
          !! processed by numpydoc !!


   .. py:attribute:: EXACT

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
















      ..
          !! processed by numpydoc !!


   .. py:attribute:: WEST

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
















      ..
          !! processed by numpydoc !!


.. py:function:: add_texture_coords(mesh, meridian = None, antimeridian = False)

   
   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:

       **mesh** : :class:`~pyvista.PolyData`
           The mesh that requires texture coordinates.

       **meridian** : :class:`python:float`, optional
           The meridian (degrees longitude) to slice along. Defaults to
           :data:`geovista.common.CENTRAL_MERIDIAN`.

       **antimeridian** : :class:`python:bool`, default=False
           Whether to flip the given `meridian` to use its anti-meridian instead.



   :Returns:

       :class:`~pyvista.PolyData`
           The original mesh with inplace texture coordinates attached.








   .. rubric:: Notes

   .. versionadded:: 0.1.0



   ..
       !! processed by numpydoc !!

.. py:function:: combine(*meshes, data = True, clean = False)

   
   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:

       **\*meshes** : :term:`python:iterable` of :class:`~pyvista.PolyData`
           The meshes to be combined into a single :class:`~pyvista.PolyData` mesh.

       **data** : :class:`python:bool`, default=True
           Whether to also combine and attach common data from the meshes onto
           the resultant mesh.

       **clean** : :class:`python:bool`, default=False
           Specify whether to merge duplicate points, remove unused points,
           and/or remove degenerate cells in the resultant mesh. See
           :meth:`pyvista.PolyDataFilters.clean`.



   :Returns:

       :class:`~pyvista.PolyData`
           The input meshes combined into a single :class:`~pyvista.PolyData`.








   .. rubric:: Notes

   .. versionadded:: 0.1.0



   ..
       !! processed by numpydoc !!

.. py:function:: resize(mesh, radius = None, zlevel = None, zscale = None, inplace = False)

   
   Change the radius of the spherical mesh.


   :Parameters:

       **mesh** : :class:`~pyvista.PolyData`
           The mesh to be resized to the provided ``radius``.

       **radius** : :class:`python:float`, optional
           The target radius of the ``mesh``. Defaults to :data:`geovista.common.RADIUS`.

       **zlevel** : :class:`python:int`, 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``.

       **zscale** : :class:`python:float`, optional
           The proportional multiplier for z-axis `zlevel`. Defaults to
           :data:`geovista.common.ZLEVEL_SCALE`.

       **inplace** : :class:`python:bool`, default=False
           Update `mesh` in-place.



   :Returns:

       :class:`~pyvista.PolyData`
           The resized mesh.








   .. rubric:: Notes

   .. versionadded:: 0.1.0



   ..
       !! processed by numpydoc !!

.. py:function:: slice_cells(mesh, meridian = None, antimeridian = False, rtol = None, atol = None)

   
   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:

       **mesh** : :class:`~pyvista.PolyData`
           The mesh to be sliced along the `meridian`.

       **meridian** : :class:`python:float`, optional
           The meridian (degrees longitude) to slice along. Defaults to
           :data:`geovista.common.CENTRAL_MERIDIAN`.

       **antimeridian** : :class:`python:bool`, default=False
           Whether to flip the given `meridian` to use its anti-meridian instead.

       **rtol** : :class:`python:float`, optional
           The relative tolerance for longitudes close to the 'wrap meridian' -
           see :func:`geovista.common.wrap` for more.

       **atol** : :class:`python:float`, optional
           The absolute tolerance for longitudes close to the 'wrap meridian' -
           see :func:`geovista.common.wrap` for more.



   :Returns:

       :class:`~pyvista.PolyData`
           The mesh with a seam along the meridian and remeshed cells, if
           bisected.








   .. rubric:: Notes

   .. versionadded:: 0.1.0



   ..
       !! processed by numpydoc !!

.. py:function:: slice_lines(mesh, n_points = None, copy = False)

   
   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:

       **mesh** : :class:`~pyvista.PolyData`
           The line mesh that requires to be sliced.

       **n_points** : :class:`python:int`, 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 :data:`SPLINE_N_POINTS`.

       **copy** : :class:`python:bool`, 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:

       :class:`~pyvista.PolyData`
           The line mesh with a seam along the Antimeridian, if bisected.








   .. rubric:: Notes

   .. versionadded:: 0.3.0



   ..
       !! processed by numpydoc !!

.. py:function:: slice_mesh(mesh, rtol = None, atol = None)

   
   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 :func:`slice_cells` or :func:`slice_lines`, depending on
   the mesh type.

   :Parameters:

       **mesh** : :class:`~pyvista.PolyData`
           The mesh that requires to be sliced.

       **rtol** : :class:`python:float`, optional
           The relative tolerance for longitudes close to the 'wrap meridian' -
           see :func:`geovista.common.wrap` for more.

       **atol** : :class:`python:float`, optional
           The absolute tolerance for longitudes close to the 'wrap meridian' -
           see :func:`geovista.common.wrap` for more.



   :Returns:

       :class:`~pyvista.PolyData`
           The mesh with a seam along the Antimeridian, if bisected.








   .. rubric:: Notes

   .. versionadded:: 0.3.0



   ..
       !! processed by numpydoc !!

.. py:data:: CUT_OFFSET
   :type:  float
   :value: 1e-05


   
   Cartesian west/east bias offset of a slice.
















   ..
       !! processed by numpydoc !!

.. py:data:: SPLINE_N_POINTS
   :type:  int
   :value: 1


   
   The default number of interpolation points along a spline.
















   ..
       !! processed by numpydoc !!

