Skip to content

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.

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 #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