pytroll / trollflow2

Next generation Trollflow. Trollflow is for batch-processing satellite data using Satpy
https://trollflow2.readthedocs.org/
GNU General Public License v3.0
10 stars 15 forks source link

Decorate product with scene metadata #161

Closed nedelceo closed 1 year ago

nedelceo commented 2 years ago

Feature Request

Is your feature request related to a problem? Please describe. I would like to decorate image with start_time. This is example of my PL:

        M07_sun_corrected:
          productname: M07_sun_corrected
          formats:
            - format: png
              writer: simple_image
              decorate:  
                decorate: 
                  - text:
                      txt: f'{start_time:%Y%m%d_%H%M}'
                      align: 
                        top_bottom: top
                        left_right: right
                      font_size : 72
                      height': 100
                      bg_opacity: 127
                      bg: black
                      line: white

I tried some other variations of '{starttime:%Y%m%d%H%M}', f'{starttime:%Y%m%d%H%M}', {starttime:%Y%m%d%H%M}. But the start_time was never properly parsed. I always got image with text '{starttime:%Y%m%d%H%M}'.

Additional context @gerritholl noted on slack: satpy.MultiScene has a _format_decoration function, perhaps some functionality could be refactored out of there. See https://satpy.readthedocs.io/en/stable/multiscene.html#saving-frames-of-an-animation starting at "It is possible to add...". The desire to format decorations from trollflow2 is somehow analogous, so if adding this feature the code should probably be shared.