Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions cf/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
sadielbartholomew marked this conversation as resolved.
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
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions cf/test/test_Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down