Skip to content

Change default boundary value to "none" for dask map_overlap #8391

Closed

Description

@GenevieveBuckley

I'd like to propose changing the default value of the boundary keyword argument in map_overlap. The current default is "reflect", and I'd like it to be boundary="none" instead.

Reasons why this would be useful:

  • It's much faster. It roughly halves the number of tasks, and the difference in compute time is significant
  • There's less of a difference between results from a numpy array, vs the same data in a dask array (numpy doesn't do extra padding around the edges by default, so when we do this with dask, it's not equivalent anymore)
  • Users rely on default values to choose something sensible, and I think fast performance should be weighted more highly as a sensible priority.
  • Many inner functions already handle edges themselves (eg: scipy.ndimage.gaussian_filter, among many others), in which case it is redundant to handle the edges twice.

dask-image already uses boundary="none" wherever possible. We also see users concerned about performance end up doing a bit of experimentation and ending up here too.

cc @jni @jakirkham

Activity

  1. jsignell commented on Nov 17, 2021

    @jsignell
    Member

    This seems sane to me. I'm wondering who else is likely to be heavily using map_overlap since we should probably let them know that we intend to flip the switch. I can't think of an easy way to deprecate this slowly so I think it'll just be a matter of noting the change (and when it occurred) in the documentation.

  2. jakirkham commented on Nov 17, 2021

    @jakirkham
    Member

    At least xarray's code I didn't see much use of map_overlap. Maybe it is only used on fallback paths, but they seem to do the same thing here and here. Though I may be missing things (particularly from that broader ecosystem)

    cc @rabernat (for an xarray perspective)

  3. jakirkham commented on Nov 17, 2021

    @jakirkham
    Member

    Personally agree that this makes sense

    Have long wanted to deprecate this functionality in map_overlap and move workflows to something more NumPy-like for solving this problem (when it is needed, which arguably is rare) by using pad ( #3641 )

  4. rabernat commented on Nov 17, 2021

    @rabernat
    Contributor

    I'm not sure I can give much Xarray perspective (not my area of specialization). @dcherian would probably be better on this.

    However, we are using this feature quite heavily in xgcm/xgcm#380, which @TomNicholas is spearheading. In that PR, we actually explicitly specify boundary="none", so as long as that keeps working, 👌 .

  5. added
    discussion
    on Nov 17, 2021
  6. dcherian commented on Nov 17, 2021

    @dcherian
    Collaborator

    👍 Xarray doesn't really use map_overlap much. I bet xgcm uses map_overlap the most in the xarray ecosystem.

  7. jakirkham commented on Nov 17, 2021

    @jakirkham
    Member

    Ok so it doesn't sound like this will cause issues. So maybe we should go ahead.

    Just to make sure we haven't missed anyone, would suggest a deprecation cycle. So first we warn if boundary is not specified and let users know the behavior will change (this will become "none" in some future release). Then in that future release (whatever version we picked), we make the change.

  8. GenevieveBuckley commented on Dec 5, 2021

    @GenevieveBuckley
    ContributorAuthor

    Update, we said we'd make the change in version 2022.03.0

    So in late February, we need to make a second PR, changing the default value of the boundary kwarg to "none" (that's not the python None, but a string with the word "none"). If you see the first PR linked above, there's a comment telling you which function & line the change needs to be made on.

  9. scharlottej13 commented on Mar 1, 2022

    @scharlottej13
    Contributor

    @jsignell are we good to close this issue since #8743 has been merged?

  10. jakirkham commented on Mar 1, 2022

    @jakirkham
    Member

    I think so. @GenevieveBuckley is this good to close from your perspective? 🙂

  11. jsignell commented on Mar 1, 2022

    @jsignell
    Member

    Yeah I think this is good to close! @GenevieveBuckley please correct me if you disagree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arraydiscussion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions