def test_CF_ATOL_RTOL_environment(self): if self.test_only and inspect.stack()[0][3] not in self.test_only: return self.assertTrue(cfdm.CF() == '1.7') org = cfdm.RTOL() self.assertTrue(cfdm.RTOL(1e-5) == org) self.assertTrue(cfdm.RTOL() == 1e-5) self.assertTrue(cfdm.RTOL(org) == 1e-5) self.assertTrue(cfdm.RTOL() == org) org = cfdm.ATOL() self.assertTrue(cfdm.ATOL(1e-5) == org) self.assertTrue(cfdm.ATOL() == 1e-5) self.assertTrue(cfdm.ATOL(org) == 1e-5) self.assertTrue(cfdm.ATOL() == org) out = cfdm.environment(display=False)
def test_atol_rtol(self): """TODO DOCS.""" org = cfdm.RTOL() self.assertEqual(cfdm.RTOL(1e-5), org) self.assertEqual(cfdm.RTOL(), 1e-5) self.assertEqual(cfdm.RTOL(org), 1e-5) self.assertEqual(cfdm.RTOL(), org) org = cfdm.ATOL() self.assertEqual(cfdm.ATOL(1e-5), org) self.assertEqual(cfdm.ATOL(), 1e-5) self.assertEqual(cfdm.ATOL(org), 1e-5) self.assertEqual(cfdm.ATOL(), org) org = cfdm.atol() self.assertTrue(org == cfdm.ATOL()) # check alias self.assertTrue(cfdm.atol(1e-5) == org) self.assertTrue(cfdm.atol() == 1e-5) self.assertTrue(cfdm.atol(org) == 1e-5) self.assertTrue(cfdm.atol() == org)
def test_atol_rtol(self): """Test the atol and rtol functions.""" org = cfdm.RTOL() self.assertEqual(cfdm.RTOL(1e-5), org) self.assertEqual(cfdm.RTOL(), 1e-5) self.assertEqual(cfdm.RTOL(org), 1e-5) self.assertEqual(cfdm.RTOL(), org) org = cfdm.ATOL() self.assertEqual(cfdm.ATOL(1e-5), org) self.assertEqual(cfdm.ATOL(), 1e-5) self.assertEqual(cfdm.ATOL(org), 1e-5) self.assertEqual(cfdm.ATOL(), org) org = cfdm.atol() self.assertTrue(org == cfdm.ATOL()) # check alias self.assertTrue(cfdm.atol(1e-5) == org) self.assertTrue(cfdm.atol() == 1e-5) self.assertTrue(cfdm.atol(org) == 1e-5) self.assertTrue(cfdm.atol() == org)
def test_atol_rtol(self): if self.test_only and inspect.stack()[0][3] not in self.test_only: return org = cfdm.RTOL() self.assertEqual(cfdm.RTOL(1e-5), org) self.assertEqual(cfdm.RTOL(), 1e-5) self.assertEqual(cfdm.RTOL(org), 1e-5) self.assertEqual(cfdm.RTOL(), org) org = cfdm.ATOL() self.assertEqual(cfdm.ATOL(1e-5), org) self.assertEqual(cfdm.ATOL(), 1e-5) self.assertEqual(cfdm.ATOL(org), 1e-5) self.assertEqual(cfdm.ATOL(), org) org = cfdm.atol() self.assertTrue(org == cfdm.ATOL()) # check alias self.assertTrue(cfdm.atol(1e-5) == org) self.assertTrue(cfdm.atol() == 1e-5) self.assertTrue(cfdm.atol(org) == 1e-5) self.assertTrue(cfdm.atol() == org)
u.data[0, 0, 0] = -1e30 u.data[0, 0, 0] t.data[0, 0, 0] key = u.construct_key('grid_latitude') u.del_construct(key) u.constructs('grid_latitude') t.constructs('grid_latitude') import copy u = copy.deepcopy(t) orog = t.constructs('surface_altitude').value().copy() t.equals(t) t.equals(t.copy()) t.equals(t[...]) t.equals(q) t.equals(q, verbose=True) cfdm.ATOL() cfdm.RTOL() original = cfdm.RTOL(0.00001) cfdm.RTOL() cfdm.RTOL(original) cfdm.RTOL() orog = t.constructs('surface_altitude').value() orog.equals(orog.copy()) print("\n**NetCDF interface**\n") print(t.constructs.filter_by_ncvar('b')) t.constructs('ncvar%x').value() t.constructs('ncdim%x') q.nc_get_variable() q.nc_global_attributes()