Skip to content

Commit

Permalink
Rename iris.mesh.mesh as iris.mesh.components
Browse files Browse the repository at this point in the history
  • Loading branch information
pp-mo committed Jul 24, 2024
1 parent 501868f commit 5156f2a
Show file tree
Hide file tree
Showing 23 changed files with 171 additions and 162 deletions.
4 changes: 2 additions & 2 deletions lib/iris/common/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ def equal(self, other, lenient=None):


class ConnectivityMetadata(BaseMetadata):
"""Metadata container for a :class:`~iris.mesh.mesh.Connectivity`."""
"""Metadata container for a :class:`~iris.mesh.Connectivity`."""

# The "location_axis" member is stateful only, and does not participate in
# lenient/strict equivalence.
Expand Down Expand Up @@ -1452,7 +1452,7 @@ def equal(self, other, lenient=None):


class MeshMetadata(BaseMetadata):
"""Metadata container for a :class:`~iris.mesh.mesh.MeshXY`."""
"""Metadata container for a :class:`~iris.mesh.MeshXY`."""

# The node_dimension", "edge_dimension" and "face_dimension" members are
# stateful only; they not participate in lenient/strict equivalence.
Expand Down
4 changes: 2 additions & 2 deletions lib/iris/common/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class _PreparedItem:
axis: Any = None

def create_coord(self, metadata):
from iris.mesh.mesh import MeshCoord
from iris.mesh import MeshCoord

if issubclass(self.container, MeshCoord):
# Make a MeshCoord, for which we have mesh/location/axis.
Expand Down Expand Up @@ -741,7 +741,7 @@ def _create_prepared_item(
if container is None:
container = type(coord)

from iris.mesh.mesh import MeshCoord
from iris.mesh import MeshCoord

if issubclass(container, MeshCoord):
# Build a prepared-item to make a MeshCoord.
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -2374,7 +2374,7 @@ def mesh(self):
Returns
-------
:class:`iris.mesh.mesh.MeshXY` or None
:class:`iris.mesh.MeshXY` or None
The mesh of the cube
:class:`~iris.mesh.MeshCoord`'s,
or ``None``.
Expand Down
12 changes: 6 additions & 6 deletions lib/iris/experimental/ugrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@
import threading

from .._deprecation import warn_deprecated
from ..mesh import Connectivity as _Connectivity
from ..mesh import MeshCoord as _MeshCoord
from ..mesh import MeshXY as _MeshXY
from ..mesh import save_mesh
from ..mesh.load import load_mesh, load_meshes
from ..mesh.mesh import Connectivity as _Connectivity
from ..mesh.mesh import Mesh as _Mesh
from ..mesh.mesh import MeshCoord as _MeshCoord
from ..mesh.utils import recombine_submeshes


# NOTE: publishing the original Mesh, MeshCoord and Connectivity here causes a Sphinx
# Sphinx warning, E.G.:
# "WARNING: duplicate object description of iris.mesh.mesh.Mesh, other instance
# "WARNING: duplicate object description of iris.mesh.Mesh, other instance
# in generated/api/iris.experimental.mesh, use :no-index: for one of them"
# For some reason, this only happens for the classes, and not the functions.
#
# This is a fatal problem, i.e. breaks the build since we are building with -W.
# We couldn't fix this with "autodoc_suppress_warnings", so the solution for now is to
# wrap the classes. Which is really ugly.
# TODO: remove this when we remove iris.experimental.mesh
class Mesh(_Mesh):
class MeshXY(_MeshXY):
pass


Expand Down Expand Up @@ -137,8 +137,8 @@ def context(self):

__all__ = [
"Connectivity",
"Mesh",
"MeshCoord",
"MeshXY",
"PARSE_UGRID_ON_LOAD",
"load_mesh",
"load_meshes",
Expand Down
4 changes: 2 additions & 2 deletions lib/iris/fileformats/netcdf/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,8 @@ def __init__(self, var_dim_chunksizes=None):
:class:`~iris.coords.AncillaryVariable` etc.
This can be overridden, if required, by variable-specific settings.
For this purpose, :class:`~iris.mesh.mesh.MeshCoord` and
:class:`~iris.mesh.mesh.Connectivity` are not
For this purpose, :class:`~iris.mesh.MeshCoord` and
:class:`~iris.mesh.Connectivity` are not
:class:`~iris.cube.Cube` components, and chunk control on a
:class:`~iris.cube.Cube` data-variable will not affect them.
Expand Down
10 changes: 5 additions & 5 deletions lib/iris/fileformats/netcdf/saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def _setncattr(variable, name, attribute):
return variable.setncattr(name, attribute)


# NOTE : this matches :class:`iris.mesh.mesh.MeshXY.ELEMENTS`,
# NOTE : this matches :class:`iris.mesh.MeshXY.ELEMENTS`,
# but in the preferred order for coord/connectivity variables in the file.
MESH_ELEMENTS = ("node", "edge", "face")

Expand Down Expand Up @@ -941,7 +941,7 @@ def _add_aux_coords(self, cube, cf_var_cube, dimension_names):
dimension_names : list
Names associated with the dimensions of the cube.
"""
from iris.mesh.mesh import (
from iris.mesh.components import (
MeshEdgeCoords,
MeshFaceCoords,
MeshNodeCoords,
Expand Down Expand Up @@ -1524,7 +1524,7 @@ def _get_coord_variable_name(self, cube_or_mesh, coord):
# element-coordinate of the mesh.
# Name it for it's first dim, i.e. mesh-dim of its location.

from iris.mesh.mesh import Connectivity
from iris.mesh import Connectivity

# At present, a location-coord cannot be nameless, as the
# MeshXY code relies on guess_coord_axis.
Expand All @@ -1544,7 +1544,7 @@ def _get_mesh_variable_name(self, mesh):
Parameters
----------
mesh : :class:`iris.mesh.mesh.MeshXY`
mesh : :class:`iris.mesh.MeshXY`
An instance of a Mesh for which a CF-netCDF variable name is
required.
Expand All @@ -1570,7 +1570,7 @@ def _create_mesh(self, mesh):
Parameters
----------
mesh : :class:`iris.mesh.mesh.MeshXY`
mesh : :class:`iris.mesh.MeshXY`
The Mesh to be saved to CF-netCDF file.
Returns
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/mesh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from iris.fileformats.netcdf.saver import save_mesh

from ..config import get_logger
from .components import Connectivity, MeshCoord, MeshXY
from .load import load_mesh, load_meshes
from .mesh import Connectivity, MeshCoord, MeshXY
from .utils import recombine_submeshes

__all__ = [
Expand Down
4 changes: 2 additions & 2 deletions lib/iris/mesh/cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from ..fileformats import cf
from ..warnings import IrisCfLabelVarWarning, IrisCfMissingVarWarning
from .mesh import Connectivity
from .components import Connectivity


class CFUGridConnectivityVariable(cf.CFVariable):
Expand All @@ -32,7 +32,7 @@ class CFUGridConnectivityVariable(cf.CFVariable):
that specifies for every volume its shape.
Identified by a CF-netCDF variable attribute equal to any one of the values
in :attr:`~iris.mesh.mesh.Connectivity.UGRID_CF_ROLES`.
in :attr:`~iris.mesh.Connectivity.UGRID_CF_ROLES`.
.. seealso::
Expand Down
Loading

0 comments on commit 5156f2a

Please sign in to comment.