Skip to content

Commit

Permalink
Merge hazard update with main (#73)
Browse files Browse the repository at this point in the history
* Update hazard

Update hazard

* Update hazard

Update hazard

---------

Co-authored-by: frederique-hub <72015981+frederique-hub@users.noreply.github.com>
  • Loading branch information
Mares2022 and frederique-hub authored May 3, 2023
1 parent 64fc05b commit 8742d62
Show file tree
Hide file tree
Showing 4 changed files with 453 additions and 323 deletions.
48 changes: 41 additions & 7 deletions hydromt_fiat/fiat.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def setup_config(self, **kwargs):
global_settings[k] = kwargs[k]

self.config["global"] = global_settings

def setup_basemaps(
self,
region,
Expand Down Expand Up @@ -153,8 +153,8 @@ def setup_exposure_vector(
self.exposure.check_required_columns()

def setup_exposure_raster(self):
NotImplemented

NotImplemented
def setup_hazard(
self,
map_fn: str,
Expand All @@ -166,20 +166,32 @@ def setup_hazard(
chunks,
risk_output: bool = True,
hazard_type: str = "flooding",
name_catalog: str = "flood_maps",
maps_id: str = "RP",

):
hazard = Hazard()
hazard.setup_hazard(

hazard.checkInputs(
self,
hazard_type=hazard_type,
risk_output=risk_output,
map_fn=map_fn,
map_type=map_type,
chunks=chunks,
rp=rp,
crs=crs,
nodata=nodata,
var=var,
)

hazard.readMaps(
self,
name_catalog=name_catalog,
hazard_type=hazard_type,
risk_output=risk_output,
crs=crs,
nodata=nodata,
var=var,
chunks=chunks,
region=self.region,
)

# Store the hazard settings.
Expand All @@ -200,6 +212,8 @@ def setup_hazard(
hazard_settings["spatial_reference"] = map_type
self.config["hazard"] = hazard_settings



def setup_social_vulnerability_index(
self, census_key: str, path: str, state_abbreviation: str
):
Expand Down Expand Up @@ -291,12 +305,30 @@ def write(self):
self.tables.append(
(self.exposure.exposure_db, exposure_output_path, {"index": False})
)
# self.tables.append(
# (
# self.vulnerability.vulnerability,
# vulnerability_output_path,
# {"index": False, "header": False},
# )
# )
# self.tables.append(
# (self.exposure.exposure_db, exposure_output_path, {"index": False})
# )

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

# Store the exposure settings in the config file.
self.config["exposure"] = {
"dbase_file": exposure_output_path,
"crs": self.exposure.crs,
}
# # Store the exposure settings in the config file.
# self.config["exposure"] = {
# "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 Expand Up @@ -333,3 +365,5 @@ def _configwrite(self, fn):
"""Write config to Delft-FIAT configuration toml file."""
# Save the configuration file.
Config().save(self.config, Path(self.root).joinpath("settings.toml"))


Loading

0 comments on commit 8742d62

Please sign in to comment.