Skip to content

Commit

Permalink
Ensure that the axis is preserved when slicing or copying Coords
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanwp committed Dec 2, 2016
1 parent 33cb0f0 commit 34f0f3b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
ungridded, but not a mix. For ungridded data lists it is assumed that all objects share the same coordinates.
"""
__author__ = "David Michel, Daniel Wallis, Duncan Watson-Parris, Richard Wilkinson, Ian Bush, Matt Kendall, John Holt"
__version__ = "1.5.1"
__status__ = "Stable"
__version__ = "1.5.2"
__status__ = "Dev"
__website__ = "http://www.cistools.net/"

__all__ = ['read_data', 'read_data_list', 'get_variables']
Expand Down
4 changes: 2 additions & 2 deletions cis/data_io/Coord.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __getitem__(self, keys):
# data, and will lead to post-processing before slicing.
# TODO: We could be cleverer and figure out the right slice across the various data managers to only read the
# right data from disk.
return Coord(self.data[keys].copy(), metadata=deepcopy(self.metadata))
return Coord(self.data[keys].copy(), metadata=deepcopy(self.metadata), axis=self.axis)

@property
def points(self):
Expand Down Expand Up @@ -120,7 +120,7 @@ def copy(self, data=None):
:return: Copied :class:`Coord`
"""
data = data if data is not None else numpy.ma.copy(self.data) # Will call lazy load method
return Coord(data, self.metadata)
return Coord(data, self.metadata, axis=self.axis)


class CoordList(list):
Expand Down
4 changes: 4 additions & 0 deletions doc/whats_new_1.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ CIS 1.5.1 fixes
===============
* Minor fix in interpreting units when reading some NetCDF data in Python 2
* Fixed an issue where line and scatter plots weren't respecting the yaxis keyword

CIS 1.5.2 fixes
===============
* Slicing and copying Coords now preserves the axis

0 comments on commit 34f0f3b

Please sign in to comment.