xtr.shape = (4, 6) xtr1 = MV2.transpose(xtr) xtr2 = MV2.transpose(MV2.TransientVariable(xtr)) if not xtr2.shape == (6, 4): markError('transpose shape') xtr3 = numpy.transpose(xtr) if not MV2.allclose(xtr1, xtr3): markError('transpose 2') if not MV2.allclose(xtr2, xtr3): markError('transpose 1') ## where(condition, x, y) ## where(condition, x, y) is x where condition is true, y otherwise xwhere = MV2.where(MV2.greater(xouter, 200), xouter, MV2.masked) xwhere2 = MV2.where(MV2.greater(ud, 200), ud, MV2.masked) xwhere3 = MV2.where(MV2.greater(uf, 200), uf, MV2.masked) xwhere2 = MV2.choose(MV2.greater(xouter, 200), (MV2.masked, xouter)) if not MV2.allclose(xwhere, xwhere2): markError('where test 1') ## diagonal(x, k) xdiag = MV2.TransientVariable([[1, 2, 3], [4, 5, 6]]) if not MV2.allclose(MV2.diagonal(xdiag, 1), [2, 6]): markError('diagonal') # Broadcast vdat2 = vdat[0] try: vsum = udat - vdat2 except: markError('Broadcast') d.close() f.close() reportError()
testwrap(lat, (90.0001,90.0001,'ccn'),(15,16)) testwrap(lat, (-90.0001,-90.0001,'ccn'),(0,1)) testwrap(rlat,(-90,90,'cc'),(15,None,-1)) testwrap(rlat,(-90,90,'co'),(15,0,-1)) testwrap(rlat,(90,-90,'cc'),(0,16)) testwrap(rlat,(90,-90,'co'),(0,15)) testwrap(rlat,(45,-45),(4,12)) testwrap(rlat,(-45,45),(11,3,-1)) testwrap(rlat,(180,-180),(0,16)) testwrap(rlat, (89,89,'ccb'),(0,None,-1)) testwrap(rlat, (83,83,'ccb'),(1,0,-1)) testwrap(rlat, (89,89,'ccn'),None) testwrap(rlat, (0,0,'ccb'),(8,6,-1)) testwrap(rlat, (91,91,'ccb'),None) testwrap(rlat, (54,-54),(3,13)) testwrap(rlat, (90.0001,90.0001,'ccn'),(0,None,-1)) testwrap(rlat, (-90.0001,-90.0001,'ccn'),(15,14,-1)) testwrap(time, ('2000','2001'),(0,2)) testwrap(time, ('2000','2000'),(0,1)) testwrap(time, ('2002','2000'),(2,None,-1)) testwrap(time, ('1999-12-1','1999-12-10','cob'),(0,1)) testwrap(time0, (0.0, 0.0,'ccb'), (0,1)) testwrap(lev,(0.05035,0.05035),(0,1)) testwrap(lev,(0.1009, 0.1009),(1,2)) reportError()