diff --git a/hydromt_fiat/workflows/exposure_vector.py b/hydromt_fiat/workflows/exposure_vector.py index 4ffa39ee..0a23a6f4 100644 --- a/hydromt_fiat/workflows/exposure_vector.py +++ b/hydromt_fiat/workflows/exposure_vector.py @@ -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 diff --git a/tests/test_raise_ground_floor_height.py b/tests/test_raise_ground_floor_height.py index ce572606..79e28428 100644 --- a/tests/test_raise_ground_floor_height.py +++ b/tests/test_raise_ground_floor_height.py @@ -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, }, } @@ -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(): @@ -61,4 +68,4 @@ def test_raise_ground_floor_height(case): exposure_modified["Ground Floor Height"], exposure_modified["Ground Elevation"], ) - ) \ No newline at end of file + )