Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dask: Data.all and Data.any #373

Merged
merged 7 commits into from
Apr 29, 2022

Conversation

davidhassell
Copy link
Collaborator

No description provided.

@davidhassell davidhassell added the dask Relating to the use of Dask label Apr 5, 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.

The migration implementation is sound, and the tests have been updated nicely, though before we merge this I think we should discuss the question you pose here in the notes under 'Returned Booleans', because I am not convinced about some cases (see in-line comments) for returning Data as opposed to the Boolean in these methods, and would like to hear more about the motivation.

cf/data/README.rst Show resolved Hide resolved
cf/data/data.py Show resolved Hide resolved
cf/data/data.py Show resolved Hide resolved
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.

@davidhassell apologies for the delay in reporting back, this fell off my radar after submitting my review. After our discussions last week, my concerns about the return type were quashed, especially from:

  • it being pointed out that numpy returns its own custom type for a Boolean, rather than a Python built-in bool, so there is an appropriate consistency here as you originally saw and implemented:

    >>> import numpy as np
    >>> import cf
    >>> n = np.array([0, 1, 2, 3])
    >>> type(n.all())
    <class 'numpy.bool_'>
    >>> type(n.any())
    <class 'numpy.bool_'>
    >>> c = cf.Data(n)
    >>> type(c.any())
    <class 'cf.data.data.Data'>
    >>> type(c.all())
    <class 'cf.data.data.Data'>
    >>> bool(c.any())
    True
    >>> bool(c.all())
    False
  • and from the reference to relevant parts of the array API in dask: Data.all and Data.any #373 (comment) which I hadn't properly looked at.

So, overall, I now agree with your behaviour choice and have marked my previously opened comments on the matter as resolved. All good, please merge.

@davidhassell davidhassell merged commit cd4dc74 into NCAS-CMS:lama-to-dask Apr 29, 2022
@davidhassell davidhassell deleted the dask-all-any branch November 15, 2022 09:21
@davidhassell davidhassell added this to the 3.14.0 milestone Nov 15, 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