Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scene.start_time computation fails for datasets/composites with start_time=None (and same for end_time) #2883

Open
ameraner opened this issue Aug 14, 2024 · 1 comment

Comments

@ameraner
Copy link
Member

ameraner commented Aug 14, 2024

Describe the bug
After #2737, the start_time of a StaticImageCompositor dataset are set to None if not available in the filename. This is ok per-se, but this causes the Scene.start_time computation to fail for composites with static images, since the Scene tries to compute the min of all datasets here:

return min(start_times)

The same applies to end_time

To Reproduce

filenames = glob('/tcenas/fbf/mtg/RollingBuffer/OPE/idpfi/FCI-L1/*FDHSI*__C_0030*')
scn = Scene(filenames=filenames, reader='fci_l1c_fdhsi')
scn.load(['geo_color'], upper_right_corner='NE')
print(scn.start_time)

Expected behavior

We would propose to handle None when trying to compute the Scene.start_time, e.g. with

return min([x for x in start_times if x is not None])

and for the end_time

return max([x for x in start_times if x is not None])

to get a sensible time.

Actual results

  File "/tcenas/home/andream/code/satpy_latest/satpy/satpy/scene.py", line 219, in start_time
    return min(start_times)
           ^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'NoneType' and 'datetime.datetime'
@djhoese
Copy link
Member

djhoese commented Aug 14, 2024

I think this was likely introduced recently when changes were made to the StaticImageCompositor and/or the generic_image reader where start_time was made optional (can be set to None). Looks like we missed a couple cases where start times are used.

PRs welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants