Skip to content

Commit

Permalink
Spellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
schlunma committed Mar 6, 2023
1 parent 768a0c4 commit 0352241
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions lib/iris/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ def update_kwargs(cls, kwargs, cube):


def create_weighted_aggregator_fn(aggregator_fn, axis, **kwargs):
"""Return an aggregator function that can explicitely handle weights.
"""Return an aggregator function that can explicitly handle weights.
Args:
Expand Down Expand Up @@ -1500,7 +1500,7 @@ def _weighted_quantile_1D(data, weights, quantiles, **kwargs):
array or float. Calculated quantile values (set to np.nan wherever sum
of weights is zero or masked)
"""
# Return np.nan if no useable points found
# Return np.nan if no usable points found
if np.isclose(weights.sum(), 0.0) or ma.is_masked(weights.sum()):
return np.resize(np.array(np.nan), len(quantiles))
# Sort the data
Expand Down Expand Up @@ -1637,7 +1637,7 @@ def _proportion(array, function, axis, **kwargs):
# Otherwise, it is possible for numpy to return a masked array that has
# a dtype for its data that is different to the dtype of the fill-value,
# which can cause issues outside this function.
# Reference - tests/unit/analyis/test_PROPORTION.py Test_masked.test_ma
# Reference - tests/unit/analysis/test_PROPORTION.py Test_masked.test_ma
numerator = _count(array, axis=axis, function=function, **kwargs)
result = ma.asarray(numerator / total_non_masked)

Expand Down Expand Up @@ -2920,7 +2920,7 @@ def __init__(self, mdtol=1):
Both sourge and target cubes must have an XY grid defined by
separate X and Y dimensions with dimension coordinates.
All of the XY dimension coordinates must also be bounded, and have
the same cooordinate system.
the same coordinate system.
"""
if not (0 <= mdtol <= 1):
Expand Down
24 changes: 12 additions & 12 deletions lib/iris/tests/unit/cube/test_Cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ class Test_collapsed__multidim_weighted_with_arr(tests.IrisTest):
def setUp(self):
self.data = np.arange(6.0).reshape((2, 3))
self.lazydata = as_lazy_data(self.data)
# Test cubes wth (same-valued) real and lazy data
# Test cubes with (same-valued) real and lazy data
cube_real = Cube(self.data, units="m")
for i_dim, name in enumerate(("y", "x")):
npts = cube_real.shape[i_dim]
Expand Down Expand Up @@ -471,21 +471,21 @@ def test_weighted_1dweights_lazy_x(self):
self.assertEqual(cube_collapsed.units, "kg")

def test_weighted_sum_fullweights_adapt_units_real_y(self):
# Check that units are adapated correctly ('m' * '1' = 'm')
# Check that units are adapted correctly ('m' * '1' = 'm')
cube_collapsed = self.cube_real.collapsed(
"y", SUM, weights=self.full_weights_y
)
self.assertEqual(cube_collapsed.units, "m")

def test_weighted_sum_fullweights_adapt_units_lazy_y(self):
# Check that units are adapated correctly ('kg' * '1' = 'kg')
# Check that units are adapted correctly ('kg' * '1' = 'kg')
cube_collapsed = self.cube_lazy.collapsed(
"y", SUM, weights=self.full_weights_y
)
self.assertEqual(cube_collapsed.units, "kg")

def test_weighted_sum_1dweights_adapt_units_real_y(self):
# Check that units are adapated correctly ('m' * '1' = 'm')
# Check that units are adapted correctly ('m' * '1' = 'm')
# Note: the same test with lazy data fails:
# https://github.com/SciTools/iris/issues/5083
cube_collapsed = self.cube_real.collapsed(
Expand All @@ -494,7 +494,7 @@ def test_weighted_sum_1dweights_adapt_units_real_y(self):
self.assertEqual(cube_collapsed.units, "m")

def test_weighted_sum_with_unkown_units_real_y(self):
# Check that units are adapated correctly ('unknown' * '1' = 'unknown')
# Check that units are adapted correctly ('unknown' * '1' = 'unknown')
# Note: does not need to be adapted in subclasses since 'unknown'
# multiplied by any unit is 'unknown'
self.cube_real.units = "unknown"
Expand All @@ -506,7 +506,7 @@ def test_weighted_sum_with_unkown_units_real_y(self):
self.assertEqual(cube_collapsed.units, "unknown")

def test_weighted_sum_with_unkown_units_lazy_y(self):
# Check that units are adapated correctly ('unknown' * '1' = 'unknown')
# Check that units are adapted correctly ('unknown' * '1' = 'unknown')
# Note: does not need to be adapted in subclasses since 'unknown'
# multiplied by any unit is 'unknown'
self.cube_lazy.units = "unknown"
Expand Down Expand Up @@ -541,21 +541,21 @@ def setUp(self):
self.full_weights_x = self.cube_real.copy(self.full_weights_x_original)

def test_weighted_sum_fullweights_adapt_units_real_y(self):
# Check that units are adapated correctly ('m' * 'm2' = 'm3')
# Check that units are adapted correctly ('m' * 'm2' = 'm3')
cube_collapsed = self.cube_real.collapsed(
"y", SUM, weights=self.full_weights_y
)
self.assertEqual(cube_collapsed.units, "m3")

def test_weighted_sum_fullweights_adapt_units_lazy_y(self):
# Check that units are adapated correctly ('kg' * 'm2' = 'kg m2')
# Check that units are adapted correctly ('kg' * 'm2' = 'kg m2')
cube_collapsed = self.cube_lazy.collapsed(
"y", SUM, weights=self.full_weights_y
)
self.assertEqual(cube_collapsed.units, "kg m2")

def test_weighted_sum_1dweights_adapt_units_real_y(self):
# Check that units are adapated correctly ('m' * 'm2' = 'm3')
# Check that units are adapted correctly ('m' * 'm2' = 'm3')
# Note: the same test with lazy data fails:
# https://github.com/SciTools/iris/issues/5083
cube_collapsed = self.cube_real.collapsed(
Expand Down Expand Up @@ -669,7 +669,7 @@ def _assert_warn_collapse_without_weight(self, coords, warn):
self.assertIn(mock.call(msg.format(coord)), warn.call_args_list)

def _assert_nowarn_collapse_without_weight(self, coords, warn):
# Ensure that warning is not rised.
# Ensure that warning is not raised.
msg = "Collapsing spatial coordinate {!r} without weighting"
for coord in coords:
self.assertNotIn(mock.call(msg.format(coord)), warn.call_args_list)
Expand Down Expand Up @@ -758,7 +758,7 @@ def _assert_warn_cannot_check_contiguity(self, warn):
self.assertIn(mock.call(msg), warn.call_args_list)

def _assert_cube_as_expected(self, cube):
"""Ensure that cube data and coordiantes are as expected."""
"""Ensure that cube data and coordinates are as expected."""
self.assertArrayEqual(cube.data, np.array(3))

lat = cube.coord("latitude")
Expand Down Expand Up @@ -1096,7 +1096,7 @@ def setUp(self):
len(self.cube.coord("model_level_number").points)
)
self.exp_iter_2d = np.ndindex(6, 70, 1, 1)
# Define maximum number of interations for particularly long
# Define maximum number of interactions for particularly long
# (and so time-consuming) iterators.
self.long_iterator_max = 5

Expand Down

0 comments on commit 0352241

Please sign in to comment.