diff --git a/cf/data/data.py b/cf/data/data.py index 467f7561b2..6213d007d2 100644 --- a/cf/data/data.py +++ b/cf/data/data.py @@ -29,7 +29,6 @@ _DEPRECATION_ERROR_KWARGS, _numpy_isclose, _section, - abspath, atol, default_netCDF_fillvals, free_memory, @@ -39,7 +38,6 @@ ) from ..mixin_container import Container from ..units import Units -from . import FileArray from .collapse import Collapse from .creation import compressed_to_dask, generate_axis_identifiers, to_dask from .dask_utils import ( @@ -135,7 +133,7 @@ def wrapper(*args, **kwargs): _DEFAULT_HARDMASK = True -class Data(Container, cfdm.Data, DataClassDeprecationsMixin): +class Data(DataClassDeprecationsMixin, Container, cfdm.Data): """An N-dimensional data array with units and masked values. * Contains an N-dimensional, indexable and broadcastable array with @@ -7801,45 +7799,6 @@ def insert_dimension(self, position=0, inplace=False): return d - @daskified(_DASKIFIED_VERBOSE) - def get_filenames(self): - """Return the names of files containing parts of the data array. - - :Returns: - - `set` - The file names in normalized, absolute form. If the - data is in memory then an empty `set` is returned. - - **Examples** - - >>> f = cf.NetCDFArray(TODODASK) - >>> d = cf.Data(f) - >>> d.get_filenames() - {TODODASK} - - >>> d = cf.Data([1, 2, 3]) - >>> d.get_filenames() - set() - - """ - out = set() - - dx = self.to_dask_array() - hlg = dx.dask - dsk = hlg.to_dict() - for key, value in hlg.get_all_dependencies().items(): - if value: - continue - - # This key has no dependencies, and so is raw data. - a = dsk[key] - if isinstance(a, FileArray): - out.add(abspath(a.get_filename())) - - out.discard(None) - return out - @daskified(_DASKIFIED_VERBOSE) @_deprecated_kwarg_check("size") @_inplace_enabled(default=False) diff --git a/cf/data/mixin/deprecations.py b/cf/data/mixin/deprecations.py index c97e2c05fd..a935a8c8cb 100644 --- a/cf/data/mixin/deprecations.py +++ b/cf/data/mixin/deprecations.py @@ -315,6 +315,23 @@ def close(self): removed_at="5.0.0", ) # pragma: no cover + def get_filenames(self): + """Return the names of files containing parts of the data array. + + Deprecated at version TODODASK. + + :Returns: + + `set` + The file names in normalized, absolute form. If the + data is in memory then an empty `set` is returned. + + """ + raise DeprecationError( + "Data method 'get_filenames' has been deprecated at " + "version TODODASK and is not available." + ) # pragma: no cover + def chunk(self, chunksize=None, total=None, omit_axes=None, pmshape=None): """Partition the data array. diff --git a/cf/test/test_Data.py b/cf/test/test_Data.py index 95837ead3e..278796fe0a 100644 --- a/cf/test/test_Data.py +++ b/cf/test/test_Data.py @@ -3819,10 +3819,6 @@ def test_Data_flat(self): list(d.flat(ignore_masked=False)), [1, np.ma.masked, 3, 4] ) - @unittest.skipIf(TEST_DASKIFIED_ONLY, "Needs updated NetCDFArray to test") - def test_Data_get_filenames(self): - pass - def test_Data_tolist(self): for x in (1, [1, 2], [[1, 2], [3, 4]]): d = cf.Data(x) @@ -3954,7 +3950,7 @@ def test_Data_soften_mask(self): d.soften_mask() self.assertFalse(d.hardmask) self.assertEqual(len(d.to_dask_array().dask.layers), 2) - + def test_Data_compressed_array(self): import cfdm