Skip to content

Commit

Permalink
Fixes wrapping when using np.take
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonb5 committed Nov 8, 2023
1 parent 3d5d0d9 commit 5f5e1be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xcdat/regridder/regrid2.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ def _regrid(

# need to optimize
for y in range(y_length):
y_seg = np.take(input_data, lat_mapping[y], axis=y_index)
y_seg = np.take(input_data, lat_mapping[y], axis=y_index, mode="wrap")

for x in range(x_length):
x_seg = np.take(y_seg, lon_mapping[x], axis=x_index, mode="clip")
x_seg = np.take(y_seg, lon_mapping[x], axis=x_index, mode="wrap")

cell_weight = np.dot(
lat_weights[y].reshape((-1, 1)), lon_weights[x].reshape((1, -1))
Expand Down

0 comments on commit 5f5e1be

Please sign in to comment.