Skip to content

Commit

Permalink
add squeeze array to MV2
Browse files Browse the repository at this point in the history
  • Loading branch information
dnadeau4 committed Nov 16, 2017
1 parent 46b27f5 commit 197aa46
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Lib/MV2.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,14 @@ def _conv_axis_arg(axis):
axis = 0
return axis

def squeeze(x):
"squeze array"

This comment has been minimized.

Copy link
@durack1

durack1 Nov 16, 2017

Member

squeze -> squeeze

ta = _makeMaskedArg(x)
maresult = numpy.squeeze(x._data)
axes, attributes, id, grid = _extractMetadata(x)
return TransientVariable(
maresult, axes=axes, attributes=attributes, grid=grid, id=id)


def is_masked(x):
"Is x a 0-D masked value?"
Expand Down
3 changes: 3 additions & 0 deletions Lib/avariable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,9 @@ def getGridIndices(self):

# numpy.ma overrides

def squeeze(self):
return(MV.squeeze(self))

def __getitem__(self, key):
if isinstance(key, tuple):
speclist = self._process_specs(key, {})
Expand Down
2 changes: 2 additions & 0 deletions Lib/tvariable.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def __array_finalize__(self, obj):
def __copy__(self):
return numpy.ma.MaskedArray.copy(self)

squeeze = AbstractVariable.squeeze

__mul__ = AbstractVariable.__mul__
__rmul__ = AbstractVariable.__rmul__
__imul__ = AbstractVariable.__imul__
Expand Down

0 comments on commit 197aa46

Please sign in to comment.