Commit 6282935c authored by Tara Evaz Zadeh's avatar Tara Evaz Zadeh
Browse files

Fixed bugs for building exposure calculations

parent 949644e3
Pipeline #19167 passed with stage
in 1 minute and 51 seconds
......@@ -116,7 +116,7 @@ def get_exposure_per_tile(
tile_id = "origin_id"
for i in range(cell_ids.shape[0]):
cell_id = cell_ids.loc[i][0]
......@@ -112,7 +112,7 @@ def damageCalculator_TileVersion(
- exposure_type: (string), optional
{‘cell’, ‘OBM’}, optional'. cell by default.
{‘cell’, ‘building’}. Cell by default.
- method: (string), optional
{‘linear’, ‘nearest’, ‘cubic’}, optional'. Linear by default.
......@@ -186,10 +186,10 @@ def damageCalculator_TileVersion(
lat = lats.iloc[asset]
asset_id = asset_ids.iloc[asset]
origin_id = origin_ids.iloc[asset]
# In case of `exposure_type == "OBM"`, not only the geometry, but also the
# In case of `exposure_type == "building"`, not only the geometry, but also the
# respective cell ID (in which the asset is located), is extracted
# using `origin_id_to_geometry_map`
if exposure_type == "OBM":
if exposure_type == "building":
[geometry, respective_cell_id] = origin_id_to_geometry_map[origin_id]
geometry = origin_id_to_geometry_map[origin_id]
......@@ -214,13 +214,13 @@ def damageCalculator_TileVersion(
for h in a:
dmg_by_asset.insert(h, "")
# Append results
if exposure_type == "OBM":
if exposure_type == "building":
asset = [
"cell_" + respective_cell_id,
......@@ -180,19 +180,19 @@ def origin_id_to_geometry(geometry_source, exposure_type):
Creates a dictionary of Origin-ids and their polygons.
The input map 'geometry_source' contains the mapping for each
Origin-id to a polygon along with its Cell-id if it's an OBM geometry source
Origin-id to a polygon along with its cell-id if it's a building geometry source
as the 'origin_id_to_geometry_map'.
- exposure_type: (string)
Either 'OBM' or 'cell'
Either 'building' or 'cell'
- geometry_source: (csv.reader)
Origin-id to geometry file map with semicolon as the delimiter,
following the format:
['OriginID'; 'geometry'; 'cell_ID']. 'cell_ID' would only be available if
your input geometry belongs to the OBM data(single buildings). 'cell_ID'
the input geometry belongs to the building data(single buildings). 'cell_ID'
here points to the cell that contains the geometry.
Example extract:
......@@ -206,7 +206,7 @@ def origin_id_to_geometry(geometry_source, exposure_type):
23.6889 38.3416, 23.6889 38.3389))
if you have OBM geometry source:
if you have building geometry source:
>>> geometry_source
OSM_517924352;POLYGON((2641289.2688 4582010.1248,2641299.6772
4582007.1292,2641304.1745 4582019.8887,2641294.4229
......@@ -270,7 +270,7 @@ def origin_id_to_geometry(geometry_source, exposure_type):
# to know if the geometry refers to single buildings instead of cells.
# In this case we need to also know the cell_ID that this building geometry
# is located in.
if exposure_type == "OBM":
if exposure_type == "building":
# Loop through the origin_id_to_geometry map
for geometry_mapping_item in geometry_source:
# Check if already one geometry for a given OriginId has been
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment