Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: resample_to_grid function doesn't return correct values when method='nearest' #2472

Open
wceyhan opened this issue Mar 11, 2025 · 0 comments
Labels

Comments

@wceyhan
Copy link

wceyhan commented Mar 11, 2025

Describe the bug
I am using resample_to_grid raster utility to map elevation data from a raster to the model grid with method='nearest'. When I manually check the resampled data, it is outside the range of the raster cells covering the model element. It seems to me that 'linear', or 'mean' works. I just can't use them due to memory limit.

To Reproduce
Steps to reproduce the behavior:
I can provide the datasets I am using but it returned a similar result when I tested with other raster data.

Expected behavior
The resampled data using method='nearest' will not match the underlying raster cells.

Additional context
I found these two links below. It sounds like the issue originates from the griddata function of scipy. The first link explains what may be going on in griddata and the second link suggests setting rescale=True in griddata. When I modified the resample_to_grid call of the griddata with rescale=True, it works.

Thank you!

@wceyhan wceyhan added the bug label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant