def test_select(self): # check indexing with a tuple of arrays and with 1-level dimensions: dim1=Dim(['dim'],'dim1') dim2=Dim([1,2],'dim2') dim3=Dim([3,4,5],'dim3') dat=DimArray([[[6,7,8],[9,10,11]]],[dim1,dim2,dim3]) self.assertEquals(dat.select(dim2=dat['dim2']>1, dim3=dat['dim3']>3).shape,(1,1,2))
def test_find(self): # check indexing with a tuple of arrays and with 1-level dimensions: dim1=Dim(['dim'],'dim1') dim2=Dim([1,2],'dim2') dim3=Dim([3,4,5],'dim3') dat=DimArray([[[6,7,8],[9,10,11]]],[dim1,dim2,dim3]) indx = dat.find(dim2=dat['dim2']>1,dim3=dat['dim3']>3) assert_array_equal(dat.select(dim2=dat['dim2']>1,dim3=dat['dim3']>3), dat[indx])