-
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 a blend method to create temporal RGB from MultiScene #2488
Changes from 7 commits
6d8eed7
72ccf1f
3c48c53
ef355b4
02b971c
652e325
6c41a99
1890bb2
ec911db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""Functions and classes related to MultiScene functionality.""" | ||
|
||
from ._blend_funcs import stack, timeseries # noqa | ||
from ._blend_funcs import stack, temporal_rgb, timeseries # noqa | ||
from ._multiscene import MultiScene # noqa |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,3 +178,20 @@ def timeseries(datasets): | |
res = xr.concat(expanded_ds, dim="time") | ||
res.attrs = combine_metadata(*[x.attrs for x in expanded_ds]) | ||
return res | ||
|
||
|
||
def temporal_rgb( | ||
data_arrays: Sequence[xr.DataArray], | ||
) -> xr.DataArray: | ||
"""Combine a series of datasets as a temporal RGB. | ||
|
||
The first dataset is used as the Red component of the new composite, the second as Green and the third as Blue. | ||
All the other datasets are discarded. | ||
""" | ||
from satpy.composites import GenericCompositor | ||
|
||
compositor = GenericCompositor("temporal_composite") | ||
composite = compositor((data_arrays[0], data_arrays[1], data_arrays[2])) | ||
Comment on lines
+193
to
+194
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there is time metadata available, this would probably fail with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any idea which data has that so I could test? SEVIRI HRIT and AVHRR L1b AAPP worked. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think in a lot of cases we started removing the time metadata in the readers because it was so inconsistent. I could be completely misremembering though. |
||
composite.attrs = data_arrays[2].attrs | ||
|
||
return composite |
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.
GenericCompositor
removes units and calibration information, which we probably don't want if we produce an RGB from three times the same channel. MaybeGenericCompositor
contains other (implicit) assumptions that make it not optimal for temporal composites.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, good point. GenericCompositor is really "generic image compositor" so it assumes things no longer represent "real physical data" anymore.
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.
Units don't make sense for the returned RGB, so that's fine.
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.
Why would units not make sense if I combine three times HRV or three times 10.8 µm?
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.
As this is creating an RGB, we are already implicitely renaming the time dimension with
bands
, so I get we already moved out of the scientific realm to move into the imaging one.