setting masked channels

45 views
Skip to first unread message

EliB

unread,
Mar 4, 2021, 4:26:00 AM3/4/21
to pytroll
Hi everybody,
I am here to ask your support for a product for the Italian weather service.
We are currently still using python2 with the old version of pytroll, and I am in the process of making the switch to satpy.
I'm having a lot of trouble replicating this product with satpy: it's an MSG4, IR108 (hrit l1b), with white clouds and a static background image.
I've managed to apply the static image, and to select the cloud layer of interest in white, but I'm having problems with the transparency mask which still appears too grey.
I also can't find a way to get a black frame as the basic background, instead of white.
Below I paste the configurations I used; I also attach the two images for comparison, the one with the name starting with MSG* is the one produced by the old configuration and the one starting with TEST* is the current result with satpy.

thanks a lot to anyone who wants to help me.

MSG_IR108_Globo_Colore_py_20210301_1030.JPGTEST1_IR108_Globo_Colore_202103011030.jpg

from /satpy/etc/composites/seviri.yaml
  IR108_Europa_bkg:
    compositor: !!python/name:satpy.composites.BackgroundCompositor
    standard_name: IR108_Europa_bkg
    prerequisites:
      - ir108_masked
      - backgr_static_2
 
 ir108_masked:
   compositor: !!python/name:satpy.composites.MaskingCompositor
   conditions:
   - method: greater
     value: 288
     transparency: 100
   - method: less
     value: 203.15
     transparency: 5
   prerequisites:
   - name: 'IR_108'
   - name: 'IR_108'
   standard_name: ir108_masked

  backgr_static_2:
    compositor: !!python/name:satpy.composites.StaticImageCompositor
    standard_name: backgr_static_2
    filename: /home/postelab/MSG/data/background/world.topo.bathy.200407.3x21600x10800.jpg
    area: world_plat_21600_10800

from /satpy/etc/enhancements/generic.yaml

  ir108_masked:
    standard_name: ir108_masked
    operations:
      - name: colorize
        method: !!python/name:satpy.enhancements.colorize
        kwargs:
          palettes:
            - {colors: greys, min_value: 208.15, max_value: 413.15}



Panu Lahtinen

unread,
Mar 4, 2021, 6:12:57 AM3/4/21
to pyt...@googlegroups.com
On 4.3.2021 11.26, EliB wrote:
> Hi everybody,

Hi!

> I've managed to apply the static image, and to select the cloud layer
> of interest in white, but I'm having problems with the transparency
> mask which still appears too grey.

The MaskingCompositor doesn't do any interpolation between the values
and transparencies you have set in the config. So if you'd like to have
more different levels of transparency, you'll need to add more
conditions between the two you now have. The conditions are applied in
the order they are listed, so take care in having them in a logical order.

> I also can't find a way to get a black frame as the basic background,
> instead of white.

Assuming you are using Satpy directly, you can add the `fill_value`
keyword argument when saving. To make the space black, do
`scn.save_datasets(..., fill_value=0)`.


P

--
Finnish Meteorological Institute
Erik Palménin aukio 1, P.O.Box 503, FIN-00101 Helsinki, Finland
Room: 4B15a, Phone: +358 50 380 3261

EliB

unread,
Mar 4, 2021, 8:44:09 AM3/4/21
to pytroll
OK, in the meantime thank you very much for the suggestions Paul, I will try to do more tests by adding conditions in the MaskingCompositor.

as for the black frame, I have already set that condition in my satpy, but it doesn't seem to change anything...
here after my string for saving the final image.

local_scene.save_datasets(filename='TEST_IR108_Globo_Colore_' + IR_GlCol.attrs['start_time'].strftime('%Y%m%d%H%M') + '.jpg',
                           base_dir=outdir,
                           writer='simple_image',
                           overlay = {'coast_dir': '/home/postelab/MSG/data/shapes',
                                      'overlays': {'coasts': my_coasts}},
                           decorate = {'decorate': my_deco},
                           fill_value=0
                          )
any other idea about this?

thanks again
Reply all
Reply to author
Forward
0 new messages