Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix setGrid #193

Merged
merged 7 commits into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ before_install:
script:
#- conda install -c uvcdat/label/nightly -c conda-forge -c uvcdat libcf distarray cdtime libcdms cdat_info numpy esmf esmpy libdrs_f pyopenssl nose requests flake8
- conda create -n py3 python=3.6
- conda install -n py3 -c conda-forge -c uvcdat libcf distarray cdtime libcdms cdat_info numpy libdrs_f pyopenssl nose requests flake8 myproxyclient
- conda install -n py3 -c conda-forge -c uvcdat libcf distarray cdtime libcdms cdat_info numpy libdrs_f pyopenssl nose requests flake8 myproxyclient libnetcdf=4.4.1.1=9
- source activate py3
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then conda install -n py3 -c nesii/channel/dev-esmf -c conda-forge esmpy=7.1.0.dev34; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then conda install -n py3 -c nadeau1 -c conda-forge esmf esmpy; fi
Expand Down
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: 1 addition & 1 deletion Lib/hgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ def isClose(self, g):
def checkAxes(self, axes):
"""Return 1 iff every element of self.getAxisList() is in the list 'axes'."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iff -> if

for item in self.getAxisList():
if item not in axes:
if item.shape not in [axis.shape for axis in axes]:
result = 0
break
else:
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
2 changes: 1 addition & 1 deletion ci-support/circleci_mac_dep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ echo $cmd
$cmd

# Create Python 3 environment
cmd="conda create -n py3 -c uvcdat/label/nightly -c conda-forge -c uvcdat libcf distarray cdtime libcdms cdat_info numpy libdrs_f pyopenssl nose requests flake8 myproxyclient"
cmd="conda create -n py3 -c uvcdat/label/nightly -c conda-forge -c uvcdat libcf distarray cdtime libcdms cdat_info numpy libdrs_f pyopenssl nose requests flake8 myproxyclient libnetcdf=4.4.1.1=9"
echo $cmd
$cmd

Expand Down