Skip to content

Commit

Permalink
Elevating new composite areas based on base flood maps bug fix (#404)
Browse files Browse the repository at this point in the history
* fixed issue were it was assumed that all new areas would be elevated, even though if an area is already height it can stay at ground level

* generalize raise_by type to make sure that either a single value or a Series can be handled

* corrected isinstance check
  • Loading branch information
panosatha authored Oct 29, 2024
1 parent eea6bb2 commit b4175a1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hydromt_fiat/workflows/exposure_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1903,6 +1903,10 @@ def set_height_relative_to_reference(
"Object ID", drop=False
)

# Ensure that the raise_by variable has the correct type
if not isinstance(raise_by, pd.Series):
raise_by = pd.Series(raise_by, index=exposure_to_modify.index)

# Find indices of properties that are below the required level
properties_below_level = (
exposure_to_modify.loc[:, "Ground Floor Height"]
Expand All @@ -1920,7 +1924,7 @@ def set_height_relative_to_reference(
original_df = exposure_to_modify.copy() # to be used for metrics
exposure_to_modify.loc[to_change, "Ground Floor Height"] = list(
modified_objects_gdf.loc[to_change, attr_ref]
+ raise_by
+ raise_by[to_change]
- exposure_to_modify.loc[to_change, "Ground Elevation"]
)

Expand Down

0 comments on commit b4175a1

Please sign in to comment.