Skip to content

LAMA to Dask: managing default(-argument) Data instance #378

@sadielbartholomew

Description

@sadielbartholomew

(Opening as a general issue since __init__ isn't listed under our table of methods in #295, so I am not sure of the migration status of Data initialisation.) Whilst I was trying to create diverse cases of instances of Data (in the context of #376 (comment)), I noticed cf.Data() initialised as-is, i.e. with no arguments, which is seemingly documented as being valid (initial argument array=None with array: optional stated), runs into an error:

>>> cf.Data()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sadie/cf-python/cf/data/data.py", line 964, in __repr__
    return super().__repr__().replace("<", "<CF ", 1)
  File "/home/sadie/anaconda3/envs/cf-env/lib/python3.8/site-packages/cfdm/data/data.py", line 214, in __repr__
    shape = self.shape
  File "/home/sadie/cf-python/cf/data/data.py", line 158, in wrapper
    return method(*args, **kwargs)
  File "/home/sadie/cf-python/cf/data/data.py", line 6288, in shape
    dx = self._get_dask()
  File "/home/sadie/cf-python/cf/data/data.py", line 1387, in _get_dask
    return self._custom["dask"]
KeyError: 'dask'

The fix is probably a quite simple adaptation, though I don't have time to look into it now; once I have finished reviewing my backlog of Dask migration PRs I will sort this, if you haven't already tackled it @davidhassell.

Metadata

Metadata

Labels

daskRelating to the use of Dask

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions