Commit 0ef3506c authored by Eryk Leniart's avatar Eryk Leniart
parents 8baa05af ae84eb66
from uuid import UUID
from functools import partial
import models
import csv
from tornado.gen import coroutine
from tornado.ioloop import IOLoop
@coroutine
def main():
with open("syfy.csv", 'r') as csvfile:
reader = csv.reader(csvfile)
next(reader)
for row in reader:
uuid = UUID(int=int(row[0]))
station = models.Type(shortname=row[1], longname=row[2], description=row[2], norm=row[5], unit=row[4],
type_id=uuid)
result = yield station.save()
IOLoop.current().run_sync(main)
id,name,city,lat,long
1,Al. Krasińskiego,Kraków,50.057678,19.926189
2,ul. Bulwarowa,Kraków,50.069308,20.053492
3,ul. Bujaka,Kraków,50.010575,19.949189
13,ul. Dietla,Kraków,50.057447,19.946008
14,os. Piastów,Kraków,50.099361,20.018317
15,ul. Złoty Róg,Kraków,50.081197,19.895358
from uuid import UUID
from functools import partial
import models
import csv
from tornado.gen import coroutine
from tornado.ioloop import IOLoop
@coroutine
def main():
with open("stations.csv", 'r') as csvfile:
reader = csv.reader(csvfile)
next(reader)
for row in reader:
print(row)
uuid = UUID(int=int(row[0]))
station = models.Station(station_id=uuid, city=row[2], name=row[1], longitude=float(row[3])*10e6,
latitude=float(row[4])*10e6, api_station_id=row[0])
result = yield station.save()
IOLoop.current().run_sync(main)
id,name,description,html,unit,norm
1,pm10,pył PM10,PM 10,µg/m³,50
2,pm2.5,pył PM2.5,PM 2.5,µg/m³,25
3,no2,dwutlenek azotu,NO<sub>2</sub>,µg/m³,40
6,so2,dwutlenek siarki,SO<sub>2</sub>,µg/m³,125
7,co,tlenek węgla,CO,µg/m³,10000
8,o3,ozon,O<sub>3</sub>,µg/m³,120
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment