Esempio n. 1
0
    def test_005_gridsAreTheSame(self):
        grid1 = cdms.createRectGrid(self.y, self.x, 'yx')

        v1 = cdms.createVariable(self.arr, axes=[self.x, self.y], grid=grid1)
        v2 = cdms.createVariable(self.arr, axes=[self.x, self.y], grid=grid1)

        nt.assert_true(var_utils.areGridsEqual(v1, v2))
        nt.assert_true(var_utils.areGridsEqual(v2, v1))
Esempio n. 2
0
    def test_004_oneGridMissing(self):
        grid1 = cdms.createRectGrid(self.y, self.x, 'yx')

        v1 = cdms.createVariable(self.arr, axes=[self.x, self.y], grid=grid1)
        v2 = cdms.createVariable(self.arr)

        nt.assert_false(var_utils.areGridsEqual(v1, v2))
        nt.assert_false(var_utils.areGridsEqual(v2, v1))
Esempio n. 3
0
    def test_003_gridLatitudeDifferent(self):

        grid1 = cdms.createRectGrid(self.y, self.x, 'yx')
        y2 = cdms.createAxis([8.0, 10.0], id='y')
        grid2 = cdms.createRectGrid(y2, self.x, 'yx')

        v1 = cdms.createVariable(self.arr, axes=[self.x, self.y], grid=grid1)
        v2 = cdms.createVariable(self.arr, axes=[self.x, y2], grid=grid2)

        nt.assert_false(var_utils.areGridsEqual(v1, v2))
Esempio n. 4
0
    def test_001_gridTypesDifferent(self):

        latArr = N.array([[56., 58.], [54., 56.], [52., 54.]])
        lonArr = N.array([[-14., -10.], [-12., -8.], [-10., -6.]])

        lon = cdms.coord.TransientAxis2D(lonArr, axes=[self.x, self.y])
        lon.id = 'lon'
        lat = cdms.coord.TransientAxis2D(latArr, axes=[self.x, self.y])
        lat.id = 'lat'

        grid1 = cdms.hgrid.TransientCurveGrid(lat, lon)
        #adding the x and y axis to the transient grid changes them so you need to retrieve them from the grid to make sure they match
        x, y = grid1.getAxisList()
        grid2 = cdms.createRectGrid(y, x, 'yx')

        v1 = cdms.createVariable(self.arr, axes=[x, y], grid=grid1)
        v2 = cdms.createVariable(self.arr, axes=[x, y], grid=grid2)

        nt.assert_false(var_utils.areGridsEqual(v1, v2))