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

corrected raising of buildings when using datum reference #172

Merged
merged 2 commits into from
Oct 13, 2023
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
6 changes: 3 additions & 3 deletions hydromt_fiat/workflows/exposure_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,9 @@ def raise_ground_floor_height(
"Raising the ground floor height of the properties relative to Datum."
)
self.exposure_db.loc[
self.exposure_db["Ground Floor Height"] < raise_by,
"Ground Floor Height",
].iloc[idx, :] = raise_by
(self.exposure_db["Ground Floor Height"] < raise_by) & self.exposure_db.index.isin(idx),
"Ground Floor Height",
] = raise_by

elif height_reference.lower() in ["geom", "table"]:
# Elevate the objects relative to the surface water elevation map that the
Expand Down
21 changes: 14 additions & 7 deletions tests/test_raise_ground_floor_height.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@
EXAMPLEDIR = Path("P:/11207949-dhs-phaseii-floodadapt/Model-builder/Delft-FIAT/local_test_database")

_cases = {
"raise_ground_floor_height": {
"data_catalogue": EXAMPLEDIR / "fiat_catalog.yml",
"raise_ground_floor_height_geom": {
"dir": "test_read",
"ini": EXAMPLEDIR / "test_read.ini",
"new_root": EXAMPLEDIR / "test_raise_ground_floor_height_geom",
"ground_floor_height_reference": EXAMPLEDIR
/ "test_read"
/ "reference_groundHeight_test.shp",
"new_root": EXAMPLEDIR / "test_raise_ground_floor_height",
"height_reference": "geom",
"attr_ref": "bfe",
},
"raise_ground_floor_height_datum": {
"dir": "test_read",
"new_root": EXAMPLEDIR / "test_raise_ground_floor_height_datum",
"ground_floor_height_reference": None,
"height_reference": "datum",
"attr_ref": None,
},
}

Expand All @@ -36,9 +43,9 @@ def test_raise_ground_floor_height(case):
fm.exposure.raise_ground_floor_height(
raise_by=2,
objectids=objectids,
height_reference="geom",
height_reference=_cases[case]["height_reference"],
path_ref=_cases[case]["ground_floor_height_reference"],
attr_ref="bfe",
attr_ref=_cases[case]["attr_ref"],
)

if _cases[case]["new_root"].exists():
Expand All @@ -61,4 +68,4 @@ def test_raise_ground_floor_height(case):
exposure_modified["Ground Floor Height"],
exposure_modified["Ground Elevation"],
)
)
)