Skip to content

Conversation

@davidhassell
Copy link
Collaborator

Following on from #365, I think that this method is just too "dangerous", now, and it would be better to manage this from the Field/Domain, with content injected by cf.read/cf.aggregate. All of which would be the topic of a later PR.

@davidhassell davidhassell added the dask Relating to the use of Dask label Jun 13, 2022
Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the code changes here are fine and sensible, though it seems something has been missed, since the method doesn't seem to hit the deprecation error for the direct case, e.g:

>>> import cf
>>> d = cf.Data(100, "m")
>>> d.get_filenames()
set()

which I assume is because there's still a case under the mixin.propertiesdatabounds module:

$ pwd
/home/sadie/cf-python/cf
$ git grep "def get_filenames"
data/mixin/deprecations.py:    def get_filenames(self):
mixin/propertiesdatabounds.py:    def get_filenames(self):

So that probably needs to go or be deprecated also. Once that's done, this will be good to merge I think!

@davidhassell
Copy link
Collaborator Author

Good spot - I didn't think to check that it actually worked :). It turns out that the issue is that the method is inherited from cfdm.Data, which is higher in the MRO than DataClassDeprecationsMixin.

I have changed the MRO and everything seems OK (bc2bbce).

I'll make a note in #295 to pay attention to the get_filenames methods on other classes, which will need varying treatment (e.g. Field and Domain needs re-implementing, others (probably) deprecating), but that will be for another PR.

@sadielbartholomew
Copy link
Member

I didn't think to check that it actually worked :)

Sometimes it can be useful! 😆

Thanks for investigating and clarifying. I'll do a quick sanity check re-review in a moment...

Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback addressed in an elegant way after:

I have changed the MRO and everything seems OK (bc2bbce).

All good, thanks. Merging.

@sadielbartholomew sadielbartholomew merged commit 032eabd into NCAS-CMS:lama-to-dask Jun 14, 2022
@davidhassell davidhassell added this to the 3.14.0 milestone Nov 15, 2022
@davidhassell davidhassell changed the title dask: Dask.get_filenames dask: Dask.get_filenames (2) Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dask Relating to the use of Dask

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants