Skip to content

Commit

Permalink
Merge pull request #172 from Deltares/correct_raise_datum
Browse files Browse the repository at this point in the history
corrected raising of buildings when using datum reference
  • Loading branch information
frederique-hub authored Oct 13, 2023
2 parents 86b79c5 + 6cbe514 commit 6fadf32
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
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"],
)
)
)

0 comments on commit 6fadf32

Please sign in to comment.