Skip to content

Merge branch 'develop' into feature/exposures_crs #946

Merge branch 'develop' into feature/exposures_crs

Merge branch 'develop' into feature/exposures_crs #946

GitHub Actions / Core / Unit Test Results (3.9) failed Sep 9, 2024 in 0s

24 fail, 673 pass in 8m 1s

697 tests  ±0   673 ✅  - 24   8m 1s ⏱️ -48s
  1 suites ±0     0 💤 ± 0 
  1 files   ±0    24 ❌ +24 

Results for commit 92eb4ae. ± Comparison against earlier commit 456720b.

Annotations

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsData

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_from_meta_pass (climada.hazard.centroids.test.test_centr.TestCentroidsData) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsData testMethod=test_from_meta_pass>

    def test_from_meta_pass(self):
        expected_lon = np.array([-30.0, -20.0, -10.0]*3)
        expected_lat = np.repeat([30.0, 20.0, 10.0],3)
        # Check metadata
        meta = dict(
            crs=DEF_CRS,
            height=3,
            width=3,
            transform=Affine(
                10, 0, -35,
                0, -10, 35,
            ),
        )
        centroids = Centroids.from_meta(meta)
    
        # check created object
        np.testing.assert_array_equal(centroids.lon,expected_lon)
        np.testing.assert_array_equal(centroids.lat,expected_lat)
        self.assertEqual(centroids.crs,DEF_CRS)
        # generally we assume that from_meta does not set region_ids and on_land flags
>       self.assertFalse(centroids.region_id)

climada/hazard/centroids/test/test_centr.py:172: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0    None
1    None
2    None
3    None
4    None
5    None
6    None
7    None
8    None
Name: region_id, dtype: object
name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsData

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_from_pnt_bounds (climada.hazard.centroids.test.test_centr.TestCentroidsData) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsData testMethod=test_from_pnt_bounds>

    def test_from_pnt_bounds(self):
        """Test from_pnt_bounds"""
        width, height = 26, 51
        left, bottom, right, top = 5, 0, 10, 10
    
        centr = Centroids.from_pnt_bounds((left, bottom, right, top), 0.2, crs=DEF_CRS)
        self.assertTrue(u_coord.equal_crs(centr.crs, DEF_CRS))
        self.assertEqual(centr.size, width * height)
        np.testing.assert_allclose([5.0, 5.2, 5.0], centr.lon[[0, 1, width]], atol=0.1)
        np.testing.assert_allclose([10.0, 10.0, 9.8], centr.lat[[0, 1, width]], atol=0.1)
        # generally we assume that from_meta does not set region_ids and on_land flags
>       self.assertFalse(centr.region_id)

climada/hazard/centroids/test/test_centr.py:235: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0       None
1       None
2       None
3       None
4       None
        ... 
1321    None
1322    None
1323    None
1324    None
1325    None
Name: region_id, Length: 1326, dtype: object
name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsData

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_init_defaults (climada.hazard.centroids.test.test_centr.TestCentroidsData) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsData testMethod=test_init_defaults>

    def test_init_defaults(self):
        ''' Checking default values for Centroids'''
        centroids = Centroids(lat=VEC_LAT,lon=VEC_LON)
        # Checking defaults: nothing set for region_id, on_land
>       self.assertFalse(centroids.region_id)

climada/hazard/centroids/test/test_centr.py:118: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0    None
1    None
2    None
3    None
4    None
5    None
6    None
7    None
Name: region_id, dtype: object
name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsData

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_init_kwargs (climada.hazard.centroids.test.test_centr.TestCentroidsData) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsData testMethod=test_init_kwargs>

    def test_init_kwargs(self):
        """ Test default crs and kwargs forwarding """
        centr = Centroids(
            lat=VEC_LAT,
            lon=VEC_LON,
            region_id=REGION_ID,
            on_land=ON_LAND,
        )
        self.assertTrue(u_coord.equal_crs(centr.crs, DEF_CRS))
>       self.assertTrue(np.allclose(centr.region_id, REGION_ID))

climada/hazard/centroids/test/test_centr.py:140: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0    776
1      0
2    554
3      0
4    578
5      0
6     10
7    218
Name: region_id, dtype: int64
name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsData

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_init_pass (climada.hazard.centroids.test.test_centr.TestCentroidsData) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsData testMethod=test_init_pass>

    def test_init_pass(self):
        # Creating Centroids with latitude and longitude arrays
        # check instance - trivial...
        # Checking attributes
        np.testing.assert_array_equal(self.centr.lat, VEC_LAT)
        np.testing.assert_array_equal(self.centr.lon, VEC_LON)
        self.assertTrue(u_coord.equal_crs(self.centr.crs, DEF_CRS))
    
        # Creating Centroids with additional attributes
        centroids = Centroids(lat=VEC_LAT, lon=VEC_LON,
                              region_id=REGION_ID, on_land=ON_LAND)
    
        # Checking additional attributes
>       np.testing.assert_array_equal(centroids.region_id, REGION_ID)

climada/hazard/centroids/test/test_centr.py:111: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0    776
1      0
2    554
3      0
4    578
5      0
6     10
7    218
Name: region_id, dtype: int64
name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsData

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_init_properties (climada.hazard.centroids.test.test_centr.TestCentroidsData) failed

tests_xml/tests.xml [took 0s]
Raw output
AssertionError: False is not true
self = <climada.hazard.centroids.test.test_centr.TestCentroidsData testMethod=test_init_properties>

    def test_init_properties(self):
        """ Guarantee that Centroid objects have at least the properties: """
        properties = ['gdf','lon','lat','geometry',
                      'on_land','region_id','crs',
                      'shape','size','total_bounds','coord']
        centroids = Centroids(lat=[],lon=[])
>       [self.assertTrue(hasattr(centroids,prop)) for prop in properties]

climada/hazard/centroids/test/test_centr.py:129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/test/test_centr.py:129: in <listcomp>
    [self.assertTrue(hasattr(centroids,prop)) for prop in properties]
E   AssertionError: False is not true

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsTransformation

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_set_on_land_pass (climada.hazard.centroids.test.test_centr.TestCentroidsTransformation) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'on_land'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsTransformation testMethod=test_set_on_land_pass>

    def test_set_on_land_pass(self):
        """Test set_on_land"""
>       self.centr.set_on_land()

climada/hazard/centroids/test/test_centr.py:321: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:544: in set_on_land
    if overwrite or self.on_land is None:
climada/hazard/centroids/centr.py:143: in on_land
    if self.gdf['on_land'].on_land.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0    None
1    None
2    None
3    None
4    None
5    None
6    None
7    None
Name: on_land, dtype: object
name = 'on_land'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'on_land'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsTransformation

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_set_on_land_raster (climada.hazard.centroids.test.test_centr.TestCentroidsTransformation) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'on_land'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsTransformation testMethod=test_set_on_land_raster>

    def test_set_on_land_raster(self):
        """Test set_on_land"""
        centr_ras = Centroids.from_raster_file(HAZ_DEMO_FL, window=Window(0, 0, 50, 60))
>       centr_ras.set_on_land()

climada/hazard/centroids/test/test_centr.py:336: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:544: in set_on_land
    if overwrite or self.on_land is None:
climada/hazard/centroids/centr.py:143: in on_land
    if self.gdf['on_land'].on_land.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0       None
1       None
2       None
3       None
4       None
        ... 
2995    None
2996    None
2997    None
2998    None
2999    None
Name: on_land, Length: 3000, dtype: object
name = 'on_land'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'on_land'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsTransformation

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_set_region_id_pass (climada.hazard.centroids.test.test_centr.TestCentroidsTransformation) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsTransformation testMethod=test_set_region_id_pass>

    def test_set_region_id_pass(self):
        """Test set_region_id"""
>       self.centr.set_region_id()

climada/hazard/centroids/test/test_centr.py:341: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:519: in set_region_id
    if overwrite or self.region_id is None:
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0    None
1    None
2    None
3    None
4    None
5    None
6    None
7    None
Name: region_id, dtype: object
name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsTransformation

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_set_region_id_raster (climada.hazard.centroids.test.test_centr.TestCentroidsTransformation) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsTransformation testMethod=test_set_region_id_raster>

    def test_set_region_id_raster(self):
        """Test set_region_id raster file"""
        centr_ras = Centroids.from_raster_file(HAZ_DEMO_FL, window=Window(0, 0, 50, 60))
>       centr_ras.set_region_id()

climada/hazard/centroids/test/test_centr.py:350: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:519: in set_region_id
    if overwrite or self.region_id is None:
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0       None
1       None
2       None
3       None
4       None
        ... 
2995    None
2996    None
2997    None
2998    None
2999    None
Name: region_id, Length: 3000, dtype: object
name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_from_csv (climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter testMethod=test_from_csv>

    def test_from_csv(self):
        """Read a centroid csv file which contains CRS information."""
        tmpfile = Path('test_write_csv.csv')
        lat = np.array([0, 20048966.1, -20048966, 0, 0])
        lon = np.array([0, 0, 0, 20037508.34, -20037508.34])
        region_id = np.array([1, 2, 3, 4, 5])
        on_land = np.array([True, False, False, True, True])
        df = pd.DataFrame({'lat': lat, 'lon': lon, 'region_id': region_id, 'on_land': on_land})
        df['crs'] = CRS.from_user_input(3857).to_wkt()
        df.to_csv(tmpfile, index=False)
    
        # Read centroids using from_csv method
        centroids = Centroids.from_csv(tmpfile)
    
        # Test attributes
        np.testing.assert_array_equal(centroids.lat, lat)
        np.testing.assert_array_equal(centroids.lon, lon)
        self.assertEqual(centroids.crs, 'epsg:3857')
>       np.testing.assert_array_equal(centroids.region_id, region_id)

climada/hazard/centroids/test/test_centr.py:411: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0    1
1    2
2    3
3    4
4    5
Name: region_id, dtype: int64
name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_from_excel (climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter testMethod=test_from_excel>

    def test_from_excel(self):
        """Read a centroid excel file correctly which contains CRS information."""
        # Create temporary excel file containing centroids data
        tmpfile = Path('test_write_excel.xlsx')
        lat = np.array([0, 20048966.1, -20048966, 0, 0])
        lon = np.array([0, 0, 0, 20037508.34, -20037508.34])
        region_id = np.array([1, 2, 3, 4, 5])
        on_land = np.array([True, False, False, True, True])
        df = pd.DataFrame({'lat': lat, 'lon': lon, 'region_id': region_id, 'on_land': on_land})
        df['crs'] = CRS.from_user_input(3857).to_wkt()
        df.to_excel(tmpfile, sheet_name='centroids', index=False)
    
        # Read centroids using from_excel method
        centroids = Centroids.from_excel(file_path=tmpfile)
    
        # test attributes
        np.testing.assert_array_equal(centroids.lat, lat)
        np.testing.assert_array_equal(centroids.lon, lon)
        self.assertEqual(centroids.crs, 'epsg:3857')
>       np.testing.assert_array_equal(centroids.region_id, region_id)

climada/hazard/centroids/test/test_centr.py:482: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0    1
1    2
2    3
3    4
4    5
Name: region_id, dtype: int64
name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_from_exposures_with_region_id (climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter testMethod=test_from_exposures_with_region_id>

    def test_from_exposures_with_region_id(self):
        """
        Test that the `from_exposures` method correctly extracts
        centroids and region_id from an `Exposure` object with region_id.
        """
        # Create an Exposure object with region_id, on_land and custom crs
        lat = np.array([10.0, 20.0, 30.0])
        lon = np.array([-10.0, -20.0, -30.0])
        value = np.array([1, 1, 1])
        region_id = np.array([1, 2, 3])
        on_land = [False, True, True]
        crs = 'epsg:32632'
        gdf = gpd.GeoDataFrame({
            'latitude': lat,
            'longitude': lon,
            'value': value,
            'region_id': region_id,
            'on_land': on_land,
        })
        exposures = Exposures(gdf, crs=crs)
    
        # Extract centroids from exposures
        centroids = Centroids.from_exposures(exposures)
    
        # Check attributes
        np.testing.assert_array_equal(centroids.lat, lat)
        np.testing.assert_array_equal(centroids.lon, lon)
>       np.testing.assert_array_equal(centroids.region_id, region_id)

climada/hazard/centroids/test/test_centr.py:613: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0    1
1    2
2    3
Name: region_id, dtype: int64, name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_from_geodataframe (climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter testMethod=test_from_geodataframe>

    def test_from_geodataframe(self):
        """Test that constructing a valid Centroids instance from gdf works."""
        crs = DEF_CRS
        lat = np.arange(170, 180)
        lon = np.arange(-50, -40)
        region_id = np.arange(1, 11)
        on_land = np.ones(10, dtype=bool)
        extra = np.full(10, 'a')
    
        gdf = gpd.GeoDataFrame({
            'geometry': gpd.points_from_xy(lon, lat),
            'region_id': region_id,
            'on_land': on_land,
            'extra': extra,
        }, crs=crs)
    
        centroids = Centroids.from_geodataframe(gdf)
    
        for name, array in zip(
            ['lat', 'lon', 'region_id', 'on_land'],
            [lat, lon, region_id, on_land],
        ):
>           np.testing.assert_array_equal(array, getattr(centroids, name))

climada/hazard/centroids/test/test_centr.py:567: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0     1
1     2
2     3
3     4
4     5
5     6
6     7
7     8
8     9
9    10
Name: region_id, dtype: int64
name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_write_read_csv (climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter testMethod=test_write_read_csv>

    def test_write_read_csv(self):
        """Write and read a Centroids CSV file correctly."""
        # Create Centroids with latitude and longitude arrays
        tmpfile = Path('test_write_csv.csv')
        lat = np.array([10.0, 20.0, 30.0])
        lon = np.array([-10.0, -20.0, -30.0])
        region_id = np.array([1, 2, 3])
        on_land = np.array([True, False, False])
        centroids_out = Centroids(lat=lat, lon=lon, region_id=region_id, on_land=on_land)
    
        # Write CSV file from Centroids using write_csv
        centroids_out.write_csv(tmpfile)
    
        # Read CSV file using read_csv
        centroids_in = Centroids.from_csv(tmpfile)
    
        # Test attributes
        np.testing.assert_array_equal(centroids_in.lat, centroids_out.lat)
        np.testing.assert_array_equal(centroids_in.lon, centroids_out.lon)
        self.assertTrue(u_coord.equal_crs(centroids_in.crs, centroids_out.crs))
>       np.testing.assert_array_equal(centroids_in.region_id, centroids_out.region_id)

climada/hazard/centroids/test/test_centr.py:437: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0    1
1    2
2    3
Name: region_id, dtype: int64, name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_write_read_excel (climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsReaderWriter testMethod=test_write_read_excel>

    def test_write_read_excel(self):
        """Write and read a Centroids Excel file correctly."""
        # Create Centroids with latitude and longitude arrays
        tmpfile = Path('test_write_excel.xlsx')
        lat = np.array([10.0, 20.0, 30.0])
        lon = np.array([-10.0, -20.0, -30.0])
        region_id = np.array([1, 2, 3])
        on_land = np.array([True, False, False])
        centroids_out = Centroids(lat=lat, lon=lon, region_id=region_id, on_land=on_land)
    
        # Write Excel file from Centroids using write_csv
        centroids_out.write_excel(tmpfile)
    
        # Read Excel file using read_csv
        centroids_in = Centroids.from_excel(tmpfile)
    
        # Test attributes
        np.testing.assert_array_equal(centroids_in.lat, centroids_out.lat)
        np.testing.assert_array_equal(centroids_in.lon, centroids_out.lon)
        self.assertTrue(u_coord.equal_crs(centroids_in.crs, centroids_out.crs))
>       np.testing.assert_array_equal(centroids_in.region_id, centroids_out.region_id)

climada/hazard/centroids/test/test_centr.py:508: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0    1
1    2
2    3
Name: region_id, dtype: int64, name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsMethods

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_remove_duplicates_dif_on_land (climada.hazard.centroids.test.test_centr.TestCentroidsMethods) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'on_land'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsMethods testMethod=test_remove_duplicates_dif_on_land>

    def test_remove_duplicates_dif_on_land(self):
        ### We currently expect that only the geometry of the gdf defines duplicates.
        ### If one geometry is duplicated with differences in other attributes e.g. on_land
        ### they get removed nevertheless. Only the first occurrence will be part of the new object
        ### this test is only here to guarantee this behaviour
        lat, lon = np.array([0,0,1,2,3,4,5]),np.array([0,0,1,2,3,4,5])
        centr = Centroids(lat=lat,lon=lon,on_land=[True]+[False]*6)
        centr_subset = centr.remove_duplicate_points()
        # new object created
        self.assertFalse(centr == centr_subset)
        self.assertIsNot(centr,centr_subset)
        # duplicates removed
        self.assertTrue(centr_subset.size == len(lat)-1)
        self.assertTrue(np.all(centr_subset.shape == (len(lat)-1,len(lon)-1)))
        np.testing.assert_array_equal(centr_subset.lon,np.unique(lon))
        np.testing.assert_array_equal(centr_subset.lat,np.unique(lat))
        # only first on_land (True) is selected
>       self.assertTrue(centr_subset.on_land[0])

climada/hazard/centroids/test/test_centr.py:782: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:143: in on_land
    if self.gdf['on_land'].on_land.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0     True
2    False
3    False
4    False
5    False
6    False
Name: on_land, dtype: bool
name = 'on_land'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'on_land'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsMethods

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_select_pass (climada.hazard.centroids.test.test_centr.TestCentroidsMethods) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsMethods testMethod=test_select_pass>

    def test_select_pass(self):
        """Test Centroids.select method"""
        region_id = np.zeros(VEC_LAT.size)
        region_id[[2, 4]] = 10
        centr = Centroids(lat=VEC_LAT, lon=VEC_LON, region_id=region_id)
    
>       fil_centr = centr.select(reg_id=10)

climada/hazard/centroids/test/test_centr.py:828: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:429: in select
    sel_cen_mask = self.select_mask(sel_cen=sel_cen_bool, reg_id=reg_id, extent=extent)
climada/hazard/centroids/centr.py:457: in select_mask
    sel_cen &= np.isin(self.region_id, reg_id)
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0     0.0
1     0.0
2    10.0
3     0.0
4    10.0
5     0.0
6     0.0
7     0.0
Name: region_id, dtype: float64
name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_centr.TestCentroidsMethods

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_union (climada.hazard.centroids.test.test_centr.TestCentroidsMethods) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'on_land'
self = <climada.hazard.centroids.test.test_centr.TestCentroidsMethods testMethod=test_union>

    def test_union(self):
        lat, lon = np.array([0, 1]), np.array([0, -1])
        on_land = np.array([True, True])
        cent1 = Centroids(lat=lat, lon=lon, on_land=on_land)
    
        lat2, lon2 = np.array([2, 3]), np.array([-2, 3])
        on_land2 = np.array([False, False])
        cent2 = Centroids(lat=lat2, lon=lon2, on_land=on_land2)
    
        lat3, lon3 = np.array([-1, -2]), np.array([1, 2])
        cent3 = Centroids(lat=lat3,lon=lon3)
    
        cent = cent1.union(cent2)
        np.testing.assert_array_equal(cent.lat, np.concatenate([lat,lat2]))
        np.testing.assert_array_equal(cent.lon, np.concatenate([lon,lon2]))
>       np.testing.assert_array_equal(cent.on_land, np.concatenate([on_land,on_land2]))

climada/hazard/centroids/test/test_centr.py:799: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:143: in on_land
    if self.gdf['on_land'].on_land.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0     True
1     True
0    False
1    False
Name: on_land, dtype: bool
name = 'on_land'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'on_land'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.test.test_base.TestSelect

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_select_new_fraction_zero (climada.hazard.test.test_base.TestSelect) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.test.test_base.TestSelect testMethod=test_select_new_fraction_zero>

    def test_select_new_fraction_zero(self):
        """Check if a new fraction of only zeros is handled correctly"""
        hazard = dummy_hazard()
        hazard.centroids.gdf["region_id"] = [1, 1, 2]
    
        # Select a part of the hazard where fraction is zero only
        with self.assertRaisesRegex(
            RuntimeError,
            "Your selection created a Hazard object where the fraction matrix is zero "
            "everywhere"
        ):
>           hazard.select(event_id=[3, 4], reg_id=[2])

climada/hazard/test/test_base.py:634: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/base.py:354: in select
    sel_cen = self.centroids.select_mask(reg_id=reg_id, extent=extent)
climada/hazard/centroids/centr.py:457: in select_mask
    sel_cen &= np.isin(self.region_id, reg_id)
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.test.test_base.TestSelect

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_select_reg_id_pass (climada.hazard.test.test_base.TestSelect) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.test.test_base.TestSelect testMethod=test_select_reg_id_pass>

    def test_select_reg_id_pass(self):
        """Test select region of centroids."""
        haz = dummy_hazard()
        haz.centroids.gdf['region_id'] = np.array([5, 7, 9])
>       sel_haz = haz.select(date=(2, 4), orig=False, reg_id=9)

climada/hazard/test/test_base.py:530: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/base.py:354: in select
    sel_cen = self.centroids.select_mask(reg_id=reg_id, extent=extent)
climada/hazard/centroids/centr.py:457: in select_mask
    sel_cen &= np.isin(self.region_id, reg_id)
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0    5
1    7
2    9
Name: region_id, dtype: int64, name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.test.test_storm_europe.TestReader

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_generate_prob_storms (climada.hazard.test.test_storm_europe.TestReader) failed

tests_xml/tests.xml [took 2s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.test.test_storm_europe.TestReader testMethod=test_generate_prob_storms>

    def test_generate_prob_storms(self):
        """Test the probabilistic storm generator; calls _hist2prob as well as
        Centroids.set_region_id()"""
        storms = StormEurope.from_footprints(WS_DEMO_NC)
>       storms_prob = storms.generate_prob_storms()

climada/hazard/test/test_storm_europe.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/storm_europe.py:776: in generate_prob_storms
    self.centroids.set_region_id(overwrite=False)
climada/hazard/centroids/centr.py:519: in set_region_id
    if overwrite or self.region_id is None:
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0       None
1       None
2       None
3       None
4       None
        ... 
9939    None
9940    None
9941    None
9942    None
9943    None
Name: region_id, Length: 9944, dtype: object
name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.test.test_storm_europe.TestReader

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_read_with_cent (climada.hazard.test.test_storm_europe.TestReader) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Series' object has no attribute 'region_id'
self = <climada.hazard.test.test_storm_europe.TestReader testMethod=test_read_with_cent>

    def test_read_with_cent(self):
        """Test from_footprints while passing in a Centroids object"""
        test_centroids = Centroids.from_excel(
            file_path=DATA_DIR.joinpath('fp_centroids-test.xls'),
            sheet_name='fp_centroids-test'
            )
        storms = StormEurope.from_footprints(WS_DEMO_NC, centroids=test_centroids)
    
        self.assertEqual(storms.intensity.shape, (2, 9944))
        self.assertEqual(
            np.count_nonzero(
>               ~np.isnan(storms.centroids.region_id)
            ),
            6401
        )

climada/hazard/test/test_storm_europe.py:75: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:152: in region_id
    if self.gdf['region_id'].region_id.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0         NaN
1         NaN
2         NaN
3         NaN
4         NaN
        ...  
9939    276.0
9940    276.0
9941    276.0
9942    276.0
9943    276.0
Name: region_id, Length: 9944, dtype: float64
name = 'region_id'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'region_id'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError

Check warning on line 0 in climada.hazard.test.test_storm_europe.TestReader

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_set_ssi (climada.hazard.test.test_storm_europe.TestReader) failed

tests_xml/tests.xml [took 2s]
Raw output
AttributeError: 'Series' object has no attribute 'on_land'
self = <climada.hazard.test.test_storm_europe.TestReader testMethod=test_set_ssi>

    def test_set_ssi(self):
        """Test set_ssi with both dawkins and wisc_gust methodology."""
        storms = StormEurope.from_footprints(WS_DEMO_NC)
    
>       storms.set_ssi(method='dawkins')

climada/hazard/test/test_storm_europe.py:84: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/storm_europe.py:693: in set_ssi
    self.ssi = self.calc_ssi(**kwargs)
climada/hazard/storm_europe.py:664: in calc_ssi
    sel_cen = cent.on_land.astype(bool)
climada/hazard/centroids/centr.py:143: in on_land
    if self.gdf['on_land'].on_land.isna().all():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 0        True
1        True
2        True
3        True
4        True
        ...  
9939    False
9940    False
9941    False
9942    False
9943    False
Name: on_land, Length: 9944, dtype: object
name = 'on_land'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'on_land'

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:6204: AttributeError