Plot one masked field over seviri IR108

36 views
Skip to first unread message

Thanasis Karagiannidis

unread,
Dec 28, 2021, 5:25:25 AM12/28/21
to pyt...@googlegroups.com

Dear all

 

I have the following problem: I want to overlay a masked field (eg seviri WV6.2-IR10.8) on the IR108 field. I attach an older image created with cartopy as an example. I thought that the masking compositor would do the trick, but obviously I do something wrong. So far I have done the following:

in the composites/seviri.yaml

 

  deepconvection:

    compositor: !!python/name:satpy.composites.DifferenceCompositor

    prerequisites:

      - WV_062

      - IR_108

    standard_name: deepconvection

 

  deepconvection_masked:

    compositor: !!python/name:satpy.composites.MaskingCompositor

    conditions:

      - method: less

        value: -4

        transparency: 100

    prerequisites:

      - deepconvection

      - deepconvection

    standard_name: deepconvection_masked

 

  ir108_deepconvection:

    compositor: !!python/name:satpy.composites.GenericCompositor

    prerequisites:

      - grey_ir108_clouds

    compositor: !!python/name:satpy.composites.GenericCompositor

    prerequisites:

      - deepconvection_masked

    standard_name: ir108_deepconvection

 

 

and in enchancement/generic.yaml

 

  deepconvection_masked:

    standard_name: deepconvection_masked

    operations:

      - name: colorize

        method: !!python/name:satpy.enhancements.colorize

        kwargs:

          palettes:

            - {colors: rdylbu, min_value: -4, max_value: 4}

 

  ir108_deepconvection:

    standard_name: ir108_deepconvection

    operations:

      - name: colorize

        method: !!python/name:satpy.enhancements.colorize

        kwargs:

          palettes:

            - {colors: greys, min_value: 253.15, max_value: 303.15}

    operations:

      - name: colorize

        method: !!python/name:satpy.enhancements.colorize

        kwargs:

          palettes:

            - {colors: spectral, min_value: -4, max_value: 4}

 

 

Overall, the masking seems to work well but I have trouble applying the overlay of the two fields. Only one of the two fields (the last one) is plotted. I attach an image as an example.

 

Any help would be appreciated.

 

Sakis

DC1.png
DC2.png

David Hoese

unread,
Dec 30, 2021, 11:26:14 AM12/30/21
to pyt...@googlegroups.com
Hi Sakis,

Sorry for the late reply. Most of the maintainers are on holiday this
week. The one thing that stands out immediately is this portion of your
compositor config:

ir108_deepconvection:

compositor: !!python/name:satpy.composites.GenericCompositor

prerequisites:

- grey_ir108_clouds

compositor: !!python/name:satpy.composites.GenericCompositor

prerequisites:

- deepconvection_masked

standard_name: ir108_deepconvection


What are you trying to say here? This looks like one composite
(`ir108_deepconvection`) with two separate compositor definitions (there
should never be more than one compositor or prerequisites entry).

Dave

On 12/28/21 04:17, Thanasis Karagiannidis wrote:
> Dear all
>
> I have the following problem: I want to overlay a masked field (eg
> seviri WV6.2-IR10.8) on the IR108 field. I attach an older image created
> with cartopy as an example. I thought that the masking compositor would
> do the trick, but obviously I do something wrong. So far I have done the
> following:
>
> _in the composites/seviri.yaml_
>
> deepconvection:
>
> compositor: !!python/name:satpy.composites.DifferenceCompositor
>
> prerequisites:
>
> - WV_062
>
> - IR_108
>
> standard_name: deepconvection
>
> deepconvection_masked:
>
> compositor: !!python/name:satpy.composites.MaskingCompositor
>
> conditions:
>
> - method: less
>
> value: -4
>
> transparency: 100
>
> prerequisites:
>
> - deepconvection
>
> - deepconvection
>
> standard_name: deepconvection_masked
>
> ir108_deepconvection:
>
> compositor: !!python/name:satpy.composites.GenericCompositor
>
> prerequisites:
>
> - grey_ir108_clouds
>
> compositor: !!python/name:satpy.composites.GenericCompositor
>
> prerequisites:
>
> - deepconvection_masked
>
> standard_name: ir108_deepconvection
>
> _and in enchancement/generic.yaml_
> --
> You received this message because you are subscribed to the Google
> Groups "pytroll" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to pytroll+u...@googlegroups.com
> <mailto:pytroll+u...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/pytroll/CAJ5NJ7yfiCde_T%2BezX%3D_hcmjnzzpqqawgqdAfmYAXx5Yr4QFYA%40mail.gmail.com
> <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7yfiCde_T%2BezX%3D_hcmjnzzpqqawgqdAfmYAXx5Yr4QFYA%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Thanasis Karagiannidis

unread,
Dec 31, 2021, 11:44:16 AM12/31/21
to pyt...@googlegroups.com
Dear Dave

No problem at all with the "late" reply. It is holidays!

My " ir108_deepconvection" composite is a failed attempt to solve the problem I described in the beginning of my e-mail and with the images I sent. Overlay one field on another filed.

In the "lower" field I have the IR108 and on top of it the WV62-IR108 difference (the later only if the value of that difference is over -4).

So I though: lets create the difference WV60-IR108 and mask it for values <-4 (done!) and then plot it on top of IR108. But I fail to successfully overlay the two fields. My " ir108_deepconvection"is that attempt.


Best regards and a happy new year!

Sakis

To unsubscribe from this group and stop receiving emails from it, send an email to pytroll+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/d9190c7d-3408-adda-fb77-f43ebf73da4f%40gmail.com.

David Hoese

unread,
Dec 31, 2021, 4:24:53 PM12/31/21
to pyt...@googlegroups.com
Sakis,

Ah ok. So composites can't really be configured that way. A composite
definition has one compositor and one set of prerequisites. What you are
looking for is a "BackgroundCompositor" which should put one image on
top of another. So for your case if you replace your
ir108_deepconvection composite with the following it should work:

ir108_deepconvection:
compositor: !!python/name:satpy.composites.BackgroundCompositor
prerequisites:
- deepconvection_masked
- grey_ir108_clouds
standard_name: ir108_deepconvection

This should make the "grey_ir108_clouds" the background and the
"deepconvection_masked" the foreground. You'll also need to update your
enhancement as they have the same mis-configuration (configuring
multiple enhancements in one enhancement section). You'll need to define
one enhancement for deepconvection_masked which you already have, then
one for grey_ir108_clouds, and then finally a simple one for the overall
ir108_deepconvection composite. So if you replace your
ir108_deepconvection enhancement with:

ir108_deepconvection:
standard_name: ir108_deepconvection
operations:
- name: crude_stretch
method: !!python/name:satpy.enhancements.stretch
kwargs:
palettes:
- {stretch: "crude", min_value: 0.0, max_value: 1.0}

Then it should work, but this assumes you have another section defined
for "grey_ir108_clouds" already. Let me know how it goes.

Dave
> <mailto:pytroll%2Bunsu...@googlegroups.com>
> > <mailto:pytroll+u...@googlegroups.com
> <mailto:pytroll%2Bunsu...@googlegroups.com>>.
> <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7yfiCde_T%2BezX%3D_hcmjnzzpqqawgqdAfmYAXx5Yr4QFYA%40mail.gmail.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7yfiCde_T%2BezX%3D_hcmjnzzpqqawgqdAfmYAXx5Yr4QFYA%40mail.gmail.com?utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "pytroll" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to pytroll+u...@googlegroups.com
> <mailto:pytroll%2Bunsu...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/pytroll/d9190c7d-3408-adda-fb77-f43ebf73da4f%40gmail.com
> <https://groups.google.com/d/msgid/pytroll/d9190c7d-3408-adda-fb77-f43ebf73da4f%40gmail.com>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "pytroll" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to pytroll+u...@googlegroups.com
> <mailto:pytroll+u...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/pytroll/CAJ5NJ7z1dSnFbLze%2B%3D16s1SUgoDjQNtW6CP36azqgwDqeq%2BsoA%40mail.gmail.com
> <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7z1dSnFbLze%2B%3D16s1SUgoDjQNtW6CP36azqgwDqeq%2BsoA%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Thanasis Karagiannidis

unread,
Jan 2, 2022, 3:34:08 AM1/2/22
to pyt...@googlegroups.com
Dear Dave and all, Happy New Year!

I didn't think that the background compositor could work that way. I had the impression that it only works with static images as background.

Your solution work just fine, with a small change. In the ir108_deepconvection enhancement I had to replace

         kwargs:
           palettes:
             - {stretch: "crude", min_value: 0.0, max_value: 1.0}

with

        kwargs:
          stretch: crude
          min_stretch: 0.0
          max_stretch: 1.0

Thank you very much for your help.

Best regards

Sakis

To unsubscribe from this group and stop receiving emails from it, send an email to pytroll+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/2d6a563f-4493-f509-d7a5-117d01e4d0ff%40gmail.com.

David Hoese

unread,
Jan 2, 2022, 3:42:18 PM1/2/22
to pyt...@googlegroups.com
Glad you got it working. And about the change on the enhancement, sorry
about that. That's what I get for copying and pasting. Let us know if
you have any other issues.

Dave
> >     <mailto:pytroll%2Bunsu...@googlegroups.com
> <mailto:pytroll%252Buns...@googlegroups.com>>
> >      > <mailto:pytroll+u...@googlegroups.com
> <mailto:pytroll%2Bunsu...@googlegroups.com>
> >     <mailto:pytroll%2Bunsu...@googlegroups.com
> <mailto:pytroll%252Buns...@googlegroups.com>>>.
> >      > To view this discussion on the web, visit
> >      >
> >
> https://groups.google.com/d/msgid/pytroll/CAJ5NJ7yfiCde_T%2BezX%3D_hcmjnzzpqqawgqdAfmYAXx5Yr4QFYA%40mail.gmail.com
> <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7yfiCde_T%2BezX%3D_hcmjnzzpqqawgqdAfmYAXx5Yr4QFYA%40mail.gmail.com>
> >
>  <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7yfiCde_T%2BezX%3D_hcmjnzzpqqawgqdAfmYAXx5Yr4QFYA%40mail.gmail.com <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7yfiCde_T%2BezX%3D_hcmjnzzpqqawgqdAfmYAXx5Yr4QFYA%40mail.gmail.com>>
> >
> >      >
> >
>  <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7yfiCde_T%2BezX%3D_hcmjnzzpqqawgqdAfmYAXx5Yr4QFYA%40mail.gmail.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7yfiCde_T%2BezX%3D_hcmjnzzpqqawgqdAfmYAXx5Yr4QFYA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> >
>  <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7yfiCde_T%2BezX%3D_hcmjnzzpqqawgqdAfmYAXx5Yr4QFYA%40mail.gmail.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7yfiCde_T%2BezX%3D_hcmjnzzpqqawgqdAfmYAXx5Yr4QFYA%40mail.gmail.com?utm_medium=email&utm_source=footer>>>.
> >
> >     --
> >     You received this message because you are subscribed to the
> Google
> >     Groups "pytroll" group.
> >     To unsubscribe from this group and stop receiving emails from it,
> >     send an email to pytroll+u...@googlegroups.com
> <mailto:pytroll%2Bunsu...@googlegroups.com>
> >     <mailto:pytroll%2Bunsu...@googlegroups.com
> <mailto:pytroll%252Buns...@googlegroups.com>>.
> >     To view this discussion on the web, visit
> >
> https://groups.google.com/d/msgid/pytroll/d9190c7d-3408-adda-fb77-f43ebf73da4f%40gmail.com
> <https://groups.google.com/d/msgid/pytroll/d9190c7d-3408-adda-fb77-f43ebf73da4f%40gmail.com>
> >
>  <https://groups.google.com/d/msgid/pytroll/d9190c7d-3408-adda-fb77-f43ebf73da4f%40gmail.com <https://groups.google.com/d/msgid/pytroll/d9190c7d-3408-adda-fb77-f43ebf73da4f%40gmail.com>>.
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "pytroll" group.
> > To unsubscribe from this group and stop receiving emails from it,
> send
> > an email to pytroll+u...@googlegroups.com
> <mailto:pytroll%2Bunsu...@googlegroups.com>
> > <mailto:pytroll+u...@googlegroups.com
> <mailto:pytroll%2Bunsu...@googlegroups.com>>.
> > To view this discussion on the web, visit
> >
> https://groups.google.com/d/msgid/pytroll/CAJ5NJ7z1dSnFbLze%2B%3D16s1SUgoDjQNtW6CP36azqgwDqeq%2BsoA%40mail.gmail.com
> <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7z1dSnFbLze%2B%3D16s1SUgoDjQNtW6CP36azqgwDqeq%2BsoA%40mail.gmail.com>
>
> >
> <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7z1dSnFbLze%2B%3D16s1SUgoDjQNtW6CP36azqgwDqeq%2BsoA%40mail.gmail.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7z1dSnFbLze%2B%3D16s1SUgoDjQNtW6CP36azqgwDqeq%2BsoA%40mail.gmail.com?utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "pytroll" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to pytroll+u...@googlegroups.com
> <mailto:pytroll%2Bunsu...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/pytroll/2d6a563f-4493-f509-d7a5-117d01e4d0ff%40gmail.com
> <https://groups.google.com/d/msgid/pytroll/2d6a563f-4493-f509-d7a5-117d01e4d0ff%40gmail.com>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "pytroll" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to pytroll+u...@googlegroups.com
> <mailto:pytroll+u...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/pytroll/CAJ5NJ7y0DRh9GJqqHyeEbQOVXzQ%3DfMud5xYGd50ee4UnyiEhTg%40mail.gmail.com
> <https://groups.google.com/d/msgid/pytroll/CAJ5NJ7y0DRh9GJqqHyeEbQOVXzQ%3DfMud5xYGd50ee4UnyiEhTg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages