From 2fc377131841347a10d8da7b444f4007918e714b Mon Sep 17 00:00:00 2001 From: shinde Date: Fri, 27 May 2022 17:25:05 +0200 Subject: [PATCH] Assigned -1 to unknown values --- exposurejapan/commercial.py | 8 ++++---- exposurejapan/constants.py | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/exposurejapan/commercial.py b/exposurejapan/commercial.py index 11c0b6f..f6ee85f 100644 --- a/exposurejapan/commercial.py +++ b/exposurejapan/commercial.py @@ -500,7 +500,7 @@ class CommercialAggregatedExposure(SpatialiteDatabase): # Get ID of construction material if row["construction_material"] == "Unknown": - construction_material_id = constants.TOTAL + construction_material_id = constants.UNKNOWN else: construction_material_id = add_element_and_get_index( row["construction_material"], construction_material_list @@ -508,7 +508,7 @@ class CommercialAggregatedExposure(SpatialiteDatabase): # Get ID of basement presence type if row["presence_or_absence_basement"] == "Unknown": - basement_presence_id = constants.TOTAL + basement_presence_id = constants.UNKNOWN else: basement_presence_id = add_element_and_get_index( row["presence_or_absence_basement"], basement_presence_list @@ -516,7 +516,7 @@ class CommercialAggregatedExposure(SpatialiteDatabase): # Get ID of earthquake resistance code presence type if row["earthquake_resistance_std"] == "Unknown": - eq_resistance_code_presence_id = constants.TOTAL + eq_resistance_code_presence_id = constants.UNKNOWN else: eq_resistance_code_presence_id = add_element_and_get_index( row["earthquake_resistance_std"], eq_resistance_code_presence_list @@ -524,7 +524,7 @@ class CommercialAggregatedExposure(SpatialiteDatabase): # Get ID of total floor area (in square meters) range if row["total_floor_area"] == "Unknown": - total_floor_area_id = constants.TOTAL + total_floor_area_id = constants.UNKNOWN else: total_floor_area_id = add_element_and_get_index( row["total_floor_area"], total_floor_area_list diff --git a/exposurejapan/constants.py b/exposurejapan/constants.py index e1e6b86..1d0afcf 100644 --- a/exposurejapan/constants.py +++ b/exposurejapan/constants.py @@ -108,3 +108,6 @@ NUMBER_DWELLING_SIZES = 6 # Constant numbers for import of dwelling-size data to DwellingFloorspace table FLOORSPACE_PER_DWELLING_DWELLING_SIZES = 13 + +# Constant number for Unknown values while importing commercial building numbers data +UNKNOWN = -1 -- GitLab