-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts to find buildings for large owners
- Loading branch information
1 parent
a105610
commit 1142d16
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import csv | ||
|
||
found = [] | ||
|
||
with open("src/data/scripts/cha_building_names.txt") as f: | ||
looking_for = f.read().splitlines() | ||
with open("src/data/source/ChicagoEnergyBenchmarking.csv") as a: | ||
whole_file = list(csv.DictReader(a)) | ||
|
||
for i, p in enumerate(looking_for): | ||
for j, whole_file_line in enumerate(whole_file): | ||
if p.lower().strip().replace(" ", "") in whole_file_line["Property Name"].lower().strip().replace(" ", ""): | ||
found.append((whole_file_line["ID"], whole_file_line["Property Name"])) | ||
break | ||
|
||
for place in found: | ||
print('// '+place[1]) | ||
print("'" + place[0] + "'" + ": { owner: BuildingOwners.cha.key },") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import csv | ||
|
||
found = [] | ||
|
||
def find_addresses(): | ||
with open('src/data/source/City-Owned_Land_Inventory.csv') as source_file: | ||
city_file = csv.DictReader(source_file) | ||
MAIN_FILE_ADDRESS_INDEX = 4 | ||
MAIN_FILE_ID_INDEX = 1 | ||
|
||
with open('src/data/source/ChicagoEnergyBenchmarking.csv', newline='') as all_data: | ||
whole_file = all_data.read().splitlines() | ||
for i, line in enumerate(city_file): | ||
if line["Address"].strip() == "" or line["Property Status"] != "Owned by City": | ||
continue | ||
for j, whole_file_line in enumerate(whole_file): | ||
print(i, j) | ||
address = whole_file_line.split(",")[MAIN_FILE_ADDRESS_INDEX] | ||
if line["Address"].lower().strip().replace(" ", "") == address.lower().strip().replace(" ", ""): | ||
found.append(whole_file_line.split(",")[MAIN_FILE_ID_INDEX]) | ||
break | ||
|
||
if i%50 == 49: | ||
print(found) | ||
with open("temp.txt", "w") as f: | ||
f.write(str(len(found))) | ||
f.write("/n") | ||
f.write(", ".join(found)) | ||
|
||
print("found addresses: ", found.__str__(), len(found)) | ||
|
||
def print_tags(): | ||
with open('src/data/source/ChicagoEnergyBenchmarking.csv', newline='') as all_data: | ||
whole_dict = csv.DictReader(all_data) | ||
|
||
for line in whole_dict: | ||
if line["ID"] in found: | ||
print("// "+line["Property Name"]) | ||
print(line["ID"] + ": { owner: BuildingOwners.cityofchicago.key },") | ||
found.remove(line["ID"]) | ||
|
||
find_addresses() | ||
print_tags() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import csv | ||
|
||
cps_schools:[str, str] = {} | ||
|
||
with open('src/data/source/ChicagoEnergyBenchmarking.csv', newline='') as csvfile: | ||
whole_file = csv.DictReader(csvfile) | ||
for row in whole_file: | ||
if "CPS" in row["Property Name"]: | ||
cps_schools[row["ID"]] = row["Property Name"] | ||
|
||
for id, school in cps_schools.items(): | ||
cleaned_school_name = school.removesuffix("-CPS").strip() | ||
print("// "+cleaned_school_name) | ||
print('"' + id + '"' + ": { owner: BuildingOwners.cps.key },") |