Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Dynamic Exposure
Global Dynamic Exposure
losscalculator
Commits
6282935c
Commit
6282935c
authored
Feb 05, 2021
by
Tara Evaz Zadeh
Browse files
Fixed bugs for building exposure calculations
parent
949644e3
Pipeline
#19167
passed with stage
in 1 minute and 51 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
losscalculator/damage_calculator.py
View file @
6282935c
...
...
@@ -116,7 +116,7 @@ def get_exposure_per_tile(
"structural_complete"
,
]
tile_id
=
"origin_id"
csv_writer
.
writerow
(
title
)
csv_writer
.
writerow
(
title
)
for
i
in
range
(
cell_ids
.
shape
[
0
]):
cell_id
=
cell_ids
.
loc
[
i
][
0
]
...
...
losscalculator/damage_calculator_tile_version.py
View file @
6282935c
...
...
@@ -112,7 +112,7 @@ def damageCalculator_TileVersion(
/M008_exposure_Attica_GDE_visual_v001_sat_27f_by_cell_reOrder.csv"
- exposure_type: (string), optional
{‘cell’, ‘
OBM’}, optional'
.
c
ell by default.
{‘cell’, ‘
building’}
.
C
ell 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
]
else
:
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
=
[
geometry
,
""
,
origin_id
,
""
,
"cell_"
+
respective_cell_id
,
respective_cell_id
,
""
,
asset_id
,
""
,
...
...
losscalculator/losslib.py
View file @
6282935c
...
...
@@ -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
C
ell-id if it's a
n OBM
geometry source
Origin-id to a polygon along with its
c
ell-id if it's a
building
geometry source
as the 'origin_id_to_geometry_map'.
Input:
------
- 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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment