API Reference
Core Module
exposure(disable_progress=False, **kwargs)
Run the exposure analysis.
Identifies which features are affected by the hazard footprint, depending on the type of input data (raster or vector).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
disable_progress
|
bool
|
If True, disables progress bars. Defaults to False. |
False
|
**kwargs
|
Optional keyword arguments like |
{}
|
Returns:
Type | Description |
---|---|
geopandas.GeoDataFrame | xarray.DataArray: Affected assets or raster overlay result. |
calculate(disable_progress=False, save_output=False, **kwargs)
Perform a damage calculation using the provided inputs.
Applies vulnerability curves and maximum damage values to the exposed features or raster grid to calculate expected damage.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
disable_progress
|
bool
|
If True, disables progress bars. Defaults to False. |
False
|
save_output
|
bool
|
Not implemented. Placeholder for output saving option. |
False
|
**kwargs
|
asset_type (str, optional): Infrastructure class to evaluate. multi_curves (dict, optional): Mapping of asset types to curve sets. subtypes (list, optional): Used for subtype analysis. |
{}
|
Returns:
Type | Description |
---|---|
pd.DataFrame | xr.DataArray: Estimated damages for each asset or grid cell. |
risk(hazard_dict, **kwargs)
Perform a risk assessment across multiple hazard return periods.
Integrates damages from each return period and computes expected annual damages. Supports both single and multi-curve inputs for infrastructure types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hazard_dict
|
dict
|
Dictionary mapping return periods to hazard raster paths. |
required |
**kwargs
|
asset_type (str, optional): Infrastructure class to evaluate. multi_curves (dict, optional): Mapping of asset types to curve sets. |
{}
|
Returns:
Type | Description |
---|---|
pd.DataFrame | None: A GeoDataFrame with risk values for each asset, or None if no results. |
Vector-based Specific Functions
VectorExposure(hazard_file, feature_file, asset_type='roads', object_col='object_type', disable_progress=False)
Load and overlay vector or raster hazard with vector exposure data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hazard_file
|
Path | Dataset | DatasetReader
|
Hazard input. |
required |
feature_file
|
Path | GeoDataFrame | DataFrame
|
Exposure input. |
required |
asset_type
|
str
|
Infrastructure category (only for OSM). |
'roads'
|
object_col
|
str
|
Name of the object type column. |
'object_type'
|
disable_progress
|
bool
|
Whether to suppress progress bars. |
False
|
Returns:
Name | Type | Description |
---|---|---|
tuple |
(features, object_col, hazard_crs, cell_area_m2) |
VectorScanner(hazard_file, feature_file, curve_path, maxdam_path, asset_type='roads', multi_curves=dict(), object_col='object_type', disable_progress=False, **kwargs)
Perform vector-based direct damage assessment using hazard and exposure layers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hazard_file
|
Path | Dataset | GeoDataFrame
|
Hazard input. |
required |
feature_file
|
Path | GeoDataFrame
|
Exposure input. |
required |
curve_path
|
Path | DataFrame
|
Vulnerability curve(s). |
required |
maxdam_path
|
Path | DataFrame | dict
|
Maximum damage values. |
required |
asset_type
|
str
|
Infrastructure class (only for OSM). |
'roads'
|
multi_curves
|
dict
|
Multiple curve sets. |
dict()
|
object_col
|
str
|
Column name with object type. |
'object_type'
|
disable_progress
|
bool
|
Whether to suppress progress bars. |
False
|
Returns:
Type | Description |
---|---|
gpd.GeoDataFrame: Exposure data with calculated damages. |
Raster-based Specific Functions
match_and_load_rasters(raster_in1, raster_in2)
Match and clip two raster files to their common spatial extent and resolution.
Code adapted from http://sciience.tumblr.com/post/101722591382/finding-the-georeferenced-intersection-between-two
Parameters:
Name | Type | Description | Default |
---|---|---|---|
raster_in1
|
str or Path
|
Path to the first raster file. |
required |
raster_in2
|
str or Path
|
Path to the second raster file. |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
|
RasterScanner(exposure_file, hazard_file, curve_path, maxdam_path, lu_crs=28992, haz_crs=4326, hazard_col='FX', dtype=np.int32, save=False, **kwargs)
Run a raster-based direct damage assessment using hazard and exposure layers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
exposure_file
|
Path | ndarray
|
Path to land-use GeoTIFF or numpy array. |
required |
hazard_file
|
Path | ndarray | Dataset
|
Path to hazard raster or dataset. |
required |
curve_path
|
Path | DataFrame | ndarray
|
Vulnerability curve(s). |
required |
maxdam_path
|
Path | DataFrame | ndarray
|
Maximum damage values. |
required |
lu_crs
|
int
|
CRS of the land-use file (default EPSG:28992). |
28992
|
haz_crs
|
int
|
CRS of the hazard file (default EPSG:4326). |
4326
|
hazard_col
|
str
|
Column containing hazard intensity (default "FX"). |
'FX'
|
dtype
|
type
|
Output dtype for damage raster. |
int32
|
save
|
bool
|
If True, saves damage results to file. |
False
|
Other Parameters:
Name | Type | Description |
---|---|---|
nan_value |
float
|
Replace this value in the hazard raster with 0. |
cellsize |
float
|
Cell size (m²) if exposure and hazard are arrays. |
resolution |
float
|
Resolution in target projection (used for reprojection). |
output_path |
str or Path
|
Output directory for saving results. |
scenario_name |
str
|
Scenario name used for filenames. |
in_millions |
bool
|
Convert results to millions. |
crs |
CRS
|
CRS for saving output raster (optional). |
transform |
Affine
|
Affine transform for saving raster (optional). |
Raises:
Type | Description |
---|---|
ValueError
|
If cell size is not provided when required. |
ValueError
|
If vulnerability or max damage file has invalid structure. |
Returns:
Name | Type | Description |
---|---|---|
tuple |
|