Skip to content

Commit

Permalink
Initial review actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rcomer committed Jan 9, 2024
1 parent 2373035 commit b3b9dde
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/iris/tests/unit/analysis/stats/test_pearsonr.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ def test_weight_error(self):
weights=self.weights,
)

def test_non_existent_coord(self):
with self.assertRaises(CoordinateNotFoundError):
stats.pearsonr(self.cube_a, self.cube_b, "bad_coord")

def test_mdtol(self):
cube_small = self.cube_a[:, 0, 0]
cube_small_masked = iris.util.mask_cube(cube_small, [0, 0, 0, 1, 1, 1])
Expand All @@ -163,10 +159,13 @@ def test_common_mask_broadcast(self):
# 2d mask varies on unshared coord:
mask_2d[0, 1] = 1

# Make a (6, 2) cube.
cube_small_2d = self.cube_a[:, 0:2, 0]
cube_small_2d.data = iris.util._mask_array(
cube_small.core_data().reshape(6, 1), mask_2d
# Duplicate data along unshared coord's dimension.
new_data = iris.util.broadcast_to_shape(
cube_small.core_data(), (6, 2), dim_map=[0]
)
cube_small_2d.data = iris.util._mask_array(new_data, mask_2d)

r = stats.pearsonr(
cube_small,
Expand Down Expand Up @@ -202,6 +201,10 @@ def test_single_coord(self):
# Smoke test that single coord can be passed as single string.
stats.pearsonr(self.cube_a, self.cube_b, "latitude")

def test_non_existent_coord(self):
with self.assertRaises(CoordinateNotFoundError):
stats.pearsonr(self.cube_a, self.cube_b, "bad_coord")


if __name__ == "__main__":
tests.main()

0 comments on commit b3b9dde

Please sign in to comment.