Skip to content

Commit

Permalink
corrected mistake in Hazard_update branch for writing a fiat model
Browse files Browse the repository at this point in the history
  • Loading branch information
panosatha committed May 5, 2023
1 parent d34a928 commit db7a839
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions hydromt_fiat/fiat.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,35 @@ def write(self):
"""Method to write the complete model schematization and configuration to file."""
self.logger.info(f"Writing model data to {self.root}")

# if self.hazard:
# exposure_output_path = "./hazard/*.nc"

# self.config["hazard"] = [
# {
# "type": "vector",
# "dbase_file": exposure_output_path,
# "crs": self.hazard.raster.crs,
# }
# ]
# Save the vulnerability and exposure data in the tables variable.
# Check if data exist
if self.vulnerability:
vulnerability_output_path = "./vulnerability/vulnerability_curves.csv"
self.tables.append(
(
self.vulnerability.get_table(),
vulnerability_output_path,
{"index": False, "header": False},
)
)

# Store the vulnerability settings in the config file.
self.config["vulnerability"] = {"dbase_file": vulnerability_output_path}

if self.exposure:
exposure_output_path = "./exposure/exposure.csv"
self.tables.append(
(self.exposure.exposure_db, exposure_output_path, {"index": False})
)

# Store the exposure settings in the config file.
self.config["exposure"] = [
{
"type": "vector",
"dbase_file": exposure_output_path,
"crs": self.exposure.crs,
}
]

if self.config: # try to read default if not yet set
self.write_config()
Expand Down

0 comments on commit db7a839

Please sign in to comment.