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

Wrong start_time, end_time attributes after MultiScene.blend(blend_function=timeseries) #2427

Closed
gerritholl opened this issue Mar 27, 2023 · 1 comment · Fixed by #2737
Closed

Comments

@gerritholl
Copy link
Collaborator

Describe the bug

After producing a scene with MultiScene.blend(blend_function=timeseries), the attributes start_time and/or end_time on the resulting Scene are wrong.

To Reproduce

import hdf5plugin
from glob import glob
from satpy.multiscene import MultiScene, timeseries
from satpy.utils import debug_on; debug_on()

ms = MultiScene.from_files(
        glob("/media/nas/x21308/MTG_test_data/2022_05_MTG_Testdata/RC010[012]/*BODY*.nc"),
        reader="fci_l1c_nc",
        group_keys=["repeat_cycle_in_day"])
channels = ["ir_105", "ir_133", "wv_63", "wv_73"]
ms.load(channels)
sc = ms.blend(blend_function=timeseries)
print(sc.start_time, sc.end_time)
print(ms.scenes[0].start_time, ms.scenes[-1].end_time)

Expected behavior

I expect as the final output from the print functions:

2017-09-20 16:30:08 2017-09-20 16:59:22
2017-09-20 16:30:08 2017-09-20 16:59:22

Actual results

The result of the print functions is:

2017-09-20 16:40:08 2017-09-20 16:49:22
2017-09-20 16:30:08 2017-09-20 16:59:22

Environment Info:

  • OS: openSUSE 15.3
  • Satpy Version: v0.41.1-18-gb92fe9ebb (current GitHub main)

Additional context

The attributes are also wrong on the individual datasets that have been blended.

@djhoese
Copy link
Member

djhoese commented Mar 27, 2023

@adybbroe and I had a conversation similar to this when he added his recent weighted blending. Right now the timeseries functionality uses combine_metadata which for some reason that I don't recall does not handle start/end time in any special way and only averages them.

Usage:

res.attrs = combine_metadata(*[x.attrs for x in expanded_ds])

Definition docstring:

the returned dictionary. By default any keys with the word 'time'
in them and consisting of datetime objects will be averaged. This
is to handle cases where data were observed at almost the same time
but not exactly. In the interest of time, lazy arrays are compared by

I think we need to update combine_metadata to min/max start/end times. @mraspaud @pnuu?

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

Successfully merging a pull request may close this issue.

2 participants