Skip to content

Commit

Permalink
drop index right from exposure_gdf
Browse files Browse the repository at this point in the history
  • Loading branch information
Santonia27 committed Mar 5, 2024
1 parent ff6bd03 commit 0d077db
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions hydromt_fiat/workflows/aggregation_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def join_exposure_aggregation_multiple_areas(
exposure_gdf.drop_duplicates(subset="Object ID", keep="first", inplace=True)

if new_composite_area[0] is True:
exposure_gdf = split_composite_area(exposure_gdf, aggregated, aggregation_gdf, attribute_name)
new_exposure_aggregation, exposure_gdf = split_composite_area(exposure_gdf, aggregated, aggregation_gdf, attribute_name)

else:
exposure_gdf.drop(columns=attribute_name, inplace=True)
exposure_gdf = exposure_gdf.merge(aggregated, on="Object ID")
Expand Down Expand Up @@ -117,8 +118,12 @@ def split_composite_area(exposure_gdf, aggregated, aggregation_gdf, attribute_na
exposure_gdf = new_exposure_aggregation
else:
exposure_gdf = pd.concat([new_exposure_aggregation, exposure_gdf], ignore_index=True)

return exposure_gdf

# Remove the index_right column
if "index_right" in exposure_gdf.columns:
del exposure_gdf["index_right"]

return new_exposure_aggregation, exposure_gdf

def join_exposure_aggregation_areas(
exposure_gdf: gpd.GeoDataFrame,
Expand Down

0 comments on commit 0d077db

Please sign in to comment.