Skip to content

Commit bd66de9

Browse files
authored
Rename Mesh to MeshXY (#6056)
* Rename Mesh to MeshXY. * Add placeholder Mesh class. * What's New entry. * Fix weird typo.
1 parent c06bf55 commit bd66de9

File tree

32 files changed

+338
-293
lines changed

32 files changed

+338
-293
lines changed

benchmarks/benchmarks/sperf/equality.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class CubeEquality(FileMixin):
1313
r"""Benchmark time and memory costs.
1414
1515
Benchmark time and memory costs of comparing :class:`~iris.cube.Cube`\\ s
16-
with attached :class:`~iris.experimental.ugrid.mesh.Mesh`\\ es.
16+
with attached :class:`~iris.experimental.ugrid.mesh.MeshXY`\\ es.
1717
1818
Uses :class:`FileMixin` as the realistic case will be comparing
1919
:class:`~iris.cube.Cube`\\ s that have been loaded from file.

benchmarks/benchmarks/unit_style/ugrid.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def setup(self, n_faces):
8080
self.object = self.create()
8181

8282

83-
class Mesh(UGridCommon):
83+
class MeshXY(UGridCommon):
8484
def setup(self, n_faces, lazy=False):
8585
####
8686
# Steal everything from the sample mesh for benchmarking creation of a
@@ -124,7 +124,7 @@ def get_coords_and_axes(location):
124124
self.eq_object = deepcopy(self.object)
125125

126126
def create(self):
127-
return ugrid.Mesh(**self.mesh_kwargs)
127+
return ugrid.MeshXY(**self.mesh_kwargs)
128128

129129
def time_add_connectivities(self, n_faces):
130130
self.object.add_connectivities(self.face_node)
@@ -149,8 +149,8 @@ def time_remove_coords(self, n_faces):
149149

150150

151151
@disable_repeat_between_setup
152-
class MeshLazy(Mesh):
153-
"""Lazy equivalent of :class:`Mesh`."""
152+
class MeshXYLazy(MeshXY):
153+
"""Lazy equivalent of :class:`MeshXY`."""
154154

155155
def setup(self, n_faces, lazy=True):
156156
super().setup(n_faces, lazy=lazy)

docs/src/further_topics/ugrid/data_model.rst

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ The Basics
310310
The Iris :class:`~iris.cube.Cube` has several new members:
311311

312312
* | :attr:`~iris.cube.Cube.mesh`
313-
| The :class:`iris.experimental.ugrid.Mesh` that describes the
313+
| The :class:`iris.experimental.ugrid.MeshXY` that describes the
314314
:class:`~iris.cube.Cube`\'s horizontal geography.
315315
* | :attr:`~iris.cube.Cube.location`
316316
| ``node``/``edge``/``face`` - the mesh element type with which this
@@ -320,7 +320,7 @@ The Iris :class:`~iris.cube.Cube` has several new members:
320320
indexes over the horizontal :attr:`~iris.cube.Cube.data` positions.
321321
322322
These members will all be ``None`` for a :class:`~iris.cube.Cube` with no
323-
associated :class:`~iris.experimental.ugrid.Mesh`.
323+
associated :class:`~iris.experimental.ugrid.MeshXY`.
324324

325325
This :class:`~iris.cube.Cube`\'s unstructured dimension has multiple attached
326326
:class:`iris.experimental.ugrid.MeshCoord`\s (one for each axis e.g.
@@ -333,7 +333,7 @@ the :class:`~iris.cube.Cube`\'s unstructured dimension.
333333

334334
from iris.coords import AuxCoord, DimCoord
335335
from iris.cube import Cube
336-
from iris.experimental.ugrid import Connectivity, Mesh
336+
from iris.experimental.ugrid import Connectivity, MeshXY
337337

338338
node_x = AuxCoord(
339339
points=[0.0, 5.0, 0.0, 5.0, 8.0],
@@ -368,7 +368,7 @@ the :class:`~iris.cube.Cube`\'s unstructured dimension.
368368
]
369369
return [(x, "x"), (y, "y")]
370370

371-
my_mesh = Mesh(
371+
my_mesh = MeshXY(
372372
long_name="my_mesh",
373373
topology_dimension=2,
374374
node_coords_and_axes=[(node_x, "x"), (node_y, "y")],
@@ -416,41 +416,41 @@ the :class:`~iris.cube.Cube`\'s unstructured dimension.
416416
0
417417

418418
>>> print(edge_cube.mesh.summary(shorten=True))
419-
<Mesh: 'my_mesh'>
419+
<MeshXY: 'my_mesh'>
420420

421421
The Detail
422422
----------
423423
How UGRID information is stored
424424
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
425-
* | :class:`iris.experimental.ugrid.Mesh`
425+
* | :class:`iris.experimental.ugrid.MeshXY`
426426
| Contains all information about the mesh.
427427
| Includes:
428428
429-
* | :attr:`~iris.experimental.ugrid.Mesh.topology_dimension`
429+
* | :attr:`~iris.experimental.ugrid.MeshXY.topology_dimension`
430430
| The maximum dimensionality of shape (1D=edge, 2D=face) supported
431-
by this :class:`~iris.experimental.ugrid.Mesh`. Determines which
431+
by this :class:`~iris.experimental.ugrid.MeshXY`. Determines which
432432
:class:`~iris.experimental.ugrid.Connectivity`\s are required/optional
433433
(see below).
434434
435435
* 1-3 collections of :class:`iris.coords.AuxCoord`\s:
436436

437-
* | **Required**: :attr:`~iris.experimental.ugrid.Mesh.node_coords`
437+
* | **Required**: :attr:`~iris.experimental.ugrid.MeshXY.node_coords`
438438
| The nodes that are the basis for the mesh.
439-
* | Optional: :attr:`~iris.experimental.ugrid.Mesh.edge_coords`,
440-
:attr:`~iris.experimental.ugrid.Mesh.face_coords`
439+
* | Optional: :attr:`~iris.experimental.ugrid.MeshXY.edge_coords`,
440+
:attr:`~iris.experimental.ugrid.MeshXY.face_coords`
441441
| For indicating the 'centres' of the edges/faces.
442442
| **NOTE:** generating a :class:`~iris.experimental.ugrid.MeshCoord` from
443-
a :class:`~iris.experimental.ugrid.Mesh` currently (``Jan 2022``)
443+
a :class:`~iris.experimental.ugrid.MeshXY` currently (``Jan 2022``)
444444
requires centre coordinates for the given ``location``; to be rectified
445445
in future.
446446
447447
* 1 or more :class:`iris.experimental.ugrid.Connectivity`\s:
448448

449449
* | **Required for 1D (edge) elements**:
450-
:attr:`~iris.experimental.ugrid.Mesh.edge_node_connectivity`
450+
:attr:`~iris.experimental.ugrid.MeshXY.edge_node_connectivity`
451451
| Define the edges by connecting nodes.
452452
* | **Required for 2D (face) elements**:
453-
:attr:`~iris.experimental.ugrid.Mesh.face_node_connectivity`
453+
:attr:`~iris.experimental.ugrid.MeshXY.face_node_connectivity`
454454
| Define the faces by connecting nodes.
455455
* Optional: any other connectivity type. See
456456
:attr:`iris.experimental.ugrid.mesh.Connectivity.UGRID_CF_ROLES` for the
@@ -459,7 +459,7 @@ How UGRID information is stored
459459
.. doctest:: ugrid_summaries
460460

461461
>>> print(edge_cube.mesh)
462-
Mesh : 'my_mesh'
462+
MeshXY : 'my_mesh'
463463
topology_dimension: 2
464464
node
465465
node_dimension: 'Mesh2d_node'
@@ -485,7 +485,7 @@ How UGRID information is stored
485485
| Stores the following information:
486486
487487
* | :attr:`~iris.experimental.ugrid.MeshCoord.mesh`
488-
| The :class:`~iris.experimental.ugrid.Mesh` associated with this
488+
| The :class:`~iris.experimental.ugrid.MeshXY` associated with this
489489
:class:`~iris.experimental.ugrid.MeshCoord`. This determines the
490490
:attr:`~iris.cube.Cube.mesh` attribute of any :class:`~iris.cube.Cube`
491491
this :class:`~iris.experimental.ugrid.MeshCoord` is attached to (see
@@ -503,7 +503,7 @@ How UGRID information is stored
503503

504504
MeshCoords
505505
~~~~~~~~~~
506-
Links a :class:`~iris.cube.Cube` to a :class:`~iris.experimental.ugrid.Mesh` by
506+
Links a :class:`~iris.cube.Cube` to a :class:`~iris.experimental.ugrid.MeshXY` by
507507
attaching to the :class:`~iris.cube.Cube`\'s unstructured dimension, in the
508508
same way that all :class:`~iris.coords.Coord`\s attach to
509509
:class:`~iris.cube.Cube` dimensions. This allows a single
@@ -512,30 +512,30 @@ dimensions (e.g. horizontal mesh plus vertical levels and a time series),
512512
using the same logic for every dimension.
513513

514514
:class:`~iris.experimental.ugrid.MeshCoord`\s are instantiated using a given
515-
:class:`~iris.experimental.ugrid.Mesh`, ``location``
515+
:class:`~iris.experimental.ugrid.MeshXY`, ``location``
516516
("node"/"edge"/"face") and ``axis``. The process interprets the
517-
:class:`~iris.experimental.ugrid.Mesh`\'s
518-
:attr:`~iris.experimental.ugrid.Mesh.node_coords` and if appropriate the
519-
:attr:`~iris.experimental.ugrid.Mesh.edge_node_connectivity`/
520-
:attr:`~iris.experimental.ugrid.Mesh.face_node_connectivity` and
521-
:attr:`~iris.experimental.ugrid.Mesh.edge_coords`/
522-
:attr:`~iris.experimental.ugrid.Mesh.face_coords`
517+
:class:`~iris.experimental.ugrid.MeshXY`\'s
518+
:attr:`~iris.experimental.ugrid.MeshXY.node_coords` and if appropriate the
519+
:attr:`~iris.experimental.ugrid.MeshXY.edge_node_connectivity`/
520+
:attr:`~iris.experimental.ugrid.MeshXY.face_node_connectivity` and
521+
:attr:`~iris.experimental.ugrid.MeshXY.edge_coords`/
522+
:attr:`~iris.experimental.ugrid.MeshXY.face_coords`
523523
to produce a :class:`~iris.coords.Coord`
524524
:attr:`~iris.coords.Coord.points` and :attr:`~iris.coords.Coord.bounds`
525-
representation of all the :class:`~iris.experimental.ugrid.Mesh`\'s
525+
representation of all the :class:`~iris.experimental.ugrid.MeshXY`\'s
526526
nodes/edges/faces for the given axis.
527527

528-
The method :meth:`iris.experimental.ugrid.Mesh.to_MeshCoords` is available to
528+
The method :meth:`iris.experimental.ugrid.MeshXY.to_MeshCoords` is available to
529529
create a :class:`~iris.experimental.ugrid.MeshCoord` for
530-
every axis represented by that :class:`~iris.experimental.ugrid.Mesh`,
530+
every axis represented by that :class:`~iris.experimental.ugrid.MeshXY`,
531531
given only the ``location`` argument
532532

533533
.. doctest:: ugrid_summaries
534534

535535
>>> for coord in edge_cube.coords(mesh_coords=True):
536536
... print(coord)
537537
MeshCoord : latitude / (degrees_north)
538-
mesh: <Mesh: 'my_mesh'>
538+
mesh: <MeshXY: 'my_mesh'>
539539
location: 'edge'
540540
points: [3. , 1.5, 1.5, 1.5, 0. , 0. ]
541541
bounds: [
@@ -550,7 +550,7 @@ given only the ``location`` argument
550550
standard_name: 'latitude'
551551
axis: 'y'
552552
MeshCoord : longitude / (degrees_east)
553-
mesh: <Mesh: 'my_mesh'>
553+
mesh: <MeshXY: 'my_mesh'>
554554
location: 'edge'
555555
points: [2.5, 0. , 5. , 6.5, 2.5, 6.5]
556556
bounds: [

docs/src/further_topics/ugrid/operations.rst

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ subsequent example operations on this page.
6161
>>> import numpy as np
6262

6363
>>> from iris.coords import AuxCoord
64-
>>> from iris.experimental.ugrid import Connectivity, Mesh
64+
>>> from iris.experimental.ugrid import Connectivity, MeshXY
6565

6666
# Going to create the following mesh
6767
# (node indices are shown to aid understanding):
@@ -102,7 +102,7 @@ subsequent example operations on this page.
102102
... indices=face_indices, cf_role="face_node_connectivity"
103103
... )
104104

105-
>>> my_mesh = Mesh(
105+
>>> my_mesh = MeshXY(
106106
... long_name="my_mesh",
107107
... topology_dimension=2, # Supports 2D (face) elements.
108108
... node_coords_and_axes=[(node_x, "x"), (node_y, "y")],
@@ -112,7 +112,7 @@ subsequent example operations on this page.
112112
... )
113113

114114
>>> print(my_mesh)
115-
Mesh : 'my_mesh'
115+
MeshXY : 'my_mesh'
116116
topology_dimension: 2
117117
node
118118
node_dimension: 'Mesh2d_node'
@@ -143,7 +143,7 @@ Making a Cube (with a Mesh)
143143
.. rubric:: |tagline: making a cube|
144144

145145
Creating a :class:`~iris.cube.Cube` is unchanged; the
146-
:class:`~iris.experimental.ugrid.Mesh` is linked via a
146+
:class:`~iris.experimental.ugrid.MeshXY` is linked via a
147147
:class:`~iris.experimental.ugrid.MeshCoord` (see :ref:`ugrid MeshCoords`):
148148

149149
.. dropdown:: Code
@@ -205,7 +205,7 @@ Save
205205
.. note:: UGRID saving support is limited to the NetCDF file format.
206206

207207
The Iris saving process automatically detects if the :class:`~iris.cube.Cube`
208-
has an associated :class:`~iris.experimental.ugrid.Mesh` and automatically
208+
has an associated :class:`~iris.experimental.ugrid.MeshXY` and automatically
209209
saves the file in a UGRID-conformant format:
210210

211211
.. dropdown:: Code
@@ -283,7 +283,7 @@ saves the file in a UGRID-conformant format:
283283
<BLANKLINE>
284284

285285
The :func:`iris.experimental.ugrid.save_mesh` function allows
286-
:class:`~iris.experimental.ugrid.Mesh`\es to be saved to file without
286+
:class:`~iris.experimental.ugrid.MeshXY`\es to be saved to file without
287287
associated :class:`~iris.cube.Cube`\s:
288288

289289
.. dropdown:: Code
@@ -412,15 +412,15 @@ etcetera:
412412
.. note::
413413

414414
We recommend caution if constraining on coordinates associated with a
415-
:class:`~iris.experimental.ugrid.Mesh`. An individual coordinate value
415+
:class:`~iris.experimental.ugrid.MeshXY`. An individual coordinate value
416416
might not be shared by any other data points, and using a coordinate range
417417
will demand notably higher performance given the size of the dimension
418418
versus structured grids
419419
(:ref:`see the data model detail <ugrid implications>`).
420420

421421
The :func:`iris.experimental.ugrid.load_mesh` and
422422
:func:`~iris.experimental.ugrid.load_meshes` functions allow only
423-
:class:`~iris.experimental.ugrid.Mesh`\es to be loaded from a file without
423+
:class:`~iris.experimental.ugrid.MeshXY`\es to be loaded from a file without
424424
creating any associated :class:`~iris.cube.Cube`\s:
425425

426426
.. dropdown:: Code
@@ -434,7 +434,7 @@ creating any associated :class:`~iris.cube.Cube`\s:
434434
... loaded_mesh = load_mesh(cubelist_path)
435435

436436
>>> print(loaded_mesh)
437-
Mesh : 'my_mesh'
437+
MeshXY : 'my_mesh'
438438
topology_dimension: 2
439439
node
440440
node_dimension: 'Mesh2d_node'
@@ -545,7 +545,7 @@ unrelated to spatial position**. This means that subsetted
545545
as intended, and subsetting a :class:`~iris.experimental.ugrid.MeshCoord` is
546546
therefore set to return an :class:`~iris.coords.AuxCoord` instead - breaking
547547
the link between :class:`~iris.cube.Cube` and
548-
:class:`~iris.experimental.ugrid.Mesh`:
548+
:class:`~iris.experimental.ugrid.MeshXY`:
549549
550550
.. dropdown:: Code
551551
:icon: code
@@ -751,7 +751,7 @@ with the
751751
The initialisation process is computationally expensive so we use caching to
752752
improve performance. Once a regridder has been initialised, it can be used on
753753
any :class:`~iris.cube.Cube` which has been defined on the same
754-
:class:`~iris.experimental.ugrid.Mesh` (or on the same **grid** in the case of
754+
:class:`~iris.experimental.ugrid.MeshXY` (or on the same **grid** in the case of
755755
:class:`~esmf_regrid.experimental.unstructured_scheme.GridToMeshESMFRegridder`).
756756
Since calling a regridder is usually a lot faster than initialising, reusing
757757
regridders can save a lot of time. We can demonstrate the reuse of the
@@ -819,19 +819,19 @@ Equality
819819
820820
.. rubric:: |tagline: equality|
821821
822-
:class:`~iris.experimental.ugrid.Mesh` comparison is supported, and comparing
823-
two ':class:`~iris.experimental.ugrid.Mesh`-:class:`~iris.cube.Cube`\s' will
822+
:class:`~iris.experimental.ugrid.MeshXY` comparison is supported, and comparing
823+
two ':class:`~iris.experimental.ugrid.MeshXY`-:class:`~iris.cube.Cube`\s' will
824824
include a comparison of the respective
825-
:class:`~iris.experimental.ugrid.Mesh`\es, with no extra action needed by the
825+
:class:`~iris.experimental.ugrid.MeshXY`\es, with no extra action needed by the
826826
user.
827827
828828
.. note::
829829
830830
Keep an eye on memory demand when comparing large
831-
:class:`~iris.experimental.ugrid.Mesh`\es, but note that
832-
:class:`~iris.experimental.ugrid.Mesh`\ equality is enabled for lazy
831+
:class:`~iris.experimental.ugrid.MeshXY`\es, but note that
832+
:class:`~iris.experimental.ugrid.MeshXY`\ equality is enabled for lazy
833833
processing (:doc:`/userguide/real_and_lazy_data`), so if the
834-
:class:`~iris.experimental.ugrid.Mesh`\es being compared are lazy the
834+
:class:`~iris.experimental.ugrid.MeshXY`\es being compared are lazy the
835835
process will use less memory than their total size.
836836
837837
Combining Cubes
@@ -842,23 +842,23 @@ Combining Cubes
842842
843843
Merging or concatenating :class:`~iris.cube.Cube`\s (described in
844844
:doc:`/userguide/merge_and_concat`) with two different
845-
:class:`~iris.experimental.ugrid.Mesh`\es is not possible - a
845+
:class:`~iris.experimental.ugrid.MeshXY`\es is not possible - a
846846
:class:`~iris.cube.Cube` must be associated with just a single
847-
:class:`~iris.experimental.ugrid.Mesh`, and merge/concatenate are not yet
848-
capable of combining multiple :class:`~iris.experimental.ugrid.Mesh`\es into
847+
:class:`~iris.experimental.ugrid.MeshXY`, and merge/concatenate are not yet
848+
capable of combining multiple :class:`~iris.experimental.ugrid.MeshXY`\es into
849849
one.
850850

851851
:class:`~iris.cube.Cube`\s that include
852852
:class:`~iris.experimental.ugrid.MeshCoord`\s can still be merged/concatenated
853853
on dimensions other than the :meth:`~iris.cube.Cube.mesh_dim`, since such
854854
:class:`~iris.cube.Cube`\s will by definition share the same
855-
:class:`~iris.experimental.ugrid.Mesh`.
855+
:class:`~iris.experimental.ugrid.MeshXY`.
856856

857857
.. seealso::
858858

859859
You may wish to investigate
860860
:func:`iris.experimental.ugrid.recombine_submeshes`, which can be used
861-
for a very specific type of :class:`~iris.experimental.ugrid.Mesh`
861+
for a very specific type of :class:`~iris.experimental.ugrid.MeshXY`
862862
combination not detailed here.
863863

864864
Arithmetic

0 commit comments

Comments
 (0)