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

Test_scene failure on debian sid #2248

Closed
avalentino opened this issue Oct 30, 2022 · 5 comments
Closed

Test_scene failure on debian sid #2248

avalentino opened this issue Oct 30, 2022 · 5 comments

Comments

@avalentino
Copy link
Contributor

Describe the bug
Unitest failure on debian sid.
Failing tests are in satpy/tests/test_scene.py.

To Reproduce

$ python3 -m pytest -k "test_scene and not geoviews"

Expected behavior
All tests pass

Actual results

$ python3 -m pytest -k "test_scene and not geoviews"
=============================================================== test session starts ===============================================================
platform linux -- Python 3.10.8, pytest-7.1.2, pluggy-1.0.0+repack
rootdir: /home/antonio/projects/forks/satpy
plugins: lazy-fixture-0.6.3
collected 1859 items / 1716 deselected / 143 selected                                                                                             

satpy/tests/test_scene.py ...................................................................FFF...FF.........F......F....F..........FFFF.F [ 79%]
..........                                                                                                                                  [ 86%]
satpy/tests/reader_tests/test_ahi_hsd.py .                                                                                                  [ 86%]
satpy/tests/reader_tests/test_ascat_l2_soilmoisture_bufr.py ...                                                                             [ 88%]
satpy/tests/reader_tests/test_iasi_l2.py .....                                                                                              [ 92%]
satpy/tests/reader_tests/test_iasi_l2_so2_bufr.py ...                                                                                       [ 94%]
satpy/tests/reader_tests/test_modis_l1b.py ....                                                                                             [ 97%]
satpy/tests/reader_tests/test_modis_l2.py .                                                                                                 [ 97%]
satpy/tests/reader_tests/test_seadas_l2.py ...                                                                                              [100%]

==================================================================== FAILURES =====================================================================
________________________________________________________ TestSceneLoading.test_load_comp4 _________________________________________________________

self = <satpy.tests.test_scene.TestSceneLoading object at 0x7f9bab95ff40>

    def test_load_comp4(self):
        """Test loading a composite that depends on a composite."""
        scene = Scene(filenames=['fake1_1.txt'], reader='fake1')
        scene.load(['comp4'])
        loaded_ids = list(scene._datasets.keys())
>       assert len(loaded_ids) == 1
E       AssertionError: assert 2 == 1
E        +  where 2 = len([DataID(name='comp2'), DataID(name='ds3', modifiers=())])

satpy/tests/test_scene.py:1066: AssertionError
---------------------------------------------------------------- Captured log call ----------------------------------------------------------------
WARNING  satpy.scene:scene.py:1276 The following datasets were not created and may require resampling to be generated: DataID(name='comp4')
_________________________________________________ TestSceneLoading.test_load_multiple_resolutions _________________________________________________

self = <satpy.tests.test_scene.TestSceneLoading object at 0x7f9bab95ff10>

    def test_load_multiple_resolutions(self):
        """Test loading a dataset has multiple resolutions available with different resolutions."""
        scene = Scene(filenames=['fake1_1.txt'], reader='fake1')
        comp25 = make_cid(name='comp25', resolution=1000)
        scene[comp25] = xr.DataArray([], attrs={'name': 'comp25', 'resolution': 1000})
        scene.load(['comp25'], resolution=500)
    
        loaded_ids = list(scene._datasets.keys())
>       assert len(loaded_ids) == 2
E       AssertionError: assert 3 == 2
E        +  where 3 = len([DataID(name='comp24', resolution=500), DataID(name='comp25', resolution=1000), DataID(name='ds5', resolution=500, modifiers=())])

satpy/tests/test_scene.py:1077: AssertionError
---------------------------------------------------------------- Captured log call ----------------------------------------------------------------
WARNING  satpy.scene:scene.py:1276 The following datasets were not created and may require resampling to be generated: DataID(name='comp25')
__________________________________________________ TestSceneLoading.test_load_same_subcomposite ___________________________________________________

self = <satpy.tests.test_scene.TestSceneLoading object at 0x7f9bab970250>

    def test_load_same_subcomposite(self):
        """Test loading a composite and one of it's subcomposites at the same time."""
        scene = Scene(filenames=['fake1_1.txt'], reader='fake1')
        scene.load(['comp24', 'comp25'], resolution=500)
        loaded_ids = list(scene._datasets.keys())
        assert len(loaded_ids) == 2
        assert loaded_ids[0]['name'] == 'comp24'
        assert loaded_ids[0]['resolution'] == 500
>       assert loaded_ids[1]['name'] == 'comp25'
E       AssertionError: assert 'ds5' == 'comp25'
E         - comp25
E         + ds5

satpy/tests/test_scene.py:1091: AssertionError
---------------------------------------------------------------- Captured log call ----------------------------------------------------------------
WARNING  satpy.scene:scene.py:1276 The following datasets were not created and may require resampling to be generated: DataID(name='comp25')
________________________________________________________ TestSceneLoading.test_load_comp9 _________________________________________________________

self = <satpy.tests.test_scene.TestSceneLoading object at 0x7f9bab970b50>

    def test_load_comp9(self):
        """Test loading a composite that has a non-existent optional prereq."""
        # it is fine that an optional prereq doesn't exist
        scene = Scene(filenames=['fake1_1.txt'], reader='fake1')
        scene.load(['comp9'])
        loaded_ids = list(scene._datasets.keys())
>       assert len(loaded_ids) == 1
E       AssertionError: assert 2 == 1
E        +  where 2 = len([DataID(name='comp2'), DataID(name='ds1', resolution=250, calibration=<calibration.reflectance>, modifiers=())])

satpy/tests/test_scene.py:1121: AssertionError
---------------------------------------------------------------- Captured log call ----------------------------------------------------------------
WARNING  satpy.scene:scene.py:1276 The following datasets were not created and may require resampling to be generated: DataID(name='comp9')
________________________________________________________ TestSceneLoading.test_load_comp10 ________________________________________________________

self = <satpy.tests.test_scene.TestSceneLoading object at 0x7f9bab970d90>

    def test_load_comp10(self):
        """Test loading a composite that depends on a modified dataset."""
        # it is fine that an optional prereq doesn't exist
        scene = Scene(filenames=['fake1_1.txt'], reader='fake1')
        scene.load(['comp10'])
        loaded_ids = list(scene._datasets.keys())
>       assert len(loaded_ids) == 1
E       AssertionError: assert 2 == 1
E        +  where 2 = len([DataID(name='comp2'), DataID(name='ds1', resolution=250, calibration=<calibration.reflectance>, modifiers=('mod1',))])

satpy/tests/test_scene.py:1130: AssertionError
---------------------------------------------------------------- Captured log call ----------------------------------------------------------------
WARNING  satpy.scene:scene.py:1276 The following datasets were not created and may require resampling to be generated: DataID(name='comp10')
________________________________________________________ TestSceneLoading.test_load_comp19 ________________________________________________________

self = <satpy.tests.test_scene.TestSceneLoading object at 0x7f9bab971e10>

    def test_load_comp19(self):
        """Test loading a composite that shares a dep with a dependency.
    
        More importantly test that loading a dependency that depends on
        the same dependency as this composite (a sibling dependency) and
        that sibling dependency includes a modifier. This test makes sure
        that the Node in the dependency tree is the exact same node.
    
        """
        # Check dependency tree nodes
        # initialize the dep tree without loading the data
        scene = Scene(filenames=['fake1_1.txt'], reader='fake1')
        scene._update_dependency_tree({'comp19'}, None)
    
        this_node = scene._dependency_tree['comp19']
        shared_dep_id = make_dataid(name='ds5', modifiers=('res_change',))
        shared_dep_expected_node = scene._dependency_tree[shared_dep_id]
        # get the node for the first dep in the prereqs list of the
        # comp13 node
        shared_dep_node = scene._dependency_tree['comp13'].data[1][0]
        shared_dep_node2 = this_node.data[1][0]
        assert shared_dep_expected_node is shared_dep_node
        assert shared_dep_expected_node is shared_dep_node2
    
        scene.load(['comp19'])
    
        loaded_ids = list(scene._datasets.keys())
>       assert len(loaded_ids) == 1
E       AssertionError: assert 3 == 1
E        +  where 3 = len([DataID(name='comp13'), DataID(name='ds2', resolution=250, calibration=<calibration.reflectance>, modifiers=()), DataID(name='ds5', resolution=250, modifiers=('res_change',))])

satpy/tests/test_scene.py:1273: AssertionError
---------------------------------------------------------------- Captured log call ----------------------------------------------------------------
WARNING  satpy.scene:scene.py:1276 The following datasets were not created and may require resampling to be generated: DataID(name='comp19')
_______________________________________________ TestSceneLoading.test_load_dataset_after_composite2 _______________________________________________

self = <satpy.tests.test_scene.TestSceneLoading object at 0x7f9bab972dd0>

    def test_load_dataset_after_composite2(self):
        """Test load complex composite followed by other datasets."""
        from satpy.readers.yaml_reader import FileYAMLReader
        from satpy.tests.utils import FakeCompositor, FakeModifier
        load_mock = spy_decorator(FileYAMLReader.load)
        comp_mock = spy_decorator(FakeCompositor.__call__)
        mod_mock = spy_decorator(FakeModifier.__call__)
        with mock.patch.object(FileYAMLReader, 'load', load_mock), \
             mock.patch.object(FakeCompositor, '__call__', comp_mock), \
             mock.patch.object(FakeModifier, '__call__', mod_mock):
            lmock = load_mock.mock
            scene = Scene(filenames=['fake1_1.txt'], reader='fake1')
            scene.load(['comp10'])
            assert lmock.call_count == 1
            loaded_ids = list(scene._datasets.keys())
>           assert len(loaded_ids) == 1
E           AssertionError: assert 2 == 1
E            +  where 2 = len([DataID(name='comp2'), DataID(name='ds1', resolution=250, calibration=<calibration.reflectance>, modifiers=('mod1',))])

satpy/tests/test_scene.py:1368: AssertionError
---------------------------------------------------------------- Captured log call ----------------------------------------------------------------
WARNING  satpy.scene:scene.py:1276 The following datasets were not created and may require resampling to be generated: DataID(name='comp10')
____________________________________________________ TestSceneLoading.test_no_generate_comp10 _____________________________________________________

self = <satpy.tests.test_scene.TestSceneLoading object at 0x7f9bab973220>

    def test_no_generate_comp10(self):
        """Test generating a composite after loading."""
        # it is fine that an optional prereq doesn't exist
        scene = Scene(filenames=['fake1_1.txt'], reader='fake1')
        scene.load(['comp10'], generate=False)
        assert any(ds_id['name'] == 'comp10' for ds_id in scene._wishlist)
        assert 'comp10' not in scene._datasets
        # two dependencies should have been loaded
        assert len(scene._datasets) == 2
        assert len(scene.missing_datasets) == 1
    
        scene._generate_composites_from_loaded_datasets()
        assert any(ds_id['name'] == 'comp10' for ds_id in scene._wishlist)
>       assert 'comp10' in scene._datasets
E       AssertionError: assert 'comp10' in {DataID(name='ds2', resolution=250, calibration=<calibration.reflectance>, modifiers=()): <xarray.DataArray 'zeros_lik...:  []\n    optional_datasets:       []\n    area:                    Shape: (20, 20)\nLons: <xarray.DataArray 'zeros_...}
E        +  where {DataID(name='ds2', resolution=250, calibration=<calibration.reflectance>, modifiers=()): <xarray.DataArray 'zeros_lik...:  []\n    optional_datasets:       []\n    area:                    Shape: (20, 20)\nLons: <xarray.DataArray 'zeros_...} = <satpy.scene.Scene object at 0x7f9b79730850>._datasets

satpy/tests/test_scene.py:1448: AssertionError
______________________________________________ TestSceneResampling.test_resample_reduce_data_toggle _______________________________________________

self = {DataID(name='ds2', resolution=250, calibration=<calibration.reflectance>, modifiers=()): <xarray.DataArray 'zeros_lik...:  []
    optional_datasets:       []
    area:                    Shape: (20, 20)\nLons: <xarray.DataArray 'zeros_...}
item = 'comp19'

    def __getitem__(self, item):
        """Get item from container."""
        try:
            # short circuit - try to get the object without more work
>           return super(DatasetDict, self).__getitem__(item)
E           KeyError: 'comp19'

satpy/dataset/data_dict.py:169: KeyError

During handling of the above exception, another exception occurred:

self = <satpy.tests.test_scene.TestSceneResampling object at 0x7f9bab98ce50>, rs = <MagicMock name='resample_dataset' id='140305729295008'>

    @mock.patch('satpy.scene.resample_dataset')
    def test_resample_reduce_data_toggle(self, rs):
        """Test that the Scene can be reduced or not reduced during resampling."""
        from pyresample.geometry import AreaDefinition
    
        rs.side_effect = self._fake_resample_dataset_force_20x20
        proj_str = ('+proj=lcc +datum=WGS84 +ellps=WGS84 '
                    '+lon_0=-95. +lat_0=25 +lat_1=25 +units=m +no_defs')
        target_area = AreaDefinition('test', 'test', 'test', proj_str, 4, 4, (-1000., -1500., 1000., 1500.))
        area_def = AreaDefinition('test', 'test', 'test', proj_str, 5, 5, (-1000., -1500., 1000., 1500.))
        area_def.get_area_slices = mock.MagicMock()
        get_area_slices = area_def.get_area_slices
        get_area_slices.return_value = (slice(0, 3, None), slice(0, 3, None))
        area_def_big = AreaDefinition('test', 'test', 'test', proj_str, 10, 10, (-1000., -1500., 1000., 1500.))
        area_def_big.get_area_slices = mock.MagicMock()
        get_area_slices_big = area_def_big.get_area_slices
        get_area_slices_big.return_value = (slice(0, 6, None), slice(0, 6, None))
    
        # Test that data reduction can be disabled
        scene = Scene(filenames=['fake1_1.txt'], reader='fake1')
        scene.load(['comp19'])
>       scene['comp19'].attrs['area'] = area_def

satpy/tests/test_scene.py:1680: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
satpy/scene.py:804: in __getitem__
    return self._datasets[key]
satpy/dataset/data_dict.py:171: in __getitem__
    key = self.get_key(item)
satpy/dataset/data_dict.py:158: in get_key
    return get_key(match_key, self.keys(), num_results=num_results,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

key = DataQuery(name='comp19')
key_container = [DataID(name='comp13'), DataID(name='ds2', resolution=250, calibration=<calibration.reflectance>, modifiers=()), DataID(name='ds5', resolution=250, modifiers=('res_change',))]
num_results = 1, best = True, query = None, kwargs = {}, res = []

    def get_key(key, key_container, num_results=1, best=True, query=None,
                **kwargs):
        """Get the fully-specified key best matching the provided key.
    
        Only the best match is returned if `best` is `True` (default). See
        `get_best_dataset_key` for more information on how this is determined.
    
        `query` is provided as a convenience to filter by multiple parameters
        at once without having to filter by multiple `key` inputs.
    
        Args:
            key (DataID): DataID of query parameters to use for
                             searching. Any parameter that is `None`
                             is considered a wild card and any match is
                             accepted.
            key_container (dict or set): Container of DataID objects that
                                         uses hashing to quickly access items.
            num_results (int): Number of results to return. Use `0` for all
                               matching results. If `1` then the single matching
                               key is returned instead of a list of length 1.
                               (default: 1)
            best (bool): Sort results to get "best" result first
                         (default: True). See `get_best_dataset_key` for details.
            query (DataQuery): filter for the key which can contain for example:
    
                resolution (float, int, or list): Resolution of the dataset in
                                                dataset units (typically
                                                meters). This can also be a
                                                list of these numbers.
                calibration (str or list): Dataset calibration
                                        (ex.'reflectance'). This can also be a
                                        list of these strings.
                polarization (str or list): Dataset polarization
                                            (ex.'V'). This can also be a
                                            list of these strings.
                level (number or list): Dataset level (ex. 100). This can also be a
                                        list of these numbers.
                modifiers (list): Modifiers applied to the dataset. Unlike
                                resolution and calibration this is the exact
                                desired list of modifiers for one dataset, not
                                a list of possible modifiers.
    
        Returns:
            list or DataID: Matching key(s)
    
        Raises: KeyError if no matching results or if more than one result is
                found when `num_results` is `1`.
    
        """
        key = create_filtered_query(key, query)
    
        res = key.filter_dataids(key_container)
        if not res:
>           raise KeyError("No dataset matching '{}' found".format(str(key)))
E           KeyError: "No dataset matching 'DataQuery(name='comp19')' found"

satpy/dataset/data_dict.py:107: KeyError
---------------------------------------------------------------- Captured log call ----------------------------------------------------------------
WARNING  satpy.scene:scene.py:1276 The following datasets were not created and may require resampling to be generated: DataID(name='comp19')
___________________________________________________ TestSceneResampling.test_resample_ancillary ___________________________________________________

self = {DataID(name='ds2', resolution=250, calibration=<calibration.reflectance>, modifiers=()): <xarray.DataArray 'zeros_lik...:  []
    optional_datasets:       []
    area:                    Shape: (10, 10)\nLons: <xarray.DataArray 'zeros_...}
item = 'comp19'

    def __getitem__(self, item):
        """Get item from container."""
        try:
            # short circuit - try to get the object without more work
>           return super(DatasetDict, self).__getitem__(item)
E           KeyError: 'comp19'

satpy/dataset/data_dict.py:169: KeyError

During handling of the above exception, another exception occurred:

self = <satpy.tests.test_scene.TestSceneResampling object at 0x7f9bab98d090>

    def test_resample_ancillary(self):
        """Test that the Scene reducing data does not affect final output."""
        from pyresample.geometry import AreaDefinition
        from pyresample.utils import proj4_str_to_dict
        proj_dict = proj4_str_to_dict('+proj=lcc +datum=WGS84 +ellps=WGS84 '
                                      '+lon_0=-95. +lat_0=25 +lat_1=25 '
                                      '+units=m +no_defs')
        area_def = AreaDefinition('test', 'test', 'test', proj_dict, 5, 5, (-1000., -1500., 1000., 1500.))
        scene = Scene(filenames=['fake1_1.txt'], reader='fake1')
    
        scene.load(['comp19', 'comp20'])
>       scene['comp19'].attrs['area'] = area_def

satpy/tests/test_scene.py:1722: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
satpy/scene.py:804: in __getitem__
    return self._datasets[key]
satpy/dataset/data_dict.py:171: in __getitem__
    key = self.get_key(item)
satpy/dataset/data_dict.py:158: in get_key
    return get_key(match_key, self.keys(), num_results=num_results,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

key = DataQuery(name='comp19')
key_container = [DataID(name='comp13'), DataID(name='comp20'), DataID(name='ds2', resolution=250, calibration=<calibration.reflectance>, modifiers=()), DataID(name='ds5', resolution=250, modifiers=('res_change',))]
num_results = 1, best = True, query = None, kwargs = {}, res = []

    def get_key(key, key_container, num_results=1, best=True, query=None,
                **kwargs):
        """Get the fully-specified key best matching the provided key.
    
        Only the best match is returned if `best` is `True` (default). See
        `get_best_dataset_key` for more information on how this is determined.
    
        `query` is provided as a convenience to filter by multiple parameters
        at once without having to filter by multiple `key` inputs.
    
        Args:
            key (DataID): DataID of query parameters to use for
                             searching. Any parameter that is `None`
                             is considered a wild card and any match is
                             accepted.
            key_container (dict or set): Container of DataID objects that
                                         uses hashing to quickly access items.
            num_results (int): Number of results to return. Use `0` for all
                               matching results. If `1` then the single matching
                               key is returned instead of a list of length 1.
                               (default: 1)
            best (bool): Sort results to get "best" result first
                         (default: True). See `get_best_dataset_key` for details.
            query (DataQuery): filter for the key which can contain for example:
    
                resolution (float, int, or list): Resolution of the dataset in
                                                dataset units (typically
                                                meters). This can also be a
                                                list of these numbers.
                calibration (str or list): Dataset calibration
                                        (ex.'reflectance'). This can also be a
                                        list of these strings.
                polarization (str or list): Dataset polarization
                                            (ex.'V'). This can also be a
                                            list of these strings.
                level (number or list): Dataset level (ex. 100). This can also be a
                                        list of these numbers.
                modifiers (list): Modifiers applied to the dataset. Unlike
                                resolution and calibration this is the exact
                                desired list of modifiers for one dataset, not
                                a list of possible modifiers.
    
        Returns:
            list or DataID: Matching key(s)
    
        Raises: KeyError if no matching results or if more than one result is
                found when `num_results` is `1`.
    
        """
        key = create_filtered_query(key, query)
    
        res = key.filter_dataids(key_container)
        if not res:
>           raise KeyError("No dataset matching '{}' found".format(str(key)))
E           KeyError: "No dataset matching 'DataQuery(name='comp19')' found"

satpy/dataset/data_dict.py:107: KeyError
---------------------------------------------------------------- Captured log call ----------------------------------------------------------------
WARNING  satpy.scene:scene.py:1276 The following datasets were not created and may require resampling to be generated: DataID(name='comp19')
__________________________________________________ TestSceneResampling.test_resample_reduce_data __________________________________________________

self = {DataID(name='ds2', resolution=250, calibration=<calibration.reflectance>, modifiers=()): <xarray.DataArray 'zeros_lik...:  []
    optional_datasets:       []
    area:                    Shape: (20, 20)\nLons: <xarray.DataArray 'zeros_...}
item = 'comp19'

    def __getitem__(self, item):
        """Get item from container."""
        try:
            # short circuit - try to get the object without more work
>           return super(DatasetDict, self).__getitem__(item)
E           KeyError: 'comp19'

satpy/dataset/data_dict.py:169: KeyError

During handling of the above exception, another exception occurred:

self = <satpy.tests.test_scene.TestSceneResampling object at 0x7f9bab98d2d0>

    def test_resample_reduce_data(self):
        """Test that the Scene reducing data does not affect final output."""
        from pyresample.geometry import AreaDefinition
        proj_str = ('+proj=lcc +datum=WGS84 +ellps=WGS84 '
                    '+lon_0=-95. +lat_0=25 +lat_1=25 +units=m +no_defs')
        area_def = AreaDefinition('test', 'test', 'test', proj_str, 20, 20, (-1000., -1500., 1000., 1500.))
        scene = Scene(filenames=['fake1_1.txt'], reader='fake1')
    
        scene.load(['comp19'])
>       scene['comp19'].attrs['area'] = area_def

satpy/tests/test_scene.py:1743: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
satpy/scene.py:804: in __getitem__
    return self._datasets[key]
satpy/dataset/data_dict.py:171: in __getitem__
    key = self.get_key(item)
satpy/dataset/data_dict.py:158: in get_key
    return get_key(match_key, self.keys(), num_results=num_results,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

key = DataQuery(name='comp19')
key_container = [DataID(name='comp13'), DataID(name='ds2', resolution=250, calibration=<calibration.reflectance>, modifiers=()), DataID(name='ds5', resolution=250, modifiers=('res_change',))]
num_results = 1, best = True, query = None, kwargs = {}, res = []

    def get_key(key, key_container, num_results=1, best=True, query=None,
                **kwargs):
        """Get the fully-specified key best matching the provided key.
    
        Only the best match is returned if `best` is `True` (default). See
        `get_best_dataset_key` for more information on how this is determined.
    
        `query` is provided as a convenience to filter by multiple parameters
        at once without having to filter by multiple `key` inputs.
    
        Args:
            key (DataID): DataID of query parameters to use for
                             searching. Any parameter that is `None`
                             is considered a wild card and any match is
                             accepted.
            key_container (dict or set): Container of DataID objects that
                                         uses hashing to quickly access items.
            num_results (int): Number of results to return. Use `0` for all
                               matching results. If `1` then the single matching
                               key is returned instead of a list of length 1.
                               (default: 1)
            best (bool): Sort results to get "best" result first
                         (default: True). See `get_best_dataset_key` for details.
            query (DataQuery): filter for the key which can contain for example:
    
                resolution (float, int, or list): Resolution of the dataset in
                                                dataset units (typically
                                                meters). This can also be a
                                                list of these numbers.
                calibration (str or list): Dataset calibration
                                        (ex.'reflectance'). This can also be a
                                        list of these strings.
                polarization (str or list): Dataset polarization
                                            (ex.'V'). This can also be a
                                            list of these strings.
                level (number or list): Dataset level (ex. 100). This can also be a
                                        list of these numbers.
                modifiers (list): Modifiers applied to the dataset. Unlike
                                resolution and calibration this is the exact
                                desired list of modifiers for one dataset, not
                                a list of possible modifiers.
    
        Returns:
            list or DataID: Matching key(s)
    
        Raises: KeyError if no matching results or if more than one result is
                found when `num_results` is `1`.
    
        """
        key = create_filtered_query(key, query)
    
        res = key.filter_dataids(key_container)
        if not res:
>           raise KeyError("No dataset matching '{}' found".format(str(key)))
E           KeyError: "No dataset matching 'DataQuery(name='comp19')' found"

satpy/dataset/data_dict.py:107: KeyError
---------------------------------------------------------------- Captured log call ----------------------------------------------------------------
WARNING  satpy.scene:scene.py:1276 The following datasets were not created and may require resampling to be generated: DataID(name='comp19')
___________________________________________________ TestSceneResampling.test_no_generate_comp10 ___________________________________________________

self = <satpy.tests.test_scene.TestSceneResampling object at 0x7f9bab98d4e0>, rs = <MagicMock name='resample_dataset' id='140305729047088'>

    @mock.patch('satpy.scene.resample_dataset')
    def test_no_generate_comp10(self, rs):
        """Test generating a composite after loading."""
        from pyresample.geometry import AreaDefinition
        from pyresample.utils import proj4_str_to_dict
    
        rs.side_effect = self._fake_resample_dataset
        proj_dict = proj4_str_to_dict('+proj=lcc +datum=WGS84 +ellps=WGS84 '
                                      '+lon_0=-95. +lat_0=25 +lat_1=25 '
                                      '+units=m +no_defs')
        area_def = AreaDefinition(
            'test',
            'test',
            'test',
            proj_dict,
            200,
            400,
            (-1000., -1500., 1000., 1500.),
        )
    
        # it is fine that an optional prereq doesn't exist
        scene = Scene(filenames=['fake1_1.txt'], reader='fake1')
        scene.load(['comp10'], generate=False)
        assert any(ds_id['name'] == 'comp10' for ds_id in scene._wishlist)
        assert 'comp10' not in scene
        # two dependencies should have been loaded
        assert len(scene._datasets) == 2
        assert len(scene.missing_datasets) == 1
    
        new_scn = scene.resample(area_def, generate=False)
        assert 'comp10' not in scene
        # two dependencies should have been loaded
        assert len(scene._datasets) == 2
        assert len(scene.missing_datasets) == 1
    
        new_scn._generate_composites_from_loaded_datasets()
        assert any(ds_id['name'] == 'comp10' for ds_id in new_scn._wishlist)
>       assert 'comp10' in new_scn
E       AssertionError: assert 'comp10' in <satpy.scene.Scene object at 0x7f9bab1790f0>

satpy/tests/test_scene.py:1793: AssertionError
________________________________________ TestSceneResampling.test_comp_loading_after_resampling_new_sensor ________________________________________

self = <satpy.tests.test_scene.TestSceneResampling object at 0x7f9bab98d960>

    def test_comp_loading_after_resampling_new_sensor(self):
        """Test requesting a composite after resampling when the sensor composites weren't loaded before."""
        # this is our base Scene with sensor "fake_sensor2"
        scene1 = Scene(filenames=['fake2_3ds_1.txt'], reader='fake2_3ds')
        scene1.load(["ds2"])
        new_scn = scene1.resample(resampler='native')
    
        # Can't load from readers after resampling
        with pytest.raises(KeyError):
            new_scn.load(["ds3"])
    
        # Can't load the composite from fake_sensor composites yet
        # 'ds1' is missing
        with pytest.raises(KeyError):
            new_scn.load(["comp2"])
    
        # artificial DataArray "created by the user"
        # mimics a user adding their own data with the same sensor
        user_da = scene1["ds2"].copy()
        user_da.attrs["name"] = "ds1"
        user_da.attrs["sensor"] = {"fake_sensor2"}
        # Add 'ds1' that doesn't provide the 'fake_sensor' sensor
        new_scn["ds1"] = user_da
        with pytest.raises(KeyError):
            new_scn.load(["comp2"])
        assert "comp2" not in new_scn
    
        # artificial DataArray "created by the user"
        # mimics a user adding their own data with its own sensor to the Scene
        user_da = scene1["ds2"].copy()
        user_da.attrs["name"] = "ds1"
        user_da.attrs["sensor"] = {"fake_sensor"}
        # Now 'fake_sensor' composites have been loaded
        new_scn["ds1"] = user_da
        new_scn.load(["comp2"])
>       assert "comp2" in new_scn
E       AssertionError: assert 'comp2' in <satpy.scene.Scene object at 0x7f9b7989ffd0>

satpy/tests/test_scene.py:1852: AssertionError
---------------------------------------------------------------- Captured log call ----------------------------------------------------------------
WARNING  satpy.scene:scene.py:1276 The following datasets were not created and may require resampling to be generated: DataID(name='comp2')
================================================================ warnings summary =================================================================
../../../../../usr/lib/python3/dist-packages/blosc/toplevel.py:11
  /usr/lib/python3/dist-packages/blosc/toplevel.py:11: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
    from distutils.version import LooseVersion

../../../../../usr/lib/python3/dist-packages/invoke/loader.py:3
  /usr/lib/python3/dist-packages/invoke/loader.py:3: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
    import imp

satpy/readers/seviri_base.py:452
  /home/antonio/projects/forks/satpy/satpy/readers/seviri_base.py:452: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    ('GsicsCalMode', np.bool),

satpy/readers/seviri_base.py:453
  /home/antonio/projects/forks/satpy/satpy/readers/seviri_base.py:453: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    ('GsicsCalValidity', np.bool),

satpy/tests/reader_tests/test_mviri_l1b_fiduceo_nc.py:541
  /home/antonio/projects/forks/satpy/satpy/tests/reader_tests/test_mviri_l1b_fiduceo_nc.py:541: PytestUnknownMarkWarning: Unknown pytest.mark.file_handler_data - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.file_handler_data(mask_bad_quality=False)

satpy/tests/test_scene.py: 225 warnings
satpy/tests/reader_tests/test_ahi_hsd.py: 3 warnings
satpy/tests/reader_tests/test_ascat_l2_soilmoisture_bufr.py: 7 warnings
satpy/tests/reader_tests/test_iasi_l2.py: 9 warnings
satpy/tests/reader_tests/test_iasi_l2_so2_bufr.py: 6 warnings
satpy/tests/reader_tests/test_modis_l1b.py: 4 warnings
satpy/tests/reader_tests/test_modis_l2.py: 1 warning
satpy/tests/reader_tests/test_seadas_l2.py: 3 warnings
  /home/antonio/projects/forks/satpy/satpy/_config.py:125: DeprecationWarning: SelectableGroups dict interface is deprecated. Use select.
    for entry_point in entry_points().get(name, []):

satpy/tests/test_scene.py::TestScene::test_getitem_slices
satpy/tests/test_scene.py::TestSceneResampling::test_resample_scene_preserves_requested_dependencies
satpy/tests/test_scene.py::TestSceneResampling::test_resample_ancillary
satpy/tests/test_scene.py::TestSceneResampling::test_no_generate_comp10
  /usr/lib/python3/dist-packages/pyproj/crs/crs.py:1286: 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 = self._crs.to_proj4(version=version)

satpy/tests/test_scene.py::TestSceneSaving::test_save_dataset_default
satpy/tests/test_scene.py::TestSceneSaving::test_save_datasets_default
  /usr/lib/python3/dist-packages/rasterio/__init__.py:314: NotGeoreferencedWarning: Dataset has no geotransform, gcps, or rpcs. The identity matrix will be returned.
    dataset = writer(

satpy/tests/test_scene.py::TestSceneSaving::test_save_dataset_default
satpy/tests/test_scene.py::TestSceneSaving::test_save_datasets_by_ext
satpy/tests/test_scene.py::TestSceneSaving::test_save_datasets_default
  /usr/lib/python3/dist-packages/dask/core.py:119: RuntimeWarning: divide by zero encountered in true_divide
    return func(*(_execute_task(a, cache) for a in args))

satpy/tests/test_scene.py::TestSceneSaving::test_save_dataset_default
satpy/tests/test_scene.py::TestSceneSaving::test_save_datasets_by_ext
satpy/tests/test_scene.py::TestSceneSaving::test_save_datasets_default
  /usr/lib/python3/dist-packages/dask/core.py:119: RuntimeWarning: invalid value encountered in multiply
    return func(*(_execute_task(a, cache) for a in args))

satpy/tests/reader_tests/test_ahi_hsd.py::TestAHIHSDFileHandler::test_scene_loading
  /home/antonio/projects/forks/satpy/satpy/readers/ahi_hsd.py:515: UserWarning: Actual block1 header size does not match expected
    warnings.warn(f"Actual {block} header size does not match expected")

satpy/tests/reader_tests/test_ahi_hsd.py::TestAHIHSDFileHandler::test_scene_loading
  /home/antonio/projects/forks/satpy/satpy/readers/ahi_hsd.py:515: UserWarning: Actual block2 header size does not match expected
    warnings.warn(f"Actual {block} header size does not match expected")

satpy/tests/reader_tests/test_ahi_hsd.py::TestAHIHSDFileHandler::test_scene_loading
  /home/antonio/projects/forks/satpy/satpy/readers/ahi_hsd.py:515: UserWarning: Actual block3 header size does not match expected
    warnings.warn(f"Actual {block} header size does not match expected")

satpy/tests/reader_tests/test_ahi_hsd.py::TestAHIHSDFileHandler::test_scene_loading
  /home/antonio/projects/forks/satpy/satpy/readers/ahi_hsd.py:515: UserWarning: Actual block4 header size does not match expected
    warnings.warn(f"Actual {block} header size does not match expected")

satpy/tests/reader_tests/test_ahi_hsd.py::TestAHIHSDFileHandler::test_scene_loading
  /home/antonio/projects/forks/satpy/satpy/readers/ahi_hsd.py:515: UserWarning: Actual block5 header size does not match expected
    warnings.warn(f"Actual {block} header size does not match expected")

satpy/tests/reader_tests/test_ahi_hsd.py::TestAHIHSDFileHandler::test_scene_loading
  /home/antonio/projects/forks/satpy/satpy/readers/ahi_hsd.py:515: UserWarning: Actual block6 header size does not match expected
    warnings.warn(f"Actual {block} header size does not match expected")

satpy/tests/reader_tests/test_ahi_hsd.py::TestAHIHSDFileHandler::test_scene_loading
  /home/antonio/projects/forks/satpy/satpy/readers/ahi_hsd.py:515: UserWarning: Actual block7 header size does not match expected
    warnings.warn(f"Actual {block} header size does not match expected")

satpy/tests/reader_tests/test_ahi_hsd.py::TestAHIHSDFileHandler::test_scene_loading
  /home/antonio/projects/forks/satpy/satpy/readers/ahi_hsd.py:515: UserWarning: Actual block8 header size does not match expected
    warnings.warn(f"Actual {block} header size does not match expected")

satpy/tests/reader_tests/test_ahi_hsd.py::TestAHIHSDFileHandler::test_scene_loading
  /home/antonio/projects/forks/satpy/satpy/readers/ahi_hsd.py:515: UserWarning: Actual block9 header size does not match expected
    warnings.warn(f"Actual {block} header size does not match expected")

satpy/tests/reader_tests/test_ahi_hsd.py::TestAHIHSDFileHandler::test_scene_loading
  /home/antonio/projects/forks/satpy/satpy/readers/ahi_hsd.py:515: UserWarning: Actual block10 header size does not match expected
    warnings.warn(f"Actual {block} header size does not match expected")

satpy/tests/reader_tests/test_ahi_hsd.py::TestAHIHSDFileHandler::test_scene_loading
  /home/antonio/projects/forks/satpy/satpy/readers/ahi_hsd.py:515: UserWarning: Actual block11 header size does not match expected
    warnings.warn(f"Actual {block} header size does not match expected")

satpy/tests/reader_tests/test_ahi_hsd.py::TestAHIHSDFileHandler::test_scene_loading
  /home/antonio/projects/forks/satpy/satpy/readers/utils.py:334: DeprecationWarning: This function is deprecated. See: https://pyproj4.github.io/pyproj/stable/gotchas.html#upgrading-to-pyproj-2-from-pyproj-1
    x, y, z = pyproj.transform(latlong, geocent, lon, lat, 0.)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================= short test summary info =============================================================
FAILED satpy/tests/test_scene.py::TestSceneLoading::test_load_comp4 - AssertionError: assert 2 == 1
FAILED satpy/tests/test_scene.py::TestSceneLoading::test_load_multiple_resolutions - AssertionError: assert 3 == 2
FAILED satpy/tests/test_scene.py::TestSceneLoading::test_load_same_subcomposite - AssertionError: assert 'ds5' == 'comp25'
FAILED satpy/tests/test_scene.py::TestSceneLoading::test_load_comp9 - AssertionError: assert 2 == 1
FAILED satpy/tests/test_scene.py::TestSceneLoading::test_load_comp10 - AssertionError: assert 2 == 1
FAILED satpy/tests/test_scene.py::TestSceneLoading::test_load_comp19 - AssertionError: assert 3 == 1
FAILED satpy/tests/test_scene.py::TestSceneLoading::test_load_dataset_after_composite2 - AssertionError: assert 2 == 1
FAILED satpy/tests/test_scene.py::TestSceneLoading::test_no_generate_comp10 - AssertionError: assert 'comp10' in {DataID(name='ds2', resolution=...
FAILED satpy/tests/test_scene.py::TestSceneResampling::test_resample_reduce_data_toggle - KeyError: "No dataset matching 'DataQuery(name='comp19...
FAILED satpy/tests/test_scene.py::TestSceneResampling::test_resample_ancillary - KeyError: "No dataset matching 'DataQuery(name='comp19')' found"
FAILED satpy/tests/test_scene.py::TestSceneResampling::test_resample_reduce_data - KeyError: "No dataset matching 'DataQuery(name='comp19')' found"
FAILED satpy/tests/test_scene.py::TestSceneResampling::test_no_generate_comp10 - AssertionError: assert 'comp10' in <satpy.scene.Scene object at...
FAILED satpy/tests/test_scene.py::TestSceneResampling::test_comp_loading_after_resampling_new_sensor - AssertionError: assert 'comp2' in <satpy....
========================================= 13 failed, 130 passed, 1716 deselected, 287 warnings in 41.94s ==========================================

Environment Info:

  • OS: GNU/Linux - Debian Sid x86_64
  • Satpy Version: main (ee3066b)
  • Python: 3.10.8
  • PyResample Version: 1.25.1
  • xarray: 2022.10.0
  • dask: 2022.02.0
  • pyproj: 3.4.0
  • Readers and writers dependencies (when relevant): [run from satpy.utils import check_satpy; check_satpy()]
Readers
=======
abi_l1b:  ok
abi_l1b_scmi:  ok
abi_l2_nc:  ok
acspo:  ok
agri_l1:  ok
ahi_hrit:  ok
ahi_hsd:  ok
ahi_l1b_gridded_bin:  ok
ami_l1b:  ok
amsr2_l1b:  ok
amsr2_l2:  ok
amsr2_l2_gaasp:  ok
amsub_l1c_aapp:  cannot find 'FrequencyDoubleSideBand' in the module 'satpy.readers.aapp_mhs_amsub_l1c'
ascat_l2_soilmoisture_bufr:  ok
avhrr_l1b_aapp:  ok
avhrr_l1b_eps:  ok
avhrr_l1b_gaclac:  ok
avhrr_l1b_hrpt:  ok
avhrr_l1c_eum_gac_fdr_nc:  ok
caliop_l2_cloud:  cannot find module 'satpy.readers.caliop_l2_cloud' (cannot import name 'Dataset' from 'satpy.dataset' (/home/antonio/projects/forks/satpy/satpy/dataset/__init__.py))
clavrx:  ok
cmsaf-claas2_l2_nc:  ok
electrol_hrit:  ok
fci_l1c_nc:  ok
fci_l2_nc:  ok
generic_image:  ok
geocat:  ok
ghrsst_l2:  ok
glm_l2:  ok
goes-imager_hrit:  ok
goes-imager_nc:  ok
gpm_imerg:  ok
grib:  ok
hsaf_grib:  ok
hy2_scat_l2b_h5:  ok
iasi_l2:  ok
iasi_l2_so2_bufr:  ok
ici_l1b_nc:  ok
jami_hrit:  ok
li_l2:  cannot find module 'satpy.readers.li_l2' (cannot import name 'Dataset' from 'satpy.dataset' (/home/antonio/projects/forks/satpy/satpy/dataset/__init__.py))
maia:  ok
mersi2_l1b:  ok
mhs_l1c_aapp:  ok
mimicTPW2_comp:  ok
mirs:  ok
modis_l1b:  ok
modis_l2:  ok
msi_safe:  ok
msu_gsa_l1b:  ok
mtsat2-imager_hrit:  ok
mviri_l1b_fiduceo_nc:  ok
mwi_l1b_nc:  cannot find 'FrequencyDoubleSideBand' in the module 'satpy.readers.aapp_mhs_amsub_l1c'
mws_l1b_nc:  ok
nucaps:  ok
nwcsaf-geo:  ok
nwcsaf-msg2013-hdf5:  ok
nwcsaf-pps_nc:  ok
oceancolorcci_l3_nc:  ok
olci_l1b:  ok
olci_l2:  ok
omps_edr:  ok
safe_sar_l2_ocn:  ok
sar-c_safe:  ok
satpy_cf_nc:  ok
scatsat1_l2b:  cannot find module 'satpy.readers.scatsat1_l2b' (cannot import name 'Dataset' from 'satpy.dataset' (/home/antonio/projects/forks/satpy/satpy/dataset/__init__.py))
seadas_l2:  ok
seviri_l1b_hrit:  ok
seviri_l1b_icare:  ok
seviri_l1b_native:  ok
seviri_l1b_nc:  ok
seviri_l2_bufr:  ok
seviri_l2_grib:  ok
slstr_l1b:  ok
slstr_l2:  cannot find module 'satpy.readers.slstr_l2' (No module named 'satpy.readers.slstr_l2')
smos_l2_wind:  ok
tropomi_l2:  ok
vaisala_gld360:  ok
vii_l1b_nc:  ok
vii_l2_nc:  ok
viirs_compact:  ok
viirs_edr_active_fires:  ok
viirs_edr_flood:  ok
viirs_l1b:  ok
viirs_sdr:  ok
virr_l1b:  ok

Writers
=======
/usr/lib/python3/dist-packages/pyninjotiff/tifffile.py:154: UserWarning: failed to import the optional _tifffile C extension module.
Loading of some compressed images will be slow.
Tifffile.c can be obtained at http://www.lfd.uci.edu/~gohlke/
  warnings.warn(
awips_tiled:  ok
cf:  ok
geotiff:  ok
mitiff:  ok
ninjogeotiff:  ok
ninjotiff:  ok
simple_image:  ok

Extras
======
cartopy:  ok
geoviews:  No module named 'geoviews'
@djhoese
Copy link
Member

djhoese commented Oct 30, 2022

I think if you update dask to at least 2022.10.0 the tests should start passing. This was a change in xarray 2022.9.0 that required a fix in xarray (released in xarray 2022.10.0 I think) but also a new dask (released in 2022.10.0).

@avalentino
Copy link
Contributor Author

Thanks @djhoese
Indeed we still do not have dask 2022.10.0 in debian.
We will try to update it ASAP.

@djhoese
Copy link
Member

djhoese commented Oct 31, 2022

Not sure how much of an option it is, but forcing xarray <2022.9.0 would also work.

@avalentino
Copy link
Contributor Author

avalentino commented Oct 31, 2022

Yes, all was working properly until xarray has been updated.

@avalentino
Copy link
Contributor Author

I can confirm that updating dask to v2022.11.1 seems to fix these specific errors.

@djhoese djhoese closed this as completed Nov 27, 2022
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