hub/bruno.py

1085 lines
34 KiB
Python

import geopandas as gpd
import numpy as np
import hub.helpers.constants as cte
import matplotlib.pyplot as plt
input_geojson = "data/cerc_cmm_corrected.geojson"
output_geojson = "data/cerc_cmm_corrected_with_archetype.geojson"
function_dict = {
'1000': cte.RESIDENTIAL,
'2089': cte.WAREHOUSE,
'1921': cte.WAREHOUSE,
'1922': cte.RESIDENTIAL,
'9100': cte.RESIDENTIAL,
'6000': cte.MEDIUM_OFFICE,
'5010': cte.STAND_ALONE_RETAIL,
'9490': cte.WAREHOUSE,
'4299': cte.WAREHOUSE,
'6379': cte.WAREHOUSE,
'5533': cte.WAREHOUSE,
'6591': cte.OFFICE_AND_ADMINISTRATION,
'6211': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'1511': cte.DORMITORY,
'5833': cte.HOTEL,
'1532': cte.DORMITORY,
'6911': cte.CONVENTION_CENTER,
'9510': cte.RESIDENTIAL,
'1990': cte.MID_RISE_APARTMENT,
'1923': cte.RESIDENTIAL,
'7222': cte.SPORTS_LOCATION,
'5002': cte.STRIP_MALL,
'6111': cte.COMMERCIAL,
'6311': cte.MEDIUM_OFFICE,
'6399': cte.MEDIUM_OFFICE,
'5812': cte.FULL_SERVICE_RESTAURANT,
'4621': cte.WAREHOUSE,
'1541': cte.DORMITORY,
'7214': cte.WAREHOUSE,
'4821': cte.RESIDENTIAL,
'9520': cte.RESIDENTIAL,
'7112': cte.WAREHOUSE,
'6299': cte.OUT_PATIENT_HEALTH_CARE,
'5461': cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
'4632': cte.RESIDENTIAL,
'7424': cte.WAREHOUSE,
'5811': cte.FULL_SERVICE_RESTAURANT,
'4113': cte.WAREHOUSE,
'6821': cte.SECONDARY_SCHOOL,
'6920': cte.OFFICE_AND_ADMINISTRATION,
'6199': cte.COMMERCIAL,
'5899': cte.WAREHOUSE,
'5999': cte.STAND_ALONE_RETAIL,
'5834': cte.RESIDENTIAL,
'2699': cte.WAREHOUSE,
'6812': cte.SECONDARY_SCHOOL,
'6649': cte.WAREHOUSE,
'3999': cte.WAREHOUSE,
'1553': cte.OFFICE_AND_ADMINISTRATION,
'6999': cte.WAREHOUSE,
'6541': cte.PRIMARY_SCHOOL,
'5831': cte.SMALL_HOTEL,
'6919': cte.OFFICE_AND_ADMINISTRATION,
'9900': cte.WAREHOUSE,
'1551': cte.WAREHOUSE,
'5511': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6231': cte.COMMERCIAL,
'6221': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6599': cte.OFFICE_AND_ADMINISTRATION,
'7119': cte.WAREHOUSE,
'6214': cte.COMMERCIAL,
'5412': cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
'4839': cte.WAREHOUSE,
'6994': cte.COMMERCIAL,
'6344': cte.WAREHOUSE,
'6722': cte.WAREHOUSE,
'5111': cte.WAREHOUSE,
'6511': cte.OUT_PATIENT_HEALTH_CARE,
'5965': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'4631': cte.WAREHOUSE,
'7451': cte.SPORTS_LOCATION,
'1539': cte.DORMITORY,
'6376': cte.WAREHOUSE,
'4633': cte.RESIDENTIAL,
'5813': cte.QUICK_SERVICE_RESTAURANT,
'6339': cte.COMMERCIAL,
'5911': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5651': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5971': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'4550': cte.RESIDENTIAL,
'5620': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'7611': cte.RESIDENTIAL,
'5531': cte.WAREHOUSE,
'6629': cte.WAREHOUSE,
'6521': cte.MEDIUM_OFFICE,
'7639': cte.WAREHOUSE,
'3399': cte.WAREHOUSE,
'3019': cte.WAREHOUSE,
'6551': cte.MEDIUM_OFFICE,
'5413': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5821': cte.QUICK_SERVICE_RESTAURANT,
'6411': cte.WAREHOUSE,
'6799': cte.OFFICE_AND_ADMINISTRATION,
'5942': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'7111': cte.OFFICE_AND_ADMINISTRATION,
'6419': cte.WAREHOUSE,
'6534': cte.COMMERCIAL,
'5020': cte.WAREHOUSE,
'6594': cte.MEDIUM_OFFICE,
'5819': cte.STAND_ALONE_RETAIL,
'6823': cte.SECONDARY_SCHOOL,
'4990': cte.WAREHOUSE,
'6759': cte.WAREHOUSE,
'6517': cte.OUT_PATIENT_HEALTH_CARE,
'6839': cte.SECONDARY_SCHOOL,
'4711': cte.MEDIUM_OFFICE,
'4111': cte.WAREHOUSE,
'3280': cte.WAREHOUSE,
'6721': cte.OFFICE_AND_ADMINISTRATION,
'9459': cte.RESIDENTIAL,
'7113': cte.WAREHOUSE,
'4743': cte.MEDIUM_OFFICE,
'7211': cte.WAREHOUSE,
'6513': cte.HOSPITAL,
'6813': cte.SECONDARY_SCHOOL,
'5921': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6383': cte.COMMERCIAL,
'5711': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6512': cte.OUT_PATIENT_HEALTH_CARE,
'1590': cte.OFFICE_AND_ADMINISTRATION,
'1890': cte.DORMITORY,
'6372': cte.WAREHOUSE,
'1600': cte.SMALL_HOTEL,
'9451': cte.RESIDENTIAL,
'6359': cte.WAREHOUSE,
'2240': cte.WAREHOUSE,
'1559': cte.OFFICE_AND_ADMINISTRATION,
'1543': cte.DORMITORY,
'6760': cte.MEDIUM_OFFICE,
'4771': cte.MOTION_PICTURE_THEATRE,
'1552': cte.DORMITORY,
'3994': cte.WAREHOUSE,
'6243': cte.RESIDENTIAL,
'6835': cte.SECONDARY_SCHOOL,
'5004': cte.STRIP_MALL,
'6791': cte.OFFICE_AND_ADMINISTRATION,
'1510': cte.DORMITORY,
'7239': cte.OFFICE_AND_ADMINISTRATION,
'5492': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5499': cte.STAND_ALONE_RETAIL,
'4413': cte.WAREHOUSE,
'5951': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5411': cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
'5532': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5252': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6395': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5462': cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
'6232': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6641': cte.WAREHOUSE,
'7432': cte.SPORTS_LOCATION,
'5431': cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
'6532': cte.OFFICE_AND_ADMINISTRATION,
'6518': cte.OUT_PATIENT_HEALTH_CARE,
'5199': cte.WAREHOUSE,
'3840': cte.WAREHOUSE,
'2051': cte.MEDIUM_OFFICE,
'7290': cte.OFFICE_AND_ADMINISTRATION,
'5253': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5660': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5699': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6579': cte.OUT_PATIENT_HEALTH_CARE,
'5173': cte.WAREHOUSE,
'6431': cte.WAREHOUSE,
'6355': cte.WAREHOUSE,
'6263': cte.OUT_PATIENT_HEALTH_CARE,
'5610': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5969': cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
'5991': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'7219': cte.OFFICE_AND_ADMINISTRATION,
'7117': cte.WAREHOUSE,
'5005': cte.STAND_ALONE_RETAIL,
'4561': cte.RESIDENTIAL,
'5631': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'4623': cte.WAREHOUSE,
'4590': cte.WAREHOUSE,
'3899': cte.WAREHOUSE,
'6563': cte.COMMERCIAL,
'5399': cte.STAND_ALONE_RETAIL,
'6241': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6351': cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
'2270': cte.WAREHOUSE,
'5132': cte.WAREHOUSE,
'4221': cte.WAREHOUSE,
'6253': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5640': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'3299': cte.WAREHOUSE,
'6831': cte.SECONDARY_SCHOOL,
'2012': cte.WAREHOUSE,
'3620': cte.WAREHOUSE,
'6519': cte.OUT_PATIENT_HEALTH_CARE,
'2291': cte.WAREHOUSE,
'5311': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5931': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'4611': cte.WAREHOUSE,
'4719': cte.STAND_ALONE_RETAIL,
'5693': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'4490': cte.WAREHOUSE,
'5823': cte.FULL_SERVICE_RESTAURANT,
'2045': cte.WAREHOUSE,
'6542': cte.HOSPITAL,
'2014': cte.WAREHOUSE,
'6375': cte.WAREHOUSE,
'2799': cte.WAREHOUSE,
'6612': cte.WAREHOUSE,
'4222': cte.WAREHOUSE,
'7191': cte.WAREHOUSE,
'6352': cte.WAREHOUSE,
'5836': cte.COMMERCIAL,
'5952': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'1512': cte.DORMITORY,
'5948': cte.WAREHOUSE,
'3580': cte.WAREHOUSE,
'5391': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6997': cte.OFFICE_AND_ADMINISTRATION,
'6539': cte.OFFICE_AND_ADMINISTRATION,
'2899': cte.WAREHOUSE,
'1100': cte.SINGLE_FAMILY_HOUSE,
'6348': cte.WAREHOUSE,
'7499': cte.WAREHOUSE,
'6373': cte.WAREHOUSE,
'3539': cte.WAREHOUSE,
'4922': cte.WAREHOUSE,
'6731': cte.OFFICE_AND_ADMINISTRATION,
'6132': cte.MEDIUM_OFFICE,
'2073': cte.WAREHOUSE,
'4761': cte.COMMERCIAL,
'7312': cte.RESIDENTIAL,
'7425': cte.SPORTS_LOCATION,
'6634': cte.WAREHOUSE,
'6639': cte.WAREHOUSE,
'3231': cte.WAREHOUSE,
'6569': cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
'2499': cte.WAREHOUSE,
'7199': cte.WAREHOUSE,
'7114': cte.WAREHOUSE,
'4733': cte.COMMERCIAL,
'4112': cte.WAREHOUSE,
'7129': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'7620': cte.RESIDENTIAL,
'9390': cte.WAREHOUSE,
'1529': cte.OFFICE_AND_ADMINISTRATION,
'7417': cte.RESIDENTIAL,
'8221': cte.OUT_PATIENT_HEALTH_CARE,
'6598': cte.OUT_PATIENT_HEALTH_CARE,
'6515': cte.OUT_PATIENT_HEALTH_CARE,
'3719': cte.WAREHOUSE,
'2471': cte.WAREHOUSE,
'7433': cte.WAREHOUSE,
'6413': cte.WAREHOUSE,
'3459': cte.WAREHOUSE,
'6152': cte.MEDIUM_OFFICE,
'2093': cte.WAREHOUSE,
'3031': cte.WAREHOUSE,
'5251': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5394': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5141': cte.STRIP_MALL,
'7419': cte.SPORTS_LOCATION,
'4293': cte.WAREHOUSE,
'6834': cte.SECONDARY_SCHOOL,
'2092': cte.WAREHOUSE,
'2072': cte.WAREHOUSE,
'6712': cte.MEDIUM_OFFICE,
'4411': cte.WAREHOUSE,
'4562': cte.RESIDENTIAL,
'2096': cte.WAREHOUSE,
'5997': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'7212': cte.WAREHOUSE,
'6713': cte.MEDIUM_OFFICE,
'9212': cte.RESIDENTIAL,
'6725': cte.OFFICE_AND_ADMINISTRATION,
'9410': cte.RESIDENTIAL,
'4211': cte.WAREHOUSE,
'5230': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6141': cte.MEDIUM_OFFICE,
'7512': cte.HEALTH_CARE,
'5822': cte.QUICK_SERVICE_RESTAURANT,
'5121': cte.STRIP_MALL,
'6369': cte.SECONDARY_SCHOOL,
'5171': cte.STRIP_MALL,
'5003': cte.STRIP_MALL,
'3630': cte.WAREHOUSE,
'5521': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6531': cte.OUT_PATIENT_HEALTH_CARE,
'7413': cte.WAREHOUSE,
'3239': cte.WAREHOUSE,
'4715': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6365': cte.UNIVERSITY,
'6121': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6611': cte.WAREHOUSE,
'3649': cte.WAREHOUSE,
'2892': cte.WAREHOUSE,
'6269': cte.OUT_PATIENT_HEALTH_CARE,
'2020': cte.WAREHOUSE,
'6621': cte.WAREHOUSE,
'6312': cte.RESIDENTIAL,
'6416': cte.WAREHOUSE,
'5712': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'2261': cte.WAREHOUSE,
'2931': cte.WAREHOUSE,
'3011': cte.WAREHOUSE,
'6499': cte.STAND_ALONE_RETAIL,
'3599': cte.WAREHOUSE,
'2299': cte.WAREHOUSE,
'3831': cte.WAREHOUSE,
'2410': cte.WAREHOUSE,
'5112': cte.STRIP_MALL,
'5941': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6822': cte.SECONDARY_SCHOOL,
'6753': cte.WAREHOUSE,
'5149': cte.STRIP_MALL,
'3190': cte.WAREHOUSE,
'6414': cte.WAREHOUSE,
'6633': cte.WAREHOUSE,
'3895': cte.WAREHOUSE,
'5133': cte.STRIP_MALL,
'2082': cte.WAREHOUSE,
'5512': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'9420': cte.RESIDENTIAL,
'6543': cte.HOSPITAL,
'4841': cte.WAREHOUSE,
'4851': cte.WAREHOUSE,
'5432': cte.STRIP_MALL,
'3711': cte.WAREHOUSE,
'3460': cte.WAREHOUSE,
'2087': cte.WAREHOUSE,
'1522': cte.HALL,
'8549': cte.WAREHOUSE,
'6242': cte.WAREHOUSE,
'6412': cte.WAREHOUSE,
'6811': cte.SECONDARY_SCHOOL,
'6154': cte.WAREHOUSE,
'7123': cte.WAREHOUSE,
'6993': cte.MEDIUM_OFFICE,
'6742': cte.HOSPITAL,
'5212': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5211': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'7990': cte.HALL,
'3714': cte.WAREHOUSE,
'6593': cte.SECONDARY_SCHOOL,
'5172': cte.STRIP_MALL,
'5955': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6635': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'3799': cte.WAREHOUSE,
'2819': cte.WAREHOUSE,
'5894': cte.QUICK_SERVICE_RESTAURANT,
'9530': cte.RESIDENTIAL,
'3159': cte.WAREHOUSE,
'3713': cte.WAREHOUSE,
'3894': cte.WAREHOUSE,
'5721': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5169': cte.STRIP_MALL,
'5593': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6631': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5731': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'2739': cte.WAREHOUSE,
'6619': cte.WAREHOUSE,
'6815': cte.SECONDARY_SCHOOL,
'5320': cte.STRIP_MALL,
'3261': cte.WAREHOUSE,
'6394': cte.WAREHOUSE,
'2031': cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
'6423': cte.WAREHOUSE,
'3162': cte.WAREHOUSE,
'5814': cte.QUICK_SERVICE_RESTAURANT,
'6653': cte.WAREHOUSE,
'2213': cte.WAREHOUSE,
'2046': cte.WAREHOUSE,
'6251': cte.COMMERCIAL,
'3650': cte.WAREHOUSE,
'4799': cte.RESIDENTIAL,
'5832': cte.SMALL_HOTEL,
'4229': cte.WAREHOUSE,
'4842': cte.WAREHOUSE,
'5163': cte.STRIP_MALL,
'5148': cte.STRIP_MALL,
'2011': cte.WAREHOUSE,
'5361': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'2999': cte.WAREHOUSE,
'6522': cte.MEDIUM_OFFICE,
'7121': cte.MUSEUM,
'7221': cte.SPORTS_LOCATION,
'1549': cte.OFFICE_AND_ADMINISTRATION,
'5652': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'3331': cte.WAREHOUSE,
'6219': cte.WAREHOUSE,
'5421': cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
'3861': cte.WAREHOUSE,
'3919': cte.WAREHOUSE,
'6441': cte.WAREHOUSE,
'6648': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'8199': cte.WAREHOUSE,
'6832': cte.SECONDARY_SCHOOL,
'6992': cte.MEDIUM_OFFICE,
'1521': cte.WAREHOUSE,
'6349': cte.WAREHOUSE,
'4921': cte.WAREHOUSE,
'6498': cte.WAREHOUSE,
'6415': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'4122': cte.WAREHOUSE,
'4219': cte.WAREHOUSE,
'9440': cte.RESIDENTIAL,
'4782': cte.DATACENTER,
'2619': cte.WAREHOUSE,
'7229': cte.SPORTS_LOCATION,
'2079': cte.WAREHOUSE,
'2320': cte.WAREHOUSE,
'3259': cte.WAREHOUSE,
'3931': cte.WAREHOUSE,
'5470': cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
'4890': cte.WAREHOUSE,
'5599': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'3270': cte.WAREHOUSE,
'5186': cte.STRIP_MALL,
'2043': cte.WAREHOUSE,
'6733': cte.WAREHOUSE,
'4311': cte.WAREHOUSE,
'3451': cte.WAREHOUSE,
'2812': cte.WAREHOUSE,
'2130': cte.WAREHOUSE,
'7449': cte.WAREHOUSE,
'2919': cte.WAREHOUSE,
'4315': cte.WAREHOUSE,
'3569': cte.WAREHOUSE,
'7399': cte.WAREHOUSE,
'6160': cte.OFFICE_AND_ADMINISTRATION,
'7412': cte.RESIDENTIAL,
'2084': cte.WAREHOUSE,
'3870': cte.WAREHOUSE,
'5001': cte.STRIP_MALL,
'3411': cte.WAREHOUSE,
'1702': cte.RESIDENTIAL,
'3243': cte.WAREHOUSE,
'4926': cte.MEDIUM_OFFICE,
'3490': cte.WAREHOUSE,
'2219': cte.WAREHOUSE,
'2829': cte.WAREHOUSE,
'4399': cte.WAREHOUSE,
'4319': cte.WAREHOUSE,
'2039': cte.WAREHOUSE,
'8139': cte.GREEN_HOUSE,
'5146': cte.STRIP_MALL,
'3396': cte.WAREHOUSE,
'5161': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'2091': cte.WAREHOUSE,
'3850': cte.WAREHOUSE,
'5241': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'3049': cte.WAREHOUSE,
'5181': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'2627': cte.WAREHOUSE,
'3412': cte.WAREHOUSE,
'5220': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'3699': cte.WAREHOUSE,
'4929': cte.WAREHOUSE,
'3551': cte.WAREHOUSE,
'5198': cte.STRIP_MALL,
'6646': cte.RESIDENTIAL,
'5189': cte.STRIP_MALL,
'5312': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'4214': cte.WAREHOUSE,
'3410': cte.WAREHOUSE,
'4859': cte.WAREHOUSE,
'2736': cte.WAREHOUSE,
'6642': cte.WAREHOUSE,
'3921': cte.WAREHOUSE,
'5815': cte.FULL_SERVICE_RESTAURANT,
'6514': cte.OUT_PATIENT_HEALTH_CARE,
'8399': cte.WAREHOUSE,
'2250': cte.WAREHOUSE,
'6378': cte.WAREHOUSE,
'6343': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'2652': cte.WAREHOUSE,
'3552': cte.WAREHOUSE,
'2891': cte.WAREHOUSE,
'6368': cte.SECONDARY_SCHOOL,
'3559': cte.WAREHOUSE,
'5145': cte.STRIP_MALL,
'3244': cte.WAREHOUSE,
'3292': cte.WAREHOUSE,
'4510': cte.WAREHOUSE,
'7423': cte.SPORTS_LOCATION,
'5370': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'4824': cte.WAREHOUSE,
'4832': cte.WAREHOUSE,
'6573': cte.HEALTH_CARE,
'6623': cte.RESIDENTIAL,
'5162': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'4612': cte.WAREHOUSE,
'2629': cte.WAREHOUSE,
'3291': cte.WAREHOUSE,
'3229': cte.WAREHOUSE,
'5829': cte.STAND_ALONE_RETAIL,
'2932': cte.WAREHOUSE,
'5594': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'2722': cte.WAREHOUSE,
'2811': cte.WAREHOUSE,
'2235': cte.WAREHOUSE,
'5953': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'3170': cte.WAREHOUSE,
'3662': cte.WAREHOUSE,
'4879': cte.WAREHOUSE,
'2074': cte.WAREHOUSE,
'7429': cte.SPORTS_LOCATION,
'4843': cte.WAREHOUSE,
'6335': cte.OFFICE_AND_ADMINISTRATION,
'4116': cte.WAREHOUSE,
'2622': cte.WAREHOUSE,
'6112': cte.OFFICE_AND_ADMINISTRATION,
'4875': cte.WAREHOUSE,
'4792': cte.WAREHOUSE_REFRIGERATED,
'6391': cte.UNIVERSITY,
'6425': cte.WAREHOUSE,
'6212': cte.WAREHOUSE,
'5147': cte.STRIP_MALL,
'2460': cte.WAREHOUSE,
'4874': cte.WAREHOUSE,
'6743': cte.DORMITORY,
'3241': cte.WAREHOUSE,
'5123': cte.STRIP_MALL,
'4833': cte.RESIDENTIAL,
'9470': cte.RESIDENTIAL,
'3932': cte.WAREHOUSE,
'4292': cte.WAREHOUSE,
'6424': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'6139': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'2624': cte.WAREHOUSE,
'3915': cte.WAREHOUSE,
'7233': cte.CONVENTION_CENTER,
'5184': cte.STRIP_MALL,
'2099': cte.WAREHOUSE,
'5129': cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
'5913': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'5717': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'4712': cte.RESIDENTIAL,
'5142': cte.STRIP_MALL,
'3210': cte.WAREHOUSE,
'4834': cte.WAREHOUSE,
'3456': cte.WAREHOUSE,
'2075': cte.WAREHOUSE,
'3020': cte.WAREHOUSE,
'3821': cte.WAREHOUSE,
'6613': cte.MEDIUM_OFFICE,
'4826': cte.WAREHOUSE,
'5839': cte.MULTI_FAMILY_HOUSE,
'4316': cte.WAREHOUSE,
'6592': cte.OFFICE_AND_ADMINISTRATION,
'3971': cte.WAREHOUSE,
'3972': cte.WAREHOUSE,
'2694': cte.WAREHOUSE,
'3882': cte.WAREHOUSE,
'3119': cte.WAREHOUSE,
'2495': cte.WAREHOUSE,
'4759': cte.MEDIUM_OFFICE,
'6439': cte.WAREHOUSE,
'6643': cte.WAREHOUSE,
'3470': cte.WAREHOUSE,
'3531': cte.WAREHOUSE,
'4823': cte.RESIDENTIAL,
'2293': cte.WAREHOUSE,
'3532': cte.WAREHOUSE,
'3913': cte.WAREHOUSE,
'6816': cte.OFFICE_AND_ADMINISTRATION,
'3562': cte.WAREHOUSE,
'6496': cte.COMMERCIAL,
'4119': cte.WAREHOUSE,
'6533': cte.OUT_PATIENT_HEALTH_CARE,
'6814': cte.PRIMARY_SCHOOL,
'6353': cte.WAREHOUSE,
'3392': cte.WAREHOUSE,
'5114': cte.STRIP_MALL,
'5131': cte.STRIP_MALL,
'3641': cte.WAREHOUSE,
'2614': cte.WAREHOUSE,
'3661': cte.WAREHOUSE,
'2081': cte.WAREHOUSE,
'3340': cte.WAREHOUSE,
'4928': cte.WORKSHOP,
'3712': cte.WAREHOUSE,
'3253': cte.WAREHOUSE,
'3860': cte.WAREHOUSE,
'3892': cte.WAREHOUSE,
'2992': cte.WAREHOUSE,
'5598': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'4825': cte.RESIDENTIAL,
'2071': cte.WAREHOUSE,
'6495': cte.WAREHOUSE,
'2914': cte.WAREHOUSE,
'3182': cte.WAREHOUSE,
'3791': cte.WAREHOUSE,
'3992': cte.WAREHOUSE,
'3114': cte.WAREHOUSE,
'7920': cte.OFFICE_AND_ADMINISTRATION,
'5891': cte.RESTAURANT,
'5835': cte.SMALL_HOTEL,
'6565': cte.HEALTH_CARE,
'3391': cte.WAREHOUSE,
'6615': cte.WAREHOUSE,
'3883': cte.WAREHOUSE,
'2032': cte.WAREHOUSE,
'2994': cte.WAREHOUSE,
'4871': cte.WAREHOUSE,
'5113': cte.WORKSHOP,
'3571': cte.WAREHOUSE,
'2342': cte.WAREHOUSE,
'3911': cte.WAREHOUSE,
'7444': cte.EDUCATION,
'2221': cte.WAREHOUSE,
'8192': cte.FARM,
'2439': cte.WAREHOUSE,
'3891': cte.WAREHOUSE,
'6354': cte.WORKSHOP,
'4815': cte.RESIDENTIAL,
'6651': cte.WORKSHOP,
'2822': cte.WAREHOUSE,
'2821': cte.WAREHOUSE,
'1211': cte.RESIDENTIAL,
'8133': cte.WAREHOUSE,
'6572': cte.HEALTH_CARE,
'2734': cte.WAREHOUSE,
'8132': cte.WAREHOUSE,
'6659': cte.WAREHOUSE,
'6332': cte.COMMERCIAL,
'6595': cte.COMMERCIAL,
'5393': cte.COMMERCIAL,
'5450': cte.COMMERCIAL,
'8127': cte.WAREHOUSE,
'5595': cte.COMMERCIAL,
'6571': cte.HEALTH_CARE,
'5030': cte.COMMERCIAL,
'9460': cte.WAREHOUSE,
'7516': cte.SPORTS_LOCATION,
'5523': cte.COMMERCIAL,
'5722': cte.COMMERCIAL,
'4732': cte.RESIDENTIAL,
'7491': cte.SPORTS_LOCATION,
'3262': cte.WAREHOUSE,
'8543': cte.WAREHOUSE,
'6129': cte.COMMERCIAL,
'5362': cte.COMMERCIAL,
'8122': cte.WAREHOUSE,
'5597': cte.COMMERCIAL,
'3269': cte.WAREHOUSE,
'5331': cte.COMMERCIAL,
'5522': cte.COMMERCIAL,
'7421': cte.WAREHOUSE,
'2723': cte.WAREHOUSE,
'4822': cte.RESIDENTIAL,
'6319': cte.COMMERCIAL,
'8131': cte.WAREHOUSE,
'7422': cte.SPORTS_LOCATION,
'3140': cte.WAREHOUSE,
'9220': cte.RESIDENTIAL,
'4852': cte.RESIDENTIAL,
'3694': cte.WAREHOUSE,
'6632': cte.COMMERCIAL,
'6656': cte.WAREHOUSE,
'8322': cte.WAREHOUSE,
'8126': cte.WAREHOUSE,
'6638': cte.COMMERCIAL,
'2292': cte.WAREHOUSE,
'6392': cte.COMMERCIAL,
'4313': cte.WAREHOUSE,
'4312': cte.RESIDENTIAL,
'6417': cte.COMMERCIAL,
'6234': cte.COMMERCIAL,
'6254': cte.COMMERCIAL,
'7396': cte.SPORTS_LOCATION,
'3579': cte.WAREHOUSE,
'6596': cte.COMMERCIAL,
'5397': cte.COMMERCIAL,
'5946': cte.COMMERCIAL,
'6657': cte.COMMERCIAL,
'6995': cte.COMMERCIAL,
'6711': cte.OFFICE_AND_ADMINISTRATION,
'5713': cte.COMMERCIAL,
'5954': cte.COMMERCIAL,
'6342': cte.COMMERCIAL,
'6333': cte.COMMERCIAL,
'5932': cte.COMMERCIAL,
'5332': cte.COMMERCIAL,
'3510': cte.WAREHOUSE,
'5732': cte.COMMERCIAL,
'4811': cte.WAREHOUSE,
'5422': cte.COMMERCIAL,
'5596': cte.COMMERCIAL,
'5740': cte.COMMERCIAL,
'3232': cte.WAREHOUSE,
'5933': cte.COMMERCIAL,
'5992': cte.COMMERCIAL,
'3443': cte.WAREHOUSE,
'2472': cte.WAREHOUSE,
'6151': cte.COMMERCIAL,
'3263': cte.WAREHOUSE,
'5396': cte.COMMERCIAL,
'3249': cte.WAREHOUSE,
'4752': cte.COMMERCIAL,
'6836': cte.EDUCATION,
'3934': cte.WAREHOUSE,
'4849': cte.RESIDENTIAL,
'4749': cte.RESIDENTIAL,
'3441': cte.WAREHOUSE,
'7441': cte.SPORTS_LOCATION,
'6320': cte.COMMERCIAL,
'6191': cte.COMMERCIAL,
'6561': cte.HEALTH_CARE,
'5185': cte.COMMERCIAL,
'4731': cte.COMMERCIAL,
'5680': cte.COMMERCIAL,
'9458': cte.COMMERCIAL,
'2737': cte.WAREHOUSE,
'3264': cte.WAREHOUSE,
'6233': cte.COMMERCIAL,
'4819': cte.WAREHOUSE,
'5183': cte.COMMERCIAL,
'6724': cte.OFFICE_AND_ADMINISTRATION,
'6131': cte.COMMERCIAL,
'8121': cte.WAREHOUSE,
'6652': cte.WAREHOUSE,
'5983': cte.COMMERCIAL,
'7393': cte.SPORTS_LOCATION,
'3350': cte.WAREHOUSE,
'6397': cte.COMMERCIAL,
'3594': cte.WAREHOUSE,
'6637': cte.WAREHOUSE,
'5191': cte.COMMERCIAL,
'6636': cte.WAREHOUSE,
'2061': cte.WAREHOUSE,
'2049': cte.WAREHOUSE,
'8299': cte.WAREHOUSE,
'8180': cte.COMMERCIAL,
'6516': cte.HEALTH_CARE,
'6597': cte.OFFICE_AND_ADMINISTRATION,
'2933': cte.WAREHOUSE,
'5154': cte.COMMERCIAL,
'6371': cte.WAREHOUSE,
'5995': cte.COMMERCIAL,
'4772': cte.COMMERCIAL,
'4760': cte.COMMERCIAL,
'6493': cte.COMMERCIAL,
'5947': cte.COMMERCIAL,
'5242': cte.COMMERCIAL,
'5892': cte.COMMERCIAL,
'5719': cte.COMMERCIAL,
'2895': cte.WAREHOUSE,
'7415': cte.SPORTS_LOCATION,
'4563': cte.RESIDENTIAL,
'3014': cte.WAREHOUSE,
'5691': cte.COMMERCIAL,
'3111': cte.WAREHOUSE,
'8198': cte.WAREHOUSE,
'8141': cte.WAREHOUSE,
'7452': cte.WAREHOUSE,
'3222': cte.WAREHOUSE,
'2713': cte.WAREHOUSE,
'2088': cte.WAREHOUSE,
'6564': cte.HEALTH_CARE,
'6622': cte.WAREHOUSE,
'5440': cte.COMMERCIAL,
'2894': cte.WAREHOUSE,
'6625': cte.WAREHOUSE,
'6239': cte.COMMERCIAL,
'8129': cte.WAREHOUSE,
'6647': cte.WAREHOUSE,
'8137': cte.WAREHOUSE,
'6553': cte.COMMERCIAL,
'3442': cte.WAREHOUSE,
'4391': cte.RESIDENTIAL,
'5591': cte.COMMERCIAL,
'5151': cte.COMMERCIAL,
'5196': cte.COMMERCIAL,
'6616': cte.COMMERCIAL,
'2216': cte.WAREHOUSE,
'8191': cte.WAREHOUSE,
'6422': cte.COMMERCIAL,
'1212': cte.RESIDENTIAL,
'8134': cte.WAREHOUSE,
'5194': cte.COMMERCIAL,
'6658': cte.WAREHOUSE,
'8123': cte.WAREHOUSE,
'6346': cte.COMMERCIAL,
'2731': cte.WAREHOUSE,
'7445': cte.COMMERCIAL,
'8125': cte.WAREHOUSE,
'4746': cte.RESIDENTIAL,
'3922': cte.WAREHOUSE,
'5360': cte.WAREHOUSE,
'3330': cte.WAREHOUSE,
'7610': cte.WAREHOUSE,
'6142': cte.WAREHOUSE,
'4610': cte.WAREHOUSE,
'6552': cte.WAREHOUSE,
'8120': cte.WAREHOUSE,
'6313': cte.WAREHOUSE,
'6398': cte.WAREHOUSE,
'6730': cte.WAREHOUSE,
'6153': cte.WAREHOUSE,
'3013': cte.WAREHOUSE,
'5187': cte.WAREHOUSE,
'5182': cte.WAREHOUSE,
'6336': cte.WAREHOUSE,
'5122': cte.WAREHOUSE,
'3914': cte.WAREHOUSE,
'3480': cte.WAREHOUSE,
'8135': cte.WAREHOUSE,
'3979': cte.WAREHOUSE,
'8319': cte.WAREHOUSE,
'6155': cte.WAREHOUSE,
'5998': cte.WAREHOUSE,
'3016': cte.WAREHOUSE,
'5333': cte.WAREHOUSE,
'6381': cte.WAREHOUSE,
'5912': cte.WAREHOUSE,
'4829': cte.WAREHOUSE,
'2732': cte.WAREHOUSE,
'5993': cte.WAREHOUSE,
'2735': cte.WAREHOUSE,
'6421': cte.WAREHOUSE,
'5981': cte.WAREHOUSE,
'7213': cte.WAREHOUSE,
'5994': cte.WAREHOUSE,
'3940': cte.WAREHOUSE,
'3893': cte.WAREHOUSE,
'6729': cte.WAREHOUSE,
'3152': cte.WAREHOUSE,
'6991': cte.WAREHOUSE,
'6626': cte.WAREHOUSE,
'6149': cte.WAREHOUSE,
'4764': cte.WAREHOUSE,
'7511': cte.WAREHOUSE,
'6655': cte.WAREHOUSE,
'8229': cte.WAREHOUSE,
'6418': cte.WAREHOUSE,
'6356': cte.WAREHOUSE,
'6562': cte.WAREHOUSE,
'6654': cte.WAREHOUSE,
'5164': cte.WAREHOUSE,
'5188': cte.WAREHOUSE,
'6996': cte.WAREHOUSE,
'3221': cte.WAREHOUSE,
'8124': cte.WAREHOUSE,
'2494': cte.WAREHOUSE,
'6215': cte.WAREHOUSE,
'6644': cte.WAREHOUSE,
'6262': cte.WAREHOUSE,
'4927': cte.WAREHOUSE,
'3991': cte.WAREHOUSE,
'2215': cte.WAREHOUSE,
'5144': cte.WAREHOUSE,
'2740': cte.WAREHOUSE,
'5670': cte.WAREHOUSE,
'6442': cte.WAREHOUSE,
'3612': cte.WAREHOUSE,
'5990': cte.WAREHOUSE,
'5193': cte.WAREHOUSE,
'5197': cte.WAREHOUSE,
'3974': cte.WAREHOUSE,
'2019': cte.WAREHOUSE,
'7314': cte.WAREHOUSE,
'3542': cte.WAREHOUSE,
'5165': cte.WAREHOUSE,
'4291': cte.WAREHOUSE,
'1913': cte.WAREHOUSE,
'5270': cte.WAREHOUSE,
'7481': cte.WAREHOUSE,
'4855': cte.WAREHOUSE,
'6261': cte.WAREHOUSE,
'2733': cte.WAREHOUSE,
'5943': cte.WAREHOUSE,
'7522': cte.WAREHOUSE,
'5714': cte.WAREHOUSE,
'5653': cte.WAREHOUSE,
'2640': cte.WAREHOUSE,
'4813': cte.WAREHOUSE,
'6345': cte.WAREHOUSE,
'5177': cte.WAREHOUSE,
'4789': cte.WAREHOUSE,
'5195': cte.WAREHOUSE,
'3017': cte.WAREHOUSE,
'4872': cte.WAREHOUSE,
'7411': cte.WAREHOUSE,
'3973': cte.WAREHOUSE,
'3039': cte.WAREHOUSE,
'6159': cte.WAREHOUSE,
'5982': cte.WAREHOUSE,
'5539': cte.WAREHOUSE,
'8542': cte.WAREHOUSE,
'2222': cte.WAREHOUSE,
'8312': cte.WAREHOUSE,
'3832': cte.WAREHOUSE,
'3592': cte.WAREHOUSE,
'8128': cte.WAREHOUSE,
'6523': cte.WAREHOUSE,
'3430': cte.WAREHOUSE,
'5395': cte.WAREHOUSE,
'3716': cte.WAREHOUSE,
'7223': cte.WAREHOUSE,
'7521': cte.WAREHOUSE,
'2738': cte.WAREHOUSE,
'2217': cte.WAREHOUSE,
'8311': cte.WAREHOUSE,
'3693': cte.WAREHOUSE,
'6123': cte.WAREHOUSE,
'7115': cte.WAREHOUSE,
'4567': cte.WAREHOUSE,
'4742': cte.WAREHOUSE,
'5159': cte.WAREHOUSE,
'5192': cte.WAREHOUSE,
'5178': cte.WAREHOUSE,
'5716': cte.WAREHOUSE,
'7392': cte.WAREHOUSE,
'2913': cte.WAREHOUSE,
'4854': cte.WAREHOUSE,
'2062': cte.WAREHOUSE,
'5363': cte.WAREHOUSE,
'6347': cte.WAREHOUSE,
'1914': cte.WAREHOUSE,
'7519': cte.WAREHOUSE,
'2094': cte.WAREHOUSE,
'6645': cte.WAREHOUSE,
'7414': cte.WAREHOUSE,
'6732': cte.WAREHOUSE,
'6554': cte.WAREHOUSE,
'7394': cte.WAREHOUSE,
'6222': cte.WAREHOUSE,
'3520': cte.WAREHOUSE,
'6741': cte.WAREHOUSE,
'7116': cte.WAREHOUSE,
'8099': cte.WAREHOUSE,
'3642': cte.WAREHOUSE,
'6614': cte.WAREHOUSE,
'6252': cte.WAREHOUSE,
'2452': cte.WAREHOUSE,
'3251': cte.WAREHOUSE,
'5115': cte.WAREHOUSE,
'6366': cte.WAREHOUSE,
'5143': cte.WAREHOUSE,
'5493': cte.WAREHOUSE,
'7395': cte.WAREHOUSE,
'6363': cte.WAREHOUSE,
'6393': cte.WAREHOUSE,
'6244': cte.WAREHOUSE
}
gdf = gpd.read_file(input_geojson)
# Fix missing attributes
if 'function_c' not in gdf.columns:
gdf['function_c'] = '1921'
else:
gdf['function_c'] = gdf['function_c'].apply(lambda x: '1921' if (x is None or (isinstance(x, float) and np.isnan(x))) else x)
if 'height' not in gdf.columns:
gdf['height'] = 5.0
else:
gdf['height'] = gdf['height'].apply(lambda x: 5.0 if (x is None or (isinstance(x, float) and np.isnan(x))) else x)
if 'contr_year' not in gdf.columns:
gdf['contr_year'] = 1980
else:
def fix_year(val):
if val is None:
return 1980
if isinstance(val, str):
val = val.strip()
if val == '' or not val.isdigit():
return 1980
return int(val)
if isinstance(val, float) and np.isnan(val):
return 1980
return int(val)
gdf['contr_year'] = gdf['contr_year'].apply(fix_year)
if 'adjacency' not in gdf.columns:
gdf['adjacency'] = 'attached'
else:
gdf['adjacency'] = gdf['adjacency'].apply(lambda x: 'attached' if (x is None or (isinstance(x, str) and x.strip() == '') or (isinstance(x, float) and np.isnan(x))) else x)
gdf['function_c_str'] = gdf['function_c'].astype(str).apply(lambda x: str(int(float(x))) if x.replace('.', '', 1).isdigit() else x)
def map_function(function_code):
# If code not found in dictionary, default to warehouse
return function_dict.get(function_code, cte.WAREHOUSE)
gdf['function_category'] = gdf['function_c_str'].apply(map_function)
def determine_usage(function_category, height, adjacency, year):
fcat = function_category.lower() if function_category and isinstance(function_category, str) else ''
adj = adjacency.lower() if adjacency else 'detached'
h = height if height else 0.0
y = year if year else 2000
# Check custom archetypes
if 'hospital' in fcat:
return "Hospitals post 1980" if y > 1980 else "Hospitals pre 1980"
elif 'school' in fcat or 'education' in fcat or 'university' in fcat or 'primary_school' in fcat or 'secondary_school' in fcat:
return "Schools post 1980" if y > 1980 else "Schools pre 1980"
elif 'strip_mall' in fcat:
return "Strip mall post 1980" if y > 1980 else "Strip mall pre 1980"
# Fallback logic for other types
if 'residential' in fcat or 'multifamily' in fcat or 'single family' in fcat or 'single_family_house' in fcat:
if h < 6 and adj == 'detached':
return 'Single Family'
elif h < 6 and adj in ['attached', 'semi-detached']:
return 'Row house'
elif 6 <= h <= 10 and adj == 'detached':
return 'Duplex/triplex'
elif 6 <= h <= 10 and adj in ['attached', 'semi-detached']:
return 'Small MURBs'
elif 10 < h <= 15:
return 'Medium MURBs'
elif h > 15:
return 'Large MURBs'
else:
return "No Archetype!"
elif 'office' in fcat or 'office_and_administration' in fcat:
return 'Office'
elif 'commercial' in fcat or 'retail' in fcat or 'stand_alone_retail' in fcat or 'strip_mall' in fcat:
if adj in ['attached', 'semi-detached']:
return 'Commercial attached'
else:
return 'Commercial detached'
else:
return "No Archetype!"
def determine_vintage(year):
if year <= 1947:
return 'Pre 1947'
elif 1947 < year <= 1983:
return '1947-1983'
elif 1983 < year <= 2010:
return '1984-2010'
else:
return 'Post 2010'
def get_archetype_key(row):
usage = determine_usage(row['function_category'], float(row['height']), row['adjacency'], int(row['contr_year']))
y = int(row['contr_year'])
# If still "No Archetype!", default to warehouse
if usage == "No Archetype!":
usage = "Warehouse post 1980" if y > 1980 else "Warehouse pre 1980"
return usage
# If usage already specifies post/pre 1980, return it
if "post 1980" in usage.lower() or "pre 1980" in usage.lower():
return usage
else:
# Determine vintage and add to usage
vintage = determine_vintage(y)
full_archetype = f"{usage} {vintage}"
# If still starts with 'No Archetype!' (unlikely now), default to warehouse
if full_archetype.lower().startswith("no archetype!"):
return "Warehouse post 1980" if y > 1980 else "Warehouse pre 1980"
return full_archetype
gdf['archetype_key'] = gdf.apply(get_archetype_key, axis=1)
gdf.to_file(output_geojson, driver='GeoJSON')
print(f"Archetype keys updated. Saved to {output_geojson}")
# Plotting the distribution
archetype_counts = gdf['archetype_key'].value_counts()
fig, ax = plt.subplots(figsize=(10,6))
archetype_counts.plot(kind='bar', ax=ax, color='skyblue', edgecolor='black')
ax.set_title("Number of Buildings per Archetype", fontsize=16, fontweight='bold')
ax.set_xlabel("Archetype", fontsize=12)
ax.set_ylabel("Count of Buildings", fontsize=12)
plt.xticks(rotation=45, ha='right')
plt.tight_layout()
plt.show()