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

MultiScene.blend(blend_function=timeseries) results in incorrect start_time, end_time #1279

Closed
gerritholl opened this issue Jul 29, 2020 · 4 comments

Comments

@gerritholl
Copy link
Member

Describe the bug

When creating a timeseries using MultiScene.blend(blend_function=timeseries), the start_time and end_time attributes of the datasets in the resulting Scene object are incorrect.

To Reproduce

import satpy
import satpy.utils
satpy.utils.debug_on()
import glob

abi_dir = "/data/gholl/cache/fogtools/abi/2020/04/13/"
abi_glob = f"00/C10/OR_ABI-L1b-RadC-M6C*_G16_s2020104*_e*_c*.nc"
abi_files = glob.glob(abi_dir + abi_glob)

ms = satpy.MultiScene.from_files(
        abi_files,
        reader="abi_l1b")
ms.load(["C10"])
print(ms.scenes[0]["C10"].attrs["start_time"], ms.scenes[-1]["C10"].attrs["end_time"])
sc = ms.blend(blend_function=satpy.multiscene.timeseries)
print(sc["C10"].attrs["start_time"], sc["C10"].attrs["end_time"])

Expected behavior

I expect the output for the two print expressions to be identical.

Actual results

The output of the two print expressions is:

2020-04-13 00:01:13.700000 2020-04-13 00:58:52.100000
2020-04-13 00:28:43.700001 2020-04-13 00:31:22.133333
Full output of test run
[DEBUG: 2020-07-29 18:24:57 : satpy.readers] Reading ['/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/etc/readers/abi_l1b.yaml', '/home/gholl/checkouts/satpy/satpy/etc/readers/abi_l1b.yaml']
[DEBUG: 2020-07-29 18:24:57 : satpy.multiscene] Forcing iteration of generator-like object of Scenes
[DEBUG: 2020-07-29 18:24:57 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/home/gholl/checkouts/satpy/satpy/etc/'
[DEBUG: 2020-07-29 18:24:57 : satpy.readers] Reading ['/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/etc/readers/abi_l1b.yaml', '/home/gholl/checkouts/satpy/satpy/etc/readers/abi_l1b.yaml']
[DEBUG: 2020-07-29 18:24:57 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/data/gholl/cache/fogtools/abi/2020/04/13/00/C10/OR_ABI-L1b-RadC-M6C10_G16_s20201040001137_e20201040003522_c20201040003595.nc']
[DEBUG: 2020-07-29 18:24:58 : satpy.composites] Looking for composites config file abi.yaml
[DEBUG: 2020-07-29 18:24:58 : satpy.composites] Looking for composites config file visir.yaml
/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/pyproj/crs/crs.py:543: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
  proj_string = self.to_proj4()
[DEBUG: 2020-07-29 18:24:58 : satpy.readers.abi_l1b] Reading in get_dataset C10.
[DEBUG: 2020-07-29 18:24:58 : satpy.readers.abi_l1b] Calibrating to brightness temperatures
[DEBUG: 2020-07-29 18:24:58 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/home/gholl/checkouts/satpy/satpy/etc/'
[DEBUG: 2020-07-29 18:24:58 : satpy.readers] Reading ['/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/etc/readers/abi_l1b.yaml', '/home/gholl/checkouts/satpy/satpy/etc/readers/abi_l1b.yaml']
[DEBUG: 2020-07-29 18:24:58 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/data/gholl/cache/fogtools/abi/2020/04/13/00/C10/OR_ABI-L1b-RadC-M6C10_G16_s20201040006137_e20201040008522_c20201040008591.nc']
[DEBUG: 2020-07-29 18:24:58 : satpy.composites] Looking for composites config file abi.yaml
[DEBUG: 2020-07-29 18:24:58 : satpy.composites] Looking for composites config file visir.yaml
/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/pyproj/crs/crs.py:543: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
  proj_string = self.to_proj4()
[DEBUG: 2020-07-29 18:24:58 : satpy.readers.abi_l1b] Reading in get_dataset C10.
[DEBUG: 2020-07-29 18:24:58 : satpy.readers.abi_l1b] Calibrating to brightness temperatures
[DEBUG: 2020-07-29 18:24:58 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/home/gholl/checkouts/satpy/satpy/etc/'
[DEBUG: 2020-07-29 18:24:58 : satpy.readers] Reading ['/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/etc/readers/abi_l1b.yaml', '/home/gholl/checkouts/satpy/satpy/etc/readers/abi_l1b.yaml']
[DEBUG: 2020-07-29 18:24:58 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/data/gholl/cache/fogtools/abi/2020/04/13/00/C10/OR_ABI-L1b-RadC-M6C10_G16_s20201040011137_e20201040013521_c20201040013597.nc']
[DEBUG: 2020-07-29 18:24:58 : satpy.composites] Looking for composites config file abi.yaml
[DEBUG: 2020-07-29 18:24:58 : satpy.composites] Looking for composites config file visir.yaml
/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/pyproj/crs/crs.py:543: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
  proj_string = self.to_proj4()
[DEBUG: 2020-07-29 18:24:58 : satpy.readers.abi_l1b] Reading in get_dataset C10.
[DEBUG: 2020-07-29 18:24:58 : satpy.readers.abi_l1b] Calibrating to brightness temperatures
[DEBUG: 2020-07-29 18:24:58 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/home/gholl/checkouts/satpy/satpy/etc/'
[DEBUG: 2020-07-29 18:24:58 : satpy.readers] Reading ['/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/etc/readers/abi_l1b.yaml', '/home/gholl/checkouts/satpy/satpy/etc/readers/abi_l1b.yaml']
[DEBUG: 2020-07-29 18:24:58 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/data/gholl/cache/fogtools/abi/2020/04/13/00/C10/OR_ABI-L1b-RadC-M6C10_G16_s20201040016137_e20201040018521_c20201040018577.nc']
[DEBUG: 2020-07-29 18:24:58 : satpy.composites] Looking for composites config file abi.yaml
[DEBUG: 2020-07-29 18:24:59 : satpy.composites] Looking for composites config file visir.yaml
/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/pyproj/crs/crs.py:543: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
  proj_string = self.to_proj4()
[DEBUG: 2020-07-29 18:24:59 : satpy.readers.abi_l1b] Reading in get_dataset C10.
[DEBUG: 2020-07-29 18:24:59 : satpy.readers.abi_l1b] Calibrating to brightness temperatures
[DEBUG: 2020-07-29 18:24:59 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/home/gholl/checkouts/satpy/satpy/etc/'
[DEBUG: 2020-07-29 18:24:59 : satpy.readers] Reading ['/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/etc/readers/abi_l1b.yaml', '/home/gholl/checkouts/satpy/satpy/etc/readers/abi_l1b.yaml']
[DEBUG: 2020-07-29 18:24:59 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/data/gholl/cache/fogtools/abi/2020/04/13/00/C10/OR_ABI-L1b-RadC-M6C10_G16_s20201040021137_e20201040023521_c20201040024042.nc']
[DEBUG: 2020-07-29 18:24:59 : satpy.composites] Looking for composites config file abi.yaml
[DEBUG: 2020-07-29 18:24:59 : satpy.composites] Looking for composites config file visir.yaml
/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/pyproj/crs/crs.py:543: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
  proj_string = self.to_proj4()
[DEBUG: 2020-07-29 18:24:59 : satpy.readers.abi_l1b] Reading in get_dataset C10.
[DEBUG: 2020-07-29 18:24:59 : satpy.readers.abi_l1b] Calibrating to brightness temperatures
[DEBUG: 2020-07-29 18:24:59 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/home/gholl/checkouts/satpy/satpy/etc/'
[DEBUG: 2020-07-29 18:24:59 : satpy.readers] Reading ['/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/etc/readers/abi_l1b.yaml', '/home/gholl/checkouts/satpy/satpy/etc/readers/abi_l1b.yaml']
[DEBUG: 2020-07-29 18:24:59 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/data/gholl/cache/fogtools/abi/2020/04/13/00/C10/OR_ABI-L1b-RadC-M6C10_G16_s20201040026137_e20201040028522_c20201040029010.nc']
[DEBUG: 2020-07-29 18:24:59 : satpy.composites] Looking for composites config file abi.yaml
[DEBUG: 2020-07-29 18:24:59 : satpy.composites] Looking for composites config file visir.yaml
/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/pyproj/crs/crs.py:543: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
  proj_string = self.to_proj4()
[DEBUG: 2020-07-29 18:24:59 : satpy.readers.abi_l1b] Reading in get_dataset C10.
[DEBUG: 2020-07-29 18:24:59 : satpy.readers.abi_l1b] Calibrating to brightness temperatures
[DEBUG: 2020-07-29 18:24:59 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/home/gholl/checkouts/satpy/satpy/etc/'
[DEBUG: 2020-07-29 18:24:59 : satpy.readers] Reading ['/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/etc/readers/abi_l1b.yaml', '/home/gholl/checkouts/satpy/satpy/etc/readers/abi_l1b.yaml']
[DEBUG: 2020-07-29 18:24:59 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/data/gholl/cache/fogtools/abi/2020/04/13/00/C10/OR_ABI-L1b-RadC-M6C10_G16_s20201040031137_e20201040033521_c20201040033599.nc']
[DEBUG: 2020-07-29 18:24:59 : satpy.composites] Looking for composites config file abi.yaml
[DEBUG: 2020-07-29 18:25:00 : satpy.composites] Looking for composites config file visir.yaml
/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/pyproj/crs/crs.py:543: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
  proj_string = self.to_proj4()
[DEBUG: 2020-07-29 18:25:00 : satpy.readers.abi_l1b] Reading in get_dataset C10.
[DEBUG: 2020-07-29 18:25:00 : satpy.readers.abi_l1b] Calibrating to brightness temperatures
[DEBUG: 2020-07-29 18:25:00 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/home/gholl/checkouts/satpy/satpy/etc/'
[DEBUG: 2020-07-29 18:25:00 : satpy.readers] Reading ['/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/etc/readers/abi_l1b.yaml', '/home/gholl/checkouts/satpy/satpy/etc/readers/abi_l1b.yaml']
[DEBUG: 2020-07-29 18:25:00 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/data/gholl/cache/fogtools/abi/2020/04/13/00/C10/OR_ABI-L1b-RadC-M6C10_G16_s20201040036137_e20201040038521_c20201040038582.nc']
[DEBUG: 2020-07-29 18:25:00 : satpy.composites] Looking for composites config file abi.yaml
[DEBUG: 2020-07-29 18:25:00 : satpy.composites] Looking for composites config file visir.yaml
/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/pyproj/crs/crs.py:543: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
  proj_string = self.to_proj4()
[DEBUG: 2020-07-29 18:25:00 : satpy.readers.abi_l1b] Reading in get_dataset C10.
[DEBUG: 2020-07-29 18:25:00 : satpy.readers.abi_l1b] Calibrating to brightness temperatures
[DEBUG: 2020-07-29 18:25:00 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/home/gholl/checkouts/satpy/satpy/etc/'
[DEBUG: 2020-07-29 18:25:00 : satpy.readers] Reading ['/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/etc/readers/abi_l1b.yaml', '/home/gholl/checkouts/satpy/satpy/etc/readers/abi_l1b.yaml']
[DEBUG: 2020-07-29 18:25:00 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/data/gholl/cache/fogtools/abi/2020/04/13/00/C10/OR_ABI-L1b-RadC-M6C10_G16_s20201040041137_e20201040043521_c20201040044010.nc']
[DEBUG: 2020-07-29 18:25:00 : satpy.composites] Looking for composites config file abi.yaml
[DEBUG: 2020-07-29 18:25:00 : satpy.composites] Looking for composites config file visir.yaml
/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/pyproj/crs/crs.py:543: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
  proj_string = self.to_proj4()
[DEBUG: 2020-07-29 18:25:00 : satpy.readers.abi_l1b] Reading in get_dataset C10.
[DEBUG: 2020-07-29 18:25:00 : satpy.readers.abi_l1b] Calibrating to brightness temperatures
[DEBUG: 2020-07-29 18:25:00 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/home/gholl/checkouts/satpy/satpy/etc/'
[DEBUG: 2020-07-29 18:25:00 : satpy.readers] Reading ['/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/etc/readers/abi_l1b.yaml', '/home/gholl/checkouts/satpy/satpy/etc/readers/abi_l1b.yaml']
[DEBUG: 2020-07-29 18:25:00 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/data/gholl/cache/fogtools/abi/2020/04/13/00/C10/OR_ABI-L1b-RadC-M6C10_G16_s20201040046137_e20201040048522_c20201040049015.nc']
[DEBUG: 2020-07-29 18:25:00 : satpy.composites] Looking for composites config file abi.yaml
[DEBUG: 2020-07-29 18:25:01 : satpy.composites] Looking for composites config file visir.yaml
/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/pyproj/crs/crs.py:543: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
  proj_string = self.to_proj4()
[DEBUG: 2020-07-29 18:25:01 : satpy.readers.abi_l1b] Reading in get_dataset C10.
[DEBUG: 2020-07-29 18:25:01 : satpy.readers.abi_l1b] Calibrating to brightness temperatures
[DEBUG: 2020-07-29 18:25:01 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/home/gholl/checkouts/satpy/satpy/etc/'
[DEBUG: 2020-07-29 18:25:01 : satpy.readers] Reading ['/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/etc/readers/abi_l1b.yaml', '/home/gholl/checkouts/satpy/satpy/etc/readers/abi_l1b.yaml']
[DEBUG: 2020-07-29 18:25:01 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/data/gholl/cache/fogtools/abi/2020/04/13/00/C10/OR_ABI-L1b-RadC-M6C10_G16_s20201040051137_e20201040053521_c20201040054005.nc']
[DEBUG: 2020-07-29 18:25:01 : satpy.composites] Looking for composites config file abi.yaml
[DEBUG: 2020-07-29 18:25:01 : satpy.composites] Looking for composites config file visir.yaml
/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/pyproj/crs/crs.py:543: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
  proj_string = self.to_proj4()
[DEBUG: 2020-07-29 18:25:01 : satpy.readers.abi_l1b] Reading in get_dataset C10.
[DEBUG: 2020-07-29 18:25:01 : satpy.readers.abi_l1b] Calibrating to brightness temperatures
[DEBUG: 2020-07-29 18:25:01 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/home/gholl/checkouts/satpy/satpy/etc/'
[DEBUG: 2020-07-29 18:25:01 : satpy.readers] Reading ['/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/etc/readers/abi_l1b.yaml', '/home/gholl/checkouts/satpy/satpy/etc/readers/abi_l1b.yaml']
[DEBUG: 2020-07-29 18:25:01 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/data/gholl/cache/fogtools/abi/2020/04/13/00/C10/OR_ABI-L1b-RadC-M6C10_G16_s20201040056137_e20201040058521_c20201040059013.nc']
[DEBUG: 2020-07-29 18:25:01 : satpy.composites] Looking for composites config file abi.yaml
[DEBUG: 2020-07-29 18:25:01 : satpy.composites] Looking for composites config file visir.yaml
/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/pyproj/crs/crs.py:543: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
  proj_string = self.to_proj4()
[DEBUG: 2020-07-29 18:25:01 : satpy.readers.abi_l1b] Reading in get_dataset C10.
[DEBUG: 2020-07-29 18:25:01 : satpy.readers.abi_l1b] Calibrating to brightness temperatures
2020-04-13 00:01:13.700000 2020-04-13 00:58:52.100000
[DEBUG: 2020-07-29 18:25:01 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/home/gholl/checkouts/satpy/satpy/etc/'
2020-04-13 00:28:43.700001 2020-04-13 00:31:22.133333

Environment Info:

  • OS: Linux
  • Satpy Version: 0.22.1.dev129+g1ddbdb3d
  • PyResample Version: 1.16.0+5.gb84acad

Additional context
Also tested with #1269 and #1088, the problem is the same.

@djhoese
Copy link
Member

djhoese commented Jul 29, 2020

Related by @zxdawn #1173 and #1246
And I thought there was another one somewhere for adding better support for start/end time to be the min/max instead of the average (which I think is what's happening here).

@djhoese
Copy link
Member

djhoese commented Jul 29, 2020

Here it is #1174

@gerritholl
Copy link
Member Author

Oh, right. I didn't see that one, that probably makes this a duplicate as I suppose combine_metadata is used under the hood here.

@djhoese
Copy link
Member

djhoese commented Jul 29, 2020

Yeah here it is:

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

Let's close this as a duplicate of #1174 then.

@djhoese djhoese closed this as completed Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants