Skip to content

Modular Update: Split into Downloader & Handler #203

Modular Update: Split into Downloader & Handler

Modular Update: Split into Downloader & Handler #203

GitHub Actions / Petals / Unit Test Results (3.11) failed Oct 28, 2024 in 0s

2 fail, 2 skipped, 199 pass in 5m 5s

203 tests  ±0   199 ✅  - 2   5m 5s ⏱️ +37s
  1 suites ±0     2 💤 ±0 
  1 files   ±0     2 ❌ +2 

Results for commit 339cc7f. ± Comparison against earlier commit c6f005b.

Annotations

Check warning on line 0 in climada_petals.entity.exposures.test.test_crop_production.TestCropProduction

See this annotation in the file changed.

@github-actions github-actions / Petals / Unit Test Results (3.11)

test_normalize_with_fao_cp (climada_petals.entity.exposures.test.test_crop_production.TestCropProduction) failed

climada_petals/tests_xml/tests.xml [took 0s]
Raw output
TypeError: Exposures.__init__() got an unexpected keyword argument 'crop'
self = <climada_petals.entity.exposures.test.test_crop_production.TestCropProduction testMethod=test_normalize_with_fao_cp>

    def test_normalize_with_fao_cp(self):
        """ Test normalizing of two given exposures countrywise (usually firr + norr)
        with the mean crop production quantity"""
        exp = cp.CropProduction.from_isimip_netcdf(input_dir=INPUT_DIR, filename=FILENAME, hist_mean=FILENAME_MEAN,
                                          bbox=[-5, 42, 16, 55], yearrange=np.array([2001, 2005]),
                                          scenario='flexible', crop = 'mai', unit='t/y', irr='firr')
        country_list, ratio, exp_firr_norm, exp_noirr_norm, fao_crop_production, _exp_tot_production = \
>            cp.normalize_with_fao_cp(exp, exp, input_dir=INPUT_DIR,
                              yearrange=np.array([2009, 2018]), unit='t/y', return_data=True)

climada_petals/entity/exposures/test/test_crop_production.py:183: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada_petals/entity/exposures/crop_production.py:1001: in normalize_with_fao_cp
    exp_firr_norm = exp_firr.copy(deep=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <climada_petals.entity.exposures.crop_production.CropProduction object at 0x7ff5409e9e50>
deep = True

    def copy(self, deep=True):
        """Make a copy of this Exposures object.
    
        Parameters
        ----------
        deep (bool): Make a deep copy, i.e. also copy data. Default True.
    
        Returns
        -------
            Exposures
        """
        gdf = self.gdf.copy(deep=deep)
        metadata = dict(
            [(md, copy.deepcopy(self.__dict__[md])) for md in type(self)._metadata]
        )
        metadata["crs"] = self.crs
>       return type(self)(gdf, **metadata)
E       TypeError: Exposures.__init__() got an unexpected keyword argument 'crop'

../../../../micromamba/envs/climada_env_3.11/lib/python3.11/site-packages/climada/entity/exposures/base.py:1279: TypeError

Check warning on line 0 in climada_petals.entity.exposures.test.test_gdp_asset.TestGDP2AssetFunctions

See this annotation in the file changed.

@github-actions github-actions / Petals / Unit Test Results (3.11)

test_set_one_country (climada_petals.entity.exposures.test.test_gdp_asset.TestGDP2AssetFunctions) failed

climada_petals/tests_xml/tests.xml [took 2s]
Raw output
AssertionError: 47.062247399999976 != 9.5206968 within 7 places (37.54155059999998 difference)
self = <climada_petals.entity.exposures.test.test_gdp_asset.TestGDP2AssetFunctions testMethod=test_set_one_country>

    def test_set_one_country(self):
        with self.assertRaises(KeyError):
            ga.GDP2Asset._set_one_country('LIE', 2001, path=DEMO_GDP2ASSET)
    
        exp_test = ga.GDP2Asset._set_one_country('LIE', 2000, path=DEMO_GDP2ASSET).gdf
    
>       self.assertAlmostEqual(exp_test.iloc[0, 2], 9.5206968)
E       AssertionError: 47.062247399999976 != 9.5206968 within 7 places (37.54155059999998 difference)

climada_petals/entity/exposures/test/test_gdp_asset.py:58: AssertionError