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
Multiscene blend with weights #2275
Multiscene blend with weights #2275
Conversation
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…a bit Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
@djhoese Just a question. The stack function retains the attributes from the first dataset, but wouldn't it more intuitive to store the attributes from the last one in the stack, the on on top? I realize that can be debated, so if you had a particular reason for keeping the first I am absolutely fine. Just need to be clear what we do when creating/adapting the unittests. Don't think this aspect was tested before... |
Codecov Report
@@ Coverage Diff @@
## main #2275 +/- ##
==========================================
+ Coverage 94.64% 94.67% +0.03%
==========================================
Files 324 328 +4
Lines 48339 48544 +205
==========================================
+ Hits 45749 45960 +211
+ Misses 2590 2584 -6
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. |
@adybbroe This old PR of mine might be relevant here: #1157 The purpose of the PR was to compute the pixel size to enable blending of various datasets based on whichever had the smallest pixel size. I chose that method as, for example, in some cases GOES/ABI has a larger zenith angle but smaller pixel size than SEVIRI as ABI has a higher native pixel resolution. |
Oh, that's interesting! Didn't quite thought of that, might be useful also when blending AVHRR, MODIS and VIIRS (and eventually MetImage) for instance. I will have a look, but that PR was never merged, so work is "half" finished right? |
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.
A couple questions inline. Otherwise, regarding the attrs from the first DataArray being used...no probably no real reason that I can think of. I'm not sure I'm even the one who added that function originally. I could see there being a chance of performance differences in that I think the first Scene is always generated first (if Scenes were created via a generator), but I think once this blend function is called it is already a list (maybe?) so it might not matter. I'm open to changing it.
It was pretty much finished in terms of functionality, but I didn't persue it as Dave said it might not be suitable for satpy and I no longer needed the PR itself for my project. It's something I'd be interested in picking up though! |
…ove tests Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Looks good! |
I'm not sure I like the final stacked result of your first example better, but I see the usefulness. It is kind of amazing how much can be done just by throwing on some weights and/or masks. |
…olumn,line Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
@djhoese |
If it is the ones talking about "distributed" then it is probably the dask I am OK splitting the tests if you make it a |
@adybbroe @djhoese just for the record: I'm very interested in a kind of blending feature as developed and discussed here. In my version 4.0 distribution of PyTROLL/Satpy scripts for EUMETCast I have multi pass scripts for all LEO satellites available and even scripts for combined NOAA20/SNPP, MetopB/MetopC and Sen3A/Sen3B (ERR). That said being able to really blend and not just stack the data would be most welcome. See my latest benchmark here: https://groups.io/g/MSG-1/message/33860 |
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
… use of partial Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
I forgot this, should I try split the test functions as suggested. I can have a go, if that's all which you think is left? |
Co-authored-by: David Hoese <david.hoese@ssec.wisc.edu>
Co-authored-by: David Hoese <david.hoese@ssec.wisc.edu>
Co-authored-by: David Hoese <david.hoese@ssec.wisc.edu>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…atpy into multiscene_blend_with_weights
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…imes for the stack-weighted multiscene Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…ck function Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
@djhoese I have done a bit around the attributes and some minor refactoring and documentation. I have a feeling you will have an opinion. Maybe my new function should be Also, I think my section in the doc pages should be improved, but have to run for now. Otherwise I perhaps only have left to settle for the |
Are you saying you're not sure if the standard_name changes broke something? |
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.
Just some small changes. Otherwise this looks good assuming the standard_name thing isn't an issue.
Co-authored-by: David Hoese <david.hoese@ssec.wisc.edu>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…ctly Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…scene Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
@djhoese Perhaps you saw I reverted back on the |
Merge it and let's see what breaks. I'll let you click the button. |
This PR aims adding a way to blend several scenes (polar and geo cloud parameters is what we have in mind) using pixel weights. Weights could for instance simply be the satellite zenith angle (or rather
1/satz
) so that the pixel with the smallest satellite zenith angle is chosen from all scenes being blended. Weights could also be a comlex mixture of several parameters, like time, satellite zenith, retrieval uncertainty (if available) and so on.Example/pseudo code creating a multi scene of one geo (SEVIRI) and two polar (here AVHRR/3 from N18 and N19) remapping to a pre-defined area, and blending the NWCSAF cloudtype datasets by stacking with weighs. Here the weights are the inverse of the satellite-zenith angles: