-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
22 lines (17 loc) · 822 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import time
import pandas as pd
from src.ImageGrid import ImageGrid
if __name__ == '__main__':
cities = pd.read_csv('worldcities.csv')
countries = ['Austria', 'Belgium', 'Czechia', 'Denmark', 'France', 'Germany', 'Hungary', 'Luxembourg',
'Netherlands', 'Poland', 'Romania', 'Slovakia', 'Slovenia']
selection = cities.loc[(cities.country.isin(countries)) & (cities.population >= 100000)]
for row in selection.itertuples():
try:
grid = ImageGrid(row.country, row.city_ascii, row.lat, row.lng)
print(f'Saving city {row.city}')
time.sleep(0.1)
grid.save_all()
except ValueError:
# todo move exception handling where it belongs (to ImageGrid)
print(f'ValueError raised for {row.country}, {row.city}')