Skip to content
Snippets Groups Projects

Resolve "Switch to use taxonomy-lib"

Merged Danijel Schorlemmer requested to merge 4-switch-to-use-taxonomy-lib into main
All threads resolved!
Files
2
@@ -26,7 +26,7 @@ import glob
import csv
from databaselib.database import PostGISDatabase
from exposurelib.database import SpatiaLiteExposure, PostGISExposure
from exposurelib.utils import add_occupancy_to_taxonomy
from taxonomylib import Taxonomy
# Add a logger printing error, warning, info and debug messages to the screen
@@ -319,13 +319,14 @@ class ExposureInitializer:
last_boundary_id = row["BOUNDARY_ID"]
# Read in an asset
# Add the occupancy to the taxonomy string and store it in the database
taxonomy = add_occupancy_to_taxonomy(
row["TAXONOMY"], str(row["OCCUPANCY"]).upper()
)
if not self.exposure_db.taxonomy_string_exists(taxonomy):
self.exposure_db.insert_taxonomy(taxonomy)
taxonomy_id = self.exposure_db.get_taxonomy_id(taxonomy)
# Create the expanded taxonomy string and add the occupancy to it
taxonomy = Taxonomy(row["TAXONOMY"])
taxonomy.set_section("occupancy", row["OCCUPANCY"].upper())
taxonomy_string = taxonomy.get_expanded_string()
# Store the expanded taxonomy string in the database
if not self.exposure_db.taxonomy_string_exists(taxonomy_string):
self.exposure_db.insert_taxonomy(taxonomy_string)
taxonomy_id = self.exposure_db.get_taxonomy_id(taxonomy_string)
asset = {
"number": float(row["BUILDINGS"]),
"structural": float(row["COST_STRUCTURAL_EUR"]),
Loading