Skip to content

centroids.centr.write_hdf5: elimination of side effect futile for pan… #169

centroids.centr.write_hdf5: elimination of side effect futile for pan…

centroids.centr.write_hdf5: elimination of side effect futile for pan… #169

GitHub Actions / Unit Test Results Python 3.11 failed Nov 29, 2023 in 0s

26 fail, 610 pass in 6m 51s

636 tests  ±0   610 ✔️ ±0   6m 51s ⏱️ +13s
    1 suites ±0       0 💤 ±0 
    1 files   ±0     26 ±0 

Results for commit baf88a0. ± Comparison against earlier commit 5571755.

Annotations

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestVector

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_append_pass (climada.hazard.centroids.test.test_vec_ras.TestVector) failed

tests_xml/tests.xml [took 0s]
Raw output
NameError: name 'data_vector' is not defined
self = <climada.hazard.centroids.test.test_vec_ras.TestVector testMethod=test_append_pass>

    def test_append_pass(self):
        """Append points"""
>       lat, lon, geometry = data_vector()
E       NameError: name 'data_vector' is not defined

climada/hazard/centroids/test/test_vec_ras.py:192: NameError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestVector

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_area_approx (climada.hazard.centroids.test.test_vec_ras.TestVector) failed

tests_xml/tests.xml [took 0s]
Raw output
NameError: name 'data_vector' is not defined
self = <climada.hazard.centroids.test.test_vec_ras.TestVector testMethod=test_area_approx>

    def test_area_approx(self):
        """Test set_area_approx"""
>       lat, lon, geometry = data_vector()
E       NameError: name 'data_vector' is not defined

climada/hazard/centroids/test/test_vec_ras.py:184: NameError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestVector

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_area_pass (climada.hazard.centroids.test.test_vec_ras.TestVector) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: property 'geometry' of 'Centroids' object has no setter
self = <climada.hazard.centroids.test.test_vec_ras.TestVector testMethod=test_area_pass>

    def test_area_pass(self):
        """Test set_area"""
        ulx, xres, lrx = 60, 1, 90
        uly, yres, lry = 0, 1, 20
        xx, yy = np.meshgrid(np.arange(ulx + xres / 2, lrx, xres),
                             np.arange(uly + yres / 2, lry, yres))
        vec_data = gpd.GeoDataFrame({
            'geometry': [Point(xflat, yflat) for xflat, yflat in zip(xx.flatten(), yy.flatten())],
            'lon': xx.flatten(),
            'lat': yy.flatten(),
        }, crs={'proj': 'cea'})
    
        centr = Centroids(latitude=vec_data.lat.values, longitude=vec_data.lon.values)
>       centr.geometry = vec_data.geometry
E       AttributeError: property 'geometry' of 'Centroids' object has no setter

climada/hazard/centroids/test/test_vec_ras.py:132: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestVector

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_dist_coast_pass (climada.hazard.centroids.test.test_vec_ras.TestVector) failed

tests_xml/tests.xml [took 1s]
Raw output
AssertionError: 
Arrays are not almost equal to 3 decimals

Mismatched elements: 5 / 6 (83.3%)
Max absolute difference: 553972.84998257
Max relative difference: 0.99711068
 x: array([  1605.243,    603.261,   2228.629,    482.265,    661.114,
       158184.4  ])
 y: array([5.556e+05, 1.641e+03, 2.007e+03, 4.823e+02, 4.500e+03, 1.086e+05])
self = <climada.hazard.centroids.test.test_vec_ras.TestVector testMethod=test_dist_coast_pass>

    def test_dist_coast_pass(self):
        """Test set_dist_coast"""
        dist_coast = self.centr.get_dist_coast()\
        # Just checking that the output doesnt change over time.
        REF_VALUES = np.array([
            5.55578093e+05, 1.64066475e+03, 2.00703835e+03,
            4.82264614e+02, 4.50037266e+03, 1.08610274e+05
            ])
>       np.testing.assert_array_almost_equal(dist_coast, REF_VALUES, decimal=3)

climada/hazard/centroids/test/test_vec_ras.py:92: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../micromamba/envs/climada_env_3.11/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<function assert_array_almost_equal.<locals>.compare at 0x7ffb0f6223e0>, array([  1605.24301743,    603.26125189,   2...6267]), array([5.55578093e+05, 1.64066475e+03, 2.00703835e+03, 4.82264614e+02,
       4.50037266e+03, 1.08610274e+05]))
kwds = {'err_msg': '', 'header': 'Arrays are not almost equal to 3 decimals', 'precision': 3, 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Arrays are not almost equal to 3 decimals
E           
E           Mismatched elements: 5 / 6 (83.3%)
E           Max absolute difference: 553972.84998257
E           Max relative difference: 0.99711068
E            x: array([  1605.243,    603.261,   2228.629,    482.265,    661.114,
E                  158184.4  ])
E            y: array([5.556e+05, 1.641e+03, 2.007e+03, 4.823e+02, 4.500e+03, 1.086e+05])

../../../micromamba/envs/climada_env_3.11/lib/python3.11/contextlib.py:81: AssertionError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestVector

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_equal_pass (climada.hazard.centroids.test.test_vec_ras.TestVector) failed

tests_xml/tests.xml [took 0s]
Raw output
NameError: name 'data_vector' is not defined
self = <climada.hazard.centroids.test.test_vec_ras.TestVector testMethod=test_equal_pass>

    def test_equal_pass(self):
        """Test equal"""
>       lat, lon, geometry = data_vector()
E       NameError: name 'data_vector' is not defined

climada/hazard/centroids/test/test_vec_ras.py:210: NameError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestVector

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_get_closest_point (climada.hazard.centroids.test.test_vec_ras.TestVector) failed

tests_xml/tests.xml [took 0s]
Raw output
NameError: name 'data_vector' is not defined
self = <climada.hazard.centroids.test.test_vec_ras.TestVector testMethod=test_get_closest_point>

    def test_get_closest_point(self):
        """Test get_closest_point"""
>       lat, lon, geometry = data_vector()
E       NameError: name 'data_vector' is not defined

climada/hazard/centroids/test/test_vec_ras.py:145: NameError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestVector

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_get_pixel_polygons_pass (climada.hazard.centroids.test.test_vec_ras.TestVector) failed

tests_xml/tests.xml [took 0s]
Raw output
NameError: name 'data_vector' is not defined
self = <climada.hazard.centroids.test.test_vec_ras.TestVector testMethod=test_get_pixel_polygons_pass>

    def test_get_pixel_polygons_pass(self):
        """Test calc_pixels_polygons"""
>       lat, lon, geometry = data_vector()
E       NameError: name 'data_vector' is not defined

climada/hazard/centroids/test/test_vec_ras.py:174: NameError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestVector

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_on_land (climada.hazard.centroids.test.test_vec_ras.TestVector) failed

tests_xml/tests.xml [took 4s]
Raw output
AssertionError: 
Arrays are not equal

Mismatched elements: 2 / 6 (33.3%)
 x: array([ True, False, False, False,  True,  True])
 y: array([ True,  True,  True, False,  True,  True])
self = <climada.hazard.centroids.test.test_vec_ras.TestVector testMethod=test_on_land>

    def test_on_land(self):
        """Test set_on_land"""
        self.centr.set_on_land()
>       np.testing.assert_array_equal(
            self.centr.on_land,
            ON_LAND
        )

climada/hazard/centroids/test/test_vec_ras.py:105: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<built-in function eq>, 0     True
1    False
2    False
3    False
4     True
5     True
Name: on_land, dtype: bool, array([ True,  True,  True, False,  True,  True]))
kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Arrays are not equal
E           
E           Mismatched elements: 2 / 6 (33.3%)
E            x: array([ True, False, False, False,  True,  True])
E            y: array([ True,  True,  True, False,  True,  True])

../../../micromamba/envs/climada_env_3.11/lib/python3.11/contextlib.py:81: AssertionError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestVector

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_region_id_pass (climada.hazard.centroids.test.test_vec_ras.TestVector) failed

tests_xml/tests.xml [took 4s]
Raw output
AssertionError: 
Arrays are not equal

Mismatched elements: 4 / 6 (66.7%)
Max absolute difference: 776
Max relative difference: 1.
 x: array([ 0,  0,  0,  0, 10,  0])
 y: array([776, 242, 578,   0,  10, 218])
self = <climada.hazard.centroids.test.test_vec_ras.TestVector testMethod=test_region_id_pass>

    def test_region_id_pass(self):
        """Test set_region_id"""
        self.centr.set_region_id()
>       np.testing.assert_array_equal(
            self.centr.region_id,
            REGION_ID
        )

climada/hazard/centroids/test/test_vec_ras.py:97: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<built-in function eq>, 0     0
1     0
2     0
3     0
4    10
5     0
Name: region_id, dtype: int64, array([776, 242, 578,   0,  10, 218]))
kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Arrays are not equal
E           
E           Mismatched elements: 4 / 6 (66.7%)
E           Max absolute difference: 776
E           Max relative difference: 1.
E            x: array([ 0,  0,  0,  0, 10,  0])
E            y: array([776, 242, 578,   0,  10, 218])

../../../micromamba/envs/climada_env_3.11/lib/python3.11/contextlib.py:81: AssertionError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestVector

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_set_lat_lon_to_meta_pass (climada.hazard.centroids.test.test_vec_ras.TestVector) failed

tests_xml/tests.xml [took 0s]
Raw output
NameError: name 'data_vector' is not defined
self = <climada.hazard.centroids.test.test_vec_ras.TestVector testMethod=test_set_lat_lon_to_meta_pass>

    def test_set_lat_lon_to_meta_pass(self):
        """Test set_lat_lon_to_meta"""
>       lat, lon, geometry = data_vector()
E       NameError: name 'data_vector' is not defined

climada/hazard/centroids/test/test_vec_ras.py:157: NameError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestVector

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_size_pass (climada.hazard.centroids.test.test_vec_ras.TestVector) failed

tests_xml/tests.xml [took 0s]
Raw output
NameError: name 'data_vector' is not defined
self = <climada.hazard.centroids.test.test_vec_ras.TestVector testMethod=test_size_pass>

    def test_size_pass(self):
        """Test size property"""
>       lat, lon, geometry = data_vector()
E       NameError: name 'data_vector' is not defined

climada/hazard/centroids/test/test_vec_ras.py:138: NameError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestRaster

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_area_pass (climada.hazard.centroids.test.test_vec_ras.TestRaster) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Centroids' object has no attribute 'meta'
self = <climada.hazard.centroids.test.test_vec_ras.TestRaster testMethod=test_area_pass>

    def test_area_pass(self):
        """Test set_area"""
        centr_ras = Centroids.from_raster_file(HAZ_DEMO_FL, window=Window(0, 0, 50, 60))
>       centr_ras.meta['crs'] = {'proj': 'cea'}
E       AttributeError: 'Centroids' object has no attribute 'meta'

climada/hazard/centroids/test/test_vec_ras.py:301: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestRaster

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_dist_coast_pass (climada.hazard.centroids.test.test_vec_ras.TestRaster) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Centroids' object has no attribute 'set_dist_coast'
self = <climada.hazard.centroids.test.test_vec_ras.TestRaster testMethod=test_dist_coast_pass>

    def test_dist_coast_pass(self):
        """Test set_region_id"""
        centr_ras = Centroids.from_raster_file(HAZ_DEMO_FL, window=Window(0, 0, 50, 60))
>       centr_ras.set_dist_coast()
E       AttributeError: 'Centroids' object has no attribute 'set_dist_coast'

climada/hazard/centroids/test/test_vec_ras.py:286: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestRaster

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_from_pnt_bounds_pass (climada.hazard.centroids.test.test_vec_ras.TestRaster) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Centroids' object has no attribute 'meta'
self = <climada.hazard.centroids.test.test_vec_ras.TestRaster testMethod=test_from_pnt_bounds_pass>

    def test_from_pnt_bounds_pass(self):
        """Test from_pnt_bounds"""
        left, bottom, right, top = 5, 0, 10, 10
        centr = Centroids.from_pnt_bounds((left, bottom, right, top), 0.2)
>       self.assertTrue(u_coord.equal_crs(centr.meta['crs'], DEF_CRS))
E       AttributeError: 'Centroids' object has no attribute 'meta'

climada/hazard/centroids/test/test_vec_ras.py:226: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestRaster

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_get_closest_point (climada.hazard.centroids.test.test_vec_ras.TestRaster) failed

tests_xml/tests.xml [took 0s]
Raw output
TypeError: Centroids.__init__() missing 2 required positional arguments: 'longitude' and 'latitude'
self = <climada.hazard.centroids.test.test_vec_ras.TestRaster testMethod=test_get_closest_point>

    def test_get_closest_point(self):
        """Test get_closest_point"""
        for y_sign in [1, -1]:
            meta = {
                'width': 10,
                'height': 20,
                'transform': rasterio.Affine(0.5, 0, 0.1, 0, y_sign * 0.6, y_sign * (-0.3)),
                'crs': DEF_CRS,
            }
>           centr_ras = Centroids(meta=meta)
E           TypeError: Centroids.__init__() missing 2 required positional arguments: 'longitude' and 'latitude'

climada/hazard/centroids/test/test_vec_ras.py:322: TypeError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestRaster

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_ne_crs_geom_pass (climada.hazard.centroids.test.test_vec_ras.TestRaster) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Centroids' object has no attribute 'meta'
self = <climada.hazard.centroids.test.test_vec_ras.TestRaster testMethod=test_ne_crs_geom_pass>

    def test_ne_crs_geom_pass(self):
        """Test _ne_crs_geom"""
        centr_ras = Centroids.from_raster_file(HAZ_DEMO_FL, window=Window(0, 0, 50, 60))
>       centr_ras.meta['crs'] = 'epsg:32632'
E       AttributeError: 'Centroids' object has no attribute 'meta'

climada/hazard/centroids/test/test_vec_ras.py:257: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestRaster

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_on_land (climada.hazard.centroids.test.test_vec_ras.TestRaster) failed

tests_xml/tests.xml [took 2s]
Raw output
AttributeError: 'Centroids' object has no attribute 'check'
self = <climada.hazard.centroids.test.test_vec_ras.TestRaster testMethod=test_on_land>

    def test_on_land(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()
>       centr_ras.check()
E       AttributeError: 'Centroids' object has no attribute 'check'

climada/hazard/centroids/test/test_vec_ras.py:295: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestRaster

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_read_all_pass (climada.hazard.centroids.test.test_vec_ras.TestRaster) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Centroids' object has no attribute 'meta'
self = <climada.hazard.centroids.test.test_vec_ras.TestRaster testMethod=test_read_all_pass>

    def test_read_all_pass(self):
        """Test centr_ras data"""
        centr_ras = Centroids.from_raster_file(HAZ_DEMO_FL, window=Window(0, 0, 50, 60))
>       self.assertAlmostEqual(centr_ras.meta['crs'], DEF_CRS)
E       AttributeError: 'Centroids' object has no attribute 'meta'

climada/hazard/centroids/test/test_vec_ras.py:241: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestRaster

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_set_geometry_points_pass (climada.hazard.centroids.test.test_vec_ras.TestRaster) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Centroids' object has no attribute 'set_geometry_points'
self = <climada.hazard.centroids.test.test_vec_ras.TestRaster testMethod=test_set_geometry_points_pass>

    def test_set_geometry_points_pass(self):
        """Test set_geometry_points"""
        centr_ras = Centroids.from_raster_file(HAZ_DEMO_FL, window=Window(0, 0, 50, 60))
>       centr_ras.set_geometry_points()
E       AttributeError: 'Centroids' object has no attribute 'set_geometry_points'

climada/hazard/centroids/test/test_vec_ras.py:276: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestRaster

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_set_meta_to_lat_lon_pass (climada.hazard.centroids.test.test_vec_ras.TestRaster) failed

tests_xml/tests.xml [took 0s]
Raw output
NameError: name 'data_vector' is not defined
self = <climada.hazard.centroids.test.test_vec_ras.TestRaster testMethod=test_set_meta_to_lat_lon_pass>

    def test_set_meta_to_lat_lon_pass(self):
        """Test set_meta_to_lat_lon by using its inverse set_lat_lon_to_meta"""
>       lat, lon, geometry = data_vector()
E       NameError: name 'data_vector' is not defined

climada/hazard/centroids/test/test_vec_ras.py:348: NameError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestCentroids

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_centroids_check_pass (climada.hazard.centroids.test.test_vec_ras.TestCentroids) failed

tests_xml/tests.xml [took 0s]
Raw output
NameError: name 'data_vector' is not defined
self = <climada.hazard.centroids.test.test_vec_ras.TestCentroids testMethod=test_centroids_check_pass>

    def test_centroids_check_pass(self):
        """Test vector data in Centroids"""
>       data_vec = data_vector()
E       NameError: name 'data_vector' is not defined

climada/hazard/centroids/test/test_vec_ras.py:378: NameError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestReader

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_from_raster_file_wrong_fail (climada.hazard.centroids.test.test_vec_ras.TestReader) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: 'Centroids' object has no attribute 'meta'
self = <climada.hazard.centroids.test.test_vec_ras.TestReader testMethod=test_from_raster_file_wrong_fail>

    def test_from_raster_file_wrong_fail(self):
        """Test from_raster_file with wrong centroids"""
        centr = Centroids.from_raster_file(HAZ_DEMO_FL, window=Window(10, 20, 50, 60))
>       self.assertAlmostEqual(centr.meta['crs'], DEF_CRS)
E       AttributeError: 'Centroids' object has no attribute 'meta'

climada/hazard/centroids/test/test_vec_ras.py:432: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestReader

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_from_vector_file (climada.hazard.centroids.test.test_vec_ras.TestReader) failed

tests_xml/tests.xml [took 0s]
Raw output
TypeError: climada.hazard.centroids.centr.Centroids() got multiple values for keyword argument 'latitude'
self = <climada.hazard.centroids.test.test_vec_ras.TestReader testMethod=test_from_vector_file>

    def test_from_vector_file(self):
        """Test from_vector_file and values_from_vector_files"""
        shp_file = shapereader.natural_earth(resolution='110m', category='cultural',
                                             name='populated_places_simple')
>       centr = Centroids.from_vector_file(shp_file)

climada/hazard/centroids/test/test_vec_ras.py:401: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/centroids/centr.py:643: in from_vector_file
    centroids = cls.from_geodataframe(gpd.read_file(file_name))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'climada.hazard.centroids.centr.Centroids'>
gdf =      scalerank  natscale  ...       ne_id                     geometry
0            8        10  ...  1159127243    PO...INT (103.85387 1.29498)
242          0       600  ...  1159151629   POINT (114.18306 22.30693)

[243 rows x 32 columns]

    @classmethod
    def from_geodataframe(cls, gdf):
        """Initialize centroids from a geodataframe
    
        Parameters
        ----------
        gdf : GeoDataFrame
            Input geodataframe with centroids as points
            in the geometry column. All other columns are
            attached to the centroids geodataframe.
    
        Returns
        -------
        Centroids
            Centroids built from the geodataframe.
        """
>       return cls(
            longitude=gdf.geometry.x.values,
            latitude=gdf.geometry.y.values,
            crs=gdf.crs,
            **gdf.drop(columns=['geometry']).to_dict(orient='list')
            )
E       TypeError: climada.hazard.centroids.centr.Centroids() got multiple values for keyword argument 'latitude'

climada/hazard/centroids/centr.py:229: TypeError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestReader

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_write_read_points_h5 (climada.hazard.centroids.test.test_vec_ras.TestReader) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: type object 'Centroids' has no attribute 'from_lat_lon'
self = <climada.hazard.centroids.test.test_vec_ras.TestReader testMethod=test_write_read_points_h5>

    def test_write_read_points_h5(self):
        file_name = str(DATA_DIR.joinpath('test_centr.h5'))
    
>       centr = Centroids.from_lat_lon(VEC_LAT, VEC_LON)
E       AttributeError: type object 'Centroids' has no attribute 'from_lat_lon'

climada/hazard/centroids/test/test_vec_ras.py:474: AttributeError

Check warning on line 0 in climada.hazard.centroids.test.test_vec_ras.TestReader

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results Python 3.11

test_write_read_raster_h5 (climada.hazard.centroids.test.test_vec_ras.TestReader) failed

tests_xml/tests.xml [took 0s]
Raw output
AttributeError: type object 'Centroids' has no attribute 'from_pix_bounds'
self = <climada.hazard.centroids.test.test_vec_ras.TestReader testMethod=test_write_read_raster_h5>

    def test_write_read_raster_h5(self):
        """Write and read hdf5 format"""
        file_name = str(DATA_DIR.joinpath('test_centr.h5'))
    
        xf_lat, xo_lon, d_lat, d_lon, n_lat, n_lon = 10, 5, -0.5, 0.2, 20, 25
>       centr = Centroids.from_pix_bounds(xf_lat, xo_lon, d_lat, d_lon, n_lat, n_lon)
E       AttributeError: type object 'Centroids' has no attribute 'from_pix_bounds'

climada/hazard/centroids/test/test_vec_ras.py:454: AttributeError