Skip to content

Commit

Permalink
Merge pull request #200 from bacetiner/master
Browse files Browse the repository at this point in the history
Fixed BRAILStoR2D_BldgAttrMap dictionary returns & Updated OSM floor count calculation method
  • Loading branch information
bacetiner authored Mar 31, 2024
2 parents 9959fc3 + 485122a commit 893b3a1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
17 changes: 9 additions & 8 deletions brails/EnabledAttributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,21 @@
# Barbaros Cetiner
#
# Last updated:
# 03-28-2024
# 03-30-2024

def BldgAttributes():
def BldgAttributes()->list:
attr = ['buildingheight','chimney','constype','erabuilt','garage',
'numstories','occupancy','roofcover','roofeaveheight','roofshape',
'roofpitch','windarea']
'numstories','occupancy','repaircost','roofcover','roofeaveheight',
'roofshape','roofpitch','windarea']
return attr

def BRAILStoR2D_BldgAttrMap():
def BRAILStoR2D_BldgAttrMap()->dict:
r2dHeaders = ['BuildingHeight','ChimneyExists','StructureType',
'YearBuilt','GarageExists','NumberOfStories',
'OccupancyClass','RoofCoverType','RoofEaveHeight',
'RoofShape','RoofPitch','WindowAreaRatio']
'OccupancyClass','ReplacementCost','RoofCoverType',
'RoofEaveHeight','RoofShape','RoofPitch','WindowAreaRatio']
brailsAttributes = BldgAttributes()
brails2r2dmap = {}
for ind,attr in enumerate(brailsAttributes):
brails2r2dmap[attr] = r2dHeaders[ind]
brails2r2dmap[attr] = r2dHeaders[ind]
return brails2r2dmap
13 changes: 9 additions & 4 deletions brails/workflow/FootprintHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# Barbaros Cetiner
#
# Last updated:
# 03-29-2024
# 03-30-2024

import math
import json
Expand All @@ -54,6 +54,11 @@
import concurrent.futures
from requests.adapters import HTTPAdapter, Retry
import unicodedata
import warnings

# Set a custom warning message format:
warnings.formatwarning = lambda message, category, filename, lineno, line=None: \
f"{category.__name__}: {message}\n"

class FootprintHandler:
def __init__(self):
Expand Down Expand Up @@ -287,8 +292,7 @@ def height2float(inpstr,lengthUnit):
'height':'buildingheight',
}

levelkeys = {'building:levels','roof:levels',
'building:levels:underground'}
levelkeys = {'building:levels','roof:levels'} # Excluding 'building:levels:underground'
otherattrkeys = set(attrmap.keys())
datakeys = levelkeys.union(otherattrkeys)

Expand Down Expand Up @@ -1021,7 +1025,8 @@ def fp_source_selector(self):
elif self.fpSource=='usastr':
footprints, attributes = get_usastruct_footprints(self.queryarea,lengthUnit)
else:
print('Unimplemented footprint source. Setting footprint source to OSM')
warnings.warn('Unimplemented footprint source. Setting footprint source to OSM',
UserWarning)
footprints, attributes = get_osm_footprints(self.queryarea,lengthUnit)
return footprints, attributes

Expand Down

0 comments on commit 893b3a1

Please sign in to comment.