6. Hazard extraction¶
Polygonize a single hazard file¶
-
gmtra.hazard.
single_polygonized
(flood_scen, region, geometry, country_ISO3, hzd='FU')[source]¶ Function to overlay a surface or river flood hazard map with the infrastructure assets.
- Arguments:
flood_scen : Unique ID for the flood scenario to be used.
region : Unique ID of the region that is intersected.
geometry : Shapely geometry of the region that is being intersected.
country_ISO3 : ISO3 code of the country in which the region is situated. Required to get the FATHOM flood maps.
- Optional Arguments:
- hzd : Default is FU. Can be changed to PU for surface flooding.
- Returns:
- gdf : A GeoDataFrame where each row is a poylgon with the same flood depth.
Polygonize multiple hazard files¶
-
gmtra.hazard.
multiple_polygonized
(region, geometry, hzd_list, hzd_names)[source]¶ Function to overlay a set of hazard maps with infrastructure assets. This function is used for Earthquakes, Coastal floods and Cyclones (the hazard maps with global coverage).
- Arguments:
region : Unique ID of the region that is intersected.
geometry : Shapely geometry of the region that is being intersected.
hzd_list : list of file paths to each hazard. Make sure hzd_list and hzd_names are matching.
hzd_names : llist of unique hazard IDs. Most often these are the return periods.
- Returns:
- gdf : A GeoDataFrame where each row is a poylgon with the same hazard value.
Intersect an infrastructure asset with hazard maps¶
-
gmtra.hazard.
intersect_hazard
(x, hzd_reg_sindex, hzd_region, liquefaction=False)[source]¶ Function to intersect an infrastructure asset (within a GeoDataFrame) with the hazard maps.
- Arguments:
x : row in a GeoDataFrame that represents an unique infrastructure asset.
hzd_reg_sindex : Spatial Index of the hazard GeoDataFrame.
hzd_region : GeoDataFrame of a unique hazard map.
- Optional arguments:
- liquefaction : Default is False. Set to True if you are intersecting with the liquefaction map.
- Returns:
- tuple : a shapely.geometry of the part of the asset that is affected and the average hazard value in this intersection.
Intersect all assets in a region with a hazard¶
-
gmtra.hazard.
region_intersection
(n, hzd, rail=False)[source]¶ Function to intersect all return periods of a particualar hazard with all road or railway assets in the specific region.
- Arguments:
n : the index ID of a region in the specified shapefile with all the regions.
hzd : abbrevation of the hazard we want to intersect. EQ for earthquakes, Cyc for cyclones, FU for river flooding, PU for surface flooding and CF for coastal flooding.
- Optional Arguments:
- rail : Default is False. Set to True if you would like to intersect the railway assets in a region.
- Returns:
- output : a GeoDataFrame with all intersections between the infrastructure assets and the specified hazard. Will also be saved as .feather file.
Intersect all assets in a region with a global liquefaction map¶
-
gmtra.hazard.
get_liquefaction_region
(n, rail=False)[source]¶ Function to intersect all return periods of a particualar hazard with all road or railway assets in the specific region.
- Arguments:
- n : the index ID of a region in the specified shapefile with all the regions.
- Optional Arguments:
- rail : Default is False. Set to True if you would like to intersect the railway assets in a region.
- Returns:
- output : a GeoDataFrame with all intersections between the infrastructure assets and the liquefaction map. Will be saved as .feather file.
Intersect all assets in a region with a global tree density map¶
-
gmtra.hazard.
get_tree_density
(n, rail=False)[source]¶ Function to intersect all return periods of a particualar hazard with all road or railway assets in the specific region.
- Arguments:
- n : the index ID of a region in the specified shapefile with all the regions.
- Optional Arguments:
- rail : Default is False. Set to True if you would like to intersect the railway assets in a region.
- Returns:
- output : a GeoDataFrame with all intersections between the infrastructure assets and the liquefaction map. Will be saved as .feather file.