diff --git a/lib/iris/_concatenate.py b/lib/iris/_concatenate.py index 90f2438742..841cecfd53 100644 --- a/lib/iris/_concatenate.py +++ b/lib/iris/_concatenate.py @@ -690,9 +690,9 @@ def __init__(self, cube: iris.cube.Cube) -> None: # # Collate the dimension coordinate metadata. # - for coord in self.dim_coords: - dims = cube.coord_dims(coord) - self.dim_metadata.append(_CoordMetaData(coord, dims)) + for dim_coord in self.dim_coords: + dims = cube.coord_dims(dim_coord) + self.dim_metadata.append(_CoordMetaData(dim_coord, dims)) self.dim_mapping.append(dims[0]) # @@ -709,13 +709,13 @@ def key_func(coord): cube.coord_dims(coord), ) - for coord in sorted(cube.aux_coords, key=key_func): - dims = cube.coord_dims(coord) + for aux_coord in sorted(cube.aux_coords, key=key_func): + dims = cube.coord_dims(aux_coord) if dims: - self.aux_metadata.append(_CoordMetaData(coord, dims)) - self.aux_coords_and_dims.append(_CoordAndDims(coord, tuple(dims))) + self.aux_metadata.append(_CoordMetaData(aux_coord, dims)) + self.aux_coords_and_dims.append(_CoordAndDims(aux_coord, tuple(dims))) else: - self.scalar_coords.append(coord) + self.scalar_coords.append(aux_coord) def meta_key_func(dm): return (dm.metadata, dm.cube_dims(cube)) diff --git a/lib/iris/coord_categorisation.py b/lib/iris/coord_categorisation.py index 770f8327a1..12ad93a9c3 100644 --- a/lib/iris/coord_categorisation.py +++ b/lib/iris/coord_categorisation.py @@ -30,7 +30,7 @@ def add_categorised_coord( cube: iris.cube.Cube, name: str, - from_coord: iris.coords.Coord | str, + from_coord: iris.coords.DimCoord | iris.coords.AuxCoord | str, category_function: Callable, units: str = "1", ) -> None: @@ -41,18 +41,18 @@ def add_categorised_coord( Parameters ---------- - cube : :class:`iris.cube.Cube` + cube : The cube containing 'from_coord'. The new coord will be added into it. - name : str + name : Name of the created coordinate. - from_coord : :class:`iris.coords.Coord` or str + from_coord : Coordinate in 'cube', or the name of one. - category_function : callable + category_function : Function(coordinate, value), returning a category value for a coordinate point-value. If ``value`` has a type hint :obj:`cftime.datetime`, the coordinate points are translated to :obj:`cftime.datetime` s before calling ``category_function``. - units : str, default="1" + units : Units of the category value, typically 'no_unit' or '1'. """ # Interpret coord, if given as a name