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 #225 passing transient variable as axis #229

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions Lib/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1916,16 +1916,16 @@ def __init__(self, data, bounds=None, id=None,
self._data_ = data[:]
else:
self._data_ = numpy.array(data[:])
elif isinstance(data, numpy.ndarray):
elif isinstance(data, numpy.ma.MaskedArray):
if numpy.ma.getmask(data) is not numpy.ma.nomask:
data = data.filled()
else:
data = data.data
if copy == 0:
self._data_ = data
else:
self._data_ = numpy.array(data)
elif isinstance(data, numpy.ma.MaskedArray):
if numpy.ma.getmask(data) is not numpy.ma.nomask:
raise CDMSError(
'Cannot construct an axis with a missing value.')
data = data.data
elif isinstance(data, numpy.ndarray):
if copy == 0:
self._data_ = data
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cdms_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def testInfo(self):
f = cdms2.open(os.path.join(cdat_info.get_sampledata_path(),"clt.nc"))
s=f("clt")
s.info()
def tstAxis(self):
def testAxis(self):
axis = cdms2.createAxis(cdms2.createVariable([10.], id='height', missing=1e20))
print(axis)

Expand Down