def test01CurvRectRegridderInit(self): ''' Test of the CurvRectRegridder.__init__ method. ''' regridder = CurvRectRegridder() self.assertTrue(regridder != None, "CurvRectRegridder() returned None") regridder.finalize()
def test02CreateCurvGrid(self): ''' Tests the CurvRectRegridder.createCurvGrid method. Since nothing is returned from this method, just checks for unexpected/expected Errors being raised. ''' regridder = CurvRectRegridder() # Test with all corner and center data regridder.createCurvGrid(self.curv_center_lons, self.curv_center_lats, self.curv_center_ignr, self.curv_corner_lons, self.curv_corner_lats, self.curv_corner_ignr) # Test without flags regridder.createCurvGrid(self.curv_center_lons, self.curv_center_lats, None, self.curv_corner_lons, self.curv_corner_lats) # Test without corners regridder.createCurvGrid(self.curv_center_lons, self.curv_center_lats, self.curv_center_ignr) # Test without corners or flags regridder.createCurvGrid(self.curv_center_lons, self.curv_center_lats) # TODO: Test invalid cases # Done with this regridder regridder.finalize()
# Regrid from curvilinear to rectilinear using the bilinear method rect_regrid_data = regridder.regridCurvToRect(undef_val, ESMP.ESMP_REGRIDMETHOD_BILINEAR) # Print the differences between the expected and regrid data print "" print "analytic (expect) versus bilinear regridded (found) differences" printDiffs(rect_2d_center_lons, rect_2d_center_lats, undef_val, max_negl, rect_expect_data, rect_regrid_data) # Regrid from curvilinear to rectilinear using the patch method rect_regrid_data = regridder.regridCurvToRect(undef_val, ESMP.ESMP_REGRIDMETHOD_PATCH) # Print the differences between the expected and regrid data print "" print "analytic (expect) versus patch regridded (found) differences" printDiffs(rect_2d_center_lons, rect_2d_center_lats, undef_val, max_negl, rect_expect_data, rect_regrid_data) # Regrid from curvilinear to rectilinear using the conserve method # Corners required for this method rect_regrid_data = regridder.regridCurvToRect(undef_val, ESMP.ESMP_REGRIDMETHOD_CONSERVE) # Print the differences between the expected and regrid data print "" print "analytic (expect) versus conserve regridded (found) differences" printDiffs(rect_2d_center_lons, rect_2d_center_lats, undef_val, max_negl, rect_expect_data, rect_regrid_data) # Done with this regridder regridder.finalize() # Done with ESMP - delete the ESMP log file ESMPControl().stopESMP(True)