Refactor Simple Convective Aggregation Index (SCAI)#42
Refactor Simple Convective Aggregation Index (SCAI)#42leifdenby merged 12 commits intocloudsci:masterfrom
Conversation
Currently have two implementations that aren't consistent. One based on cloudmetrics original code and one based on implementation in typhon package. Neither give the values published in Tobin et al
…g a pixel size of 55. Added support for empty input files (returns nan), completed docstring, and removed prints. scai2 still needs fixing (can it be removed?).
…f SCAI is correct
|
I think I have gotten the testing working here too, it is in this branch. It needed the correct pixel size (in km) to function properly. The examples still don't correspond to Tobin et al. (2012), but they do correspond to White et al. (2018) now. There is still a second function in |
|
On a semi-related note: There are several metrics whose results assume a unit of size in "pixels" at the moment (e.g. most object-based metrics). We might need to consider offering the option of giving those physical units (like km). I had already started thinking about that a while ago (see #1), but never got around to fixing it. I'd be curious to hear what you think, @leifdenby! |
Thank you!
Yes, I've been thinking about that too. I couldn't work out from the definition of SCAI if it's possible for the pixel resolution to somehow be factored out (so that SCAI for different choices of resolution are simply related), but it doesn't seem to be (even though the number itself is non-dimensional). I like the way you've made the default be People tend to just look at relative SCAI values no and not absolute values, right? Or rather: do you know how one should compare SCAI values for two masks with different resolution but the same data? I.e. how would we get the following masks to have the same SCAI values? (at least my intuition says that the should have the same SCAI value, but maybe I'm wrong...) I'm going to add a test for this and see what it gives :D |
|
@martinjanssens I've added a test for resolution-doubling and I'm confused because to the same SCAI value it seems to be opposite to what I'd intuitively expect. In the example where I've created a zoomed copy of the mask (so that each pixel in the zoomed example is half the size of that in the original) I appear to have to double the resolution, not halve it, to get the same SCAI value. 3d14538#diff-82f87aac44e8909eeb356deac9900ee3788adb946231ccaa4a46a53e8f14f8c3R41 I'm a I being an idiot? |
|
Great, I'm really happy SCAI has you confused, it has had me confused since I first looked at it! Thanks a bunch for adding this resolution sensitivity test. I think what's going on with the resolution doubling is the following. If I understand the authors' thought process correctly, SCAI has two components,
To me, it seems like the issue here is with the formulation of |
Thanks for this detailed explanation @martinjanssens ! My gut feel is that we should keep our implementation as close to what was published as possible, and add a note to indicate that SCAI isn't resolution independent. That's what I've done and I've also added the same note in the test. Could you have a look and let me know what you think? Thank you! |
martinjanssens
left a comment
There was a problem hiding this comment.
I like this way of solving it very much! I think leaving dx=1 as an optional input is a good solution too. I'm happy to have this merged - thanks for the critical thinking on this one :)
|
TODO
|
|
🥳 |
cloudmetrics.objects.metrics.scai.scai(object_labels=...)NOTE: example from Figure 4a in White et all (COP) is different from example from Figure 2a - looks like the authors copied the example incorrectly.