From 88c96ed6d4e281e429f8f129817353763c866d9d Mon Sep 17 00:00:00 2001 From: BENR0 Date: Wed, 12 Jun 2024 14:42:07 +0200 Subject: [PATCH 01/12] doc: move reader table to reading section --- doc/source/_static/main.js | 6 ++++-- doc/source/index.rst | 38 +++++--------------------------------- doc/source/reading.rst | 31 +++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 35 deletions(-) diff --git a/doc/source/_static/main.js b/doc/source/_static/main.js index b153beb2f3..0512d24aab 100644 --- a/doc/source/_static/main.js +++ b/doc/source/_static/main.js @@ -1,10 +1,12 @@ $(document).ready( function () { $('table.datatable').DataTable( { - "paging": false, + "paging": true, + "pageLength": 15, "layout": { 'topStart': 'info', 'topEnd': 'search', - 'bottomStart': null + 'bottomStart': null, + 'bottomEnd': 'paging' }, "order": [[0, 'asc']] } ); diff --git a/doc/source/index.rst b/doc/source/index.rst index b229c904ee..9c0e8f599e 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -7,11 +7,11 @@ remote-sensing earth-observing satellite instruments. Satpy provides users with readers that convert geophysical parameters from various file formats to the common Xarray :class:`~xarray.DataArray` and :class:`~xarray.Dataset` classes for easier interoperability with other -scientific python libraries. Satpy also provides interfaces for creating -RGB (Red/Green/Blue) images and other composite types by combining data -from multiple instrument bands or products. Various atmospheric corrections -and visual enhancements are provided for improving the usefulness and quality -of output images. Output data can be written to +scientific python libraries. For a full list of available readers see :ref:`reader_table`. +Satpy also provides interfaces for creating RGB (Red/Green/Blue) images and other +composite types by combining data from multiple instrument bands or products. +Various atmospheric corrections and visual enhancements are provided for +improving the usefulness and quality of output images. Output data can be written to multiple output file formats such as PNG, GeoTIFF, and CF standard NetCDF files. Satpy also allows users to resample data to geographic projected grids (areas). Satpy is maintained by the open source @@ -80,34 +80,6 @@ Documentation Release Notes Security Policy -.. _reader_table: - -.. include:: reader_table.rst - -.. _Status Description: -.. note:: - - Status description: - - Defunct - Most likely the reader is not functional. If it is there is a good chance of - bugs and/or performance problems (e.g. not ported to dask/xarray yet). Future - development is unclear. Users are encouraged to contribute (see section - :doc:`dev_guide/CONTRIBUTING` and/or get help on Slack or by opening a Github issue). - - Alpha - This denotes early development status. Reader is functional and implements some - or all of the nominal features. There might be bugs. Exactness of results is - not be guaranteed. Use at your own risk. - - Beta - This denotes final developement status. Reader is functional and implements all - nominal features. Results should be dependable but there might be bugs. Users - are actively encouraged to test and report bugs. - - Nominal - This denotes a finished status. Reader is functional and most likely no new - features will be introduced. It has been tested and there are no known bugs. Indices and tables ================== diff --git a/doc/source/reading.rst b/doc/source/reading.rst index b7264eeb6e..bcb1ef48fd 100644 --- a/doc/source/reading.rst +++ b/doc/source/reading.rst @@ -23,6 +23,37 @@ To return additional reader information use `available_readers(as_dict=True)`:: >>> from satpy import available_readers >>> available_readers() +.. _reader_table: +Reader Table +------------ + +.. include:: reader_table.rst + +.. _Status Description: +.. note:: + + Status description: + + Defunct + Most likely the reader is not functional. If it is there is a good chance of + bugs and/or performance problems (e.g. not ported to dask/xarray yet). Future + development is unclear. Users are encouraged to contribute (see section + :doc:`dev_guide/CONTRIBUTING` and/or get help on Slack or by opening a Github issue). + + Alpha + This denotes early development status. Reader is functional and implements some + or all of the nominal features. There might be bugs. Exactness of results is + not be guaranteed. Use at your own risk. + + Beta + This denotes final developement status. Reader is functional and implements all + nominal features. Results should be dependable but there might be bugs. Users + are actively encouraged to test and report bugs. + + Nominal + This denotes a finished status. Reader is functional and most likely no new + features will be introduced. It has been tested and there are no known bugs. + Filter loaded files =================== From dc30df4680f0b4bb82f7bf55284202ca1ee732ab Mon Sep 17 00:00:00 2001 From: BENR0 Date: Wed, 12 Jun 2024 15:50:15 +0200 Subject: [PATCH 02/12] add name to authors again --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 5f94be850c..733e9d572d 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -66,6 +66,7 @@ The following people have made contributions to this project: - [Lars Ørum Rasmussen (loerum)](https://github.com/loerum) - [Martin Raspaud (mraspaud)](https://github.com/mraspaud) - [William Roberts (wroberts4)](https://github.com/wroberts4) +- [Benjamin Rösner (BENR0)](https://github.com/BENR0) - [Pascale Roquet (roquetp)](https://github.com/roquetp) - [Kristian Rune Larsen](https://github.com/) - [RutgerK (RutgerK)](https://github.com/RutgerK) From 7306605787cfe3c292a56fec7ee72939c6627d76 Mon Sep 17 00:00:00 2001 From: BENR0 Date: Wed, 12 Jun 2024 16:02:58 +0200 Subject: [PATCH 03/12] fix: read the docs complaints --- doc/source/reading.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/source/reading.rst b/doc/source/reading.rst index bcb1ef48fd..42b4646018 100644 --- a/doc/source/reading.rst +++ b/doc/source/reading.rst @@ -23,7 +23,9 @@ To return additional reader information use `available_readers(as_dict=True)`:: >>> from satpy import available_readers >>> available_readers() + .. _reader_table: + Reader Table ------------ From 2f7cfcb23290030dd2bddc690da3642c1569b34b Mon Sep 17 00:00:00 2001 From: BENR0 Date: Wed, 12 Jun 2024 16:21:12 +0200 Subject: [PATCH 04/12] add info box where reader table used to be --- doc/source/index.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/source/index.rst b/doc/source/index.rst index 9c0e8f599e..66a069fcda 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -81,6 +81,11 @@ Documentation Security Policy +.. note:: + + Please note that the reader table that used to be placed here has moved to the "reading" + section here: :ref:`reader_table`. + Indices and tables ================== From b31209ec8fa42a3140b3df43c09998fb8e099b23 Mon Sep 17 00:00:00 2001 From: Martin Raspaud Date: Thu, 13 Jun 2024 13:59:20 +0200 Subject: [PATCH 05/12] Fix-uniqueness-of-hdf5-based-dask-arrays --- satpy/readers/hdf5_utils.py | 12 +++++++++++- satpy/tests/reader_tests/test_hdf5_utils.py | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/satpy/readers/hdf5_utils.py b/satpy/readers/hdf5_utils.py index cfce968cf3..c013065e6c 100644 --- a/satpy/readers/hdf5_utils.py +++ b/satpy/readers/hdf5_utils.py @@ -17,7 +17,9 @@ # satpy. If not, see . """Helpers for reading hdf5-based files.""" +import hashlib import logging +import os import dask.array as da import h5py @@ -102,7 +104,7 @@ def __getitem__(self, key): # these datasets are closed and inaccessible when the file is closed, need to reopen f_obj = open_file_or_filename(self.filename) dset = h5py.File(f_obj, "r")[key] - dset_data = da.from_array(dset, chunks=CHUNK_SIZE) + dset_data = from_h5_array(dset) attrs = self._attrs_cache.get(key, dset.attrs) if dset.ndim == 2: return xr.DataArray(dset_data, dims=["y", "x"], attrs=attrs) @@ -120,3 +122,11 @@ def get(self, item, default=None): return self[item] else: return default + + +def from_h5_array(h5dset): + """Create a dask array from an h5py dataset, ensuring uniqueness of the dask array name.""" + name_str = os.fspath(h5dset.file.filename) + "-" + h5dset.name + name = hashlib.md5(name_str.encode(), usedforsecurity=False).hexdigest() + dset_data = da.from_array(h5dset, chunks=CHUNK_SIZE, name=name) + return dset_data diff --git a/satpy/tests/reader_tests/test_hdf5_utils.py b/satpy/tests/reader_tests/test_hdf5_utils.py index 4882701c94..cf835d32b5 100644 --- a/satpy/tests/reader_tests/test_hdf5_utils.py +++ b/satpy/tests/reader_tests/test_hdf5_utils.py @@ -150,3 +150,12 @@ def test_all_basic(self): assert "fake_ds" not in file_handler assert isinstance(file_handler["ds2_f/attr/test_ref"], np.ndarray) + + def test_array_name_uniqueness(self): + """Test the dask array generated from an hdf5 dataset stay constant and unique.""" + from satpy.readers.hdf5_utils import HDF5FileHandler + file_handler = HDF5FileHandler("test.h5", {}, {}) + + dsname = "test_group/ds1_f" + + assert file_handler[dsname].data.name == file_handler[dsname].data.name From 256a9271ed45cef334404e094c5908def23ccb0a Mon Sep 17 00:00:00 2001 From: BENR0 Date: Thu, 13 Jun 2024 14:33:09 +0200 Subject: [PATCH 06/12] doc: move and rename 'implemented readers' section --- doc/source/reading.rst | 169 +++++++++++++++++++++-------------------- 1 file changed, 85 insertions(+), 84 deletions(-) diff --git a/doc/source/reading.rst b/doc/source/reading.rst index 42b4646018..9dcfd981ba 100644 --- a/doc/source/reading.rst +++ b/doc/source/reading.rst @@ -56,6 +56,91 @@ Reader Table This denotes a finished status. Reader is functional and most likely no new features will be introduced. It has been tested and there are no known bugs. +Documentation for specific readers +---------------------------------- + +SEVIRI L1.5 data readers +------------------------ + +.. automodule:: satpy.readers.seviri_base + :noindex: + +SEVIRI HRIT format reader +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: satpy.readers.seviri_l1b_hrit + :noindex: + +SEVIRI Native format reader +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: satpy.readers.seviri_l1b_native + :noindex: + +SEVIRI netCDF format reader +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: satpy.readers.seviri_l1b_nc + :noindex: + + +Other xRIT-based readers +------------------------ + +.. automodule:: satpy.readers.hrit_base + :noindex: + + +JMA HRIT format reader +^^^^^^^^^^^^^^^^^^^^^^ + + +.. automodule:: satpy.readers.hrit_jma + :noindex: + +GOES HRIT format reader +^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: satpy.readers.goes_imager_hrit + :noindex: + +Electro-L HRIT format reader +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: satpy.readers.electrol_hrit + :noindex: + +hdf-eos based readers +--------------------- + +.. automodule:: satpy.readers.modis_l1b + :noindex: + +.. automodule:: satpy.readers.modis_l2 + :noindex: + +satpy cf nc readers +--------------------- + +.. automodule:: satpy.readers.satpy_cf_nc + :noindex: + +hdf5 based readers +------------------ + +.. automodule:: satpy.readers.agri_l1 + :noindex: + +.. automodule:: satpy.readers.ghi_l1 + :noindex: + +Arctica-M N1 HDF5 format reader +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: satpy.readers.msu_gsa_l1b + :noindex: + + Filter loaded files =================== @@ -323,87 +408,3 @@ Adding a Reader to Satpy ======================== This is described in the developer guide, see :doc:`dev_guide/custom_reader`. - -Implemented readers -=================== - -SEVIRI L1.5 data readers ------------------------- - -.. automodule:: satpy.readers.seviri_base - :noindex: - -SEVIRI HRIT format reader -^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: satpy.readers.seviri_l1b_hrit - :noindex: - -SEVIRI Native format reader -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: satpy.readers.seviri_l1b_native - :noindex: - -SEVIRI netCDF format reader -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: satpy.readers.seviri_l1b_nc - :noindex: - - -Other xRIT-based readers ------------------------- - -.. automodule:: satpy.readers.hrit_base - :noindex: - - -JMA HRIT format reader -^^^^^^^^^^^^^^^^^^^^^^ - - -.. automodule:: satpy.readers.hrit_jma - :noindex: - -GOES HRIT format reader -^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: satpy.readers.goes_imager_hrit - :noindex: - -Electro-L HRIT format reader -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: satpy.readers.electrol_hrit - :noindex: - -hdf-eos based readers ---------------------- - -.. automodule:: satpy.readers.modis_l1b - :noindex: - -.. automodule:: satpy.readers.modis_l2 - :noindex: - -satpy cf nc readers ---------------------- - -.. automodule:: satpy.readers.satpy_cf_nc - :noindex: - -hdf5 based readers ------------------- - -.. automodule:: satpy.readers.agri_l1 - :noindex: - -.. automodule:: satpy.readers.ghi_l1 - :noindex: - -Arctica-M N1 HDF5 format reader -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: satpy.readers.msu_gsa_l1b - :noindex: From 506242183efb24af49055fc90a68652c7579fa55 Mon Sep 17 00:00:00 2001 From: Martin Raspaud Date: Fri, 14 Jun 2024 09:13:58 +0200 Subject: [PATCH 07/12] Make hdf5 dataset names more robust We also now use tokenize and automatic chunk sizes --- satpy/readers/hdf5_utils.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/satpy/readers/hdf5_utils.py b/satpy/readers/hdf5_utils.py index c013065e6c..f28be51495 100644 --- a/satpy/readers/hdf5_utils.py +++ b/satpy/readers/hdf5_utils.py @@ -17,22 +17,22 @@ # satpy. If not, see . """Helpers for reading hdf5-based files.""" -import hashlib import logging import os import dask.array as da +import dask.config as dc import h5py import numpy as np import xarray as xr +from dask.array.core import normalize_chunks +from dask.base import tokenize from satpy.readers import open_file_or_filename from satpy.readers.file_handlers import BaseFileHandler from satpy.readers.utils import np2str -from satpy.utils import get_legacy_chunk_size LOG = logging.getLogger(__name__) -CHUNK_SIZE = get_legacy_chunk_size() class HDF5FileHandler(BaseFileHandler): @@ -126,7 +126,10 @@ def get(self, item, default=None): def from_h5_array(h5dset): """Create a dask array from an h5py dataset, ensuring uniqueness of the dask array name.""" - name_str = os.fspath(h5dset.file.filename) + "-" + h5dset.name - name = hashlib.md5(name_str.encode(), usedforsecurity=False).hexdigest() - dset_data = da.from_array(h5dset, chunks=CHUNK_SIZE, name=name) + chunk_size = dc.get("array.chunk-size") + + chunks = normalize_chunks(chunk_size, dtype=h5dset.dtype, previous_chunks=h5dset.chunks, shape=h5dset.shape) + name = tokenize(os.fspath(h5dset.file.filename), h5dset.name, chunks) + + dset_data = da.from_array(h5dset, chunks=chunks, name=name) return dset_data From 8bcd42715b8cd8148bb7ddac21eb0631b7692a6f Mon Sep 17 00:00:00 2001 From: BENR0 Date: Fri, 14 Jun 2024 10:40:38 +0200 Subject: [PATCH 08/12] fix: heading levels --- doc/source/reading.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/source/reading.rst b/doc/source/reading.rst index 9dcfd981ba..0dbea74046 100644 --- a/doc/source/reading.rst +++ b/doc/source/reading.rst @@ -60,32 +60,32 @@ Documentation for specific readers ---------------------------------- SEVIRI L1.5 data readers ------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^ .. automodule:: satpy.readers.seviri_base :noindex: SEVIRI HRIT format reader -^^^^^^^^^^^^^^^^^^^^^^^^^ +""""""""""""""""""""""""" .. automodule:: satpy.readers.seviri_l1b_hrit :noindex: SEVIRI Native format reader -^^^^^^^^^^^^^^^^^^^^^^^^^^^ +""""""""""""""""""""""""""" .. automodule:: satpy.readers.seviri_l1b_native :noindex: SEVIRI netCDF format reader -^^^^^^^^^^^^^^^^^^^^^^^^^^^ +""""""""""""""""""""""""""" .. automodule:: satpy.readers.seviri_l1b_nc :noindex: Other xRIT-based readers ------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^ .. automodule:: satpy.readers.hrit_base :noindex: @@ -111,7 +111,7 @@ Electro-L HRIT format reader :noindex: hdf-eos based readers ---------------------- +^^^^^^^^^^^^^^^^^^^^^ .. automodule:: satpy.readers.modis_l1b :noindex: @@ -120,13 +120,13 @@ hdf-eos based readers :noindex: satpy cf nc readers ---------------------- +^^^^^^^^^^^^^^^^^^^ .. automodule:: satpy.readers.satpy_cf_nc :noindex: hdf5 based readers ------------------- +^^^^^^^^^^^^^^^^^^ .. automodule:: satpy.readers.agri_l1 :noindex: From a337071b05f6280483348b53c90683046e6f3ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= <49512274+ludwigVonKoopa@users.noreply.github.com> Date: Fri, 14 Jun 2024 09:49:09 +0000 Subject: [PATCH 09/12] add import rioxarray where readers actually need them some readers use rasterio engine from xarray, but it actually use rioxarray in the backend, without stating it in the dependencies --- satpy/readers/generic_image.py | 4 ++++ satpy/readers/sar_c_safe.py | 1 + 2 files changed, 5 insertions(+) diff --git a/satpy/readers/generic_image.py b/satpy/readers/generic_image.py index f6c983e8d5..32102cf7c9 100644 --- a/satpy/readers/generic_image.py +++ b/satpy/readers/generic_image.py @@ -31,6 +31,7 @@ import dask.array as da import numpy as np import rasterio +import rioxarray # noqa: F401, need by xarray with the engine rasterio import xarray as xr from pyresample import utils @@ -76,6 +77,9 @@ def read(self): if hasattr(dataset, "crs") and dataset.crs is not None: self.area = utils.get_area_def_from_raster(dataset) + # xarray use the engine 'rasterio' to open the file, but + # its actually rioxarray used in the backend. + # however, error is not explicit enough (see https://github.com/pydata/xarray/issues/7831) data = xr.open_dataset(self.finfo["filename"], engine="rasterio", chunks={"band": 1, "y": CHUNK_SIZE, "x": CHUNK_SIZE}, mask_and_scale=False)["band_data"] if hasattr(dataset, "nodatavals"): diff --git a/satpy/readers/sar_c_safe.py b/satpy/readers/sar_c_safe.py index a5ec535462..b121399920 100644 --- a/satpy/readers/sar_c_safe.py +++ b/satpy/readers/sar_c_safe.py @@ -46,6 +46,7 @@ import defusedxml.ElementTree as ET import numpy as np import rasterio +import rioxarray # noqa F401 : xarray open_dataset use engine rasterio, which use rioxarray import xarray as xr from dask import array as da from geotiepoints.geointerpolator import lonlat2xyz, xyz2lonlat From 580b74152a32f3d421e3c8c794e69d631e726287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= <49512274+ludwigVonKoopa@users.noreply.github.com> Date: Fri, 14 Jun 2024 12:25:53 +0000 Subject: [PATCH 10/12] adding dependencies in pyproject.toml --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c2ae1a890d..d988737746 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,6 +41,7 @@ avhrr_l1b_gaclac = ["pygac >= 1.3.0"] modis_l1b = ["pyhdf", "python-geotiepoints >= 1.1.7"] geocat = ["pyhdf"] goci2 = ["netCDF4 >= 1.1.8"] +generic_image = ["rasterio", "rioxarray"] acspo = ["netCDF4 >= 1.1.8"] clavrx = ["netCDF4 >= 1.1.8"] viirs_l1b = ["netCDF4 >= 1.1.8"] @@ -66,7 +67,7 @@ gms5-vissr_l1b = ["numba"] # Writers: cf = ["h5netcdf >= 0.7.3"] awips_tiled = ["netCDF4 >= 1.1.8"] -geotiff = ["rasterio", "trollimage[geotiff]"] +geotiff = ["rasterio", "rioxarray", "trollimage[geotiff]"] ninjo = ["pyninjotiff", "pint"] units = ["pint-xarray"] # Composites/Modifiers: From 76e6b825ef397696cc0b1714ff78003319b8f628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= <49512274+ludwigVonKoopa@users.noreply.github.com> Date: Tue, 18 Jun 2024 08:13:17 +0000 Subject: [PATCH 11/12] correct geotiff reader dependencies, and standardize noqa comments --- pyproject.toml | 2 +- satpy/readers/generic_image.py | 2 +- satpy/readers/sar_c_safe.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d988737746..673405cfb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,7 +67,7 @@ gms5-vissr_l1b = ["numba"] # Writers: cf = ["h5netcdf >= 0.7.3"] awips_tiled = ["netCDF4 >= 1.1.8"] -geotiff = ["rasterio", "rioxarray", "trollimage[geotiff]"] +geotiff = ["rasterio", "trollimage[geotiff]"] ninjo = ["pyninjotiff", "pint"] units = ["pint-xarray"] # Composites/Modifiers: diff --git a/satpy/readers/generic_image.py b/satpy/readers/generic_image.py index 32102cf7c9..5032b7bbb8 100644 --- a/satpy/readers/generic_image.py +++ b/satpy/readers/generic_image.py @@ -31,7 +31,7 @@ import dask.array as da import numpy as np import rasterio -import rioxarray # noqa: F401, need by xarray with the engine rasterio +import rioxarray # noqa: F401 # need by xarray with the engine rasterio import xarray as xr from pyresample import utils diff --git a/satpy/readers/sar_c_safe.py b/satpy/readers/sar_c_safe.py index b121399920..f04656bfe9 100644 --- a/satpy/readers/sar_c_safe.py +++ b/satpy/readers/sar_c_safe.py @@ -46,7 +46,7 @@ import defusedxml.ElementTree as ET import numpy as np import rasterio -import rioxarray # noqa F401 : xarray open_dataset use engine rasterio, which use rioxarray +import rioxarray # noqa F401 # xarray open_dataset use engine rasterio, which use rioxarray import xarray as xr from dask import array as da from geotiepoints.geointerpolator import lonlat2xyz, xyz2lonlat From 2c6af5e530fdac5170df692d40f619429c689da5 Mon Sep 17 00:00:00 2001 From: Martin Raspaud Date: Wed, 19 Jun 2024 11:14:43 +0200 Subject: [PATCH 12/12] Make name of h5dsets more explicit --- satpy/readers/hdf5_utils.py | 2 +- satpy/tests/reader_tests/test_hdf5_utils.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/satpy/readers/hdf5_utils.py b/satpy/readers/hdf5_utils.py index f28be51495..c08b624abf 100644 --- a/satpy/readers/hdf5_utils.py +++ b/satpy/readers/hdf5_utils.py @@ -129,7 +129,7 @@ def from_h5_array(h5dset): chunk_size = dc.get("array.chunk-size") chunks = normalize_chunks(chunk_size, dtype=h5dset.dtype, previous_chunks=h5dset.chunks, shape=h5dset.shape) - name = tokenize(os.fspath(h5dset.file.filename), h5dset.name, chunks) + name = h5dset.name + "-" + tokenize(os.fspath(h5dset.file.filename), h5dset.name, chunks) dset_data = da.from_array(h5dset, chunks=chunks, name=name) return dset_data diff --git a/satpy/tests/reader_tests/test_hdf5_utils.py b/satpy/tests/reader_tests/test_hdf5_utils.py index cf835d32b5..8a7d3ef52d 100644 --- a/satpy/tests/reader_tests/test_hdf5_utils.py +++ b/satpy/tests/reader_tests/test_hdf5_utils.py @@ -159,3 +159,4 @@ def test_array_name_uniqueness(self): dsname = "test_group/ds1_f" assert file_handler[dsname].data.name == file_handler[dsname].data.name + assert file_handler[dsname].data.name.startswith("/" + dsname)