I expect check_sunlight_coverage to be successful.
Actual results
The plugin check_sunlight_coverage fails with KeyError:
Traceback (most recent call last):
File "/data/gholl/checkouts/protocode/mwe/trollflow2-keyerror-end-time.py", line 14, in <module>
check_sunlight_coverage(job)
File "/data/gholl/mambaforge/envs/py310/lib/python3.10/site-packages/trollflow2/plugins/__init__.py", line 597, in check_sunlight_coverage
end_time = scn_mda['end_time']
KeyError: 'end_time'
Environment Info:
Trollflow2 Version: v0.13.1
Satpy Version: v0.33.1-72-gb12cc5b3
Additional context
It works with Satpy v0.31.1, before https://github.com/pytroll/satpy/pull/1797 was merged. At the time, the scene attrs attribute for this case would have been {'sensor': {'seviri'}, 'start_time': datetime.datetime(2022, 2, 2, 13, 0), 'end_time': datetime.datetime(2022, 2, 2, 13, 15)}. With newer versions of Satpy, the scene attrs attribute is empty ({}).
Describe the bug
The trollflow2 plugin check_sunlight_coverage tries to combine information from the scene metadata with information from the posttroll message. Since https://github.com/pytroll/satpy/pull/1797 (specifically https://github.com/pytroll/satpy/pull/1797/commits/e05256994f7ef74b812ade158abc1a15c0f32018), scene metadata is no longer stored in a
.attrs
attribute such as trollflow2 expects, but rather in properties that calculate this information on-the-fly. Processing messages that do not explicitly contain anend_time
fails.To Reproduce
Expected behavior
I expect
check_sunlight_coverage
to be successful.Actual results
The plugin
check_sunlight_coverage
fails with KeyError:Environment Info:
Additional context
It works with Satpy v0.31.1, before https://github.com/pytroll/satpy/pull/1797 was merged. At the time, the scene
attrs
attribute for this case would have been{'sensor': {'seviri'}, 'start_time': datetime.datetime(2022, 2, 2, 13, 0), 'end_time': datetime.datetime(2022, 2, 2, 13, 15)}
. With newer versions of Satpy, the sceneattrs
attribute is empty ({}
).