diff --git a/cf/data/data.py b/cf/data/data.py index c3d0cd1449..94f3d7ecf1 100644 --- a/cf/data/data.py +++ b/cf/data/data.py @@ -30,14 +30,14 @@ _numpy_isclose, _section, abspath, + atol, + default_netCDF_fillvals, + fm_threshold, + free_memory, + log_level, + parse_indices, + rtol, ) -from ..functions import atol as cf_atol -from ..functions import default_netCDF_fillvals -from ..functions import fm_threshold as cf_fm_threshold -from ..functions import free_memory -from ..functions import inspect as cf_inspect -from ..functions import log_level, parse_indices -from ..functions import rtol as cf_rtol from ..mixin_container import Container from ..units import Units from . import FileArray @@ -667,14 +667,16 @@ def __contains__(self, value): return bool(dx.any()) @property + @daskified(_DASKIFIED_VERBOSE) def _atol(self): - """Return the current value of the `atol` function.""" - return cf_atol().value + """Return the current value of the `cf.atol` function.""" + return atol().value @property + @daskified(_DASKIFIED_VERBOSE) def _rtol(self): - """Return the current value of the `rtol` function.""" - return cf_rtol().value + """Return the current value of the `cf.rtol` function.""" + return rtol().value def _is_abstract_Array_subclass(self, array): """Whether or not an array is a type of abstract Array. @@ -690,6 +692,7 @@ def _is_abstract_Array_subclass(self, array): """ return isinstance(array, cfdm.Array) + @daskified(_DASKIFIED_VERBOSE) def __data__(self): """Returns a new reference to self.""" return self @@ -9574,7 +9577,9 @@ def inspect(self): `None` """ - print(cf_inspect(self)) # pragma: no cover + from ..functions import inspect + + print(inspect(self)) # pragma: no cover def isclose(self, y, rtol=None, atol=None): """Return where data are element-wise equal to other, @@ -10146,7 +10151,7 @@ def fits_in_memory(self, itemsize): # Note that self._size*(itemsize+1) is the array size in bytes # including space for a full boolean mask # ------------------------------------------------------------ - return self.size * (itemsize + 1) <= free_memory() - cf_fm_threshold() + return self.size * (itemsize + 1) <= free_memory() - fm_threshold() @_deprecated_kwarg_check("i") @_inplace_enabled(default=False) diff --git a/cf/test/test_Data.py b/cf/test/test_Data.py index 0f22111145..d346b12e51 100644 --- a/cf/test/test_Data.py +++ b/cf/test/test_Data.py @@ -3845,6 +3845,18 @@ def test_Data_override_calendar(self): self.assertIsNone(d.override_calendar("all_leap", inplace=True)) + def test_Data_atol(self): + d = cf.Data(1) + self.assertEqual(d._atol, cf.atol()) + cf.atol(0.001) + self.assertEqual(d._atol, 0.001) + + def test_Data_rtol(self): + d = cf.Data(1) + self.assertEqual(d._rtol, cf.rtol()) + cf.rtol(0.001) + self.assertEqual(d._rtol, 0.001) + if __name__ == "__main__": print("Run date:", datetime.datetime.now())