Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Manuel Schlund <32543114+schlunma@users.noreply.github.com>
  • Loading branch information
enekomartinmartinez and schlunma committed Feb 26, 2024
1 parent 2902b46 commit 0c91225
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions esmvalcore/preprocessor/_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ def volume_statistics(
cube:
Input cube. The input cube should have a
:class:`iris.coords.CellMeasure` named ``'ocean_volume'``, unless it
has :class:`iris.coords.CellMeasure` named ``'cell_area'`` or
has regular 1D latitude and longitude coordinates so the cell areas
has a :class:`iris.coords.CellMeasure` named ``'cell_area'`` or
regular 1D latitude and longitude coordinates so the cell areas
can be computed using :func:`iris.analysis.cartography.area_weights`.
The volume will be computed from the area multiplied by the
thickness, computed from the bounds of the vertical coordinate.
Expand Down Expand Up @@ -256,7 +256,7 @@ def volume_statistics(
raise ValueError(
f"X and Y axis coordinates depend on {xy_dims} dimensions, "
f"while X, Y, and Z axis depends on {xyz_dims} dimensions. "
"This may indicate Z axis depending on other dimension than"
"This may indicate Z axis depending on other dimension than "
"space that could provoke invalid aggregation...")

(agg, agg_kwargs) = get_iris_aggregator(operator, **operator_kwargs)
Expand Down
5 changes: 2 additions & 3 deletions tests/unit/preprocessor/_volume/test_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,19 +546,18 @@ def test_volume_statistics_z_axis_time_error(self):
self.assertIn(
"X and Y axis coordinates depend on (2, 3) dimensions, "
"while X, Y, and Z axis depends on (0, 1, 2, 3) dimensions. "
"This may indicate Z axis depending on other dimension than"
"This may indicate Z axis depending on other dimension than "
"space that could provoke invalid aggregation...",
str(err.exception)
)

# Fails because x axis is missing
grid_3d_no_x = self.grid_4d_z[..., 0]
with self.assertRaises(ValueError) as err:
volume_statistics(grid_3d_no_x, 'mean')
self.assertIn(
"X and Y axis coordinates depend on (2,) dimensions, "
"while X, Y, and Z axis depends on (0, 1, 2) dimensions. "
"This may indicate Z axis depending on other dimension than"
"This may indicate Z axis depending on other dimension than "
"space that could provoke invalid aggregation...",
str(err.exception)
)
Expand Down

0 comments on commit 0c91225

Please sign in to comment.