Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Huite committed Aug 6, 2024
1 parent ec6ca85 commit abedf0b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 2 additions & 4 deletions tests/test_regrid/test_reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ def forward_args():


def reverse_args():
values = np.flip(np.array([0.0, 1.0, 2.0, np.nan]))
weights = np.array([0.5, 0.5, 0.5, 0.5])
work = np.empty_like(weights)
return values, weights, work
values, weights, work = forward_args()
return np.flip(values), weights, work


@pytest.mark.parametrize("args", [forward_args(), reverse_args()])
Expand Down
2 changes: 1 addition & 1 deletion xugrid/regrid/nanpercentile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Numba percentile methods allocate continuosly on the heap.
Numba percentile methods allocate continuously on the heap.
This has significant overhead when calling the reduction method millions of
times -- as happens when regridding.
Expand Down
8 changes: 7 additions & 1 deletion xugrid/regrid/regridder.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,16 @@ class OverlapRegridder(BaseOverlapRegridder):
Examples
--------
Create an OverlapRegridder to regrid with mean:
>>> regridder = OverlapRegridder(source_grid, target_grid, method="mean")
>>> regridder.regrid(source_data)
Setup a custom percentile method and apply it:
>>> p33_3 = OverlapRegridder.create_percentile_method(33.3)
>>> regridder = OverlapRegridder(source, target, method=p33_3)
>>> regridder = OverlapRegridder(source_grid, target_grid, method=p33_3)
>>> regridder.regrid(source_data)
"""

_JIT_FUNCTIONS = {
Expand Down

0 comments on commit abedf0b

Please sign in to comment.