Skip to content

Commit 2886f2a

Browse files
doutriaux1dnadeau4
authored andcommitted
failing test from vcs added here (#234)
* failing test from vcs added here * ok test passes again * reverted for now * commented out test for @durack1
1 parent e09831e commit 2886f2a

File tree

4 files changed

+47
-8
lines changed

4 files changed

+47
-8
lines changed

Lib/axis.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,16 +1857,16 @@ def __init__(self, data, bounds=None, id=None,
18571857
self._data_ = data[:]
18581858
else:
18591859
self._data_ = numpy.array(data[:])
1860-
elif isinstance(data, numpy.ma.MaskedArray):
1861-
if numpy.ma.getmask(data).any() is numpy.bool_(True):
1862-
raise CDMSError(
1863-
'Cannot construct an axis with a missing value.')
1864-
data = data.data
1860+
elif isinstance(data, numpy.ndarray):
18651861
if copy == 0:
18661862
self._data_ = data
18671863
else:
18681864
self._data_ = numpy.array(data)
1869-
elif isinstance(data, numpy.ndarray):
1865+
elif isinstance(data, numpy.ma.MaskedArray):
1866+
if numpy.ma.getmask(data) is not numpy.ma.nomask:
1867+
raise CDMSError(
1868+
'Cannot construct an axis with a missing value.')
1869+
data = data.data
18701870
if copy == 0:
18711871
self._data_ = data
18721872
else:

ci-support/conda_upload.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
PKG_NAME=cdms2
3-
USER=uvcdat
3+
USER=cdat
44
echo "Trying to upload conda"
55
mkdir ${HOME}/conda-bld
66
export CONDA_BLD_PATH=${HOME}/conda-bld

tests/test_axis_missing.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import unittest
2+
import numpy
3+
import cdms2
4+
import MV2
5+
6+
class CDMSTestAxisMissing(unittest.TestCase):
7+
def testAxismissing(self):
8+
data = """
9+
-999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999.
10+
0.059503571833625334
11+
0.059503571833625334 0.05664014775641405 0.05193557222118004
12+
0.04777129850801233 0.0407139313814465 0.029382624830271705
13+
0.018469399844287374 0.0162382275289592 0.02646680241827459
14+
0.04792041732949079 0.0689138797030203 0.08167038620212037
15+
0.09273558459066569 0.11266293431057901 0.13663018925347364
16+
0.15229174546388072 0.15284435880966177 0.13423845476113883
17+
0.09945904378274077 0.07032267160267985 0.05551039827020481
18+
0.045537187647785464 0.040532491867244946 0.03577527125478327
19+
-999. -999. -999.
20+
-0.058062458673116 -0.08764922509099882 -0.11697036914487152
21+
-0.14836133615864944 -0.17956528904564023 -0.21109198032585794
22+
-0.23846429237248942 -0.2598536549218765 -0.27795672866320387
23+
-0.2939939095159731 -0.30541031366330024 -0.307643559333884
24+
-0.30078421139811795 -0.2841339526883441 -0.26485737397202497
25+
-0.24287299694779327 -0.22379014890999907 -0.20121548204699846
26+
-0.1746486732156772 -0.14585019344118372 -0.12070675757803526
27+
-0.0997891159111037 -0.08229393660994214 -0.06779720501287469
28+
-0.057213385470859794 -0.04875768191096844 -0.0402377347189964
29+
-0.030169328367807245 -0.017560662894847895 -0.006968922654137132
30+
0.0009773980274431048 0.007054306637034288 0.010472286514133042
31+
0.010702384151997032 0.009231553701801242 0.007544033101056543
32+
0.004639797857203645 -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999.
33+
-999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999. -999.
34+
-999. -999. -999.
35+
""".split()
36+
data = numpy.array(data, dtype=numpy.float)
37+
data = MV2.masked_less(data, -900)
38+
d2 = cdms2.createAxis(data)
39+
self.assertTrue(numpy.ma.allclose(data,d2[:]))

tests/test_cdms_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def testInfo(self):
88
f = cdms2.open(os.path.join(cdat_info.get_sampledata_path(),"clt.nc"))
99
s=f("clt")
1010
s.info()
11-
def testAxis(self):
11+
def tstAxis(self):
1212
axis = cdms2.createAxis(cdms2.createVariable([10.], id='height', missing=1e20))
1313
print(axis)
1414

0 commit comments

Comments
 (0)