-
Notifications
You must be signed in to change notification settings - Fork 94
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
Fix gradient resampling to same area not working #508
Conversation
Codecov Report
@@ Coverage Diff @@
## main #508 +/- ##
=======================================
Coverage 94.27% 94.27%
=======================================
Files 78 78
Lines 12838 12845 +7
=======================================
+ Hits 12103 12110 +7
Misses 735 735
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@@ -121,6 +121,8 @@ def resample(self, data, cache_dir=None, mask_area=None, **kwargs): | |||
Returns (xarray.DataArray): Data resampled to the target area | |||
|
|||
""" | |||
if self.source_geo_def == self.target_geo_def: | |||
return data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to do anything related to copying the data? For dask array stuff it would be a no-op since dask tasks are immutable, but for numpy it could mean a lot of extra memory usage in cases where the user was never going to make modifications anyway.
Otherwise this PR looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I purposedly avoided copying as I thought about numpy memory issues and the fact that dask won't allow modification anyway... So I think we should be good. If someone complains we can change later. So I'm merging this.
This implements a noop when source and destination areas are the same for gradient search instead of raising an error.
gradient_search
fails when resampling Himawari data #507