SciTools / biggus

:no_entry: [DEPRECATED] Virtual large arrays and lazy evaluation.
http://biggus.readthedocs.io/
GNU Lesser General Public License v3.0
54 stars 27 forks source link

Fixed bug with LinearMosaic __getitem__ and updated test coverage #147

Closed JosephHogg closed 9 years ago

JosephHogg commented 9 years ago

Fixes a bug in LinearMosaic._getitem_full_keys which was causing incorrect output for array slicing. The test I've added illustrates the issue. This bug came up in a support ticket from an iris user attempting to extract data by season from a cube and I imagine there could be other problems that pop up in edge cases in iris when lazy data is being used because of this bug.

Specifically, the problem was that when the slicing key for the tiling axis is split up into keys for each individual tile, biggus assumes that each tile's part of the key can be represented as a slice based on the step between the first two indices in the tile and ending at the final index in the tile. This isn't always the case (see added test).

mo-g commented 9 years ago

Looks nice, simple fix and a neat test! Would be good to get your opinion @pp-mo @marqh?

pelson commented 9 years ago

:+1: - good find. It was a strange assumption to presume that the indices were regularly spaced...