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

Mask composites using cloud products #954

Closed
jkotro opened this issue Oct 28, 2019 · 2 comments · Fixed by #982
Closed

Mask composites using cloud products #954

jkotro opened this issue Oct 28, 2019 · 2 comments · Fixed by #982
Assignees
Labels
component:compositors enhancement code enhancements, features, improvements PCW Pytroll Contributors' Week

Comments

@jkotro
Copy link
Contributor

jkotro commented Oct 28, 2019

Feature Request

I would like to use NWCSAF GEO CMA/CT data to mask out clear sky areas e.g. from IR10.8 channel. This composite could be overlaid top of background image to create simple cloud product. See below example images.

Describe the solution you'd like
I would like to configure masked composites like all other composites are now configured.

Describe any changes to existing user workflow
None.
Additional context
This could be done in separate post processing script, but it would be nicer to have it in satpy.

Example images
IR 10.8:
IR_108

NWCSAF Cloud mask:
nwcsaf_cma

Result where clear sky (black in CMA) is masked out (IR 10.8 enhanced with 3D effect):
masked_ir_composite_example

@pnuu pnuu assigned pnuu and jkotro Oct 28, 2019
@pnuu pnuu added component:compositors enhancement code enhancements, features, improvements PCW Pytroll Contributors' Week labels Oct 28, 2019
@pnuu pnuu added this to Planned in PCW Copenhagen 2019 via automation Oct 28, 2019
@pnuu
Copy link
Member

pnuu commented Oct 29, 2019

This is something @jkotro and I have already discussed in length. The above description is where we started and shows one use case, but after a little thought we noticed that this can be generalized a lot. Brain dump follows.

The masking could be done:

  • by setting the masked areas to np.nan or user defined fill_value
  • by adding an alpha layer and adjusting the transparency

This last point would enable us to use "clear sky" and "broken clouds" in the above CMA case with different transparencies. And further, using CT (Cloud Type) it would be possible to set different transparencies for different cloud types.

The StaticImageCompositor is a good starting point for this new compositor:

  • it uses satpy.Scene to read another file
  • it has an example how to handle configuration of the "external" files

For this particular case, the static filename isn't enough, so the filename config item would need to have a trollsift filename pattern that would be then composed using the metadata from the initial Scene. The gotcha here is that the cloud products come sometime after the actual satellite data, so the real-time production needs to handle this some way. Maybe make it configurable in which way the composite is created?

  • create Scene with the satellite data, and read the mask data based on that
  • create Scene with mask data and then read corresponding satellite data

The composite configuration could look something like this:

  cma_masked_ir:
    standard_name: cma_masked_ir
    compositor: !!python/name:satpy.composites.MaskingCompositor
      prerequisites:
        - IR_108
      mask_file_pattern: "/path/to/{start_time:%Y%m%d%H%M}_mask_of_some_kind.png}"
      mask_reader: generic_image
      mask_settings:
        transparency:
          # mask value - transparency-% pairs
          - 0: 100.0
          - 1: 75.0

We can continue iterating from this.

@pnuu
Copy link
Member

pnuu commented Nov 25, 2019

Another thought::

scn = Scene(filenames={'level1_reader': list_of_l1_filenames, 'cloud_product_reader': list_of_l2_cloud_product_filenames})
scn.load(['cma_masked_ir'])
  • all the required data would be loaded at the same time
  • the dependency tree might not support this
  • trollflow2 doesn't support this

@pnuu pnuu moved this from Planned to In progress in PCW Copenhagen 2019 Nov 27, 2019
@pnuu pnuu moved this from In progress to Needs review in PCW Copenhagen 2019 Dec 10, 2019
PCW Copenhagen 2019 automation moved this from Needs review to Done Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:compositors enhancement code enhancements, features, improvements PCW Pytroll Contributors' Week
Projects
Development

Successfully merging a pull request may close this issue.

2 participants