-
Notifications
You must be signed in to change notification settings - Fork 293
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
Add resized area example to resampling documentation #2816
Conversation
628796d
to
18c5600
Compare
How does this differ from the CC @mraspaud who implemented |
Correct me if i'm wrong, but aggregate method can only reduce the size by a int coefficient (i.e. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2816 +/- ##
==========================================
- Coverage 95.96% 95.95% -0.02%
==========================================
Files 366 366
Lines 53593 53619 +26
==========================================
+ Hits 51433 51450 +17
- Misses 2160 2169 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Pull Request Test Coverage Report for Build 9498919442Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Yes, it looks like you are correct. Good point. I'm torn on how I feel about this, but I'm leaning towards not wanting this added for a couple reasons:
The overall operation could be simplified to:
Of course I am not the only maintainer of Satpy so I'd like to hear what some of the others think (@pytroll/satpy-core). |
I understand. I was not aware of the
Good point. Or maybe that's too specific, I'm quite new to Pytroll so I lack experience on this project! |
I agree with @djhoese that adding a new method isn't so nice, in particular because that class is already quite bloated. In the long run, I believe we will have something based off datatree and thus it would be best to have such operations (aggregation, decimation, etc) @djhoese we could also start having accessors to the scene object already now, and just make sure they are forward-compatible with datatree, what do you think? |
Yes, I'm ok with have an accessor like interface on the Scene or creating an xarray accessor. However, there is the same bloat issue if this method were added there. |
The accessor I mentioned would be one of many, so that we can separate concerns a bit more. Eg one for spatial transformations (resizing, aggregation, resampling, etc), one for creating composites, etc. Hopefully it wouldn't be so bloated then... |
We should maybe move this discussion to an issue. At some point accessors aren't the right approach and become bloat themselves. A more traditional separate set of functions or classes might be more obvious. |
yes |
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.
LGTM.
I'm ok with merging this, but what is the consensus here? Should we just add to the documentation instead? |
I'm ok with not adding another method to the
Maybe you have a better idea ? |
What about a new section after this one: https://satpy.readthedocs.io/en/latest/resample.html#create-custom-area-definition Something like "Create reduced data area" or...ugh that's a bad section title. Something better than this that isn't too long/wordy. |
18c5600
to
0243a60
Compare
Does this kind of example suits you ? |
Pull Request Test Coverage Report for Build 9740461782Details
💛 - Coveralls |
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.
Some comments, but otherwise this seems pretty good.
satpy/resample.py
Outdated
Sometimes you may want to create a small image with fixed size in pixels. | ||
For example, to create an image of (x, y) pixels : | ||
|
||
>>> small_scn = scn.resample(scn.finest_area().copy(height=y, width=x), ...) |
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.
It may be worth mentioning that this won't always work with native resampling if it isn't a factor of the original and/or show resampler="nearest"
in the code just to suggest that the resampler should be specified.
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.
Yes i'm adding this in the example to be clearer
does this changes suits you ? (some tests don't pass, but I don't think they are relative to my modifications as... i'm only modifying some comments) FAILED satpy/tests/test_modifiers.py::TestPSPRayleighReflectance::test_rayleigh_corrector[B01-wavelength0-1000-rayleigh_only-70-95-1-41.540239-exp_unique0] - tarfile.ReadError: file could not be opened successfully |
2824071
to
79d0519
Compare
correction : after rebase with main, no more unsuccessful checks |
Pull Request Test Coverage Report for Build 9944227638Details
💛 - Coveralls |
3d8bb58
to
b0b70b9
Compare
b0b70b9
to
40b8ebe
Compare
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.
My warning got a little bigger than I expected, but I think it is more clear. Maybe I should have just linked to the information about the native resampler... 🤔
Of course the native resampler documentation doesn't mention this 🤦♂️ https://satpy.readthedocs.io/en/stable/api/satpy.resample.html#satpy.resample.NativeResampler |
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.
LGTM
Adding a
resize
method in the Scene class, to resize dataset in the resolution wanted.You specify a size (x, y) in pixels, and resample is done.
This make it people able to easily resize a scene, for example creating a small image to see it faster, when you don't need a full resolution image.
Scene.show
#368AUTHORS.md
if not there alreadyPlease let me know if something is missing, or if I should add something else