Skip to content

Commit

Permalink
Revert to calculating the points as the mid-points of the new bounds …
Browse files Browse the repository at this point in the history
…(as per the existing behaviour). Removing lazy points test since they now just inherit the 'laziness' of the bounds.
  • Loading branch information
duncanwp committed May 24, 2018
1 parent b147a42 commit 7e6ab38
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
* The partial collapse of multi-dimensional auxiliary coordinates is now
supported. Collapsed bounds span the range of the collapsed dimension(s).
*Note* the collapsed points now represent the mean over the collapsed
dimensions(s) rather than the mid-point as was previously used (for full
collapse).
supported. Collapsed bounds span the range of the collapsed dimension(s).
2 changes: 1 addition & 1 deletion lib/iris/coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,7 @@ def serialize(x):
# Calculate the bounds and points along the right dims
bounds = al.stack([item.min(axis=dims_to_collapse),
item.max(axis=dims_to_collapse)]).T
points = item.mean(axis=dims_to_collapse, dtype=self.dtype)
points = al.array(bounds.sum(axis=-1) * 0.5, dtype=self.dtype)

# Create the new collapsed coordinate.
coord = self.copy(points=points, bounds=bounds)
Expand Down
13 changes: 0 additions & 13 deletions lib/iris/tests/unit/coords/test_Coord.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,19 +301,6 @@ def test_numeric_nd(self):
[4, 10],
[5, 11]]))

def test_lazy_nd_points(self):
import dask.array as da
self.setupTestArrays((3, 4))
coord = AuxCoord(self.pts_lazy)

collapsed_coord = coord.collapsed()

self.assertTrue(collapsed_coord.has_lazy_points())
self.assertFalse(collapsed_coord.has_lazy_bounds())

self.assertArrayEqual(collapsed_coord.points, da.array([55]))
self.assertArrayEqual(collapsed_coord.bounds, da.array([[0, 110]]))

def test_lazy_nd_bounds(self):
import dask.array as da

Expand Down

0 comments on commit 7e6ab38

Please sign in to comment.