Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix new development areas #448

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading