Skip to content

Commit

Permalink
Fix type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
bouweandela committed Sep 16, 2024
1 parent 9f2f2b1 commit 4670b18
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions lib/iris/_concatenate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

#
Expand All @@ -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))
Expand Down
12 changes: 6 additions & 6 deletions lib/iris/coord_categorisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 4670b18

Please sign in to comment.