Skip to content

Commit

Permalink
fix new development areas (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
Santonia27 authored Feb 20, 2025
1 parent 09b92c8 commit 1f48698
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions hydromt_fiat/workflows/aggregation_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ def spatial_joins(

# Create new object_ids
init_Object_ID = exposure_gdf_copy.loc[0, "object_name"]
init_Object_ID = int(init_Object_ID.split(": ", 1)[1])
init_Object_ID = int(init_Object_ID.split(":", 1)[1])
exposure_gdf.loc[0:, "object_id"] = np.arange(
init_Object_ID, init_Object_ID + int(len(exposure_gdf)), 1
).tolist()
# Create new object_names
exposure_gdf["object_name"] = exposure_gdf["object_id"].apply(
lambda x: f"New development area: {int(x)}"
lambda x: f"new_develpoment_area:{int(x)}"
)

# Split max potential damages into new composite areas
Expand Down
6 changes: 3 additions & 3 deletions hydromt_fiat/workflows/exposure_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1634,9 +1634,9 @@ def setup_new_composite_areas(

dict_new_objects_data = {
"object_id": [new_id],
"object_name": ["New development area: " + str(new_id)],
"primary_object_type": ["New development area"],
"secondary_object_type": ["New development area"],
"object_name": ["new_development_area:" + str(new_id)],
"primary_object_type": ["new_development_area:"],
"secondary_object_type": ["new_development_area:"],
"extract_method": ["area"],
"ground_flht": [0],
"ground_elevtn": [0],
Expand Down
2 changes: 1 addition & 1 deletion tests/test_setup_new_composite_area_divided_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_setup_new_composite_areas_ground_elevation_aggregation(case):

# Check if max potentail damages are divided correctly
exposure_new_composite = exposure_modified[
exposure_modified["primary_object_type"] == "New development area"
exposure_modified["primary_object_type"] == "new_development_area"
]
assert round(sum([38142538.34, 13528445.7])) == round(
sum(exposure_new_composite["max_damage_content"].values)
Expand Down

0 comments on commit 1f48698

Please sign in to comment.