! 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]
crs = "EPSG:4326"
[output]
path = "output/geom_event"
[output.csv]
name = "output.csv"
[output.geom]
name1 = "spatial.gpkg"
[hazard]
file = "hazard/event_map.nc"
crs = "EPSG:4326"
risk = false
elevation_reference = "DEM"
[exposure.csv]
file = "exposure/spatial.csv"
[exposure.geom]
file1 = "exposure/spatial.gpkg"
crs = "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
2024-10-15 13:13:29 INFO Delft-Fiat version: 0.2.0
2024-10-15 13:13:29 INFO Setting up geom model..
2024-10-15 13:13:29 INFO Using settings from '/home/runner/work/Delft-FIAT/Delft-FIAT/docs/examples/../../.testdata/geom_event.toml'
2024-10-15 13:13:29 INFO Model srs set to: 'EPSG:4326'
2024-10-15 13:13:29 INFO Using number of threads: 1
2024-10-15 13:13:29 INFO Reading hazard data ('event_map.nc')
2024-10-15 13:13:29 INFO Executing hazard checks...
2024-10-15 13:13:29 INFO Reading vulnerability curves ('vulnerability_curves.csv')
2024-10-15 13:13:29 INFO Executing vulnerability checks...
2024-10-15 13:13:29 INFO Upscaling vulnerability curves, using a step size of: 0.01
2024-10-15 13:13:29 INFO Reading exposure geometry 'file1' ('spatial.gpkg')
2024-10-15 13:13:29 INFO Executing exposure geometry checks...
2024-10-15 13:13:29 INFO Reading exposure data ('spatial.csv')
2024-10-15 13:13:29 INFO Executing exposure data checks...
2024-10-15 13:13:29 INFO Starting the calculations
2024-10-15 13:13:29 INFO Busy...
2024-10-15 13:13:30 INFO Calculations time: 0.05 seconds
2024-10-15 13:13:30 INFO Output generated in: '/home/runner/work/Delft-FIAT/Delft-FIAT/docs/examples/../../.testdata/output/geom_event'
2024-10-15 13:13:30 INFO Geom calculation are done!
Let’s take a quick look at the output.
# Import a method
from fiat.io 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