! python ../../.testdata/create_test_data.py
Single event
This is a an example of running a tiny single event FIAT model.
First of all, let’s make sure that there is some actual testdata.
Now that we have some testdata, let’s take a look at the settings file.
with open("../../.testdata/geom_event.toml", "r") as r:
= r.read()
settings print(settings)
[global]
model = "geom"
[global.srs]
value = "EPSG:4326"
[output]
path = "output/geom_event"
[output.csv]
name1 = "output.csv"
[output.geom]
name1 = "spatial.gpkg"
[hazard]
file = "hazard/event_map.nc"
risk = false
elevation_reference = "DEM"
[hazard.settings]
srs = "EPSG:4326"
[exposure.csv]
file = "exposure/spatial.csv"
[exposure.geom]
file1 = "exposure/spatial.geojson"
[exposure.geom.settings]
srs = "EPSG:4326"
[vulnerability]
file = "vulnerability/vulnerability_curves.csv"
step_size = 0.01
Now let’s execute the model!
! fiat run ../../.testdata/geom_event.toml
###############################################################
######### ## ## ##############
## ## #### ######
## ## #### ##
## ## ## ## ##
###### ## ## ## ##
## ## ######## ##
## ## ## ## ##
## ## ## ## ##
## ## ## ## ##
###############################################################
Fast Impact Assessment Tool
© Deltares
2025-04-01 08:59:51 INFO Delft-Fiat version: 0.3.1
2025-04-01 08:59:51 INFO Using settings from '/home/runner/work/Delft-FIAT/Delft-FIAT/docs/examples/../../.testdata/geom_event.toml'
2025-04-01 08:59:51 INFO Using number of threads: 1
2025-04-01 08:59:51 INFO Model srs set to: 'EPSG:4326'
2025-04-01 08:59:51 INFO Reading hazard data ('event_map.nc')
2025-04-01 08:59:51 INFO Executing hazard checks...
2025-04-01 08:59:51 WARNING Setting the model srs from the hazard data.
2025-04-01 08:59:51 INFO Model srs set to: 'EPSG:4326'
2025-04-01 08:59:51 INFO Reading vulnerability curves ('vulnerability_curves.csv')
2025-04-01 08:59:51 INFO Executing vulnerability checks...
2025-04-01 08:59:51 INFO Upscaling vulnerability curves, using a step size of: 0.01
2025-04-01 08:59:51 INFO Reading exposure geometry 'file1' ('spatial.geojson')
2025-04-01 08:59:51 INFO Executing exposure geometry checks...
2025-04-01 08:59:51 INFO Reading exposure data ('spatial.csv')
2025-04-01 08:59:51 INFO Executing exposure data checks...
2025-04-01 08:59:51 INFO Starting the calculations
2025-04-01 08:59:51 INFO Busy...
2025-04-01 08:59:52 INFO Calculations time: 0.05 seconds
2025-04-01 08:59:52 INFO Output generated in: '/home/runner/work/Delft-FIAT/Delft-FIAT/docs/examples/../../.testdata/output/geom_event'
2025-04-01 08:59:52 INFO Geom calculation are done!
Let’s take a quick look at the output.
# Import a method
from fiat.fio import open_csv
from pathlib import Path
# check the output
= open_csv(Path("../../.testdata/output/geom_event", "output.csv"), index="object_id")
out print(out.columns)
('extract_method', 'ground_flht', 'ground_elevtn', 'fn_damage_structure', 'max_damage_structure', 'inun_depth', 'red_fact', 'damage_structure', 'total_damage')
Assert that the output is what we would expect.
assert float(out[2, "total_damage"]) == 740
assert float(out[3, "total_damage"]) == 1038