satpy icon indicating copy to clipboard operation
satpy copied to clipboard

Fix seviri_l2_grib end_time property bug.

Open strandgren opened this issue 4 months ago • 10 comments

As described in #2942, the changes in https://github.com/pytroll/satpy/pull/2717 lead to the end_time property not working for SEVIRI data, since we now use the sub-satellite point to determine the scanning mode and thus the temporal resolution used to determine the end_time from the start_time (prior to https://github.com/pytroll/satpy/pull/2717 it was always set to 15 minutes, which is incorrect for RSS data). However, the self._ssp_lon attribute is only available after a dataset and its metadata have been loaded and thus an AttributeError was raised during Scene initialization. This was not covered by the unit test and a human error lead to the bug being unnoticed also when testing with real data.

This PR adapts the end_time property to return None if no dataset has been loaded, meaning that _ssp_lon is not available. As soon as a dataset has been loaded, both scn.end_time and scn[dataset].attrs['end_time'] will have valid and correct datetime.datetime objects. The unit test has been adapted to cover this bug.

  • [X] Closes #2942
  • [X] Tests adapted to capture this bug

strandgren avatar Oct 21 '24 08:10 strandgren