diff --git a/lib/iris/cube.py b/lib/iris/cube.py index a72d03eabc..1098b3ac86 100644 --- a/lib/iris/cube.py +++ b/lib/iris/cube.py @@ -2553,18 +2553,14 @@ def vector_summary( ) summary += "\n ugrid information:\n" summary += "\n".join(ugrid_mesh_summary) - if ugrid_mesh.topology_dimension: - summary += "\n{pad:{width}}topology_dimension: {val}".format( - pad=" ", - width=indent, - val=ugrid_mesh.topology_dimension, - ) - if ugrid_mesh.node_coordinates: - summary += "\n{pad:{width}}node_coordinates: {val}".format( - pad=" ", - width=indent, - val=" ".join(ugrid_mesh.node_coordinates), - ) + summary += "\n{pad:{width}}topology_dimension: {val}".format( + pad=" ", width=indent, val=ugrid_mesh.topology_dimension, + ) + summary += "\n{pad:{width}}node_coordinates: {val}".format( + pad=" ", + width=indent, + val=" ".join(ugrid_mesh.node_coordinates), + ) # # Generate textual summary of cube scalar coordinates. diff --git a/lib/iris/fileformats/ugrid_cf_reader.py b/lib/iris/fileformats/ugrid_cf_reader.py index 7609588cc2..81e19f8bb8 100644 --- a/lib/iris/fileformats/ugrid_cf_reader.py +++ b/lib/iris/fileformats/ugrid_cf_reader.py @@ -57,7 +57,6 @@ class CubeUgrid( "topology_dimension", "node_coordinates", ], - defaults=(None,) * 2, ) ): """ @@ -74,12 +73,11 @@ class CubeUgrid( Which element of the mesh the cube is mapped to. Can be 'face', 'edge' or 'node'. A 'volume' is not supported. - Optional: * topology_dimension (int): - The highest dimensionality of the geometric elements in the mesh. Defaults to None. + The highest dimensionality of the geometric elements in the mesh. - * node_coordinates (string): - A list of the names of the spatial coordinates, used to geolocate the nodes. Defaults to None. + * node_coordinates (set): + A set of the names of the spatial coordinates, used to geolocate the nodes. """ @@ -88,14 +86,12 @@ def __str__(self): result += "\n cube dimension = {}".format(self.cube_dim) result += '\n mesh_location = "{}"'.format(self.mesh_location) result += '\n mesh "{}" :'.format(self.grid.mesh_name) - if self.topology_dimension: - result += '\n topology_dimension "{}" :'.format( - self.topology_dimension - ) - if self.node_coordinates: - result += '\n node_coordinates "{}" :\n'.format( - " ".join(self.node_coordinates) - ) + result += '\n topology_dimension "{}" :'.format( + self.topology_dimension + ) + result += '\n node_coordinates "{}" :\n'.format( + " ".join(self.node_coordinates) + ) try: mesh_str = str(self.grid.info) except TypeError: diff --git a/lib/iris/tests/unit/experimental/representation/test_CubeRepresentation.py b/lib/iris/tests/unit/experimental/representation/test_CubeRepresentation.py index 6215c039be..3b25677e5e 100644 --- a/lib/iris/tests/unit/experimental/representation/test_CubeRepresentation.py +++ b/lib/iris/tests/unit/experimental/representation/test_CubeRepresentation.py @@ -126,8 +126,11 @@ def setUp(self): self.representer._get_bits(self.representer._get_lines()) def test_population(self): - for v in self.representer.str_headings.values(): - self.assertIsNotNone(v) + for k, v in self.representer.str_headings.items(): + if k == "ugrid information:": + self.assertIsNone(v) + else: + self.assertIsNotNone(v) def test_headings__dimcoords(self): contents = self.representer.str_headings["Dimension coordinates:"]