-
Notifications
You must be signed in to change notification settings - Fork 149
Closed
Labels
Description
Describe the bug
Whenever climada.util.coordinates.points_to_raster or climada.util.coordinates.set_df_geometry_points are executed a warning is raised:
FutureWarning: You are adding a column named 'geometry' to a GeoDataFrame constructed without an active
geometry column. Currently, this automatically sets the active geometry column to 'geometry' but in the
future that will no longer happen.
Instead, either provide geometry to the GeoDataFrame constructor (GeoDataFrame(... geometry=GeoSeries())
or use `set_geometry('geometry')` to explicitly set the active geometry column.
To Reproduce
Steps to reproduce the behavior/error:
- Create an
Exposuresobject without a proper geometry column. - Run
set_geometry_pointson it. - Run
plot_rasteron it.
Code example:
import pandas as pd
from shapely.geometry import Point
from climada.entity.exposures import Exposures
exp = Exposures(data=pd.DataFrame(
dict(
latitude = [1,2,3]*3,
longitude = [1]*3+[2]*3+[3]*3,
value = range(9)
)
), crs='EPSG:4326')
exp.set_geometry_points()
exp.plot_raster()Expected behavior
Silent plotting.
Climada Version:
- climada_python >= 4.0
System Information (please complete the following information):
- Operating system and version: Windows 10
- Python version:3.9
Additional context
- geopandas >= 0.14