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

Fix gradient resampling to same area not working #508

Merged
merged 2 commits into from Mar 23, 2023

Conversation

mraspaud
Copy link
Member

This implements a noop when source and destination areas are the same for gradient search instead of raising an error.

@mraspaud mraspaud added the bug label Mar 22, 2023
@mraspaud mraspaud requested a review from djhoese March 22, 2023 17:30
@mraspaud mraspaud self-assigned this Mar 22, 2023
@coveralls
Copy link

coveralls commented Mar 22, 2023

Coverage Status

Coverage: 93.799% (+0.004%) from 93.795% when pulling 08b714e on mraspaud:fix-gradient-equal-areas into f3e713e on pytroll:main.

@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Merging #508 (08b714e) into main (0340c4f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #508   +/-   ##
=======================================
  Coverage   94.27%   94.27%           
=======================================
  Files          78       78           
  Lines       12838    12845    +7     
=======================================
+ Hits        12103    12110    +7     
  Misses        735      735           
Flag Coverage Δ
unittests 94.27% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pyresample/test/test_gradient.py 98.98% <100.00%> (ø)
pyresample/test/test_resamplers/test_resampler.py 100.00% <100.00%> (ø)

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
Copy link
Member

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.

Copy link
Member Author

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.

@mraspaud mraspaud merged commit 53ed600 into pytroll:main Mar 23, 2023
26 checks passed
@mraspaud mraspaud deleted the fix-gradient-equal-areas branch March 24, 2023 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gradient_search fails when resampling Himawari data
3 participants