Skip to content

Optimize ndrolling nanreduce #4325

@fujiisoup

Description

@fujiisoup

In #4219 we added ndrolling.
However, nanreduce, such as ds.rolling(x=3, y=2).mean() calls np.nanmean which copies the strided-array into a full-array.
This is memory-inefficient.

We can implement inhouse-nanreduce methods for the strided array.
For example, our .nansum currently does
make a strided array -> copy the array -> replace nan by 0 -> sum
but we can do instead
replace nan by 0 -> make a strided array -> sum
This is much more memory efficient.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions