diff --git a/climada/entity/exposures/base.py b/climada/entity/exposures/base.py index 3995c58f4..d961c5416 100644 --- a/climada/entity/exposures/base.py +++ b/climada/entity/exposures/base.py @@ -928,8 +928,6 @@ def plot_basemap(self, mask=None, ignore_zero=False, pop_name=True, ------- matplotlib.figure.Figure, cartopy.mpl.geoaxes.GeoAxesSubplot """ - if 'geometry' not in self.gdf: - self.set_geometry_points() crs_ori = self.crs self.to_crs(epsg=3857, inplace=True) axis = self.plot_scatter(mask, ignore_zero, pop_name, buffer, diff --git a/climada/entity/exposures/test/test_base.py b/climada/entity/exposures/test/test_base.py index 48dce917f..22027caf6 100644 --- a/climada/entity/exposures/test/test_base.py +++ b/climada/entity/exposures/test/test_base.py @@ -286,7 +286,6 @@ def test_read_template_pass(self): def test_io_hdf5_pass(self): """write and read hdf5""" exp_df = Exposures(pd.read_excel(ENT_TEMPLATE_XLS), crs="epsg:32632") - exp_df.set_geometry_points() exp_df.check() # set metadata exp_df.ref_year = 2020 @@ -429,7 +428,6 @@ def test_copy_pass(self): def test_to_crs_inplace_pass(self): """Test to_crs function inplace.""" exp = good_exposures() - exp.set_geometry_points() exp.check() exp.to_crs('epsg:3395', inplace=True) self.assertIsInstance(exp, Exposures) @@ -441,7 +439,6 @@ def test_to_crs_inplace_pass(self): def test_to_crs_pass(self): """Test to_crs function copy.""" exp = good_exposures() - exp.set_geometry_points() exp.check() exp_tr = exp.to_crs('epsg:3395') self.assertIsInstance(exp, Exposures) @@ -477,7 +474,6 @@ def test_set_gdf(self): gdf_without_geometry = good_exposures().gdf good_exp = good_exposures() good_exp.set_crs(crs='epsg:3395') - good_exp.set_geometry_points() gdf_with_geometry = good_exp.gdf probe = Exposures() @@ -504,7 +500,6 @@ def test_set_crs(self): empty_gdf = gpd.GeoDataFrame() gdf_without_geometry = good_exposures().gdf good_exp = good_exposures() - good_exp.set_geometry_points() gdf_with_geometry = good_exp.gdf probe = Exposures(gdf_without_geometry) diff --git a/climada/hazard/centroids/test/test_centr.py b/climada/hazard/centroids/test/test_centr.py index 0b4dcee4e..81124254b 100644 --- a/climada/hazard/centroids/test/test_centr.py +++ b/climada/hazard/centroids/test/test_centr.py @@ -358,7 +358,7 @@ def test_set_region_id_implementationerror(self): centroids.set_region_id(level='continent',overwrite=True) def test_set_geometry_points_pass(self): - """Test set_geometry_points""" + """Test geometry is set""" centr_ras = Centroids.from_raster_file(HAZ_DEMO_FL, window=Window(0, 0, 50, 60)) x_flat = np.arange(-69.3326495969998, -68.88264959699978, 0.009000000000000341) y_flat = np.arange(10.423720966978939, 9.883720966978919, -0.009000000000000341) diff --git a/climada/hazard/tc_tracks.py b/climada/hazard/tc_tracks.py index fd8c333c6..c1d129a8d 100644 --- a/climada/hazard/tc_tracks.py +++ b/climada/hazard/tc_tracks.py @@ -301,9 +301,9 @@ def tracks_in_exp(self, exposure, buffer=1.0): if buffer <= 0.0: raise ValueError(f"buffer={buffer} is invalid, must be above zero.") try: - exposure.gdf.geometry + exposure.geometry except AttributeError: - exposure.set_geometry_points() + raise Exception("this is not an Exposures object") exp_buffer = exposure.gdf.buffer(distance=buffer, resolution=0) exp_buffer = exp_buffer.unary_union diff --git a/script/applications/eca_san_salvador/functions_ss.py b/script/applications/eca_san_salvador/functions_ss.py index caee8a4f5..169e71da9 100755 --- a/script/applications/eca_san_salvador/functions_ss.py +++ b/script/applications/eca_san_salvador/functions_ss.py @@ -52,7 +52,6 @@ def plot_salvador_ma(): def load_entity(): ent_file = 'FL_entity_Acelhuate_houses.xlsx' ent = Entity.from_excel(ent_file) - ent.exposures.set_geometry_points() ent.check() return ent @@ -196,7 +195,6 @@ def load_accounting(): def generate_plots_risk(): fig_ma = plot_salvador_ma() ent = load_entity() - ent.exposures.set_geometry_points() ent.exposures.to_crs(epsg=3857, inplace=True) fig_point = plot_exposure_ss(ent.exposures, 1064) fig_houses = plot_exposure_ss(ent.exposures)