'''
uHoo analysis work
Tasks:
1. Get data from database of air quality data.
2. Get data from uhoo devices using auth
3. Get data from one device from the earliest timestamp.
4. Create calendar heatmap for the one device for No2.
5. Create heatmap for outdoor air quality for lat long of the
6. Geocode devices and plot on map
7.
'''
'\nuHoo analysis work\n\nTasks: \n1. Get data from database of air quality data. \n2. Get data from uhoo devices using auth\n3. Get data from one device from the earliest timestamp. \n4. Create calendar heatmap for the one device for No2. \n5. Create heatmap for outdoor air quality for lat long of the \n6. Geocode devices and plot on map \n7. \n'
# Import libraries
import requests
import hashlib
import pandas as pd
import geopandas as gpd
import psycopg2, psycopg2.extras
import ipyleaflet
from ipyleaflet import Map, Marker, Popup
import shapely
from shapely.geometry import Point, Polygon
import json
import matplotlib.pyplot as plt
import seaborn as sns
from highcharts import Highchart
import datetime
import os
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('bmh')
plt.rcParams['figure.figsize'] = (10.0, 10.0)
# GIS database connection
global gisdb
def postgres_test():
global gisdb
try:
cur = gisdb.cursor()
cur.execute('SELECT 1')
cur.close()
return gisdb
except:
gisdb = psycopg2.connect(host='',database="gis", user='p', p='postgres', cursor_factory=psycopg2.extras.RealDictCursor)
return gisdb
def showalltables():
cur = postgres_test().cursor()
cur.execute('SELECT * FROM pg_catalog.pg_tables')
data = cur.fetchall()
#data = showalltables()
tables = []
for i in data:
if i['schemaname'] == 'public':
tables.append(i['tablename'])
#print(i['tablename'])
cur.close()
return tables
def querydb(q):
cur = postgres_test().cursor()
cur.execute(q)
data = cur.fetchall()
cur.close()
return data
# Use rollback_db if you get any transaction related error
def rollback_db():
curs = postgres_test().cursor()
curs.execute("ROLLBACK")
cur.close()
gisdb.commit()
showalltables()
['gis_osm_pois_free_1', 'spatial_ref_sys', 'gis_osm_pofw_free_1', 'gis_osm_pois_a_free_1', 'indgebfunderingsproblematiek', 'kadastralekaartv3_annotatie', 'kadastralekaartv3_bebouwing', 'archeologische_monumenten', 'bag_ligplaats', 'bag_openbareruimte', 'bag_pand', 'bag_verblijfsobject', 'bag_verblijfsobject_poly', 'bag_woonplaats', 'beschermdenatuurmonumenten', 'bestuurlijkegrenzen:gemeenten', 'bestuurlijkegrenzen:landsgrens', 'bestuurlijkegrenzen_provincies', 'bodem50', 'brobhr', 'brocpt', 'brogmw', 'buurt_2017', 'buurt_data_2018', 'cbs_70262ned_bodemgebruik_per_gemeente', 'cbs_84286ned_kerncijfers_wijken_en_buurten_2018', 'cbs_84324ned_bodemgebruik_wijk_en_buurtcijfers_2015', 'cbs_tableinfo', 'cp_cadastralparcel', 'energieklasseutiliteit', 'energieklassewoningen', 'gem_2017', 'gis_osm_pofw_a_free_1', 'kadastralekaartv3_bebouwing_poly', 'kadastralekaartv3_kadastralegrens', 'kadastralekaartv3_kadastralegrens_poly', 'kadastralekaartv3_perceel', 'memorix_rce_api_image_table', 'n2000_20180827', 'nationaleparken', 'natura2000', 'pbwetbodembescherming', 'plu_besluitgebied_a_gml_gz', 'plu_besluitgebied_p_gml_gz', 'plu_besluitgebied_x_gml_gz', 'plu_besluitsubvlak_a_gml_gz', 'plu_besluitsubvlak_p_gml_gz', 'plu_besluitsubvlak_x_gml_gz', 'plu_besluitvlak_a_gml_gz', 'plu_besluitvlak_p_gml_gz', 'plu_besluitvlak_x_gml_gz', 'plu_bestemmingsplangebied_gml_gz', 'plu_bouwaanduiding_gml_gz', 'plu_bouwvlak_gml_gz', 'plu_dubbelbestemming_gml_gz', 'plu_enkelbestemming_gml_gz', 'plu_figuur_gml_gz', 'plu_functieaanduiding_gml_gz', 'plu_gebiedsaanduiding_gml_gz', 'plu_lettertekenaanduiding_gml_gz', 'plu_maatvoering_gml_gz', 'plu_plangebied_gml_gz', 'plu_plangebied_pcp_gml_gz', 'plu_provinciaalcomplex_gml_gz', 'plu_provinciaalgebied_gml_gz', 'plu_provinciaalplangebied_gml_gz', 'plu_structuurvisiecomplex_g_gml_gz', 'plu_structuurvisiecomplex_p_gml_gz', 'plu_structuurvisiecomplex_r_gml_gz', 'plu_structuurvisiegebied_g_gml_gz', 'plu_structuurvisiegebied_p_gml_gz', 'plu_structuurvisiegebied_r_gml_gz', 'plu_structuurvisieplangebied_g_gml_gz', 'plu_structuurvisieplangebied_p_gml_gz', 'plu_structuurvisieplangebied_r_gml_gz', 'plu_structuurvisieverklaring_p_gml_gz', 'postcode_2017', 'ps_protectedsites_points', 'ps_protectedsites_polygon', 'soortendiversiteit', 'rijksmonumenten', 'soortendiversiteit_rl', 'spoorwegen_station', 'raster_draagkracht_totale_zetting', 'stads_en_dorpsgezichten', 'top10nl_inricht_el_station', 'top10nl_renovatio_functioneelgebied_line', 'top10nl_renovatio_functioneelgebied_point', 'top10nl_renovatio_functioneelgebied_poly', 'top10nl_renovatio_gebouw_line', 'top10nl_renovatio_gebouw_point', 'top10nl_renovatio_gebouw_poly', 'top10nl_renovatio_geografischgebied_line', 'top10nl_renovatio_geografischgebied_point', 'top10nl_renovatio_geografischgebied_poly', 'top10nl_renovatio_hoogte_line', 'top10nl_renovatio_hoogte_point', 'top10nl_renovatio_hoogte_poly', 'top10nl_renovatio_inrichtingselement_line', 'top10nl_renovatio_inrichtingselement_point', 'top10nl_renovatio_inrichtingselement_poly', 'top10nl_renovatio_plaats_line', 'top10nl_renovatio_plaats_point', 'top10nl_renovatio_plaats_poly', 'top10nl_renovatio_registratiefgebied_line', 'top10nl_renovatio_registratiefgebied_point', 'top10nl_renovatio_registratiefgebied_poly', 'top10nl_renovatio_spoorbaandeel_line', 'top10nl_renovatio_spoorbaandeel_point', 'top10nl_renovatio_spoorbaandeel_poly', 'top10nl_renovatio_waterdeel_line', 'top10nl_renovatio_waterdeel_point', 'top10nl_renovatio_waterdeel_poly', 'top10nl_renovatio_wegdeel_line', 'top10nl_renovatio_wegdeel_point', 'top10nl_renovatio_wegdeel_poly', 'transport_bushaltes', 'unesco_werelderfgoed', 'wetlands2014', 'wijk_2017', 'raster_bodemdalingskaart_10de_percentiel_mm_per_jaar', 'raster_bodemdalingskaart_mediaan_min_10de_percentiel_mm_per_jaa', 'raster_bodemdalingskaart_mediaan_mm_per_jaar', 'gem_vraagprijs_per_m2', 'realeastate_woningmarkt_gemeenten', 'bestuurlijkegrenzen_gemeentegrenzen', 'adres', 'bestuurlijkegrenzen_provinciegrenzen', 'bestuurlijkegrenzen_landsgrens', 'rijstroken', 'rijstroken_vertices_pgr', 'rijstroken_line', 'postcode_pc6_2018', 'woonplaats_actueel', 'zwembaden_point', 'luchtmeetnet_openapi_stations']
# Generate Authentication credentials
def getauth():
login = ""
password = ""
salt1 = ""
salt2 = ""
concat = (salt1 + password + salt2).encode("utf-8")
hashed_password = hashlib.sha256(concat).hexdigest()
params = {
"username": login,
"password": hashed_password
}
return params
# Get Device List
params = getauth()
r = requests.post("https://api.uhooinc.com/v1/getdevicelist", data = params)
df = pd.DataFrame(r.json())
df
deviceName | macAddress | serialNumber | |
---|---|---|---|
0 | 2951 BE / Project Ablasserdam | 606405acf1e5 | 49ff76067580485655301867 |
1 | 2951 PM / Project Alblasserdam | 606405acd6e2 | 48ff72067580505252431467 |
2 | 2953 AM / Project Alblasserdam | a81b6a9ad4ff | 48ff6c067580505240571367 |
3 | 2951 BE / Project Ablasserdam | a81b6a9ae855 | 48ff72067580505235331667 |
4 | 2951 HB / Project Alblasserdam | 606405acf51f | 49ff6d067580485648301367 |
5 | 2953 WB / Project Alblasserdam | 606405acf6d4 | 30ff70064d48303544172543 |
6 | 2953 BB / Project Alblasserdam | 606405acf1d7 | 49ff6c067580485635281367 |
7 | Gemeentehuis Alblasserdam | a81b6a9addf1 | 48ff68067580505216271467 |
8 | 2952 AH / Project Alblasserdam | 606405ace2b3 | 49ff6c067580485629261367 |
9 | 2953 HC / Project Alblasserdam | 606405acf440 | 49ff68067580485646301367 |
10 | 2951 HH / Project Alblasserdam | 606405ace741 | 49ff71067580485651331367 |
11 | 2951 JG / Project Alblasserdam | 606405acf78e | 49ff72067580485655441767 |
12 | 2953 XT / Project Alblasserdam | 606405acae24 | 49ff72067580485623351367 |
13 | 2953 XD / Project Alblasserdam | 606405acf1d1 | 48ff76067580505240431367 |
14 | 2951 VH / Project Alblasserdam | a81b6a9ae594 | 49ff76067580485649291867 |
15 | 2953 BE / Project Alblasserdam | 606405acf459 | 49ff74067580485629291367 |
16 | 2952 AK / Project Alblasserdam | 606405acf1a7 | 49ff72067580485612381667 |
17 | 2951 AG / Project Alblasserdam | 606405ace2c2 | 49ff72067580485617291367 |
18 | 2953 WB / Project Alblasserdam | 606405acb241 | 48ff6e067580505240551367 |
19 | 2951 JG / Project Alblasserdam | 606405acb237 | 48ff6e067580505237541367 |
20 | 2952 AK / Project Alblasserdam | a81b6a9ad4ed | 48ff76067580505238401467 |
21 | 2951 XV / Project Alblasserdam | 606405acf32b | 48ff6e067580505232341967 |
22 | 2954 BP / Project Alblasserdam | 606405acf502 | 49ff72067580485658331367 |
23 | 2951 XW / Project Alblasserdam | a81b6a9ae0a9 | 48ff74067580505240471367 |
24 | 2951 JG 92 / Project Alblasserdam | 606405acf40a | 49ff79067580485628351367 |
25 | 2951 PK / Project Alblasserdam | 606405acb262 | 49ff72067580485618491667 |
26 | 2953 HC / Project Alblasserdam | a81b6a9ae0df | 48ff70067580505251401867 |
27 | 2951 VB / Project Alblasserdam | 606405acf308 | 49ff74067580485629431667 |
28 | 2951 VN / Project Alblasserdam | 606405acf34a | 49ff73067580485647491667 |
29 | 2951 VN / Project Alblasserdam | a81b6a9ad967 | 48ff72067580505244081967 |
... | ... | ... | ... |
48 | 2953 HB / Project Alblasserdam | a81b6a9ae0f4 | 49ff6e067580485632491667 |
49 | 2951 JD / Project Alblasserdam | 606405acafe0 | 49ff70067580485654281867 |
50 | 2953 HA /Project Alblasserdam | 606405acb43e | 49ff73067580485638461767 |
51 | 2953 XA / Project Alblassertdam | 606405acb0c3 | 49ff72067580485624431667 |
52 | 2951 PA / Project Alblasserdam | 606405acf337 | 48ff75067580505248151667 |
53 | 2951 JG / Project Alblasserdam | a81b6a9aeb50 | 49ff70067580485649461767 |
54 | 2951 JG 20 / Project Alblasserdam | a81b6a9ae805 | 48ff74067580505222602067 |
55 | 2951 DB / Project Alblasserdam | 606405acad38 | 49ff73067580485625391967 |
56 | 2951 GG / Project Alblasserdam | 606405ace561 | 48ff74067580505237491367 |
57 | 2951 ER / Project Alblasserdam | 606405acad52 | 49ff6e067580485633281467 |
58 | 2954 BL / Project Alblasserdam | a81b6a9ae0be | 48ff6c067580505251251867 |
59 | 2951HD / Project Alblasserdam | 606405acf300 | 49ff6c067580485647341767 |
60 | 2954 BE / Project Alblasserdam | 606405acb200 | 49ff70067580485650282067 |
61 | 2953 CN / Project Alblasserdam | 606405acb265 | 49ff6a067580485629221967 |
62 | 2954 PC / Project Alblasserdam | 606405acf1a2 | 49ff72067580485628441767 |
63 | 2951 PN / Project Alblasserdam | a81b6a9ae5ea | 48ff74067580505259392067 |
64 | 2954 BE / Project Alblasserdam | a81b6a9ad930 | 48ff76067580505246451867 |
65 | 2969 BT / Project Alblasserdam | a81b6a9ae2ab | 48ff75067580505219521767 |
66 | 2953HC / Project Alblasserdam | 606405acb27c | 49ff76067580485632441667 |
67 | 2952AB / ProjectAlblasserdam | a81b6a9aeb48 | 48ff71067580505236321467 |
68 | 2954 PB / Project Alblasserdam | 606405acf1bd | 49ff76067580485637441767 |
69 | 2953 GC / Project Alblasserdam | a81b6a9ae2f5 | 48ff6e067580505229081467 |
70 | 2951 HC Ablasserdam | 606405acf537 | 49ff70067580485657291867 |
71 | 2951 JG Ablasserdam | 606405ace2a8 | 49ff6a067580485633331367 |
72 | 2951 EC / Project Alblasserdam | a81b6a9ae585 | 48ff6f067580505217131767 |
73 | 2953 XB Alblasserdam | a81b6a9aee3a | 48ff70067580505228482067 |
74 | 2951 WB / Project Alblasserdam | 606405acb261 | 48ff73067580505240411367 |
75 | 2954BJ Alblasserdam | 606405acf434 | 49ff74067580485632291867 |
76 | 2951 VH / Project Alblasserdam | 606405a4462c | 53ff73067788545138430567 |
77 | 2954AH / ProjectAlblasserdam | a81b6a9aeb34 | 48ff76067580505219111367 |
78 rows × 3 columns
#Get Latest Data for a device
def get_latest_data(serialno):
params = getauth()
params['serialNumber'] = serialno
r = requests.post("https://api.uhooinc.com/v1/getlatestdata", data = params)
return r.json()
# Test it
get_latest_data(df.head(1)['serialNumber'].values[0])
{'Temperature': '13.4', 'Relative Humidity': '73.4', 'PM2.5': '6.7', 'TVOC': '74.0', 'CO2': '504.0', 'CO': '0.0', 'Air Pressure': '1005.5', 'Ozone': '6.9', 'NO2': '0.1', 'Timestamp': 1552649062, 'DateTime': '2019-03-15 12:24'}
# Get Latest Data for multiple devices
df1 = df.head(100)
df2 = df1.apply(lambda x : get_latest_data(x['serialNumber']), result_type = 'expand', axis=1)
df3 = df1.join(df2)
#df3['datetime'] = pd.to_datetime(df3['Timestamp']*10**9)
df3['datetime'] = pd.to_datetime(df3['DateTime'], errors='ignore')
df3
deviceName | macAddress | serialNumber | Air Pressure | CO | CO2 | DateTime | NO2 | Ozone | PM2.5 | Relative Humidity | TVOC | Temperature | Timestamp | datetime | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 2951 BE / Project Ablasserdam | 606405acf1e5 | 49ff76067580485655301867 | 1005.5 | 0.0 | 504.0 | 2019-03-15 12:24 | 0.1 | 6.9 | 6.7 | 73.4 | 74.0 | 13.4 | 1552649062 | 2019-03-15 12:24:00 |
1 | 2951 PM / Project Alblasserdam | 606405acd6e2 | 48ff72067580505252431467 | 1003.5 | 0.0 | 456.0 | 2019-03-15 12:24 | 0.4 | 9.6 | 6.5 | 52.9 | 58.0 | 18.7 | 1552649086 | 2019-03-15 12:24:00 |
2 | 2953 AM / Project Alblasserdam | a81b6a9ad4ff | 48ff6c067580505240571367 | 1003.2 | 0.0 | 773.0 | 2019-03-15 12:24 | 1.0 | 7.8 | 6.7 | 51.8 | 130.0 | 19.9 | 1552649062 | 2019-03-15 12:24:00 |
3 | 2951 BE / Project Ablasserdam | a81b6a9ae855 | 48ff72067580505235331667 | 1004.0 | 0.0 | 442.0 | 2019-03-15 12:24 | 0.7 | 9.0 | 57.4 | 50.7 | 72.0 | 17.8 | 1552649088 | 2019-03-15 12:24:00 |
4 | 2951 HB / Project Alblasserdam | 606405acf51f | 49ff6d067580485648301367 | 1024.4 | 0.0 | 1510.0 | 2018-12-04 15:34 | 19.4 | 8.7 | 10.8 | 58.3 | 10.0 | 20.3 | 1543934068 | 2018-12-04 15:34:00 |
5 | 2953 WB / Project Alblasserdam | 606405acf6d4 | 30ff70064d48303544172543 | 1003.7 | 0.0 | 859.0 | 2019-03-15 14:24 | 0.5 | 4.9 | 30.9 | 52.4 | 74.0 | 19.8 | 1552649069 | 2019-03-15 14:24:00 |
6 | 2953 BB / Project Alblasserdam | 606405acf1d7 | 49ff6c067580485635281367 | 1004.0 | 0.0 | 598.0 | 2019-03-15 12:25 | 0.5 | 4.7 | 4.3 | 52.0 | 28.0 | 20.1 | 1552649124 | 2019-03-15 12:25:00 |
7 | Gemeentehuis Alblasserdam | a81b6a9addf1 | 48ff68067580505216271467 | 1004.3 | 0.0 | 400.0 | 2018-11-29 15:52 | 19.4 | 11.6 | 4.9 | 40.4 | 2.0 | 22.2 | 1543503135 | 2018-11-29 15:52:00 |
8 | 2952 AH / Project Alblasserdam | 606405ace2b3 | 49ff6c067580485629261367 | 1003.9 | 0.0 | 813.0 | 2019-03-15 12:25 | 0.5 | 10.0 | 6.7 | 54.0 | 1.0 | 20.3 | 1552649123 | 2019-03-15 12:25:00 |
9 | 2953 HC / Project Alblasserdam | 606405acf440 | 49ff68067580485646301367 | 1003.5 | 0.0 | 805.0 | 2019-03-15 12:25 | 0.9 | 4.6 | 33.3 | 47.2 | 32.0 | 20.4 | 1552649112 | 2019-03-15 12:25:00 |
10 | 2951 HH / Project Alblasserdam | 606405ace741 | 49ff71067580485651331367 | 1003.6 | 0.0 | 681.0 | 2019-03-15 12:24 | 0.1 | 4.8 | 6.3 | 47.2 | 15.0 | 20.5 | 1552649073 | 2019-03-15 12:24:00 |
11 | 2951 JG / Project Alblasserdam | 606405acf78e | 49ff72067580485655441767 | 1001.3 | 0.0 | 546.0 | 2019-03-15 12:25 | 11.3 | 7.8 | 14.8 | 39.4 | 17.0 | 22.0 | 1552649116 | 2019-03-15 12:25:00 |
12 | 2953 XT / Project Alblasserdam | 606405acae24 | 49ff72067580485623351367 | 1003.0 | 0.0 | 548.0 | 2019-03-15 12:24 | 7.3 | 9.8 | 60.1 | 55.1 | 11.0 | 18.6 | 1552649097 | 2019-03-15 12:24:00 |
13 | 2953 XD / Project Alblasserdam | 606405acf1d1 | 48ff76067580505240431367 | 1004.5 | 0.0 | 678.0 | 2019-03-15 12:25 | 0.5 | 5.0 | 9.7 | 46.8 | 12.0 | 20.7 | 1552649100 | 2019-03-15 12:25:00 |
14 | 2951 VH / Project Alblasserdam | a81b6a9ae594 | 49ff76067580485649291867 | 1002.4 | 0.0 | 447.0 | 2019-03-15 12:24 | 3.3 | 7.2 | 15.0 | 39.4 | 11.0 | 21.4 | 1552649075 | 2019-03-15 12:24:00 |
15 | 2953 BE / Project Alblasserdam | 606405acf459 | 49ff74067580485629291367 | 1003.3 | 0.0 | 594.0 | 2019-03-15 12:25 | 6.4 | 10.8 | 4.2 | 54.0 | 29.0 | 20.5 | 1552649121 | 2019-03-15 12:25:00 |
16 | 2952 AK / Project Alblasserdam | 606405acf1a7 | 49ff72067580485612381667 | 1003.2 | 0.0 | 833.0 | 2019-03-15 12:25 | 0.9 | 7.2 | 4.0 | 48.9 | 48.0 | 20.6 | 1552649123 | 2019-03-15 12:25:00 |
17 | 2951 AG / Project Alblasserdam | 606405ace2c2 | 49ff72067580485617291367 | 1003.9 | 0.0 | 509.0 | 2019-03-15 12:25 | 7.7 | 7.7 | 25.1 | 51.7 | 31.0 | 18.8 | 1552649110 | 2019-03-15 12:25:00 |
18 | 2953 WB / Project Alblasserdam | 606405acb241 | 48ff6e067580505240551367 | 1003.6 | 0.0 | 545.0 | 2019-03-15 12:25 | 1.4 | 7.6 | 11.8 | 52.3 | 28.0 | 19.4 | 1552649134 | 2019-03-15 12:25:00 |
19 | 2951 JG / Project Alblasserdam | 606405acb237 | 48ff6e067580505237541367 | 1002.4 | 0.0 | 550.0 | 2019-03-15 12:25 | 0.3 | 6.8 | 25.8 | 48.2 | 123.0 | 19.5 | 1552649111 | 2019-03-15 12:25:00 |
20 | 2952 AK / Project Alblasserdam | a81b6a9ad4ed | 48ff76067580505238401467 | 1004.3 | 0.0 | 563.0 | 2019-03-15 12:24 | 11.6 | 8.1 | 7.3 | 55.0 | 19.0 | 18.7 | 1552649095 | 2019-03-15 12:24:00 |
21 | 2951 XV / Project Alblasserdam | 606405acf32b | 48ff6e067580505232341967 | 996.5 | 0.0 | 845.0 | 2019-03-14 15:03 | 50.5 | 12.9 | 14.4 | 50.9 | 119.0 | 18.3 | 1552572190 | 2019-03-14 15:03:00 |
22 | 2954 BP / Project Alblasserdam | 606405acf502 | 49ff72067580485658331367 | 1004.4 | 0.0 | 540.0 | 2019-03-15 12:25 | 44.5 | 10.3 | 4.4 | 50.7 | 51.0 | 17.6 | 1552649112 | 2019-03-15 12:25:00 |
23 | 2951 XW / Project Alblasserdam | a81b6a9ae0a9 | 48ff74067580505240471367 | 1003.1 | 0.0 | 400.0 | 2019-03-15 12:25 | 0.5 | 6.9 | 34.8 | 48.8 | 73.0 | 20.9 | 1552649104 | 2019-03-15 12:25:00 |
24 | 2951 JG 92 / Project Alblasserdam | 606405acf40a | 49ff79067580485628351367 | 1001.0 | 0.0 | 781.0 | 2019-03-15 12:25 | 0.7 | 7.0 | 35.7 | 46.2 | 18.0 | 20.6 | 1552649110 | 2019-03-15 12:25:00 |
25 | 2951 PK / Project Alblasserdam | 606405acb262 | 49ff72067580485618491667 | 1003.4 | 0.0 | 579.0 | 2019-03-15 12:25 | 11.8 | 10.4 | 31.6 | 56.9 | 3.0 | 18.2 | 1552649126 | 2019-03-15 12:25:00 |
26 | 2953 HC / Project Alblasserdam | a81b6a9ae0df | 48ff70067580505251401867 | 1003.7 | 0.0 | 451.0 | 2019-03-15 12:25 | 0.2 | 7.9 | 22.8 | 44.4 | 24.0 | 20.0 | 1552649119 | 2019-03-15 12:25:00 |
27 | 2951 VB / Project Alblasserdam | 606405acf308 | 49ff74067580485629431667 | 1004.7 | 0.0 | 889.0 | 2019-03-15 12:25 | 0.1 | 4.3 | 10.9 | 51.6 | 174.0 | 21.1 | 1552649142 | 2019-03-15 12:25:00 |
28 | 2951 VN / Project Alblasserdam | 606405acf34a | 49ff73067580485647491667 | 1003.8 | 0.0 | 901.0 | 2019-03-15 12:25 | 0.6 | 4.9 | 3.7 | 54.2 | 101.0 | 19.4 | 1552649126 | 2019-03-15 12:25:00 |
29 | 2951 VN / Project Alblasserdam | a81b6a9ad967 | 48ff72067580505244081967 | 1021.7 | 0.0 | 448.0 | 2019-02-27 22:34 | 19.4 | 15.2 | 18.3 | 61.6 | 0.0 | 16.3 | 1551303241 | 2019-02-27 22:34:00 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
48 | 2953 HB / Project Alblasserdam | a81b6a9ae0f4 | 49ff6e067580485632491667 | 1004.2 | 0.0 | 550.0 | 2019-03-15 12:25 | 1.0 | 4.4 | 11.5 | 48.1 | 115.0 | 19.6 | 1552649139 | 2019-03-15 12:25:00 |
49 | 2951 JD / Project Alblasserdam | 606405acafe0 | 49ff70067580485654281867 | 1003.8 | 0.0 | 430.0 | 2019-03-15 12:25 | 10.3 | 8.3 | 7.9 | 47.6 | 12.0 | 19.3 | 1552649120 | 2019-03-15 12:25:00 |
50 | 2953 HA /Project Alblasserdam | 606405acb43e | 49ff73067580485638461767 | 1024.8 | 0.0 | 517.0 | 2019-03-11 18:17 | 6.5 | 14.5 | 14.1 | 35.7 | 366.0 | 19.9 | 1552324656 | 2019-03-11 18:17:00 |
51 | 2953 XA / Project Alblassertdam | 606405acb0c3 | 49ff72067580485624431667 | 1004.1 | 0.0 | 485.0 | 2019-03-15 12:25 | 8.9 | 8.2 | 45.7 | 51.6 | 47.0 | 19.7 | 1552649159 | 2019-03-15 12:25:00 |
52 | 2951 PA / Project Alblasserdam | 606405acf337 | 48ff75067580505248151667 | 1003.9 | 0.0 | 543.0 | 2019-03-15 12:25 | 10.7 | 13.5 | 6.8 | 56.8 | 22.0 | 16.9 | 1552649132 | 2019-03-15 12:25:00 |
53 | 2951 JG / Project Alblasserdam | a81b6a9aeb50 | 49ff70067580485649461767 | 1001.2 | 0.0 | 597.0 | 2019-03-15 12:26 | 4.7 | 7.8 | 4.7 | 41.4 | 49.0 | 21.6 | 1552649163 | 2019-03-15 12:26:00 |
54 | 2951 JG 20 / Project Alblasserdam | a81b6a9ae805 | 48ff74067580505222602067 | 1002.2 | 0.0 | 852.0 | 2019-02-02 15:20 | 7.8 | 8.9 | 6.0 | 39.0 | 81.0 | 19.8 | 1549117208 | 2019-02-02 15:20:00 |
55 | 2951 DB / Project Alblasserdam | 606405acad38 | 49ff73067580485625391967 | 1004.3 | 0.0 | 886.0 | 2019-03-15 12:25 | 8.0 | 9.3 | 21.5 | 48.0 | 85.0 | 21.3 | 1552649147 | 2019-03-15 12:25:00 |
56 | 2951 GG / Project Alblasserdam | 606405ace561 | 48ff74067580505237491367 | 997.5 | 0.0 | 531.0 | 2019-01-31 10:50 | 0.5 | 7.8 | 93.8 | 32.7 | 80.0 | 20.2 | 1548928241 | 2019-01-31 10:50:00 |
57 | 2951 ER / Project Alblasserdam | 606405acad52 | 49ff6e067580485633281467 | 1003.0 | 0.0 | 415.0 | 2019-03-15 12:10 | 18.0 | 8.1 | 29.0 | 39.2 | 0.0 | 22.1 | 1552648224 | 2019-03-15 12:10:00 |
58 | 2954 BL / Project Alblasserdam | a81b6a9ae0be | 48ff6c067580505251251867 | 1003.9 | 0.0 | 441.0 | 2019-03-15 12:25 | 0.3 | 9.3 | 8.2 | 47.8 | 65.0 | 19.3 | 1552649151 | 2019-03-15 12:25:00 |
59 | 2951HD / Project Alblasserdam | 606405acf300 | 49ff6c067580485647341767 | 1001.8 | 0.0 | 788.0 | 2019-03-13 13:16 | 0.1 | 7.3 | 31.1 | 52.3 | 1127.0 | 21.4 | 1552479403 | 2019-03-13 13:16:00 |
60 | 2954 BE / Project Alblasserdam | 606405acb200 | 49ff70067580485650282067 | 1004.2 | 0.0 | 634.0 | 2019-03-15 12:26 | 0.6 | 5.0 | 16.8 | 48.3 | 1156.0 | 21.2 | 1552649174 | 2019-03-15 12:26:00 |
61 | 2953 CN / Project Alblasserdam | 606405acb265 | 49ff6a067580485629221967 | 1003.3 | 0.0 | 1508.0 | 2019-03-15 12:26 | 0.3 | 8.2 | 33.2 | 56.4 | 35.0 | 19.5 | 1552649186 | 2019-03-15 12:26:00 |
62 | 2954 PC / Project Alblasserdam | 606405acf1a2 | 49ff72067580485628441767 | 1004.2 | 0.0 | 902.0 | 2019-03-15 12:26 | 0.2 | 7.2 | 33.5 | 47.0 | 43.0 | 20.0 | 1552649166 | 2019-03-15 12:26:00 |
63 | 2951 PN / Project Alblasserdam | a81b6a9ae5ea | 48ff74067580505259392067 | 1003.2 | 0.0 | 442.0 | 2019-03-15 12:26 | 10.8 | 9.9 | 19.1 | 59.4 | 3.0 | 18.0 | 1552649187 | 2019-03-15 12:26:00 |
64 | 2954 BE / Project Alblasserdam | a81b6a9ad930 | 48ff76067580505246451867 | 1003.7 | 0.0 | 536.0 | 2019-03-15 12:23 | 15.6 | 8.1 | 3.8 | 52.7 | 1.0 | 17.8 | 1552649010 | 2019-03-15 12:23:00 |
65 | 2969 BT / Project Alblasserdam | a81b6a9ae2ab | 48ff75067580505219521767 | 1019.5 | 0.0 | 1349.0 | 2018-12-18 12:17 | 0.7 | 7.5 | 4.2 | 56.7 | 41.0 | 17.6 | 1545131875 | 2018-12-18 12:17:00 |
66 | 2953HC / Project Alblasserdam | 606405acb27c | 49ff76067580485632441667 | 1003.8 | 0.0 | 478.0 | 2019-03-15 12:21 | 19.4 | 8.3 | 9.1 | 41.7 | 0.0 | 19.3 | 1552648860 | 2019-03-15 12:21:00 |
67 | 2952AB / ProjectAlblasserdam | a81b6a9aeb48 | 48ff71067580505236321467 | 1003.3 | 0.0 | 412.0 | 2019-03-15 12:25 | 0.4 | 8.3 | 34.4 | 53.5 | 21.0 | 16.9 | 1552649135 | 2019-03-15 12:25:00 |
68 | 2954 PB / Project Alblasserdam | 606405acf1bd | 49ff76067580485637441767 | 1003.9 | 0.0 | 483.0 | 2019-03-15 12:25 | 3.4 | 10.3 | 3.7 | 52.8 | 8.0 | 19.2 | 1552649139 | 2019-03-15 12:25:00 |
69 | 2953 GC / Project Alblasserdam | a81b6a9ae2f5 | 48ff6e067580505229081467 | 1003.7 | 0.0 | 764.0 | 2019-03-15 12:25 | 0.4 | 7.7 | 25.1 | 48.5 | 57.0 | 20.3 | 1552649159 | 2019-03-15 12:25:00 |
70 | 2951 HC Ablasserdam | 606405acf537 | 49ff70067580485657291867 | 1004.1 | 0.0 | 521.0 | 2019-03-15 12:25 | 4.3 | 7.6 | 6.4 | 48.3 | 76.0 | 19.8 | 1552649146 | 2019-03-15 12:25:00 |
71 | 2951 JG Ablasserdam | 606405ace2a8 | 49ff6a067580485633331367 | 1002.1 | 0.0 | 424.0 | 2019-03-15 12:26 | 9.7 | 7.8 | 16.9 | 44.2 | 11.0 | 21.0 | 1552649175 | 2019-03-15 12:26:00 |
72 | 2951 EC / Project Alblasserdam | a81b6a9ae585 | 48ff6f067580505217131767 | 1004.2 | 0.0 | 522.0 | 2019-03-15 12:25 | 0.5 | 5.2 | 3.3 | 52.7 | 64.0 | 20.4 | 1552649142 | 2019-03-15 12:25:00 |
73 | 2953 XB Alblasserdam | a81b6a9aee3a | 48ff70067580505228482067 | 1004.5 | 0.0 | 617.0 | 2019-03-15 12:26 | 0.1 | 4.6 | 12.1 | 50.9 | 107.0 | 19.0 | 1552649191 | 2019-03-15 12:26:00 |
74 | 2951 WB / Project Alblasserdam | 606405acb261 | 48ff73067580505240411367 | 1003.8 | 0.0 | 912.0 | 2019-03-15 12:26 | 0.6 | 8.9 | 28.8 | 47.6 | 57.0 | 21.0 | 1552649174 | 2019-03-15 12:26:00 |
75 | 2954BJ Alblasserdam | 606405acf434 | 49ff74067580485632291867 | 1004.4 | 0.0 | 749.0 | 2019-03-15 12:26 | 9.4 | 7.9 | 10.8 | 57.3 | 24.0 | 19.3 | 1552649161 | 2019-03-15 12:26:00 |
76 | 2951 VH / Project Alblasserdam | 606405a4462c | 53ff73067788545138430567 | 1004.5 | 0.0 | 602.0 | 2019-03-15 13:25 | 1.0 | 8.9 | 13.9 | 50.3 | 19.0 | 20.3 | 1552649152 | 2019-03-15 13:25:00 |
77 | 2954AH / ProjectAlblasserdam | a81b6a9aeb34 | 48ff76067580505219111367 | 1004.6 | 0.0 | 915.0 | 2019-03-15 12:26 | 0.5 | 8.7 | 9.6 | 61.7 | 243.0 | 19.2 | 1552649171 | 2019-03-15 12:26:00 |
78 rows × 15 columns
# Get Hourly Data
params = getauth()
params['serialNumber'] = df.serialNumber.values[0]
params['prevDateTime'] = '2019-01-31 08:00:00'
r = requests.post("https://api.uhooinc.com/v1/gethourlydata", data = params)
_df = pd.DataFrame(r.json())
#_df['datetime'] = pd.to_datetime(_df['Timestamp']*10**9)
_df['datetime'] = pd.to_datetime(_df['DateTime'], errors='ignore')
print('Data for Device with Serial No:', params['serialNumber'])
_df
Data for Device with Serial No: 49ff76067580485655301867
Air Pressure | CO | CO2 | DateTime | NO2 | Ozone | PM2.5 | Relative Humidity | TVOC | Temperature | Timestamp | datetime | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 997.9 | 0.0 | 576.0 | 2019-01-31 08:00 | 43.3 | 10.3 | 9.4 | 45.2 | 3.0 | 19.8 | 1548918009 | 2019-01-31 08:00:00 |
1 | 997.9 | 0.0 | 581.0 | 2019-01-31 08:01 | 43.1 | 10.3 | 7.6 | 45.3 | 3.0 | 19.8 | 1548918068 | 2019-01-31 08:01:00 |
2 | 997.9 | 0.0 | 603.0 | 2019-01-31 08:02 | 42.8 | 10.3 | 18.1 | 45.4 | 3.0 | 19.8 | 1548918128 | 2019-01-31 08:02:00 |
3 | 997.9 | 0.0 | 588.0 | 2019-01-31 08:03 | 43.0 | 10.3 | 12.4 | 45.3 | 0.0 | 19.8 | 1548918187 | 2019-01-31 08:03:00 |
4 | 997.9 | 0.0 | 568.0 | 2019-01-31 08:04 | 42.6 | 10.2 | 18.1 | 45.3 | 0.0 | 19.9 | 1548918247 | 2019-01-31 08:04:00 |
5 | 997.9 | 0.0 | 578.0 | 2019-01-31 08:05 | 42.6 | 10.2 | 7.6 | 45.3 | 0.0 | 19.9 | 1548918306 | 2019-01-31 08:05:00 |
6 | 998.0 | 0.0 | 576.0 | 2019-01-31 08:06 | 42.2 | 10.2 | 6.2 | 45.2 | 1.0 | 19.9 | 1548918366 | 2019-01-31 08:06:00 |
7 | 998.0 | 0.0 | 571.0 | 2019-01-31 08:07 | 42.0 | 10.2 | 9.1 | 45.2 | 1.0 | 19.9 | 1548918426 | 2019-01-31 08:07:00 |
8 | 997.9 | 0.0 | 582.0 | 2019-01-31 08:08 | 42.0 | 10.2 | 7.7 | 45.0 | 1.0 | 19.9 | 1548918485 | 2019-01-31 08:08:00 |
9 | 997.9 | 0.0 | 560.0 | 2019-01-31 08:09 | 42.4 | 10.2 | 14.9 | 44.8 | 2.0 | 19.9 | 1548918545 | 2019-01-31 08:09:00 |
10 | 997.9 | 0.0 | 532.0 | 2019-01-31 08:10 | 42.4 | 10.2 | 5.5 | 45.1 | 2.0 | 19.9 | 1548918604 | 2019-01-31 08:10:00 |
11 | 998.0 | 0.0 | 537.0 | 2019-01-31 08:11 | 42.4 | 10.2 | 6.8 | 44.9 | 2.0 | 20.0 | 1548918664 | 2019-01-31 08:11:00 |
12 | 997.9 | 0.0 | 569.0 | 2019-01-31 08:12 | 42.3 | 10.2 | 5.8 | 44.9 | 2.0 | 20.0 | 1548918723 | 2019-01-31 08:12:00 |
13 | 998.0 | 0.0 | 564.0 | 2019-01-31 08:13 | 40.6 | 10.1 | 20.7 | 45.0 | 2.0 | 20.0 | 1548918783 | 2019-01-31 08:13:00 |
14 | 998.0 | 0.0 | 559.0 | 2019-01-31 08:14 | 42.3 | 10.2 | 26.8 | 45.0 | 3.0 | 20.1 | 1548918842 | 2019-01-31 08:14:00 |
15 | 997.9 | 0.0 | 546.0 | 2019-01-31 08:15 | 41.7 | 10.2 | 17.2 | 44.9 | 2.0 | 20.1 | 1548918902 | 2019-01-31 08:15:00 |
16 | 998.0 | 0.0 | 548.0 | 2019-01-31 08:16 | 41.7 | 10.2 | 9.1 | 45.0 | 3.0 | 20.2 | 1548918961 | 2019-01-31 08:16:00 |
17 | 998.0 | 0.0 | 572.0 | 2019-01-31 08:17 | 41.0 | 10.1 | 6.1 | 44.9 | 3.0 | 20.3 | 1548919021 | 2019-01-31 08:17:00 |
18 | 998.0 | 0.0 | 580.0 | 2019-01-31 08:18 | 41.1 | 10.1 | 6.2 | 45.1 | 3.0 | 20.3 | 1548919080 | 2019-01-31 08:18:00 |
19 | 998.0 | 0.0 | 583.0 | 2019-01-31 08:19 | 40.6 | 10.1 | 24.5 | 45.0 | 0.0 | 20.3 | 1548919140 | 2019-01-31 08:19:00 |
20 | 998.0 | 0.0 | 602.0 | 2019-01-31 08:19 | 40.6 | 10.1 | 5.9 | 45.0 | 3.0 | 20.3 | 1548919199 | 2019-01-31 08:19:00 |
21 | 998.0 | 0.0 | 619.0 | 2019-01-31 08:20 | 40.3 | 10.1 | 6.3 | 45.2 | 3.0 | 20.3 | 1548919259 | 2019-01-31 08:20:00 |
22 | 997.9 | 0.0 | 655.0 | 2019-01-31 08:21 | 40.2 | 10.1 | 8.8 | 45.2 | 4.0 | 20.3 | 1548919318 | 2019-01-31 08:21:00 |
23 | 998.0 | 0.0 | 644.0 | 2019-01-31 08:22 | 39.9 | 10.0 | 20.4 | 45.0 | 0.0 | 20.3 | 1548919378 | 2019-01-31 08:22:00 |
24 | 998.0 | 0.0 | 629.0 | 2019-01-31 08:23 | 40.0 | 10.1 | 29.1 | 45.2 | 0.0 | 20.3 | 1548919437 | 2019-01-31 08:23:00 |
25 | 998.0 | 0.0 | 661.0 | 2019-01-31 08:24 | 39.9 | 10.1 | 16.4 | 45.3 | 0.0 | 20.4 | 1548919497 | 2019-01-31 08:24:00 |
26 | 998.0 | 0.0 | 668.0 | 2019-01-31 08:25 | 37.0 | 9.9 | 8.4 | 45.3 | 0.0 | 20.4 | 1548919556 | 2019-01-31 08:25:00 |
27 | 998.1 | 0.0 | 646.0 | 2019-01-31 08:26 | 39.6 | 10.0 | 8.4 | 45.4 | 0.0 | 20.3 | 1548919616 | 2019-01-31 08:26:00 |
28 | 998.1 | 0.0 | 637.0 | 2019-01-31 08:27 | 40.3 | 10.1 | 10.5 | 45.4 | 0.0 | 20.3 | 1548919675 | 2019-01-31 08:27:00 |
29 | 998.1 | 0.0 | 665.0 | 2019-01-31 08:28 | 40.1 | 10.1 | 11.0 | 45.3 | 0.0 | 20.3 | 1548919735 | 2019-01-31 08:28:00 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
31 | 998.1 | 0.0 | 671.0 | 2019-01-31 08:30 | 39.9 | 10.1 | 6.3 | 45.4 | 1.0 | 20.4 | 1548919854 | 2019-01-31 08:30:00 |
32 | 998.1 | 0.0 | 691.0 | 2019-01-31 08:31 | 33.4 | 9.6 | 8.6 | 45.5 | 1.0 | 20.4 | 1548919913 | 2019-01-31 08:31:00 |
33 | 998.0 | 0.0 | 692.0 | 2019-01-31 08:32 | 39.7 | 10.1 | 21.4 | 45.4 | 1.0 | 20.4 | 1548919973 | 2019-01-31 08:32:00 |
34 | 998.1 | 0.0 | 677.0 | 2019-01-31 08:33 | 39.2 | 10.0 | 19.8 | 45.5 | 1.0 | 20.4 | 1548920032 | 2019-01-31 08:33:00 |
35 | 998.1 | 0.0 | 673.0 | 2019-01-31 08:34 | 39.1 | 10.0 | 21.6 | 45.4 | 1.0 | 20.4 | 1548920092 | 2019-01-31 08:34:00 |
36 | 998.1 | 0.0 | 681.0 | 2019-01-31 08:35 | 38.9 | 10.0 | 19.2 | 45.5 | 1.0 | 20.4 | 1548920151 | 2019-01-31 08:35:00 |
37 | 998.1 | 0.0 | 705.0 | 2019-01-31 08:36 | 39.1 | 10.0 | 6.1 | 45.5 | 2.0 | 20.4 | 1548920211 | 2019-01-31 08:36:00 |
38 | 998.1 | 0.0 | 710.0 | 2019-01-31 08:37 | 38.9 | 10.0 | 8.0 | 45.4 | 2.0 | 20.5 | 1548920270 | 2019-01-31 08:37:00 |
39 | 998.1 | 0.0 | 682.0 | 2019-01-31 08:38 | 36.5 | 9.8 | 11.2 | 45.4 | 2.0 | 20.4 | 1548920330 | 2019-01-31 08:38:00 |
40 | 998.2 | 0.0 | 662.0 | 2019-01-31 08:39 | 38.8 | 10.0 | 7.3 | 45.5 | 2.0 | 20.4 | 1548920389 | 2019-01-31 08:39:00 |
41 | 998.1 | 0.0 | 680.0 | 2019-01-31 08:40 | 38.9 | 10.0 | 5.8 | 45.4 | 2.0 | 20.5 | 1548920449 | 2019-01-31 08:40:00 |
42 | 998.1 | 0.0 | 696.0 | 2019-01-31 08:41 | 38.9 | 10.0 | 14.5 | 45.4 | 3.0 | 20.5 | 1548920508 | 2019-01-31 08:41:00 |
43 | 998.1 | 0.0 | 697.0 | 2019-01-31 08:42 | 38.9 | 10.0 | 15.3 | 45.4 | 3.0 | 20.5 | 1548920568 | 2019-01-31 08:42:00 |
44 | 998.2 | 0.0 | 725.0 | 2019-01-31 08:43 | 38.7 | 10.0 | 13.9 | 45.4 | 3.0 | 20.5 | 1548920627 | 2019-01-31 08:43:00 |
45 | 998.2 | 0.0 | 742.0 | 2019-01-31 08:44 | 38.5 | 10.0 | 11.1 | 45.4 | 3.0 | 20.5 | 1548920687 | 2019-01-31 08:44:00 |
46 | 998.2 | 0.0 | 705.0 | 2019-01-31 08:45 | 38.4 | 10.0 | 7.8 | 45.4 | 3.0 | 20.5 | 1548920746 | 2019-01-31 08:45:00 |
47 | 998.2 | 0.0 | 732.0 | 2019-01-31 08:46 | 38.6 | 10.0 | 9.4 | 45.4 | 4.0 | 20.6 | 1548920806 | 2019-01-31 08:46:00 |
48 | 998.2 | 0.0 | 733.0 | 2019-01-31 08:47 | 38.8 | 10.0 | 6.1 | 45.4 | 5.0 | 20.6 | 1548920865 | 2019-01-31 08:47:00 |
49 | 998.2 | 0.0 | 723.0 | 2019-01-31 08:48 | 38.4 | 10.0 | 6.0 | 45.4 | 5.0 | 20.6 | 1548920925 | 2019-01-31 08:48:00 |
50 | 998.3 | 0.0 | 725.0 | 2019-01-31 08:49 | 38.6 | 10.0 | 5.8 | 45.5 | 5.0 | 20.5 | 1548920984 | 2019-01-31 08:49:00 |
51 | 998.2 | 0.0 | 731.0 | 2019-01-31 08:50 | 38.3 | 9.9 | 9.2 | 45.5 | 5.0 | 20.6 | 1548921044 | 2019-01-31 08:50:00 |
52 | 998.2 | 0.0 | 739.0 | 2019-01-31 08:51 | 38.6 | 10.0 | 23.1 | 45.4 | 6.0 | 20.5 | 1548921103 | 2019-01-31 08:51:00 |
53 | 998.2 | 0.0 | 749.0 | 2019-01-31 08:52 | 38.3 | 9.9 | 14.9 | 45.4 | 6.0 | 20.6 | 1548921163 | 2019-01-31 08:52:00 |
54 | 998.3 | 0.0 | 733.0 | 2019-01-31 08:53 | 38.5 | 10.0 | 17.6 | 45.4 | 6.0 | 20.6 | 1548921222 | 2019-01-31 08:53:00 |
55 | 998.2 | 0.0 | 729.0 | 2019-01-31 08:54 | 38.4 | 10.0 | 10.7 | 45.4 | 7.0 | 20.6 | 1548921282 | 2019-01-31 08:54:00 |
56 | 998.3 | 0.0 | 741.0 | 2019-01-31 08:55 | 38.4 | 10.0 | 7.1 | 45.5 | 7.0 | 20.6 | 1548921341 | 2019-01-31 08:55:00 |
57 | 998.2 | 0.0 | 729.0 | 2019-01-31 08:56 | 38.1 | 9.9 | 8.0 | 45.5 | 7.0 | 20.6 | 1548921401 | 2019-01-31 08:56:00 |
58 | 998.3 | 0.0 | 711.0 | 2019-01-31 08:57 | 38.2 | 9.9 | 8.5 | 45.6 | 8.0 | 20.6 | 1548921460 | 2019-01-31 08:57:00 |
59 | 998.2 | 0.0 | 719.0 | 2019-01-31 08:58 | 37.7 | 9.9 | 6.3 | 45.7 | 8.0 | 20.6 | 1548921520 | 2019-01-31 08:58:00 |
60 | 998.3 | 0.0 | 737.0 | 2019-01-31 08:59 | 37.8 | 9.9 | 7.3 | 45.7 | 8.0 | 20.6 | 1548921579 | 2019-01-31 08:59:00 |
61 rows × 12 columns
# Get Daily Data
params = getauth()
params['serialNumber'] = df.serialNumber.values[0]
params['prevDateTime'] = '2018-10-1 08:00:00'
r = requests.post('https://api.uhooinc.com/v1/getdailydata', data = params)
_df = pd.DataFrame(r.json())
#_df['datetime'] = pd.to_datetime(_df['Timestamp']*10**9)
_df['datetime'] = pd.to_datetime(_df['DateTime'], errors='ignore')
print('Data for Device with Serial No:', params['serialNumber'])
_df
Data for Device with Serial No: 49ff76067580485655301867
Air Pressure | CO | CO2 | DateTime | NO2 | Ozone | PM2.5 | Relative Humidity | TVOC | Temperature | Timestamp | datetime | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1017.9 | 0.0 | 690.3 | 2018-10-01 00:00 | 0.5 | 4.5 | 10.0 | 53.4 | 155.2 | 21.0 | 1538348401 | 2018-10-01 00:00:00 |
1 | 1017.9 | 0.0 | 616.6 | 2018-10-01 01:00 | 0.5 | 4.6 | 9.7 | 53.5 | 128.8 | 20.8 | 1538352001 | 2018-10-01 01:00:00 |
2 | 1018.1 | 0.0 | 596.8 | 2018-10-01 02:00 | 0.4 | 4.7 | 9.0 | 53.6 | 114.6 | 20.6 | 1538355601 | 2018-10-01 02:00:00 |
3 | 1018.4 | 0.0 | 583.9 | 2018-10-01 03:00 | 0.5 | 4.7 | 8.8 | 53.7 | 106.1 | 20.4 | 1538359201 | 2018-10-01 03:00:00 |
4 | 1018.2 | 0.0 | 579.0 | 2018-10-01 04:00 | 0.5 | 4.8 | 8.4 | 53.9 | 106.5 | 20.2 | 1538362801 | 2018-10-01 04:00:00 |
5 | 1018.5 | 0.0 | 583.8 | 2018-10-01 05:00 | 0.5 | 4.8 | 8.3 | 54.1 | 103.1 | 20.1 | 1538366401 | 2018-10-01 05:00:00 |
6 | 1019.0 | 0.0 | 787.6 | 2018-10-01 06:00 | 0.4 | 4.5 | 11.5 | 55.6 | 165.4 | 20.5 | 1538370001 | 2018-10-01 06:00:00 |
7 | 1019.8 | 0.0 | 766.4 | 2018-10-01 07:00 | 0.5 | 4.5 | 10.9 | 56.3 | 172.5 | 20.5 | 1538373601 | 2018-10-01 07:00:00 |
8 | 1020.7 | 0.0 | 838.5 | 2018-10-01 08:00 | 0.4 | 4.6 | 19.2 | 55.9 | 145.9 | 20.5 | 1538377201 | 2018-10-01 08:00:00 |
9 | 1021.9 | 0.0 | 843.3 | 2018-10-01 09:00 | 0.5 | 4.7 | 32.5 | 55.5 | 138.8 | 20.5 | 1538380801 | 2018-10-01 09:00:00 |
10 | 1022.4 | 0.0 | 922.2 | 2018-10-01 10:00 | 0.5 | 4.8 | 27.0 | 55.9 | 167.2 | 20.6 | 1538384401 | 2018-10-01 10:00:00 |
11 | 1022.5 | 0.0 | 872.3 | 2018-10-01 11:00 | 0.5 | 4.3 | 90.6 | 52.5 | 274.2 | 21.3 | 1538388001 | 2018-10-01 11:00:00 |
12 | 1023.0 | 0.0 | 743.6 | 2018-10-01 12:00 | 0.5 | 3.0 | 149.6 | 50.1 | 892.0 | 21.4 | 1538391601 | 2018-10-01 12:00:00 |
13 | 1023.2 | 0.0 | 680.3 | 2018-10-01 13:00 | 0.6 | 3.7 | 50.1 | 51.4 | 450.0 | 21.1 | 1538395201 | 2018-10-01 13:00:00 |
14 | 1023.3 | 0.0 | 681.8 | 2018-10-01 14:00 | 0.5 | 4.0 | 21.4 | 50.5 | 344.1 | 21.3 | 1538398801 | 2018-10-01 14:00:00 |
15 | 1023.5 | 0.0 | 739.2 | 2018-10-01 15:00 | 0.5 | 4.3 | 14.4 | 51.5 | 182.9 | 20.9 | 1538402401 | 2018-10-01 15:00:00 |
16 | 1023.8 | 0.0 | 749.0 | 2018-10-01 16:00 | 0.5 | 4.4 | 19.7 | 51.1 | 99.6 | 20.9 | 1538406001 | 2018-10-01 16:00:00 |
17 | 1024.3 | 0.0 | 777.9 | 2018-10-01 17:00 | 0.5 | 4.5 | 17.4 | 50.7 | 70.2 | 21.2 | 1538409601 | 2018-10-01 17:00:00 |
18 | 1024.8 | 0.0 | 780.4 | 2018-10-01 18:00 | 0.5 | 4.4 | 16.6 | 50.7 | 86.5 | 21.4 | 1538413201 | 2018-10-01 18:00:00 |
19 | 1025.2 | 0.0 | 747.0 | 2018-10-01 19:00 | 0.5 | 4.5 | 15.6 | 52.5 | 91.5 | 21.0 | 1538416801 | 2018-10-01 19:00:00 |
20 | 1025.1 | 0.0 | 714.4 | 2018-10-01 20:00 | 0.5 | 4.6 | 12.0 | 52.7 | 54.8 | 20.6 | 1538420401 | 2018-10-01 20:00:00 |
21 | 1024.8 | 0.0 | 678.4 | 2018-10-01 21:00 | 0.5 | 4.7 | 11.9 | 52.4 | 40.9 | 20.4 | 1538424001 | 2018-10-01 21:00:00 |
22 | 1024.5 | 0.0 | 637.9 | 2018-10-01 22:00 | 0.5 | 4.7 | 9.9 | 52.3 | 35.6 | 20.4 | 1538427601 | 2018-10-01 22:00:00 |
23 | 1024.0 | 0.0 | 619.3 | 2018-10-01 23:00 | 0.4 | 4.7 | 9.3 | 52.2 | 37.6 | 20.2 | 1538431201 | 2018-10-01 23:00:00 |
df_measurements = df3.loc[:, 'Air Pressure':'Temperature']
df_m = df_measurements.drop(columns='DateTime')
df_measurements_int = df_m.apply(pd.to_numeric)
corrmat = df_measurements_int.corr()
f, ax = plt.subplots(figsize=(12,9))
sns.heatmap(corrmat, cbar=True, annot=True, square=True, fmt='.2f', annot_kws={'size': 11})
<matplotlib.axes._subplots.AxesSubplot at 0x2381e38de10>
# Prepare for Plotting
plotdf = _df.copy()
plotdf.index = plotdf['datetime']
plotdf = plotdf[['Air Pressure', 'CO', 'CO2', 'NO2', 'Ozone', 'PM2.5', 'Relative Humidity', 'TVOC', 'Temperature']]
plotdf = plotdf.apply(pd.to_numeric)
plotdf
Air Pressure | CO | CO2 | NO2 | Ozone | PM2.5 | Relative Humidity | TVOC | Temperature | |
---|---|---|---|---|---|---|---|---|---|
datetime | |||||||||
2018-10-01 00:00:00 | 1017.9 | 0.0 | 690.3 | 0.5 | 4.5 | 10.0 | 53.4 | 155.2 | 21.0 |
2018-10-01 01:00:00 | 1017.9 | 0.0 | 616.6 | 0.5 | 4.6 | 9.7 | 53.5 | 128.8 | 20.8 |
2018-10-01 02:00:00 | 1018.1 | 0.0 | 596.8 | 0.4 | 4.7 | 9.0 | 53.6 | 114.6 | 20.6 |
2018-10-01 03:00:00 | 1018.4 | 0.0 | 583.9 | 0.5 | 4.7 | 8.8 | 53.7 | 106.1 | 20.4 |
2018-10-01 04:00:00 | 1018.2 | 0.0 | 579.0 | 0.5 | 4.8 | 8.4 | 53.9 | 106.5 | 20.2 |
2018-10-01 05:00:00 | 1018.5 | 0.0 | 583.8 | 0.5 | 4.8 | 8.3 | 54.1 | 103.1 | 20.1 |
2018-10-01 06:00:00 | 1019.0 | 0.0 | 787.6 | 0.4 | 4.5 | 11.5 | 55.6 | 165.4 | 20.5 |
2018-10-01 07:00:00 | 1019.8 | 0.0 | 766.4 | 0.5 | 4.5 | 10.9 | 56.3 | 172.5 | 20.5 |
2018-10-01 08:00:00 | 1020.7 | 0.0 | 838.5 | 0.4 | 4.6 | 19.2 | 55.9 | 145.9 | 20.5 |
2018-10-01 09:00:00 | 1021.9 | 0.0 | 843.3 | 0.5 | 4.7 | 32.5 | 55.5 | 138.8 | 20.5 |
2018-10-01 10:00:00 | 1022.4 | 0.0 | 922.2 | 0.5 | 4.8 | 27.0 | 55.9 | 167.2 | 20.6 |
2018-10-01 11:00:00 | 1022.5 | 0.0 | 872.3 | 0.5 | 4.3 | 90.6 | 52.5 | 274.2 | 21.3 |
2018-10-01 12:00:00 | 1023.0 | 0.0 | 743.6 | 0.5 | 3.0 | 149.6 | 50.1 | 892.0 | 21.4 |
2018-10-01 13:00:00 | 1023.2 | 0.0 | 680.3 | 0.6 | 3.7 | 50.1 | 51.4 | 450.0 | 21.1 |
2018-10-01 14:00:00 | 1023.3 | 0.0 | 681.8 | 0.5 | 4.0 | 21.4 | 50.5 | 344.1 | 21.3 |
2018-10-01 15:00:00 | 1023.5 | 0.0 | 739.2 | 0.5 | 4.3 | 14.4 | 51.5 | 182.9 | 20.9 |
2018-10-01 16:00:00 | 1023.8 | 0.0 | 749.0 | 0.5 | 4.4 | 19.7 | 51.1 | 99.6 | 20.9 |
2018-10-01 17:00:00 | 1024.3 | 0.0 | 777.9 | 0.5 | 4.5 | 17.4 | 50.7 | 70.2 | 21.2 |
2018-10-01 18:00:00 | 1024.8 | 0.0 | 780.4 | 0.5 | 4.4 | 16.6 | 50.7 | 86.5 | 21.4 |
2018-10-01 19:00:00 | 1025.2 | 0.0 | 747.0 | 0.5 | 4.5 | 15.6 | 52.5 | 91.5 | 21.0 |
2018-10-01 20:00:00 | 1025.1 | 0.0 | 714.4 | 0.5 | 4.6 | 12.0 | 52.7 | 54.8 | 20.6 |
2018-10-01 21:00:00 | 1024.8 | 0.0 | 678.4 | 0.5 | 4.7 | 11.9 | 52.4 | 40.9 | 20.4 |
2018-10-01 22:00:00 | 1024.5 | 0.0 | 637.9 | 0.5 | 4.7 | 9.9 | 52.3 | 35.6 | 20.4 |
2018-10-01 23:00:00 | 1024.0 | 0.0 | 619.3 | 0.4 | 4.7 | 9.3 | 52.2 | 37.6 | 20.2 |
# Daily Data
plotdf.resample('D', level=0).mean()
Air Pressure | CO | CO2 | NO2 | Ozone | PM2.5 | Relative Humidity | TVOC | Temperature | |
---|---|---|---|---|---|---|---|---|---|
datetime | |||||||||
2018-10-01 | 1021.866667 | 0.0 | 717.9125 | 0.4875 | 4.458333 | 24.741667 | 53.0 | 173.5 | 20.741667 |
# Code for Plotting Callender Map
# Source Url: https://www.pythonprogramming.in/how-to-create-heatmap-calendar-using-numpy-and-matplotlib.html
import datetime as dt
import matplotlib.pyplot as plt
import numpy as np
def calendar_array(dates, data):
i, j = zip(*[d.isocalendar()[1:] for d in dates])
i = np.array(i) - min(i)
j = np.array(j) - 1
ni = max(i) + 1
calendar = np.nan * np.zeros((ni, 7))
calendar[i, j] = data
return i, j, calendar
def calendar_heatmap(ax, df, variable):
dates = df.index.to_series().dt.to_pydatetime()
data = df[variable].values
i, j, calendar = calendar_array(dates, data)
im = ax.imshow(calendar, interpolation='none', cmap='summer')
label_days(ax, dates, i, j, calendar)
label_months(ax, dates, i, j, calendar)
ax.figure.colorbar(im)
def label_days(ax, dates, i, j, calendar):
ni, nj = calendar.shape
day_of_month = np.nan * np.zeros((ni, 7))
day_of_month[i, j] = [d.day for d in dates]
for (i, j), day in np.ndenumerate(day_of_month):
if np.isfinite(day):
ax.text(j, i, int(day), ha='center', va='center')
ax.set(xticks=np.arange(7),
xticklabels=['M', 'T', 'W', 'R', 'F', 'S', 'S'])
ax.xaxis.tick_top()
def label_months(ax, dates, i, j, calendar):
month_labels = np.array(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])
months = np.array([d.month for d in dates])
uniq_months = sorted(set(months))
yticks = [i[months == m].mean() for m in uniq_months]
labels = [month_labels[m - 1] for m in uniq_months]
ax.set(yticks=yticks)
ax.set_yticklabels(labels, rotation=90)
# Plot the heatmap
fig, ax = plt.subplots(figsize=(6, 10))
calendar_heatmap(ax, plotdf, 'NO2')
plt.show()
# Test Heat Map for a month
params = getauth()
params['serialNumber'] = df.serialNumber.values[0]
print('Data for Device with Serial No:', params['serialNumber'])
# Get Daily Data for a month
df_list = []
startdate = '01-10-2018' # 'dd-mm-yyyy'
time = 135
i = 0
startdate_ = datetime.datetime.strptime(startdate, "%d-%m-%Y")
print("Getting Data From", startdate_.strftime("%Y-%m-%d"), " to ", (startdate_ + datetime.timedelta(days=time)).strftime("%Y-%m-%d") )
print("Progress", i, "/", time)
while i < time:
a = startdate_ + datetime.timedelta(days=i)
params['prevDateTime'] = a.strftime("%Y-%m-%d %H:%M:%S")
r = requests.post('https://api.uhooinc.com/v1/getdailydata', data = params)
if r.ok:
_df = pd.DataFrame(r.json())
df_list.append(_df)
i+=1
if ((i % 5) == 0):
print("Progress", i, "/", time)
# All Done
tsdf = pd.concat(df_list)
#tsdf['datetime'] = pd.to_datetime(tsdf['Timestamp']*10**9)
tsdf['datetime'] = pd.to_datetime(tsdf['DateTime'], errors='ignore')
tsdf
Data for Device with Serial No: 49ff76067580485655301867 Getting Data From 2018-10-01 to 2019-02-13 Progress 0 / 135 Progress 5 / 135 Progress 10 / 135 Progress 15 / 135 Progress 20 / 135 Progress 25 / 135 Progress 30 / 135 Progress 35 / 135 Progress 40 / 135 Progress 45 / 135 Progress 50 / 135 Progress 55 / 135 Progress 60 / 135 Progress 65 / 135 Progress 70 / 135 Progress 75 / 135 Progress 80 / 135 Progress 85 / 135 Progress 90 / 135 Progress 95 / 135 Progress 100 / 135 Progress 105 / 135 Progress 110 / 135 Progress 115 / 135 Progress 120 / 135 Progress 125 / 135 Progress 130 / 135 Progress 135 / 135
Air Pressure | CO | CO2 | DateTime | NO2 | Ozone | PM2.5 | Relative Humidity | TVOC | Temperature | Timestamp | datetime | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1017.9 | 0.0 | 690.3 | 2018-10-01 00:00 | 0.5 | 4.5 | 10.0 | 53.4 | 155.2 | 21.0 | 1538348401 | 2018-10-01 00:00:00 |
1 | 1017.9 | 0.0 | 616.6 | 2018-10-01 01:00 | 0.5 | 4.6 | 9.7 | 53.5 | 128.8 | 20.8 | 1538352001 | 2018-10-01 01:00:00 |
2 | 1018.1 | 0.0 | 596.8 | 2018-10-01 02:00 | 0.4 | 4.7 | 9.0 | 53.6 | 114.6 | 20.6 | 1538355601 | 2018-10-01 02:00:00 |
3 | 1018.4 | 0.0 | 583.9 | 2018-10-01 03:00 | 0.5 | 4.7 | 8.8 | 53.7 | 106.1 | 20.4 | 1538359201 | 2018-10-01 03:00:00 |
4 | 1018.2 | 0.0 | 579.0 | 2018-10-01 04:00 | 0.5 | 4.8 | 8.4 | 53.9 | 106.5 | 20.2 | 1538362801 | 2018-10-01 04:00:00 |
5 | 1018.5 | 0.0 | 583.8 | 2018-10-01 05:00 | 0.5 | 4.8 | 8.3 | 54.1 | 103.1 | 20.1 | 1538366401 | 2018-10-01 05:00:00 |
6 | 1019.0 | 0.0 | 787.6 | 2018-10-01 06:00 | 0.4 | 4.5 | 11.5 | 55.6 | 165.4 | 20.5 | 1538370001 | 2018-10-01 06:00:00 |
7 | 1019.8 | 0.0 | 766.4 | 2018-10-01 07:00 | 0.5 | 4.5 | 10.9 | 56.3 | 172.5 | 20.5 | 1538373601 | 2018-10-01 07:00:00 |
8 | 1020.7 | 0.0 | 838.5 | 2018-10-01 08:00 | 0.4 | 4.6 | 19.2 | 55.9 | 145.9 | 20.5 | 1538377201 | 2018-10-01 08:00:00 |
9 | 1021.9 | 0.0 | 843.3 | 2018-10-01 09:00 | 0.5 | 4.7 | 32.5 | 55.5 | 138.8 | 20.5 | 1538380801 | 2018-10-01 09:00:00 |
10 | 1022.4 | 0.0 | 922.2 | 2018-10-01 10:00 | 0.5 | 4.8 | 27.0 | 55.9 | 167.2 | 20.6 | 1538384401 | 2018-10-01 10:00:00 |
11 | 1022.5 | 0.0 | 872.3 | 2018-10-01 11:00 | 0.5 | 4.3 | 90.6 | 52.5 | 274.2 | 21.3 | 1538388001 | 2018-10-01 11:00:00 |
12 | 1023.0 | 0.0 | 743.6 | 2018-10-01 12:00 | 0.5 | 3.0 | 149.6 | 50.1 | 892.0 | 21.4 | 1538391601 | 2018-10-01 12:00:00 |
13 | 1023.2 | 0.0 | 680.3 | 2018-10-01 13:00 | 0.6 | 3.7 | 50.1 | 51.4 | 450.0 | 21.1 | 1538395201 | 2018-10-01 13:00:00 |
14 | 1023.3 | 0.0 | 681.8 | 2018-10-01 14:00 | 0.5 | 4.0 | 21.4 | 50.5 | 344.1 | 21.3 | 1538398801 | 2018-10-01 14:00:00 |
15 | 1023.5 | 0.0 | 739.2 | 2018-10-01 15:00 | 0.5 | 4.3 | 14.4 | 51.5 | 182.9 | 20.9 | 1538402401 | 2018-10-01 15:00:00 |
16 | 1023.8 | 0.0 | 749.0 | 2018-10-01 16:00 | 0.5 | 4.4 | 19.7 | 51.1 | 99.6 | 20.9 | 1538406001 | 2018-10-01 16:00:00 |
17 | 1024.3 | 0.0 | 777.9 | 2018-10-01 17:00 | 0.5 | 4.5 | 17.4 | 50.7 | 70.2 | 21.2 | 1538409601 | 2018-10-01 17:00:00 |
18 | 1024.8 | 0.0 | 780.4 | 2018-10-01 18:00 | 0.5 | 4.4 | 16.6 | 50.7 | 86.5 | 21.4 | 1538413201 | 2018-10-01 18:00:00 |
19 | 1025.2 | 0.0 | 747.0 | 2018-10-01 19:00 | 0.5 | 4.5 | 15.6 | 52.5 | 91.5 | 21.0 | 1538416801 | 2018-10-01 19:00:00 |
20 | 1025.1 | 0.0 | 714.4 | 2018-10-01 20:00 | 0.5 | 4.6 | 12.0 | 52.7 | 54.8 | 20.6 | 1538420401 | 2018-10-01 20:00:00 |
21 | 1024.8 | 0.0 | 678.4 | 2018-10-01 21:00 | 0.5 | 4.7 | 11.9 | 52.4 | 40.9 | 20.4 | 1538424001 | 2018-10-01 21:00:00 |
22 | 1024.5 | 0.0 | 637.9 | 2018-10-01 22:00 | 0.5 | 4.7 | 9.9 | 52.3 | 35.6 | 20.4 | 1538427601 | 2018-10-01 22:00:00 |
23 | 1024.0 | 0.0 | 619.3 | 2018-10-01 23:00 | 0.4 | 4.7 | 9.3 | 52.2 | 37.6 | 20.2 | 1538431201 | 2018-10-01 23:00:00 |
0 | 1023.6 | 0.0 | 620.9 | 2018-10-02 00:00 | 0.5 | 4.8 | 9.2 | 52.0 | 37.8 | 20.0 | 1538434801 | 2018-10-02 00:00:00 |
1 | 1023.1 | 0.0 | 631.4 | 2018-10-02 01:00 | 0.5 | 4.8 | 9.7 | 52.0 | 40.2 | 19.9 | 1538438401 | 2018-10-02 01:00:00 |
2 | 1022.3 | 0.0 | 616.3 | 2018-10-02 02:00 | 0.6 | 4.9 | 9.0 | 52.2 | 37.4 | 19.7 | 1538442001 | 2018-10-02 02:00:00 |
3 | 1021.3 | 0.0 | 618.8 | 2018-10-02 03:00 | 0.5 | 5.0 | 8.7 | 52.5 | 33.5 | 19.5 | 1538445601 | 2018-10-02 03:00:00 |
4 | 1020.1 | 0.0 | 622.3 | 2018-10-02 04:00 | 0.5 | 5.5 | 8.9 | 52.9 | 34.5 | 19.4 | 1538449201 | 2018-10-02 04:00:00 |
5 | 1019.1 | 0.0 | 634.1 | 2018-10-02 05:00 | 0.5 | 5.4 | 9.5 | 53.2 | 42.5 | 19.3 | 1538452801 | 2018-10-02 05:00:00 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
18 | 1029.0 | 0.0 | 1048.4 | 2019-02-11 18:00 | 29.3 | 10.0 | 25.1 | 63.8 | 22.2 | 18.9 | 1549904401 | 2019-02-11 18:00:00 |
19 | 1030.1 | 0.0 | 1381.5 | 2019-02-11 19:00 | 23.8 | 9.6 | 16.2 | 63.9 | 58.1 | 19.6 | 1549908001 | 2019-02-11 19:00:00 |
20 | 1031.0 | 0.0 | 1820.5 | 2019-02-11 20:00 | 20.7 | 9.4 | 16.1 | 63.5 | 115.7 | 20.1 | 1549911601 | 2019-02-11 20:00:00 |
21 | 1031.5 | 0.0 | 2147.3 | 2019-02-11 21:00 | 21.4 | 9.4 | 12.7 | 63.1 | 124.0 | 20.5 | 1549915201 | 2019-02-11 21:00:00 |
22 | 1032.0 | 0.0 | 1900.5 | 2019-02-11 22:00 | 22.7 | 9.5 | 44.8 | 64.4 | 103.3 | 20.0 | 1549918801 | 2019-02-11 22:00:00 |
23 | 1032.5 | 0.0 | 1633.8 | 2019-02-11 23:00 | 21.3 | 9.5 | 32.2 | 69.5 | 130.8 | 18.9 | 1549922401 | 2019-02-11 23:00:00 |
0 | 1033.2 | 0.0 | 1520.6 | 2019-02-12 00:00 | 24.3 | 9.7 | 14.0 | 71.1 | 135.8 | 18.1 | 1549926001 | 2019-02-12 00:00:00 |
1 | 1033.8 | 0.0 | 1657.3 | 2019-02-12 01:00 | 26.1 | 9.9 | 12.7 | 73.0 | 164.5 | 17.4 | 1549929601 | 2019-02-12 01:00:00 |
2 | 1033.9 | 0.0 | 1592.3 | 2019-02-12 02:00 | 29.0 | 10.1 | 10.9 | 74.2 | 169.8 | 16.8 | 1549933201 | 2019-02-12 02:00:00 |
3 | 1033.8 | 0.0 | 1592.6 | 2019-02-12 03:00 | 28.4 | 10.1 | 10.2 | 75.1 | 505.2 | 16.5 | 1549936801 | 2019-02-12 03:00:00 |
4 | 1033.9 | 0.0 | 1393.3 | 2019-02-12 04:00 | 30.4 | 10.2 | 10.4 | 75.4 | 424.9 | 16.3 | 1549940401 | 2019-02-12 04:00:00 |
5 | 1033.9 | 0.0 | 1090.9 | 2019-02-12 05:00 | 34.5 | 10.5 | 9.1 | 74.8 | 135.8 | 16.2 | 1549944001 | 2019-02-12 05:00:00 |
6 | 1033.9 | 0.0 | 1074.4 | 2019-02-12 06:00 | 27.8 | 10.0 | 61.4 | 77.3 | 207.7 | 16.2 | 1549947601 | 2019-02-12 06:00:00 |
7 | 1034.0 | 0.0 | 1171.8 | 2019-02-12 07:00 | 24.2 | 9.8 | 199.4 | 78.7 | 325.6 | 16.0 | 1549951201 | 2019-02-12 07:00:00 |
8 | 1034.5 | 0.0 | 1175.9 | 2019-02-12 08:00 | 26.5 | 9.9 | 116.9 | 79.5 | 224.5 | 15.7 | 1549954801 | 2019-02-12 08:00:00 |
9 | 1034.8 | 0.0 | 1086.8 | 2019-02-12 09:00 | 29.1 | 10.1 | 29.9 | 79.6 | 154.5 | 15.5 | 1549958401 | 2019-02-12 09:00:00 |
10 | 1035.1 | 0.0 | 915.4 | 2019-02-12 10:00 | 33.0 | 10.4 | 17.1 | 78.9 | 112.6 | 15.3 | 1549962001 | 2019-02-12 10:00:00 |
11 | 1035.5 | 0.0 | 855.9 | 2019-02-12 11:00 | 32.4 | 10.3 | 27.5 | 80.0 | 101.0 | 15.4 | 1549965601 | 2019-02-12 11:00:00 |
12 | 1035.3 | 0.0 | 891.6 | 2019-02-12 12:00 | 30.5 | 10.2 | 20.8 | 78.9 | 77.9 | 16.0 | 1549969201 | 2019-02-12 12:00:00 |
13 | 1034.9 | 0.0 | 1393.8 | 2019-02-12 13:00 | 23.6 | 9.7 | 22.8 | 77.2 | 58.0 | 17.4 | 1549972801 | 2019-02-12 13:00:00 |
14 | 1034.8 | 0.0 | 1490.0 | 2019-02-12 14:00 | 20.3 | 9.5 | 13.9 | 73.6 | 54.4 | 18.7 | 1549976401 | 2019-02-12 14:00:00 |
15 | 1034.8 | 0.0 | 1431.7 | 2019-02-12 15:00 | 18.4 | 9.3 | 14.2 | 70.9 | 40.8 | 19.6 | 1549980001 | 2019-02-12 15:00:00 |
16 | 1034.8 | 0.0 | 1424.3 | 2019-02-12 16:00 | 16.2 | 9.2 | 13.8 | 69.4 | 32.5 | 20.3 | 1549983601 | 2019-02-12 16:00:00 |
17 | 1034.7 | 0.0 | 1389.0 | 2019-02-12 17:00 | 16.6 | 9.2 | 12.7 | 67.1 | 14.1 | 20.7 | 1549987201 | 2019-02-12 17:00:00 |
18 | 1034.9 | 0.0 | 1405.9 | 2019-02-12 18:00 | 19.4 | 9.3 | 12.0 | 64.1 | 11.3 | 21.2 | 1549990801 | 2019-02-12 18:00:00 |
19 | 1035.2 | 0.0 | 1583.3 | 2019-02-12 19:00 | 16.8 | 9.1 | 12.3 | 64.3 | 47.1 | 21.3 | 1549994401 | 2019-02-12 19:00:00 |
20 | 1035.2 | 0.0 | 1608.4 | 2019-02-12 20:00 | 16.1 | 9.1 | 13.1 | 62.7 | 44.4 | 21.8 | 1549998001 | 2019-02-12 20:00:00 |
21 | 1035.2 | 0.0 | 1384.2 | 2019-02-12 21:00 | 19.2 | 9.2 | 100.2 | 61.5 | 34.4 | 21.7 | 1550001601 | 2019-02-12 21:00:00 |
22 | 1035.6 | 0.0 | 1126.0 | 2019-02-12 22:00 | 18.0 | 9.2 | 37.7 | 63.6 | 22.5 | 21.3 | 1550005201 | 2019-02-12 22:00:00 |
23 | 1035.8 | 0.0 | 811.1 | 2019-02-12 23:00 | 24.1 | 9.7 | 14.1 | 64.7 | 18.5 | 20.1 | 1550008801 | 2019-02-12 23:00:00 |
3240 rows × 12 columns
# Prepare for Plotting
print("Plotting Data From", startdate_.strftime("%Y-%m-%d"), " to ", (startdate_ + datetime.timedelta(days=time)).strftime("%Y-%m-%d"), "for Device with Serial No:", params['serialNumber'] )
plotdf = tsdf.copy()
plotdf.index = plotdf['datetime']
plotdf = plotdf[['Air Pressure', 'CO', 'CO2', 'NO2', 'Ozone', 'PM2.5', 'Relative Humidity', 'TVOC', 'Temperature']]
plotdf = plotdf.apply(pd.to_numeric)
# Daily Data
plotdf.resample('D', level=0).mean()
# Plot the heatmap
fig, ax = plt.subplots(figsize=(40, 40))
calendar_heatmap(ax, plotdf, 'NO2')
plt.show()
Plotting Data From 2018-10-01 to 2019-02-13 for Device with Serial No: 49ff76067580485655301867
# Clean Data to get pc6
df3['pc6'] = df3['deviceName'].str.split('/').str[0].str.strip().str.replace(' ', '')
df3['pc4'] = pd.to_numeric(df3['deviceName'].str.split(' ').str[0].str.strip() , errors='ceorce')
df3 = df3[~df3['pc4'].isnull()]
# Get pincode data
pincodelist = "', '".join(df3['pc6'].unique().astype(str))
query = "select postcode as pc6, wkb_geometry from postcode_pc6_2018 where postcode in ('"+ pincodelist +"') LIMIT 100"
con = postgres_test()
gdf = gpd.GeoDataFrame.from_postgis(query, con, geom_col='wkb_geometry' )
gdf.plot()
<matplotlib.axes._subplots.AxesSubplot at 0x23820cbfda0>
gdf
pc6 | wkb_geometry | |
---|---|---|
0 | 2951ER | (POLYGON ((104791.5001766441 430901.5047104367... |
1 | 2951AG | (POLYGON ((105351.697376682 430865.7110104564,... |
2 | 2951AT | (POLYGON ((105207.2637766702 430733.3865105017... |
3 | 2951AW | (POLYGON ((105313.4081766779 430716.3427105072... |
4 | 2951BE | (POLYGON ((105038.7358766636 431323.6454103026... |
5 | 2951CN | (POLYGON ((104680.3259766386 430968.2379104128... |
6 | 2951DB | (POLYGON ((105069.6622766652 431503.465210241,... |
7 | 2951EC | (POLYGON ((104380.8704766151 430954.5252104093... |
8 | 2951GG | (POLYGON ((105068.3635766616 430570.596210549,... |
9 | 2951GJ | (POLYGON ((105554.9494766929 430683.3787105273... |
10 | 2951HB | (POLYGON ((105358.3605766857 431609.6387102101... |
11 | 2951HH | (POLYGON ((105122.1352766703 431584.3420102132... |
12 | 2951JD | (POLYGON ((104429.9827766182 430742.0111104829... |
13 | 2951JG | (POLYGON ((104369.537176614 430617.7807105244,... |
14 | 2951PA | (POLYGON ((105851.6881767209 431542.5957102404... |
15 | 2951PK | (POLYGON ((105667.4069767085 431403.8277102865... |
16 | 2951PM | (POLYGON ((105674.5635767084 431568.3117102302... |
17 | 2951PN | (POLYGON ((105721.0628767101 431469.9266102646... |
18 | 2951VB | (POLYGON ((105131.2501766682 431069.4677103875... |
19 | 2951VE | (POLYGON ((104959.1134766547 430867.4660104557... |
20 | 2951VH | (POLYGON ((105203.6094766716 431062.7947103878... |
21 | 2951VN | (POLYGON ((105156.5310766728 431302.8693103092... |
22 | 2951WB | (POLYGON ((105395.4781766854 430968.3647104228... |
23 | 2951XV | (POLYGON ((105510.401176693 430869.864710459, ... |
24 | 2951XW | (POLYGON ((105480.3101766909 431146.7148103634... |
25 | 2952AH | (POLYGON ((105066.3496766598 430373.3048106213... |
26 | 2952AK | (POLYGON ((104954.6209766518 430434.4408105956... |
27 | 2953AM | (POLYGON ((104468.7093766241 431411.6148102594... |
28 | 2953BB | (POLYGON ((104441.6701766271 431646.9695101805... |
29 | 2953BE | (POLYGON ((104395.326976622 431627.7506101847,... |
30 | 2953CJ | (POLYGON ((104280.828776612 431183.2868103341,... |
31 | 2953CN | (POLYGON ((103466.9180765592 431626.8143101659... |
32 | 2953CT | (POLYGON ((103776.9671765816 431762.2367101334... |
33 | 2953EZ | (POLYGON ((103924.904976594 431915.2589100823,... |
34 | 2953GC | (POLYGON ((103533.0861765667 432130.2617100005... |
35 | 2953HA | (POLYGON ((104533.4168766304 431197.0559103308... |
36 | 2953HB | (POLYGON ((104484.5353766253 431217.0693103203... |
37 | 2953HC | (POLYGON ((104214.9731766062 430920.1797104231... |
38 | 2953WB | (POLYGON ((104204.5492766095 431603.7041101894... |
39 | 2953WL | (POLYGON ((104041.7212765982 431775.9168101324... |
40 | 2953XA | (POLYGON ((103537.759476566 431767.2454101265,... |
41 | 2953XD | (POLYGON ((103429.1724765578 431785.9104101136... |
42 | 2953XJ | (POLYGON ((103466.3963765625 431893.1223100763... |
43 | 2953XT | (POLYGON ((103220.084676549 432514.422709867, ... |
44 | 2954AA | (POLYGON ((105248.4640766799 431675.0329101846... |
45 | 2954BA | (POLYGON ((104516.6317766312 431769.4257101389... |
46 | 2954BE | (POLYGON ((104516.6317766312 431769.4257101389... |
47 | 2954BL | (POLYGON ((104661.6371766392 431750.6767101502... |
48 | 2954BP | (POLYGON ((104877.8170766566 431930.610210091,... |
49 | 2954ND | (POLYGON ((105399.8403766898 431692.1669101812... |
50 | 2954PB | (POLYGON ((104924.5819766576 431750.2877101554... |
51 | 2954PC | (POLYGON ((104872.5781766572 431821.1258101297... |
52 | 2969BT | (POLYGON ((108344.7648768795 430083.2758107731... |
53 | 3355AA | (POLYGON ((107624.7321768187 427766.2941115281... |
# Geocode Devices
gdf['x'] = gdf.wkb_geometry.centroid.x
gdf['y'] = gdf.wkb_geometry.centroid.y
_gdf = gdf[['x', 'y', 'pc6']]
geo_df = df3.merge(_gdf, on='pc6')
crs = {'init': 'epsg:28992'}
geometry = [Point(xy) for xy in zip(geo_df.x, geo_df.y)]
geo_df = gpd.GeoDataFrame(geo_df, crs=crs, geometry=geometry)
geo_df = geo_df.to_crs({'init': 'epsg:4326'})
geo_df.plot()
<matplotlib.axes._subplots.AxesSubplot at 0x23820cd8e48>
# Convert layer to geojson
geo_df['Timestamp'] = geo_df['Timestamp'].astype(str)
geo_df['datetime'] = geo_df['datetime'].astype(str)
data = geo_df.to_json()
data = json.loads(data)
data
{'type': 'FeatureCollection', 'features': [{'id': '0', 'type': 'Feature', 'properties': {'deviceName': '2951 BE / Project Ablasserdam', 'macAddress': '606405acf1e5', 'serialNumber': '49ff76067580485655301867', 'Air Pressure': '1005.5', 'CO': '0.0', 'CO2': '504.0', 'DateTime': '2019-03-15 12:24', 'NO2': '0.1', 'Ozone': '6.9', 'PM2.5': '6.7', 'Relative Humidity': '73.4', 'TVOC': '74.0', 'Temperature': '13.4', 'Timestamp': '1552649062', 'datetime': '2019-03-15 12:24:00', 'pc6': '2951BE', 'pc4': 2951.0, 'x': 104986.14116720512, 'y': 431261.36722261243}, 'geometry': {'type': 'Point', 'coordinates': [4.66103620904929, 51.86765719595473]}}, {'id': '1', 'type': 'Feature', 'properties': {'deviceName': '2951 BE / Project Ablasserdam', 'macAddress': 'a81b6a9ae855', 'serialNumber': '48ff72067580505235331667', 'Air Pressure': '1004.0', 'CO': '0.0', 'CO2': '442.0', 'DateTime': '2019-03-15 12:24', 'NO2': '0.7', 'Ozone': '9.0', 'PM2.5': '57.4', 'Relative Humidity': '50.7', 'TVOC': '72.0', 'Temperature': '17.8', 'Timestamp': '1552649088', 'datetime': '2019-03-15 12:24:00', 'pc6': '2951BE', 'pc4': 2951.0, 'x': 104986.14116720512, 'y': 431261.36722261243}, 'geometry': {'type': 'Point', 'coordinates': [4.66103620904929, 51.86765719595473]}}, {'id': '2', 'type': 'Feature', 'properties': {'deviceName': '2951 PM / Project Alblasserdam', 'macAddress': '606405acd6e2', 'serialNumber': '48ff72067580505252431467', 'Air Pressure': '1003.5', 'CO': '0.0', 'CO2': '456.0', 'DateTime': '2019-03-15 12:24', 'NO2': '0.4', 'Ozone': '9.6', 'PM2.5': '6.5', 'Relative Humidity': '52.9', 'TVOC': '58.0', 'Temperature': '18.7', 'Timestamp': '1552649086', 'datetime': '2019-03-15 12:24:00', 'pc6': '2951PM', 'pc4': 2951.0, 'x': 105656.16709962736, 'y': 431517.2654491878}, 'geometry': {'type': 'Point', 'coordinates': [4.6707271772420995, 51.8700168821404]}}, {'id': '3', 'type': 'Feature', 'properties': {'deviceName': '2953 AM / Project Alblasserdam', 'macAddress': 'a81b6a9ad4ff', 'serialNumber': '48ff6c067580505240571367', 'Air Pressure': '1003.2', 'CO': '0.0', 'CO2': '773.0', 'DateTime': '2019-03-15 12:24', 'NO2': '1.0', 'Ozone': '7.8', 'PM2.5': '6.7', 'Relative Humidity': '51.8', 'TVOC': '130.0', 'Temperature': '19.9', 'Timestamp': '1552649062', 'datetime': '2019-03-15 12:24:00', 'pc6': '2953AM', 'pc4': 2953.0, 'x': 104442.31728432377, 'y': 431414.4776872626}, 'geometry': {'type': 'Point', 'coordinates': [4.653118439552964, 51.86898422920255]}}, {'id': '4', 'type': 'Feature', 'properties': {'deviceName': '2951 HB / Project Alblasserdam', 'macAddress': '606405acf51f', 'serialNumber': '49ff6d067580485648301367', 'Air Pressure': '1024.4', 'CO': '0.0', 'CO2': '1510.0', 'DateTime': '2018-12-04 15:34', 'NO2': '19.4', 'Ozone': '8.7', 'PM2.5': '10.8', 'Relative Humidity': '58.3', 'TVOC': '10.0', 'Temperature': '20.3', 'Timestamp': '1543934068', 'datetime': '2018-12-04 15:34:00', 'pc6': '2951HB', 'pc4': 2951.0, 'x': 105268.5902409369, 'y': 431539.5627000045}, 'geometry': {'type': 'Point', 'coordinates': [4.665096748820099, 51.87018282349947]}}, {'id': '5', 'type': 'Feature', 'properties': {'deviceName': '2953 WB / Project Alblasserdam', 'macAddress': '606405acf6d4', 'serialNumber': '30ff70064d48303544172543', 'Air Pressure': '1003.7', 'CO': '0.0', 'CO2': '859.0', 'DateTime': '2019-03-15 14:24', 'NO2': '0.5', 'Ozone': '4.9', 'PM2.5': '30.9', 'Relative Humidity': '52.4', 'TVOC': '74.0', 'Temperature': '19.8', 'Timestamp': '1552649069', 'datetime': '2019-03-15 14:24:00', 'pc6': '2953WB', 'pc4': 2953.0, 'x': 104120.20380335854, 'y': 431567.3875764528}, 'geometry': {'type': 'Point', 'coordinates': [4.648419250645758, 51.870329216007626]}}, {'id': '6', 'type': 'Feature', 'properties': {'deviceName': '2953 WB / Project Alblasserdam', 'macAddress': '606405acb241', 'serialNumber': '48ff6e067580505240551367', 'Air Pressure': '1003.6', 'CO': '0.0', 'CO2': '545.0', 'DateTime': '2019-03-15 12:25', 'NO2': '1.4', 'Ozone': '7.6', 'PM2.5': '11.8', 'Relative Humidity': '52.3', 'TVOC': '28.0', 'Temperature': '19.4', 'Timestamp': '1552649134', 'datetime': '2019-03-15 12:25:00', 'pc6': '2953WB', 'pc4': 2953.0, 'x': 104120.20380335854, 'y': 431567.3875764528}, 'geometry': {'type': 'Point', 'coordinates': [4.648419250645758, 51.870329216007626]}}, {'id': '7', 'type': 'Feature', 'properties': {'deviceName': '2953 BB / Project Alblasserdam', 'macAddress': '606405acf1d7', 'serialNumber': '49ff6c067580485635281367', 'Air Pressure': '1004.0', 'CO': '0.0', 'CO2': '598.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.5', 'Ozone': '4.7', 'PM2.5': '4.3', 'Relative Humidity': '52.0', 'TVOC': '28.0', 'Temperature': '20.1', 'Timestamp': '1552649124', 'datetime': '2019-03-15 12:25:00', 'pc6': '2953BB', 'pc4': 2953.0, 'x': 104393.79240884478, 'y': 431587.77128439007}, 'geometry': {'type': 'Point', 'coordinates': [4.652388499674358, 51.870537336470804]}}, {'id': '8', 'type': 'Feature', 'properties': {'deviceName': '2952 AH / Project Alblasserdam', 'macAddress': '606405ace2b3', 'serialNumber': '49ff6c067580485629261367', 'Air Pressure': '1003.9', 'CO': '0.0', 'CO2': '813.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.5', 'Ozone': '10.0', 'PM2.5': '6.7', 'Relative Humidity': '54.0', 'TVOC': '1.0', 'Temperature': '20.3', 'Timestamp': '1552649123', 'datetime': '2019-03-15 12:25:00', 'pc6': '2952AH', 'pc4': 2952.0, 'x': 105056.21516814694, 'y': 430312.5254927916}, 'geometry': {'type': 'Point', 'coordinates': [4.662190910466406, 51.859135545488755]}}, {'id': '9', 'type': 'Feature', 'properties': {'deviceName': '2953 HC / Project Alblasserdam', 'macAddress': '606405acf440', 'serialNumber': '49ff68067580485646301367', 'Air Pressure': '1003.5', 'CO': '0.0', 'CO2': '805.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.9', 'Ozone': '4.6', 'PM2.5': '33.3', 'Relative Humidity': '47.2', 'TVOC': '32.0', 'Temperature': '20.4', 'Timestamp': '1552649112', 'datetime': '2019-03-15 12:25:00', 'pc6': '2953HC', 'pc4': 2953.0, 'x': 104138.33866890383, 'y': 430882.45473479026}, 'geometry': {'type': 'Point', 'coordinates': [4.6487835440378635, 51.86417489635055]}}, {'id': '10', 'type': 'Feature', 'properties': {'deviceName': '2953 HC / Project Alblasserdam', 'macAddress': 'a81b6a9ae0df', 'serialNumber': '48ff70067580505251401867', 'Air Pressure': '1003.7', 'CO': '0.0', 'CO2': '451.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.2', 'Ozone': '7.9', 'PM2.5': '22.8', 'Relative Humidity': '44.4', 'TVOC': '24.0', 'Temperature': '20.0', 'Timestamp': '1552649119', 'datetime': '2019-03-15 12:25:00', 'pc6': '2953HC', 'pc4': 2953.0, 'x': 104138.33866890383, 'y': 430882.45473479026}, 'geometry': {'type': 'Point', 'coordinates': [4.6487835440378635, 51.86417489635055]}}, {'id': '11', 'type': 'Feature', 'properties': {'deviceName': '2953 HC / Project Alblasserdam', 'macAddress': '606405acf33d', 'serialNumber': '49ff6c067580485642222067', 'Air Pressure': '1035.2', 'CO': '0.0', 'CO2': '975.0', 'DateTime': '2019-02-26 10:43', 'NO2': '19.4', 'Ozone': '8.0', 'PM2.5': '8.5', 'Relative Humidity': '45.1', 'TVOC': '0.0', 'Temperature': '19.0', 'Timestamp': '1551174195', 'datetime': '2019-02-26 10:43:00', 'pc6': '2953HC', 'pc4': 2953.0, 'x': 104138.33866890383, 'y': 430882.45473479026}, 'geometry': {'type': 'Point', 'coordinates': [4.6487835440378635, 51.86417489635055]}}, {'id': '12', 'type': 'Feature', 'properties': {'deviceName': '2951 HH / Project Alblasserdam', 'macAddress': '606405ace741', 'serialNumber': '49ff71067580485651331367', 'Air Pressure': '1003.6', 'CO': '0.0', 'CO2': '681.0', 'DateTime': '2019-03-15 12:24', 'NO2': '0.1', 'Ozone': '4.8', 'PM2.5': '6.3', 'Relative Humidity': '47.2', 'TVOC': '15.0', 'Temperature': '20.5', 'Timestamp': '1552649073', 'datetime': '2019-03-15 12:24:00', 'pc6': '2951HH', 'pc4': 2951.0, 'x': 105167.12299372452, 'y': 431517.00934367435}, 'geometry': {'type': 'Point', 'coordinates': [4.663626803568363, 51.86997105381214]}}, {'id': '13', 'type': 'Feature', 'properties': {'deviceName': '2951 JG / Project Alblasserdam', 'macAddress': '606405acf78e', 'serialNumber': '49ff72067580485655441767', 'Air Pressure': '1001.3', 'CO': '0.0', 'CO2': '546.0', 'DateTime': '2019-03-15 12:25', 'NO2': '11.3', 'Ozone': '7.8', 'PM2.5': '14.8', 'Relative Humidity': '39.4', 'TVOC': '17.0', 'Temperature': '22.0', 'Timestamp': '1552649116', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951JG', 'pc4': 2951.0, 'x': 104354.16097773775, 'y': 430560.253867502}, 'geometry': {'type': 'Point', 'coordinates': [4.651963940785627, 51.86129870322683]}}, {'id': '14', 'type': 'Feature', 'properties': {'deviceName': '2951 JG / Project Alblasserdam', 'macAddress': '606405acb237', 'serialNumber': '48ff6e067580505237541367', 'Air Pressure': '1002.4', 'CO': '0.0', 'CO2': '550.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.3', 'Ozone': '6.8', 'PM2.5': '25.8', 'Relative Humidity': '48.2', 'TVOC': '123.0', 'Temperature': '19.5', 'Timestamp': '1552649111', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951JG', 'pc4': 2951.0, 'x': 104354.16097773775, 'y': 430560.253867502}, 'geometry': {'type': 'Point', 'coordinates': [4.651963940785627, 51.86129870322683]}}, {'id': '15', 'type': 'Feature', 'properties': {'deviceName': '2951 JG / Project Alblasserdam', 'macAddress': 'a81b6a9aeb50', 'serialNumber': '49ff70067580485649461767', 'Air Pressure': '1001.2', 'CO': '0.0', 'CO2': '597.0', 'DateTime': '2019-03-15 12:26', 'NO2': '4.7', 'Ozone': '7.8', 'PM2.5': '4.7', 'Relative Humidity': '41.4', 'TVOC': '49.0', 'Temperature': '21.6', 'Timestamp': '1552649163', 'datetime': '2019-03-15 12:26:00', 'pc6': '2951JG', 'pc4': 2951.0, 'x': 104354.16097773775, 'y': 430560.253867502}, 'geometry': {'type': 'Point', 'coordinates': [4.651963940785627, 51.86129870322683]}}, {'id': '16', 'type': 'Feature', 'properties': {'deviceName': '2953 XT / Project Alblasserdam', 'macAddress': '606405acae24', 'serialNumber': '49ff72067580485623351367', 'Air Pressure': '1003.0', 'CO': '0.0', 'CO2': '548.0', 'DateTime': '2019-03-15 12:24', 'NO2': '7.3', 'Ozone': '9.8', 'PM2.5': '60.1', 'Relative Humidity': '55.1', 'TVOC': '11.0', 'Temperature': '18.6', 'Timestamp': '1552649097', 'datetime': '2019-03-15 12:24:00', 'pc6': '2953XT', 'pc4': 2953.0, 'x': 103061.71152553103, 'y': 432547.13589054235}, 'geometry': {'type': 'Point', 'coordinates': [4.632903444532086, 51.87903720284938]}}, {'id': '17', 'type': 'Feature', 'properties': {'deviceName': '2953 XT / Project Alblasserdam', 'macAddress': 'a81b6a9ae58f', 'serialNumber': '48ff70067580505226481767', 'Air Pressure': '1002.0', 'CO': '0.0', 'CO2': '448.0', 'DateTime': '2019-03-15 12:25', 'NO2': '9.9', 'Ozone': '10.2', 'PM2.5': '3.8', 'Relative Humidity': '59.7', 'TVOC': '24.0', 'Temperature': '15.8', 'Timestamp': '1552649118', 'datetime': '2019-03-15 12:25:00', 'pc6': '2953XT', 'pc4': 2953.0, 'x': 103061.71152553103, 'y': 432547.13589054235}, 'geometry': {'type': 'Point', 'coordinates': [4.632903444532086, 51.87903720284938]}}, {'id': '18', 'type': 'Feature', 'properties': {'deviceName': '2953 XD / Project Alblasserdam', 'macAddress': '606405acf1d1', 'serialNumber': '48ff76067580505240431367', 'Air Pressure': '1004.5', 'CO': '0.0', 'CO2': '678.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.5', 'Ozone': '5.0', 'PM2.5': '9.7', 'Relative Humidity': '46.8', 'TVOC': '12.0', 'Temperature': '20.7', 'Timestamp': '1552649100', 'datetime': '2019-03-15 12:25:00', 'pc6': '2953XD', 'pc4': 2953.0, 'x': 103415.05788025355, 'y': 431813.5508177045}, 'geometry': {'type': 'Point', 'coordinates': [4.638144421738962, 51.87247681158955]}}, {'id': '19', 'type': 'Feature', 'properties': {'deviceName': '2951 VH / Project Alblasserdam', 'macAddress': 'a81b6a9ae594', 'serialNumber': '49ff76067580485649291867', 'Air Pressure': '1002.4', 'CO': '0.0', 'CO2': '447.0', 'DateTime': '2019-03-15 12:24', 'NO2': '3.3', 'Ozone': '7.2', 'PM2.5': '15.0', 'Relative Humidity': '39.4', 'TVOC': '11.0', 'Temperature': '21.4', 'Timestamp': '1552649075', 'datetime': '2019-03-15 12:24:00', 'pc6': '2951VH', 'pc4': 2951.0, 'x': 105145.31720741333, 'y': 431001.8339174026}, 'geometry': {'type': 'Point', 'coordinates': [4.663384666308675, 51.86533884541635]}}, {'id': '20', 'type': 'Feature', 'properties': {'deviceName': '2951 VH / Project Alblasserdam', 'macAddress': '606405acb0f2', 'serialNumber': '48ff6a067580505243151767', 'Air Pressure': '1003.9', 'CO': '0.0', 'CO2': '1232.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.4', 'Ozone': '7.1', 'PM2.5': '4.2', 'Relative Humidity': '50.7', 'TVOC': '53.0', 'Temperature': '21.9', 'Timestamp': '1552649100', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951VH', 'pc4': 2951.0, 'x': 105145.31720741333, 'y': 431001.8339174026}, 'geometry': {'type': 'Point', 'coordinates': [4.663384666308675, 51.86533884541635]}}, {'id': '21', 'type': 'Feature', 'properties': {'deviceName': '2951 VH / Project Alblasserdam', 'macAddress': '606405a4462c', 'serialNumber': '53ff73067788545138430567', 'Air Pressure': '1004.5', 'CO': '0.0', 'CO2': '602.0', 'DateTime': '2019-03-15 13:25', 'NO2': '1.0', 'Ozone': '8.9', 'PM2.5': '13.9', 'Relative Humidity': '50.3', 'TVOC': '19.0', 'Temperature': '20.3', 'Timestamp': '1552649152', 'datetime': '2019-03-15 13:25:00', 'pc6': '2951VH', 'pc4': 2951.0, 'x': 105145.31720741333, 'y': 431001.8339174026}, 'geometry': {'type': 'Point', 'coordinates': [4.663384666308675, 51.86533884541635]}}, {'id': '22', 'type': 'Feature', 'properties': {'deviceName': '2953 BE / Project Alblasserdam', 'macAddress': '606405acf459', 'serialNumber': '49ff74067580485629291367', 'Air Pressure': '1003.3', 'CO': '0.0', 'CO2': '594.0', 'DateTime': '2019-03-15 12:25', 'NO2': '6.4', 'Ozone': '10.8', 'PM2.5': '4.2', 'Relative Humidity': '54.0', 'TVOC': '29.0', 'Temperature': '20.5', 'Timestamp': '1552649121', 'datetime': '2019-03-15 12:25:00', 'pc6': '2953BE', 'pc4': 2953.0, 'x': 104339.01607201215, 'y': 431597.97343892435}, 'geometry': {'type': 'Point', 'coordinates': [4.6515916983697565, 51.87062405231882]}}, {'id': '23', 'type': 'Feature', 'properties': {'deviceName': '2952 AK / Project Alblasserdam', 'macAddress': '606405acf1a7', 'serialNumber': '49ff72067580485612381667', 'Air Pressure': '1003.2', 'CO': '0.0', 'CO2': '833.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.9', 'Ozone': '7.2', 'PM2.5': '4.0', 'Relative Humidity': '48.9', 'TVOC': '48.0', 'Temperature': '20.6', 'Timestamp': '1552649123', 'datetime': '2019-03-15 12:25:00', 'pc6': '2952AK', 'pc4': 2952.0, 'x': 105082.94566841045, 'y': 430370.27613762184}, 'geometry': {'type': 'Point', 'coordinates': [4.6625705617583035, 51.85965698792576]}}, {'id': '24', 'type': 'Feature', 'properties': {'deviceName': '2952 AK / Project Alblasserdam', 'macAddress': 'a81b6a9ad4ed', 'serialNumber': '48ff76067580505238401467', 'Air Pressure': '1004.3', 'CO': '0.0', 'CO2': '563.0', 'DateTime': '2019-03-15 12:24', 'NO2': '11.6', 'Ozone': '8.1', 'PM2.5': '7.3', 'Relative Humidity': '55.0', 'TVOC': '19.0', 'Temperature': '18.7', 'Timestamp': '1552649095', 'datetime': '2019-03-15 12:24:00', 'pc6': '2952AK', 'pc4': 2952.0, 'x': 105082.94566841045, 'y': 430370.27613762184}, 'geometry': {'type': 'Point', 'coordinates': [4.6625705617583035, 51.85965698792576]}}, {'id': '25', 'type': 'Feature', 'properties': {'deviceName': '2951 AG / Project Alblasserdam', 'macAddress': '606405ace2c2', 'serialNumber': '49ff72067580485617291367', 'Air Pressure': '1003.9', 'CO': '0.0', 'CO2': '509.0', 'DateTime': '2019-03-15 12:25', 'NO2': '7.7', 'Ozone': '7.7', 'PM2.5': '25.1', 'Relative Humidity': '51.7', 'TVOC': '31.0', 'Temperature': '18.8', 'Timestamp': '1552649110', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951AG', 'pc4': 2951.0, 'x': 105303.64548773231, 'y': 430842.0763438874}, 'geometry': {'type': 'Point', 'coordinates': [4.6657062026408855, 51.86391712936577]}}, {'id': '26', 'type': 'Feature', 'properties': {'deviceName': '2951 XV / Project Alblasserdam', 'macAddress': '606405acf32b', 'serialNumber': '48ff6e067580505232341967', 'Air Pressure': '996.5', 'CO': '0.0', 'CO2': '845.0', 'DateTime': '2019-03-14 15:03', 'NO2': '50.5', 'Ozone': '12.9', 'PM2.5': '14.4', 'Relative Humidity': '50.9', 'TVOC': '119.0', 'Temperature': '18.3', 'Timestamp': '1552572190', 'datetime': '2019-03-14 15:03:00', 'pc6': '2951XV', 'pc4': 2951.0, 'x': 105463.63684655375, 'y': 430866.04843028367}, 'geometry': {'type': 'Point', 'coordinates': [4.6680253549793145, 51.864146829581394]}}, {'id': '27', 'type': 'Feature', 'properties': {'deviceName': '2954 BP / Project Alblasserdam', 'macAddress': '606405acf502', 'serialNumber': '49ff72067580485658331367', 'Air Pressure': '1004.4', 'CO': '0.0', 'CO2': '540.0', 'DateTime': '2019-03-15 12:25', 'NO2': '44.5', 'Ozone': '10.3', 'PM2.5': '4.4', 'Relative Humidity': '50.7', 'TVOC': '51.0', 'Temperature': '17.6', 'Timestamp': '1552649112', 'datetime': '2019-03-15 12:25:00', 'pc6': '2954BP', 'pc4': 2954.0, 'x': 104668.69552249354, 'y': 431959.79091314913}, 'geometry': {'type': 'Point', 'coordinates': [4.656325550531225, 51.873905844431256]}}, {'id': '28', 'type': 'Feature', 'properties': {'deviceName': '2951 XW / Project Alblasserdam', 'macAddress': 'a81b6a9ae0a9', 'serialNumber': '48ff74067580505240471367', 'Air Pressure': '1003.1', 'CO': '0.0', 'CO2': '400.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.5', 'Ozone': '6.9', 'PM2.5': '34.8', 'Relative Humidity': '48.8', 'TVOC': '73.0', 'Temperature': '20.9', 'Timestamp': '1552649104', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951XW', 'pc4': 2951.0, 'x': 105426.42954301703, 'y': 431078.19348175137}, 'geometry': {'type': 'Point', 'coordinates': [4.667454728915423, 51.86605022525549]}}, {'id': '29', 'type': 'Feature', 'properties': {'deviceName': '2951 PK / Project Alblasserdam', 'macAddress': '606405acb262', 'serialNumber': '49ff72067580485618491667', 'Air Pressure': '1003.4', 'CO': '0.0', 'CO2': '579.0', 'DateTime': '2019-03-15 12:25', 'NO2': '11.8', 'Ozone': '10.4', 'PM2.5': '31.6', 'Relative Humidity': '56.9', 'TVOC': '3.0', 'Temperature': '18.2', 'Timestamp': '1552649126', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951PK', 'pc4': 2951.0, 'x': 105608.55703261496, 'y': 431431.72755134956}, 'geometry': {'type': 'Point', 'coordinates': [4.670048177355471, 51.869243871301585]}}, {'id': '30', 'type': 'Feature', 'properties': {'deviceName': '2951 VB / Project Alblasserdam', 'macAddress': '606405acf308', 'serialNumber': '49ff74067580485629431667', 'Air Pressure': '1004.7', 'CO': '0.0', 'CO2': '889.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.1', 'Ozone': '4.3', 'PM2.5': '10.9', 'Relative Humidity': '51.6', 'TVOC': '174.0', 'Temperature': '21.1', 'Timestamp': '1552649142', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951VB', 'pc4': 2951.0, 'x': 105075.51806729638, 'y': 431002.9489989633}, 'geometry': {'type': 'Point', 'coordinates': [4.66237119986626, 51.86534261821464]}}, {'id': '31', 'type': 'Feature', 'properties': {'deviceName': '2951 VN / Project Alblasserdam', 'macAddress': '606405acf34a', 'serialNumber': '49ff73067580485647491667', 'Air Pressure': '1003.8', 'CO': '0.0', 'CO2': '901.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.6', 'Ozone': '4.9', 'PM2.5': '3.7', 'Relative Humidity': '54.2', 'TVOC': '101.0', 'Temperature': '19.4', 'Timestamp': '1552649126', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951VN', 'pc4': 2951.0, 'x': 105169.02218395859, 'y': 431250.41779838805}, 'geometry': {'type': 'Point', 'coordinates': [4.663692892851819, 51.86757517106023]}}, {'id': '32', 'type': 'Feature', 'properties': {'deviceName': '2951 VN / Project Alblasserdam', 'macAddress': 'a81b6a9ad967', 'serialNumber': '48ff72067580505244081967', 'Air Pressure': '1021.7', 'CO': '0.0', 'CO2': '448.0', 'DateTime': '2019-02-27 22:34', 'NO2': '19.4', 'Ozone': '15.2', 'PM2.5': '18.3', 'Relative Humidity': '61.6', 'TVOC': '0.0', 'Temperature': '16.3', 'Timestamp': '1551303241', 'datetime': '2019-02-27 22:34:00', 'pc6': '2951VN', 'pc4': 2951.0, 'x': 105169.02218395859, 'y': 431250.41779838805}, 'geometry': {'type': 'Point', 'coordinates': [4.663692892851819, 51.86757517106023]}}, {'id': '33', 'type': 'Feature', 'properties': {'deviceName': '2951 VE / Project Alblasserdam', 'macAddress': '606405acb0d2', 'serialNumber': '49ff70067580485607291367', 'Air Pressure': '1003.6', 'CO': '0.0', 'CO2': '600.0', 'DateTime': '2019-03-15 12:25', 'NO2': '1.2', 'Ozone': '7.2', 'PM2.5': '10.9', 'Relative Humidity': '45.5', 'TVOC': '27.0', 'Temperature': '20.4', 'Timestamp': '1552649137', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951VE', 'pc4': 2951.0, 'x': 104899.17560303428, 'y': 430843.49137874215}, 'geometry': {'type': 'Point', 'coordinates': [4.659834316010386, 51.86389362929139]}}, {'id': '34', 'type': 'Feature', 'properties': {'deviceName': '2953 XJ /Project Alblasserdam', 'macAddress': '606405acb1da', 'serialNumber': '49ff70067580485641261367', 'Air Pressure': '1007.4', 'CO': '0.0', 'CO2': '472.0', 'DateTime': '2019-03-15 01:37', 'NO2': '12.9', 'Ozone': '7.7', 'PM2.5': '3.7', 'Relative Humidity': '43.5', 'TVOC': '30.0', 'Temperature': '18.4', 'Timestamp': '1552610262', 'datetime': '2019-03-15 01:37:00', 'pc6': '2953XJ', 'pc4': 2953.0, 'x': 103425.29290123998, 'y': 431867.9034759807}, 'geometry': {'type': 'Point', 'coordinates': [4.638284902068439, 51.872966263670754]}}, {'id': '35', 'type': 'Feature', 'properties': {'deviceName': '2953 CT / Project Alblasserdam', 'macAddress': '606405acf1c4', 'serialNumber': '48ff6a067580505240351367', 'Air Pressure': '1003.2', 'CO': '0.0', 'CO2': '452.0', 'DateTime': '2019-03-15 12:25', 'NO2': '8.2', 'Ozone': '8.0', 'PM2.5': '9.0', 'Relative Humidity': '45.7', 'TVOC': '25.0', 'Temperature': '20.8', 'Timestamp': '1552649138', 'datetime': '2019-03-15 12:25:00', 'pc6': '2953CT', 'pc4': 2953.0, 'x': 103735.59131024008, 'y': 431752.3490495927}, 'geometry': {'type': 'Point', 'coordinates': [4.642807566671386, 51.87195633630646]}}, {'id': '36', 'type': 'Feature', 'properties': {'deviceName': '2953 CJ / Project Alblasserdam', 'macAddress': 'a81b6a9ae0cd', 'serialNumber': '49ff74067580485617131867', 'Air Pressure': '1003.0', 'CO': '0.0', 'CO2': '542.0', 'DateTime': '2019-03-15 12:25', 'NO2': '6.5', 'Ozone': '7.5', 'PM2.5': '9.6', 'Relative Humidity': '41.3', 'TVOC': '74.0', 'Temperature': '19.6', 'Timestamp': '1552649140', 'datetime': '2019-03-15 12:25:00', 'pc6': '2953CJ', 'pc4': 2953.0, 'x': 104152.09366045208, 'y': 431044.287191501}, 'geometry': {'type': 'Point', 'coordinates': [4.648959372917042, 51.86563065480238]}}, {'id': '37', 'type': 'Feature', 'properties': {'deviceName': '2951 JD / Project Alblasserdam', 'macAddress': '606405acf41f', 'serialNumber': '49ff71067580485631311367', 'Air Pressure': '1003.4', 'CO': '0.0', 'CO2': '595.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.3', 'Ozone': '10.1', 'PM2.5': '11.1', 'Relative Humidity': '53.1', 'TVOC': '15.0', 'Temperature': '18.6', 'Timestamp': '1552649152', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951JD', 'pc4': 2951.0, 'x': 104368.17183377377, 'y': 430706.9578851981}, 'geometry': {'type': 'Point', 'coordinates': [4.652145796139145, 51.86261851072978]}}, {'id': '38', 'type': 'Feature', 'properties': {'deviceName': '2951 JD / Project Alblasserdam', 'macAddress': '606405acafe0', 'serialNumber': '49ff70067580485654281867', 'Air Pressure': '1003.8', 'CO': '0.0', 'CO2': '430.0', 'DateTime': '2019-03-15 12:25', 'NO2': '10.3', 'Ozone': '8.3', 'PM2.5': '7.9', 'Relative Humidity': '47.6', 'TVOC': '12.0', 'Temperature': '19.3', 'Timestamp': '1552649120', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951JD', 'pc4': 2951.0, 'x': 104368.17183377377, 'y': 430706.9578851981}, 'geometry': {'type': 'Point', 'coordinates': [4.652145796139145, 51.86261851072978]}}, {'id': '39', 'type': 'Feature', 'properties': {'deviceName': '2954 BA / Project Alblasserdam', 'macAddress': '606405acf6d8', 'serialNumber': '49ff69067580485641461767', 'Air Pressure': '1004.7', 'CO': '0.0', 'CO2': '724.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.3', 'Ozone': '8.5', 'PM2.5': '27.6', 'Relative Humidity': '49.9', 'TVOC': '1156.0', 'Temperature': '20.4', 'Timestamp': '1552649137', 'datetime': '2019-03-15 12:25:00', 'pc6': '2954BA', 'pc4': 2954.0, 'x': 104467.03167052692, 'y': 431790.6142810521}, 'geometry': {'type': 'Point', 'coordinates': [4.653422145419168, 51.87236707806075]}}, {'id': '40', 'type': 'Feature', 'properties': {'deviceName': '2951 GJ / Project Alblasserdam', 'macAddress': '606405acf6b3', 'serialNumber': '48ff70067580505252281367', 'Air Pressure': '1001.9', 'CO': '0.0', 'CO2': '632.0', 'DateTime': '2019-03-15 12:25', 'NO2': '1.1', 'Ozone': '9.2', 'PM2.5': '71.5', 'Relative Humidity': '47.6', 'TVOC': '142.0', 'Temperature': '20.9', 'Timestamp': '1552649116', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951GJ', 'pc4': 2951.0, 'x': 105459.4270300301, 'y': 430602.0790601154}, 'geometry': {'type': 'Point', 'coordinates': [4.668002143402793, 51.861773966543275]}}, {'id': '41', 'type': 'Feature', 'properties': {'deviceName': '2954 ND / Project Alblasserdam', 'macAddress': 'a81b6a9aeb21', 'serialNumber': '49ff72067580485637301367', 'Air Pressure': '1004.4', 'CO': '0.0', 'CO2': '642.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.6', 'Ozone': '7.0', 'PM2.5': '5.4', 'Relative Humidity': '43.1', 'TVOC': '156.0', 'Temperature': '21.3', 'Timestamp': '1552649117', 'datetime': '2019-03-15 12:25:00', 'pc6': '2954ND', 'pc4': 2954.0, 'x': 105336.33849669596, 'y': 431677.8443831976}, 'geometry': {'type': 'Point', 'coordinates': [4.666060473931189, 51.87143170515778]}}, {'id': '42', 'type': 'Feature', 'properties': {'deviceName': '2954 AA / Project Ablasserdam', 'macAddress': '606405acb245', 'serialNumber': '49ff70067580485632431667', 'Air Pressure': '1004.1', 'CO': '0.0', 'CO2': '400.0', 'DateTime': '2019-03-15 12:25', 'NO2': '3.9', 'Ozone': '7.5', 'PM2.5': '12.3', 'Relative Humidity': '48.8', 'TVOC': '23.0', 'Temperature': '17.9', 'Timestamp': '1552649147', 'datetime': '2019-03-15 12:25:00', 'pc6': '2954AA', 'pc4': 2954.0, 'x': 105156.24209484275, 'y': 431629.26089509006}, 'geometry': {'type': 'Point', 'coordinates': [4.6634526016496896, 51.870978966783774]}}, {'id': '43', 'type': 'Feature', 'properties': {'deviceName': '2951 AT / Project Alblasserdam', 'macAddress': '606405acf423', 'serialNumber': '49ff70067580485653451767', 'Air Pressure': '1016.8', 'CO': '0.0', 'CO2': '542.0', 'DateTime': '2019-03-01 11:40', 'NO2': '42.1', 'Ozone': '9.9', 'PM2.5': '56.2', 'Relative Humidity': '48.6', 'TVOC': '6.0', 'Temperature': '18.8', 'Timestamp': '1551436830', 'datetime': '2019-03-01 11:40:00', 'pc6': '2951AT', 'pc4': 2951.0, 'x': 105164.1222684387, 'y': 430722.9491697561}, 'geometry': {'type': 'Point', 'coordinates': [4.663697953142499, 51.86283398548988]}}, {'id': '44', 'type': 'Feature', 'properties': {'deviceName': '3355 AA / Project Alblasserdam', 'macAddress': '606405acb0cd', 'serialNumber': '49ff73067580485650381667', 'Air Pressure': '1006.4', 'CO': '0.6', 'CO2': '2078.0', 'DateTime': '2019-01-13 21:39', 'NO2': '15.6', 'Ozone': '10.0', 'PM2.5': '18.7', 'Relative Humidity': '70.5', 'TVOC': '45.0', 'Temperature': '20.5', 'Timestamp': '1547411973', 'datetime': '2019-01-13 21:39:00', 'pc6': '3355AA', 'pc4': 3355.0, 'x': 107633.75260999044, 'y': 427693.820153462}, 'geometry': {'type': 'Point', 'coordinates': [4.699964446977091, 51.83582414088034]}}, {'id': '45', 'type': 'Feature', 'properties': {'deviceName': '2953 EZ / Project Alblasserdam', 'macAddress': '606405acae3e', 'serialNumber': '49ff72067580485644381667', 'Air Pressure': '1003.3', 'CO': '0.0', 'CO2': '425.0', 'DateTime': '2019-03-15 12:25', 'NO2': '11.7', 'Ozone': '14.6', 'PM2.5': '58.4', 'Relative Humidity': '50.8', 'TVOC': '1.0', 'Temperature': '19.3', 'Timestamp': '1552649109', 'datetime': '2019-03-15 12:25:00', 'pc6': '2953EZ', 'pc4': 2953.0, 'x': 103861.06877931042, 'y': 431888.12668354454}, 'geometry': {'type': 'Point', 'coordinates': [4.644609305650088, 51.87318819607706]}}, {'id': '46', 'type': 'Feature', 'properties': {'deviceName': '2951 AW / Project Alblasserdam', 'macAddress': '606405acb27a', 'serialNumber': '49ff74067580485660381667', 'Air Pressure': '1004.5', 'CO': '0.0', 'CO2': '443.0', 'DateTime': '2019-03-15 12:25', 'NO2': '1.8', 'Ozone': '9.6', 'PM2.5': '16.2', 'Relative Humidity': '59.6', 'TVOC': '22.0', 'Temperature': '15.3', 'Timestamp': '1552649119', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951AW', 'pc4': 2951.0, 'x': 105303.8647371557, 'y': 430667.0479772387}, 'geometry': {'type': 'Point', 'coordinates': [4.665734596478663, 51.86234403965355]}}, {'id': '47', 'type': 'Feature', 'properties': {'deviceName': '2953 WL /ProjectAlblasserdam', 'macAddress': '606405acb0b0', 'serialNumber': '49ff76067580485618441667', 'Air Pressure': '1003.7', 'CO': '0.0', 'CO2': '696.0', 'DateTime': '2019-03-15 12:25', 'NO2': '4.2', 'Ozone': '13.6', 'PM2.5': '18.1', 'Relative Humidity': '50.0', 'TVOC': '46.0', 'Temperature': '20.2', 'Timestamp': '1552649139', 'datetime': '2019-03-15 12:25:00', 'pc6': '2953WL', 'pc4': 2953.0, 'x': 103978.60688748815, 'y': 431650.7432233642}, 'geometry': {'type': 'Point', 'coordinates': [4.646351071861922, 51.87106544247583]}}, {'id': '48', 'type': 'Feature', 'properties': {'deviceName': '2951 CN / Project Alblasserdam', 'macAddress': '606405acf04e', 'serialNumber': '49ff70067580485609441667', 'Air Pressure': '1004.5', 'CO': '0.0', 'CO2': '643.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.8', 'Ozone': '6.8', 'PM2.5': '6.3', 'Relative Humidity': '63.2', 'TVOC': '143.0', 'Temperature': '16.6', 'Timestamp': '1552649138', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951CN', 'pc4': 2951.0, 'x': 104606.55794934698, 'y': 430898.35573864647}, 'geometry': {'type': 'Point', 'coordinates': [4.6555783831155395, 51.864360349550445]}}, {'id': '49', 'type': 'Feature', 'properties': {'deviceName': '2953 HB / Project Alblasserdam', 'macAddress': 'a81b6a9ae0f4', 'serialNumber': '49ff6e067580485632491667', 'Air Pressure': '1004.2', 'CO': '0.0', 'CO2': '550.0', 'DateTime': '2019-03-15 12:25', 'NO2': '1.0', 'Ozone': '4.4', 'PM2.5': '11.5', 'Relative Humidity': '48.1', 'TVOC': '115.0', 'Temperature': '19.6', 'Timestamp': '1552649139', 'datetime': '2019-03-15 12:25:00', 'pc6': '2953HB', 'pc4': 2953.0, 'x': 104357.33127389438, 'y': 431134.66165163764}, 'geometry': {'type': 'Point', 'coordinates': [4.651925644362775, 51.86646160526745]}}, {'id': '50', 'type': 'Feature', 'properties': {'deviceName': '2953 HA /Project Alblasserdam', 'macAddress': '606405acb43e', 'serialNumber': '49ff73067580485638461767', 'Air Pressure': '1024.8', 'CO': '0.0', 'CO2': '517.0', 'DateTime': '2019-03-11 18:17', 'NO2': '6.5', 'Ozone': '14.5', 'PM2.5': '14.1', 'Relative Humidity': '35.7', 'TVOC': '366.0', 'Temperature': '19.9', 'Timestamp': '1552324656', 'datetime': '2019-03-11 18:17:00', 'pc6': '2953HA', 'pc4': 2953.0, 'x': 104436.02297296736, 'y': 431073.38486817764}, 'geometry': {'type': 'Point', 'coordinates': [4.653077055035219, 51.86591801347253]}}, {'id': '51', 'type': 'Feature', 'properties': {'deviceName': '2953 XA / Project Alblassertdam', 'macAddress': '606405acb0c3', 'serialNumber': '49ff72067580485624431667', 'Air Pressure': '1004.1', 'CO': '0.0', 'CO2': '485.0', 'DateTime': '2019-03-15 12:25', 'NO2': '8.9', 'Ozone': '8.2', 'PM2.5': '45.7', 'Relative Humidity': '51.6', 'TVOC': '47.0', 'Temperature': '19.7', 'Timestamp': '1552649159', 'datetime': '2019-03-15 12:25:00', 'pc6': '2953XA', 'pc4': 2953.0, 'x': 103536.02013550609, 'y': 431785.4707383874}, 'geometry': {'type': 'Point', 'coordinates': [4.639904946240937, 51.87223562391267]}}, {'id': '52', 'type': 'Feature', 'properties': {'deviceName': '2951 PA / Project Alblasserdam', 'macAddress': '606405acf337', 'serialNumber': '48ff75067580505248151667', 'Air Pressure': '1003.9', 'CO': '0.0', 'CO2': '543.0', 'DateTime': '2019-03-15 12:25', 'NO2': '10.7', 'Ozone': '13.5', 'PM2.5': '6.8', 'Relative Humidity': '56.8', 'TVOC': '22.0', 'Temperature': '16.9', 'Timestamp': '1552649132', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951PA', 'pc4': 2951.0, 'x': 105787.42128978197, 'y': 431449.990702455}, 'geometry': {'type': 'Point', 'coordinates': [4.672642453118662, 51.86942384302633]}}, {'id': '53', 'type': 'Feature', 'properties': {'deviceName': '2951 DB / Project Alblasserdam', 'macAddress': '606405acad38', 'serialNumber': '49ff73067580485625391967', 'Air Pressure': '1004.3', 'CO': '0.0', 'CO2': '886.0', 'DateTime': '2019-03-15 12:25', 'NO2': '8.0', 'Ozone': '9.3', 'PM2.5': '21.5', 'Relative Humidity': '48.0', 'TVOC': '85.0', 'Temperature': '21.3', 'Timestamp': '1552649147', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951DB', 'pc4': 2951.0, 'x': 105148.43050094946, 'y': 431434.59094680526}, 'geometry': {'type': 'Point', 'coordinates': [4.663367320973592, 51.8692286274886]}}, {'id': '54', 'type': 'Feature', 'properties': {'deviceName': '2951 GG / Project Alblasserdam', 'macAddress': '606405ace561', 'serialNumber': '48ff74067580505237491367', 'Air Pressure': '997.5', 'CO': '0.0', 'CO2': '531.0', 'DateTime': '2019-01-31 10:50', 'NO2': '0.5', 'Ozone': '7.8', 'PM2.5': '93.8', 'Relative Humidity': '32.7', 'TVOC': '80.0', 'Temperature': '20.2', 'Timestamp': '1548928241', 'datetime': '2019-01-31 10:50:00', 'pc6': '2951GG', 'pc4': 2951.0, 'x': 105044.343541395, 'y': 430541.9666284378}, 'geometry': {'type': 'Point', 'coordinates': [4.661985372404269, 51.86119663793743]}}, {'id': '55', 'type': 'Feature', 'properties': {'deviceName': '2951 ER / Project Alblasserdam', 'macAddress': '606405acad52', 'serialNumber': '49ff6e067580485633281467', 'Air Pressure': '1003.0', 'CO': '0.0', 'CO2': '415.0', 'DateTime': '2019-03-15 12:10', 'NO2': '18.0', 'Ozone': '8.1', 'PM2.5': '29.0', 'Relative Humidity': '39.2', 'TVOC': '0.0', 'Temperature': '22.1', 'Timestamp': '1552648224', 'datetime': '2019-03-15 12:10:00', 'pc6': '2951ER', 'pc4': 2951.0, 'x': 104788.64866542941, 'y': 430894.55895891413}, 'geometry': {'type': 'Point', 'coordinates': [4.658222367740549, 51.86434266254493]}}, {'id': '56', 'type': 'Feature', 'properties': {'deviceName': '2954 BL / Project Alblasserdam', 'macAddress': 'a81b6a9ae0be', 'serialNumber': '48ff6c067580505251251867', 'Air Pressure': '1003.9', 'CO': '0.0', 'CO2': '441.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.3', 'Ozone': '9.3', 'PM2.5': '8.2', 'Relative Humidity': '47.8', 'TVOC': '65.0', 'Temperature': '19.3', 'Timestamp': '1552649151', 'datetime': '2019-03-15 12:25:00', 'pc6': '2954BL', 'pc4': 2954.0, 'x': 104716.80345857094, 'y': 431720.45885117375}, 'geometry': {'type': 'Point', 'coordinates': [4.657058984969572, 51.87175914068789]}}, {'id': '57', 'type': 'Feature', 'properties': {'deviceName': '2954 BE / Project Alblasserdam', 'macAddress': '606405acb200', 'serialNumber': '49ff70067580485650282067', 'Air Pressure': '1004.2', 'CO': '0.0', 'CO2': '634.0', 'DateTime': '2019-03-15 12:26', 'NO2': '0.6', 'Ozone': '5.0', 'PM2.5': '16.8', 'Relative Humidity': '48.3', 'TVOC': '1156.0', 'Temperature': '21.2', 'Timestamp': '1552649174', 'datetime': '2019-03-15 12:26:00', 'pc6': '2954BE', 'pc4': 2954.0, 'x': 104490.61488863114, 'y': 431739.9653917526}, 'geometry': {'type': 'Point', 'coordinates': [4.6537719846594126, 51.871913999189175]}}, {'id': '58', 'type': 'Feature', 'properties': {'deviceName': '2954 BE / Project Alblasserdam', 'macAddress': 'a81b6a9ad930', 'serialNumber': '48ff76067580505246451867', 'Air Pressure': '1003.7', 'CO': '0.0', 'CO2': '536.0', 'DateTime': '2019-03-15 12:23', 'NO2': '15.6', 'Ozone': '8.1', 'PM2.5': '3.8', 'Relative Humidity': '52.7', 'TVOC': '1.0', 'Temperature': '17.8', 'Timestamp': '1552649010', 'datetime': '2019-03-15 12:23:00', 'pc6': '2954BE', 'pc4': 2954.0, 'x': 104490.61488863114, 'y': 431739.9653917526}, 'geometry': {'type': 'Point', 'coordinates': [4.6537719846594126, 51.871913999189175]}}, {'id': '59', 'type': 'Feature', 'properties': {'deviceName': '2953 CN / Project Alblasserdam', 'macAddress': '606405acb265', 'serialNumber': '49ff6a067580485629221967', 'Air Pressure': '1003.3', 'CO': '0.0', 'CO2': '1508.0', 'DateTime': '2019-03-15 12:26', 'NO2': '0.3', 'Ozone': '8.2', 'PM2.5': '33.2', 'Relative Humidity': '56.4', 'TVOC': '35.0', 'Temperature': '19.5', 'Timestamp': '1552649186', 'datetime': '2019-03-15 12:26:00', 'pc6': '2953CN', 'pc4': 2953.0, 'x': 103499.42966465857, 'y': 431564.74737042096}, 'geometry': {'type': 'Point', 'coordinates': [4.639406628142007, 51.870248450137154]}}, {'id': '60', 'type': 'Feature', 'properties': {'deviceName': '2954 PC / Project Alblasserdam', 'macAddress': '606405acf1a2', 'serialNumber': '49ff72067580485628441767', 'Air Pressure': '1004.2', 'CO': '0.0', 'CO2': '902.0', 'DateTime': '2019-03-15 12:26', 'NO2': '0.2', 'Ozone': '7.2', 'PM2.5': '33.5', 'Relative Humidity': '47.0', 'TVOC': '43.0', 'Temperature': '20.0', 'Timestamp': '1552649166', 'datetime': '2019-03-15 12:26:00', 'pc6': '2954PC', 'pc4': 2954.0, 'x': 104817.58294736255, 'y': 431691.00094602647}, 'geometry': {'type': 'Point', 'coordinates': [4.658526539645879, 51.87150346811622]}}, {'id': '61', 'type': 'Feature', 'properties': {'deviceName': '2951 PN / Project Alblasserdam', 'macAddress': 'a81b6a9ae5ea', 'serialNumber': '48ff74067580505259392067', 'Air Pressure': '1003.2', 'CO': '0.0', 'CO2': '442.0', 'DateTime': '2019-03-15 12:26', 'NO2': '10.8', 'Ozone': '9.9', 'PM2.5': '19.1', 'Relative Humidity': '59.4', 'TVOC': '3.0', 'Temperature': '18.0', 'Timestamp': '1552649187', 'datetime': '2019-03-15 12:26:00', 'pc6': '2951PN', 'pc4': 2951.0, 'x': 105663.41796120623, 'y': 431455.0096880625}, 'geometry': {'type': 'Point', 'coordinates': [4.670841357723621, 51.86945798569486]}}, {'id': '62', 'type': 'Feature', 'properties': {'deviceName': '2969 BT / Project Alblasserdam', 'macAddress': 'a81b6a9ae2ab', 'serialNumber': '48ff75067580505219521767', 'Air Pressure': '1019.5', 'CO': '0.0', 'CO2': '1349.0', 'DateTime': '2018-12-18 12:17', 'NO2': '0.7', 'Ozone': '7.5', 'PM2.5': '4.2', 'Relative Humidity': '56.7', 'TVOC': '41.0', 'Temperature': '17.6', 'Timestamp': '1545131875', 'datetime': '2018-12-18 12:17:00', 'pc6': '2969BT', 'pc4': 2969.0, 'x': 108248.81806906153, 'y': 430049.60101183545}, 'geometry': {'type': 'Point', 'coordinates': [4.7085689032818685, 51.857049384338055]}}, {'id': '63', 'type': 'Feature', 'properties': {'deviceName': '2954 PB / Project Alblasserdam', 'macAddress': '606405acf1bd', 'serialNumber': '49ff76067580485637441767', 'Air Pressure': '1003.9', 'CO': '0.0', 'CO2': '483.0', 'DateTime': '2019-03-15 12:25', 'NO2': '3.4', 'Ozone': '10.3', 'PM2.5': '3.7', 'Relative Humidity': '52.8', 'TVOC': '8.0', 'Temperature': '19.2', 'Timestamp': '1552649139', 'datetime': '2019-03-15 12:25:00', 'pc6': '2954PB', 'pc4': 2954.0, 'x': 104851.89883777537, 'y': 431659.5552295856}, 'geometry': {'type': 'Point', 'coordinates': [4.6590293591295335, 51.871223932761865]}}, {'id': '64', 'type': 'Feature', 'properties': {'deviceName': '2953 GC / Project Alblasserdam', 'macAddress': 'a81b6a9ae2f5', 'serialNumber': '48ff6e067580505229081467', 'Air Pressure': '1003.7', 'CO': '0.0', 'CO2': '764.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.4', 'Ozone': '7.7', 'PM2.5': '25.1', 'Relative Humidity': '48.5', 'TVOC': '57.0', 'Temperature': '20.3', 'Timestamp': '1552649159', 'datetime': '2019-03-15 12:25:00', 'pc6': '2953GC', 'pc4': 2953.0, 'x': 103394.00290096687, 'y': 432111.10494611855}, 'geometry': {'type': 'Point', 'coordinates': [4.637794178796906, 51.875149183247665]}}, {'id': '65', 'type': 'Feature', 'properties': {'deviceName': '2951 EC / Project Alblasserdam', 'macAddress': 'a81b6a9ae585', 'serialNumber': '48ff6f067580505217131767', 'Air Pressure': '1004.2', 'CO': '0.0', 'CO2': '522.0', 'DateTime': '2019-03-15 12:25', 'NO2': '0.5', 'Ozone': '5.2', 'PM2.5': '3.3', 'Relative Humidity': '52.7', 'TVOC': '64.0', 'Temperature': '20.4', 'Timestamp': '1552649142', 'datetime': '2019-03-15 12:25:00', 'pc6': '2951EC', 'pc4': 2951.0, 'x': 104384.9529356474, 'y': 430878.7443331277}, 'geometry': {'type': 'Point', 'coordinates': [4.652364197677537, 51.864164003148694]}}, {'id': '66', 'type': 'Feature', 'properties': {'deviceName': '2951 WB / Project Alblasserdam', 'macAddress': '606405acb261', 'serialNumber': '48ff73067580505240411367', 'Air Pressure': '1003.8', 'CO': '0.0', 'CO2': '912.0', 'DateTime': '2019-03-15 12:26', 'NO2': '0.6', 'Ozone': '8.9', 'PM2.5': '28.8', 'Relative Humidity': '47.6', 'TVOC': '57.0', 'Temperature': '21.0', 'Timestamp': '1552649174', 'datetime': '2019-03-15 12:26:00', 'pc6': '2951WB', 'pc4': 2951.0, 'x': 105364.59710984299, 'y': 430946.6375300503}, 'geometry': {'type': 'Point', 'coordinates': [4.666575993547738, 51.86486233042584]}}]}
# Create a Map
maap = ipyleaflet.Map(
center=(51.8703, 4.6702),
zoom=12
)
layer = ipyleaflet.GeoJSON(data=data)
def hover_handler(properties=None, event=None, id=None, type=None, coordinates=tuple):
print(properties)
layer.on_click(hover_handler)
maap.add_layer(layer)
maap
# Get Station data
query = "SELECT * FROM luchtmeetnet_openapi_stations LIMIT 150"
con = postgres_test()
luchst_df = gpd.GeoDataFrame.from_postgis(query, con, geom_col='geom' )
luchst_df.plot()
<matplotlib.axes._subplots.AxesSubplot at 0x1f76134cba8>
#Logic for get nearest station for all the points
def get_nearest_station_id(geom, df2, geometry_col):
df2['distance'] = df2[geometry_col].distance(geom)
return df2.sort_values(by=['distance'])[['number', 'distance']].values[0]
# Get Nearest Station
geo_df_ = geo_df.to_crs(epsg=28992)
luchst_df_ = luchst_df.to_crs(epsg=28992)
geo_df_[['luchst_number', 'luchst_distance']] = geo_df_.apply(lambda x: get_nearest_station_id(x['geometry'], luchst_df_, 'geom'), axis=1, result_type= 'expand')
geo_df = geo_df.join(geo_df_[['luchst_number', 'luchst_distance']])
geo_df
deviceName | macAddress | serialNumber | Air Pressure | CO | CO2 | DateTime | NO2 | Ozone | PM2.5 | ... | Temperature | Timestamp | datetime | pc6 | pc4 | x | y | geometry | luchst_number | luchst_distance | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 2951 BE / Project Ablasserdam | 606405acf1e5 | 49ff76067580485655301867 | 1013.7 | 0.0 | 485.0 | 2019-03-08 09:49 | 18.2 | 10.9 | 5.7 | ... | 10.2 | 1552034949 | 2019-03-08 09:49:00 | 2951BE | 2951.0 | 104986.141167 | 431261.367223 | POINT (4.66103620904929 51.86765719595473) | NL01908 | 1087.391620 |
1 | 2951 BE / Project Ablasserdam | a81b6a9ae855 | 48ff72067580505235331667 | 1012.2 | 0.0 | 528.0 | 2019-03-08 09:49 | 4.9 | 10.2 | 38.8 | ... | 16.3 | 1552034942 | 2019-03-08 09:49:00 | 2951BE | 2951.0 | 104986.141167 | 431261.367223 | POINT (4.66103620904929 51.86765719595473) | NL01908 | 1087.391620 |
2 | 2951 PM / Project Alblasserdam | 606405acd6e2 | 48ff72067580505252431467 | 1011.7 | 0.0 | 601.0 | 2019-03-08 09:48 | 42.6 | 14.6 | 6.2 | ... | 20.7 | 1552034935 | 2019-03-08 09:48:00 | 2951PM | 2951.0 | 105656.167100 | 431517.265449 | POINT (4.6707271772421 51.8700168821404) | NL01908 | 1533.355217 |
3 | 2953 AM / Project Alblasserdam | a81b6a9ad4ff | 48ff6c067580505240571367 | 1011.5 | 0.0 | 786.0 | 2019-03-08 09:48 | 0.1 | 7.8 | 6.8 | ... | 20.0 | 1552034925 | 2019-03-08 09:48:00 | 2953AM | 2953.0 | 104442.317284 | 431414.477687 | POINT (4.653118439552964 51.86898422920255) | NL01908 | 1324.152958 |
4 | 2951 HB / Project Alblasserdam | 606405acf51f | 49ff6d067580485648301367 | 1024.4 | 0.0 | 1510.0 | 2018-12-04 15:34 | 19.4 | 8.7 | 10.8 | ... | 20.3 | 1543934068 | 2018-12-04 15:34:00 | 2951HB | 2951.0 | 105268.590241 | 431539.562700 | POINT (4.665096748820099 51.87018282349947) | NL01908 | 1408.893940 |
5 | 2953 WB / Project Alblasserdam | 606405acf6d4 | 30ff70064d48303544172543 | 1012.0 | 0.0 | 486.0 | 2019-03-08 11:50 | 48.5 | 10.0 | 35.3 | ... | 19.6 | 1552035022 | 2019-03-08 11:50:00 | 2953WB | 2953.0 | 104120.203803 | 431567.387576 | POINT (4.648419250645758 51.87032921600763) | NL01908 | 1600.569085 |
6 | 2953 WB / Project Alblasserdam | 606405acb241 | 48ff6e067580505240551367 | 1011.8 | 0.0 | 451.0 | 2019-03-08 09:50 | 53.6 | 10.2 | 4.7 | ... | 19.2 | 1552035004 | 2019-03-08 09:50:00 | 2953WB | 2953.0 | 104120.203803 | 431567.387576 | POINT (4.648419250645758 51.87032921600763) | NL01908 | 1600.569085 |
7 | 2953 BB / Project Alblasserdam | 606405acf1d7 | 49ff6c067580485635281367 | 1012.0 | 0.0 | 553.0 | 2019-03-08 09:48 | 20.0 | 8.5 | 3.1 | ... | 20.5 | 1552034920 | 2019-03-08 09:48:00 | 2953BB | 2953.0 | 104393.792409 | 431587.771284 | POINT (4.652388499674358 51.8705373364708) | NL01908 | 1503.474796 |
8 | 2952 AH / Project Alblasserdam | 606405ace2b3 | 49ff6c067580485629261367 | 1012.1 | 0.0 | 630.0 | 2019-03-08 09:49 | 5.8 | 7.6 | 11.1 | ... | 19.5 | 1552034992 | 2019-03-08 09:49:00 | 2952AH | 2952.0 | 105056.215168 | 430312.525493 | POINT (4.662190910466406 51.85913554548875) | NL01908 | 198.114291 |
9 | 2953 HC / Project Alblasserdam | 606405acf440 | 49ff68067580485646301367 | 1011.7 | 0.0 | 691.0 | 2019-03-08 09:49 | 0.3 | 5.9 | 38.0 | ... | 21.4 | 1552034954 | 2019-03-08 09:49:00 | 2953HC | 2953.0 | 104138.338669 | 430882.454735 | POINT (4.648783544037864 51.86417489635055) | NL01908 | 1047.482782 |
10 | 2953 HC / Project Alblasserdam | a81b6a9ae0df | 48ff70067580505251401867 | 1011.8 | 0.0 | 624.0 | 2019-03-08 09:49 | 37.9 | 10.3 | 22.1 | ... | 20.5 | 1552034968 | 2019-03-08 09:49:00 | 2953HC | 2953.0 | 104138.338669 | 430882.454735 | POINT (4.648783544037864 51.86417489635055) | NL01908 | 1047.482782 |
11 | 2953 HC / Project Alblasserdam | 606405acf33d | 49ff6c067580485642222067 | 1035.2 | 0.0 | 975.0 | 2019-02-26 10:43 | 19.4 | 8.0 | 8.5 | ... | 19.0 | 1551174195 | 2019-02-26 10:43:00 | 2953HC | 2953.0 | 104138.338669 | 430882.454735 | POINT (4.648783544037864 51.86417489635055) | NL01908 | 1047.482782 |
12 | 2951 HH / Project Alblasserdam | 606405ace741 | 49ff71067580485651331367 | 1011.8 | 0.0 | 819.0 | 2019-03-08 09:49 | 0.5 | 5.4 | 3.2 | ... | 20.5 | 1552034990 | 2019-03-08 09:49:00 | 2951HH | 2951.0 | 105167.122994 | 431517.009344 | POINT (4.663626803568363 51.86997105381214) | NL01908 | 1364.542411 |
13 | 2951 JG / Project Alblasserdam | 606405acf78e | 49ff72067580485655441767 | 1009.5 | 0.0 | 553.0 | 2019-03-08 09:47 | 7.5 | 8.4 | 18.7 | ... | 21.0 | 1552034870 | 2019-03-08 09:47:00 | 2951JG | 2951.0 | 104354.160978 | 430560.253868 | POINT (4.651963940785627 51.86129870322683) | NL01908 | 677.246907 |
14 | 2951 JG / Project Alblasserdam | 606405acb237 | 48ff6e067580505237541367 | 1010.3 | 0.0 | 639.0 | 2019-03-08 09:50 | 34.0 | 9.4 | 57.0 | ... | 19.8 | 1552035028 | 2019-03-08 09:50:00 | 2951JG | 2951.0 | 104354.160978 | 430560.253868 | POINT (4.651963940785627 51.86129870322683) | NL01908 | 677.246907 |
15 | 2951 JG / Project Alblasserdam | a81b6a9aeb50 | 49ff70067580485649461767 | 1009.5 | 0.0 | 646.0 | 2019-03-08 09:49 | 6.2 | 7.8 | 8.2 | ... | 21.8 | 1552034969 | 2019-03-08 09:49:00 | 2951JG | 2951.0 | 104354.160978 | 430560.253868 | POINT (4.651963940785627 51.86129870322683) | NL01908 | 677.246907 |
16 | 2953 XT / Project Alblasserdam | 606405acae24 | 49ff72067580485623351367 | 1011.3 | 0.0 | 610.0 | 2019-03-08 09:48 | 5.7 | 8.3 | 65.3 | ... | 17.4 | 1552034910 | 2019-03-08 09:48:00 | 2953XT | 2953.0 | 103061.711526 | 432547.135891 | POINT (4.632903444532086 51.87903720284938) | NL01908 | 3007.357533 |
17 | 2953 XT / Project Alblasserdam | a81b6a9ae58f | 48ff70067580505226481767 | 1010.4 | 0.0 | 649.0 | 2019-03-08 09:50 | 0.6 | 5.7 | 4.6 | ... | 15.9 | 1552035016 | 2019-03-08 09:50:00 | 2953XT | 2953.0 | 103061.711526 | 432547.135891 | POINT (4.632903444532086 51.87903720284938) | NL01908 | 3007.357533 |
18 | 2953 XD / Project Alblasserdam | 606405acf1d1 | 48ff76067580505240431367 | 1004.1 | 0.0 | 805.0 | 2019-02-09 14:02 | 0.3 | 8.6 | 43.8 | ... | 21.6 | 1549717374 | 2019-02-09 14:02:00 | 2953XD | 2953.0 | 103415.057880 | 431813.550818 | POINT (4.638144421738962 51.87247681158955) | NL01908 | 2218.411096 |
19 | 2951 VH / Project Alblasserdam | a81b6a9ae594 | 49ff76067580485649291867 | 1010.5 | 0.0 | 512.0 | 2019-03-08 09:49 | 16.4 | 8.2 | 13.8 | ... | 21.6 | 1552034974 | 2019-03-08 09:49:00 | 2951VH | 2951.0 | 105145.317207 | 431001.833917 | POINT (4.663384666308675 51.86533884541635) | NL01908 | 857.634706 |
20 | 2951 VH / Project Alblasserdam | 606405acb0f2 | 48ff6a067580505243151767 | 1012.1 | 0.0 | 480.0 | 2019-03-08 09:49 | 45.2 | 10.3 | 35.3 | ... | 21.8 | 1552034958 | 2019-03-08 09:49:00 | 2951VH | 2951.0 | 105145.317207 | 431001.833917 | POINT (4.663384666308675 51.86533884541635) | NL01908 | 857.634706 |
21 | 2951 VH / Project Alblasserdam | 606405a4462c | 53ff73067788545138430567 | 1012.7 | 0.0 | 742.0 | 2019-03-08 10:50 | 16.6 | 8.3 | 4.5 | ... | 19.4 | 1552035032 | 2019-03-08 10:50:00 | 2951VH | 2951.0 | 105145.317207 | 431001.833917 | POINT (4.663384666308675 51.86533884541635) | NL01908 | 857.634706 |
22 | 2953 BE / Project Alblasserdam | 606405acf459 | 49ff74067580485629291367 | 1011.5 | 0.0 | 532.0 | 2019-03-08 09:50 | 0.2 | 8.2 | 3.7 | ... | 21.8 | 1552035011 | 2019-03-08 09:50:00 | 2953BE | 2953.0 | 104339.016072 | 431597.973439 | POINT (4.651591698369757 51.87062405231882) | NL01908 | 1532.686689 |
23 | 2952 AK / Project Alblasserdam | 606405acf1a7 | 49ff72067580485612381667 | 1011.3 | 0.0 | 804.0 | 2019-03-08 09:50 | 30.5 | 9.7 | 5.1 | ... | 20.8 | 1552035025 | 2019-03-08 09:50:00 | 2952AK | 2952.0 | 105082.945668 | 430370.276138 | POINT (4.662570561758304 51.85965698792576) | NL01908 | 258.284295 |
24 | 2952 AK / Project Alblasserdam | a81b6a9ad4ed | 48ff76067580505238401467 | 1012.5 | 0.0 | 662.0 | 2019-03-08 09:48 | 6.6 | 8.3 | 9.6 | ... | 18.1 | 1552034917 | 2019-03-08 09:48:00 | 2952AK | 2952.0 | 105082.945668 | 430370.276138 | POINT (4.662570561758304 51.85965698792576) | NL01908 | 258.284295 |
25 | 2951 AG / Project Alblasserdam | 606405ace2c2 | 49ff72067580485617291367 | 1012.0 | 0.0 | 965.0 | 2019-03-08 09:49 | 33.0 | 9.4 | 9.8 | ... | 21.2 | 1552034997 | 2019-03-08 09:49:00 | 2951AG | 2951.0 | 105303.645488 | 430842.076344 | POINT (4.665706202640886 51.86391712936577) | NL01908 | 772.166780 |
26 | 2951 XV / Project Alblasserdam | 606405acf32b | 48ff6e067580505232341967 | 1011.1 | 0.0 | 759.0 | 2019-03-08 09:48 | 32.8 | 11.4 | 8.8 | ... | 18.6 | 1552034884 | 2019-03-08 09:48:00 | 2951XV | 2951.0 | 105463.636847 | 430866.048430 | POINT (4.668025354979314 51.86414682958139) | NL01908 | 882.940936 |
27 | 2954 BP / Project Alblasserdam | 606405acf502 | 49ff72067580485658331367 | 1012.5 | 0.0 | 528.0 | 2019-03-08 09:48 | 41.5 | 10.0 | 9.0 | ... | 18.3 | 1552034938 | 2019-03-08 09:48:00 | 2954BP | 2954.0 | 104668.695522 | 431959.790913 | POINT (4.656325550531225 51.87390584443126) | NL01908 | 1799.843652 |
28 | 2951 XW / Project Alblasserdam | a81b6a9ae0a9 | 48ff74067580505240471367 | 1011.3 | 0.0 | 1550.0 | 2019-03-08 09:50 | 54.4 | 9.9 | 34.8 | ... | 20.8 | 1552035006 | 2019-03-08 09:50:00 | 2951XW | 2951.0 | 105426.429543 | 431078.193482 | POINT (4.667454728915423 51.86605022525549) | NL01908 | 1038.031751 |
29 | 2951 PK / Project Alblasserdam | 606405acb262 | 49ff72067580485618491667 | 1011.6 | 0.0 | 749.0 | 2019-03-08 09:50 | 23.6 | 9.1 | 5.3 | ... | 18.0 | 1552035012 | 2019-03-08 09:50:00 | 2951PK | 2951.0 | 105608.557033 | 431431.727551 | POINT (4.670048177355471 51.86924387130158) | NL01908 | 1435.460207 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
37 | 2951 JD / Project Alblasserdam | 606405acf41f | 49ff71067580485631311367 | 1011.6 | 0.0 | 790.0 | 2019-03-08 09:49 | 7.5 | 7.8 | 6.1 | ... | 17.4 | 1552034956 | 2019-03-08 09:49:00 | 2951JD | 2951.0 | 104368.171834 | 430706.957885 | POINT (4.652145796139145 51.86261851072978) | NL01908 | 759.831122 |
38 | 2951 JD / Project Alblasserdam | 606405acafe0 | 49ff70067580485654281867 | 1011.9 | 0.0 | 915.0 | 2019-03-08 09:50 | 10.8 | 9.0 | 23.1 | ... | 19.6 | 1552035022 | 2019-03-08 09:50:00 | 2951JD | 2951.0 | 104368.171834 | 430706.957885 | POINT (4.652145796139145 51.86261851072978) | NL01908 | 759.831122 |
39 | 2954 BA / Project Alblasserdam | 606405acf6d8 | 49ff69067580485641461767 | 1012.4 | 0.0 | 400.0 | 2019-03-08 09:07 | 10.3 | 8.0 | 30.2 | ... | 17.2 | 1552032476 | 2019-03-08 09:07:00 | 2954BA | 2954.0 | 104467.031671 | 431790.614281 | POINT (4.653422145419168 51.87236707806075) | NL01908 | 1674.379865 |
40 | 2951 GJ / Project Alblasserdam | 606405acf6b3 | 48ff70067580505252281367 | 1009.9 | 0.0 | 561.0 | 2019-03-08 09:49 | 28.6 | 9.0 | 7.8 | ... | 21.0 | 1552034982 | 2019-03-08 09:49:00 | 2951GJ | 2951.0 | 105459.427030 | 430602.079060 | POINT (4.668002143402793 51.86177396654328) | NL01908 | 693.250637 |
41 | 2954 ND / Project Alblasserdam | a81b6a9aeb21 | 49ff72067580485637301367 | 1012.5 | 0.0 | 489.0 | 2019-03-08 09:49 | 13.5 | 8.3 | 4.9 | ... | 21.0 | 1552034970 | 2019-03-08 09:49:00 | 2954ND | 2954.0 | 105336.338497 | 431677.844383 | POINT (4.666060473931189 51.87143170515778) | NL01908 | 1560.115511 |
42 | 2954 AA / Project Ablasserdam | 606405acb245 | 49ff70067580485632431667 | 1012.3 | 0.0 | 648.0 | 2019-03-08 09:48 | 37.5 | 10.3 | 23.8 | ... | 19.0 | 1552034933 | 2019-03-08 09:48:00 | 2954AA | 2954.0 | 105156.242095 | 431629.260895 | POINT (4.66345260164969 51.87097896678377) | NL01908 | 1473.124867 |
43 | 2951 AT / Project Alblasserdam | 606405acf423 | 49ff70067580485653451767 | 1016.8 | 0.0 | 542.0 | 2019-03-01 11:40 | 42.1 | 9.9 | 56.2 | ... | 18.8 | 1551436830 | 2019-03-01 11:40:00 | 2951AT | 2951.0 | 105164.122268 | 430722.949170 | POINT (4.663697953142499 51.86283398548988) | NL01908 | 601.735825 |
44 | 3355 AA / Project Alblasserdam | 606405acb0cd | 49ff73067580485650381667 | 1006.4 | 0.6 | 2078.0 | 2019-01-13 21:39 | 15.6 | 10.0 | 18.7 | ... | 20.5 | 1547411973 | 2019-01-13 21:39:00 | 3355AA | 3355.0 | 107633.752610 | 427693.820153 | POINT (4.699964446977091 51.83582414088034) | NL01908 | 3683.828785 |
45 | 2953 EZ / Project Alblasserdam | 606405acae3e | 49ff72067580485644381667 | 1011.7 | 0.0 | 886.0 | 2019-03-08 09:49 | 44.5 | 10.6 | 55.5 | ... | 19.7 | 1552034977 | 2019-03-08 09:49:00 | 2953EZ | 2953.0 | 103861.068779 | 431888.126684 | POINT (4.644609305650088 51.87318819607706) | NL01908 | 2008.615090 |
46 | 2951 AW / Project Alblasserdam | 606405acb27a | 49ff74067580485660381667 | 1012.7 | 0.0 | 400.0 | 2019-03-08 09:50 | 24.7 | 8.6 | 4.9 | ... | 15.0 | 1552035053 | 2019-03-08 09:50:00 | 2951AW | 2951.0 | 105303.864737 | 430667.047977 | POINT (4.665734596478663 51.86234403965355) | NL01908 | 627.739115 |
47 | 2953 WL /ProjectAlblasserdam | 606405acb0b0 | 49ff76067580485618441667 | 1011.9 | 0.0 | 792.0 | 2019-03-08 09:49 | 6.5 | 7.8 | 7.0 | ... | 23.1 | 1552034958 | 2019-03-08 09:49:00 | 2953WL | 2953.0 | 103978.606887 | 431650.743223 | POINT (4.646351071861922 51.87106544247583) | NL01908 | 1744.987485 |
48 | 2951 CN / Project Alblasserdam | 606405acf04e | 49ff70067580485609441667 | 1012.6 | 0.0 | 587.0 | 2019-03-08 09:49 | 0.1 | 6.7 | 11.3 | ... | 19.6 | 1552034981 | 2019-03-08 09:49:00 | 2951CN | 2951.0 | 104606.557949 | 430898.355739 | POINT (4.65557838311554 51.86436034955045) | NL01908 | 783.896248 |
49 | 2953 HB / Project Alblasserdam | a81b6a9ae0f4 | 49ff6e067580485632491667 | 1012.3 | 0.0 | 685.0 | 2019-03-08 09:49 | 29.6 | 9.7 | 4.8 | ... | 19.2 | 1552034944 | 2019-03-08 09:49:00 | 2953HB | 2953.0 | 104357.331274 | 431134.661652 | POINT (4.651925644362775 51.86646160526745) | NL01908 | 1107.226019 |
50 | 2953 HA /Project Alblasserdam | 606405acb43e | 49ff73067580485638461767 | 1010.0 | 0.0 | 535.0 | 2019-03-03 00:23 | 10.4 | 13.9 | 6.2 | ... | 21.7 | 1551569003 | 2019-03-03 00:23:00 | 2953HA | 2953.0 | 104436.022973 | 431073.384868 | POINT (4.653077055035219 51.86591801347253) | NL01908 | 1015.453060 |
51 | 2953 XA / Project Alblassertdam | 606405acb0c3 | 49ff72067580485624431667 | 1012.0 | 0.0 | 949.0 | 2019-03-08 09:11 | 10.5 | 8.4 | 30.9 | ... | 19.2 | 1552032670 | 2019-03-08 09:11:00 | 2953XA | 2953.0 | 103536.020136 | 431785.470738 | POINT (4.639904946240937 51.87223562391267) | NL01908 | 2117.224337 |
52 | 2951 PA / Project Alblasserdam | 606405acf337 | 48ff75067580505248151667 | 1012.0 | 0.0 | 513.0 | 2019-03-08 09:51 | 45.5 | 10.0 | 46.3 | ... | 18.9 | 1552035064 | 2019-03-08 09:51:00 | 2951PA | 2951.0 | 105787.421290 | 431449.990702 | POINT (4.672642453118662 51.86942384302633) | NL01908 | 1545.261467 |
53 | 2951 DB / Project Alblasserdam | 606405acad38 | 49ff73067580485625391967 | 1012.4 | 0.0 | 552.0 | 2019-03-08 09:48 | 9.3 | 8.3 | 22.3 | ... | 21.4 | 1552034881 | 2019-03-08 09:48:00 | 2951DB | 2951.0 | 105148.430501 | 431434.590947 | POINT (4.663367320973592 51.8692286274886) | NL01908 | 1280.086332 |
54 | 2951 GG / Project Alblasserdam | 606405ace561 | 48ff74067580505237491367 | 997.5 | 0.0 | 531.0 | 2019-01-31 10:50 | 0.5 | 7.8 | 93.8 | ... | 20.2 | 1548928241 | 2019-01-31 10:50:00 | 2951GG | 2951.0 | 105044.343541 | 430541.966628 | POINT (4.661985372404269 51.86119663793743) | NL01908 | 388.634016 |
55 | 2951 ER / Project Alblasserdam | 606405acad52 | 49ff6e067580485633281467 | 1010.8 | 0.0 | 794.0 | 2019-03-08 09:47 | 3.4 | 7.9 | 7.3 | ... | 20.6 | 1552034854 | 2019-03-08 09:47:00 | 2951ER | 2951.0 | 104788.648665 | 430894.558959 | POINT (4.658222367740549 51.86434266254493) | NL01908 | 728.614716 |
56 | 2954 BL / Project Alblasserdam | a81b6a9ae0be | 48ff6c067580505251251867 | 1012.1 | 0.0 | 637.0 | 2019-03-08 09:50 | 0.8 | 8.4 | 11.5 | ... | 20.0 | 1552035004 | 2019-03-08 09:50:00 | 2954BL | 2954.0 | 104716.803459 | 431720.458851 | POINT (4.657058984969572 51.87175914068789) | NL01908 | 1556.278660 |
57 | 2954 BE / Project Alblasserdam | 606405acb200 | 49ff70067580485650282067 | 1012.3 | 0.0 | 628.0 | 2019-03-08 09:48 | 5.2 | 8.5 | 8.5 | ... | 21.5 | 1552034939 | 2019-03-08 09:48:00 | 2954BE | 2954.0 | 104490.614889 | 431739.965392 | POINT (4.653771984659413 51.87191399918918) | NL01908 | 1619.310421 |
58 | 2954 BE / Project Alblasserdam | a81b6a9ad930 | 48ff76067580505246451867 | 1011.7 | 0.0 | 428.0 | 2019-03-08 09:48 | 19.4 | 8.1 | 7.3 | ... | 20.5 | 1552034886 | 2019-03-08 09:48:00 | 2954BE | 2954.0 | 104490.614889 | 431739.965392 | POINT (4.653771984659413 51.87191399918918) | NL01908 | 1619.310421 |
59 | 2953 CN / Project Alblasserdam | 606405acb265 | 49ff6a067580485629221967 | 1011.7 | 0.0 | 509.0 | 2019-03-08 09:50 | 57.7 | 11.7 | 11.2 | ... | 11.7 | 1552035059 | 2019-03-08 09:50:00 | 2953CN | 2953.0 | 103499.429665 | 431564.747370 | POINT (4.639406628142007 51.87024845013715) | NL01908 | 1980.688735 |
60 | 2954 PC / Project Alblasserdam | 606405acf1a2 | 49ff72067580485628441767 | 1012.4 | 0.0 | 661.0 | 2019-03-08 09:50 | 25.0 | 8.8 | 37.5 | ... | 19.9 | 1552035055 | 2019-03-08 09:50:00 | 2954PC | 2954.0 | 104817.582947 | 431691.000946 | POINT (4.658526539645879 51.87150346811622) | NL01908 | 1517.459249 |
61 | 2951 PN / Project Alblasserdam | a81b6a9ae5ea | 48ff74067580505259392067 | 1011.6 | 0.0 | 656.0 | 2019-03-08 09:51 | 0.3 | 9.3 | 11.1 | ... | 18.7 | 1552035069 | 2019-03-08 09:51:00 | 2951PN | 2951.0 | 105663.417961 | 431455.009688 | POINT (4.670841357723621 51.86945798569486) | NL01908 | 1482.887060 |
62 | 2969 BT / Project Alblasserdam | a81b6a9ae2ab | 48ff75067580505219521767 | 1019.5 | 0.0 | 1349.0 | 2018-12-18 12:17 | 0.7 | 7.5 | 4.2 | ... | 17.6 | 1545131875 | 2018-12-18 12:17:00 | 2969BT | 2969.0 | 108248.818069 | 430049.601012 | POINT (4.708568903281869 51.85704938433805) | NL01908 | 3339.044609 |
63 | 2954 PB / Project Alblasserdam | 606405acf1bd | 49ff76067580485637441767 | 1012.2 | 0.0 | 812.0 | 2019-03-08 09:49 | 0.8 | 8.5 | 3.6 | ... | 17.4 | 1552034971 | 2019-03-08 09:49:00 | 2954PB | 2954.0 | 104851.898838 | 431659.555230 | POINT (4.659029359129534 51.87122393276186) | NL01908 | 1484.286597 |
64 | 2953 GC / Project Alblasserdam | a81b6a9ae2f5 | 48ff6e067580505229081467 | 1011.8 | 0.0 | 573.0 | 2019-03-08 09:51 | 42.0 | 9.8 | 9.3 | ... | 20.6 | 1552035073 | 2019-03-08 09:51:00 | 2953GC | 2953.0 | 103394.002901 | 432111.104946 | POINT (4.637794178796906 51.87514918324766) | NL01908 | 2459.186837 |
65 | 2951 EC / Project Alblasserdam | a81b6a9ae585 | 48ff6f067580505217131767 | 1012.5 | 0.0 | 447.0 | 2019-03-08 09:49 | 35.0 | 14.3 | 3.3 | ... | 16.8 | 1552034944 | 2019-03-08 09:49:00 | 2951EC | 2951.0 | 104384.952936 | 430878.744333 | POINT (4.652364197677537 51.86416400314869) | NL01908 | 878.140323 |
66 | 2951 WB / Project Alblasserdam | 606405acb261 | 48ff73067580505240411367 | 1012.0 | 0.0 | 602.0 | 2019-03-08 09:49 | 0.7 | 7.6 | 35.4 | ... | 20.3 | 1552034954 | 2019-03-08 09:49:00 | 2951WB | 2951.0 | 105364.597110 | 430946.637530 | POINT (4.666575993547738 51.86486233042584) | NL01908 | 893.195498 |
67 rows × 22 columns
# Logic for Get data for station
def get_station_data(station_number):
# Get All dates to get data for
dates = []
start = plotdf.index.to_series().min()
#datetime.datetime.strptime(date1, '%Y-%m-%d')
end = plotdf.index.to_series().max()
#datetime.datetime.strptime(date2, '%Y-%m-%d')
step = datetime.timedelta(days=7)
while start <= end:
#print (start.date())
r = {
'start': start,
'end': start+step
}
dates.append(r)
start+=step
print(f'Getting data for {len(dates)} combinations of date')
api_url = 'https://www.luchtmeetnet.nl/open_api/measurements'
global api_params
api_params = {
'start': '',
'end': '',
'station_number': '',
'order_by': 'timestamp_measured',
'order_by_direction': 'desc',
'status': '',
}
#datastore
df_list = []
for r in dates:
api_params['start'] = r['start']
api_params['end'] = r['end']
api_params['station_number'] = station_number
#print(api_params)
r = requests.get(api_url, params=api_params)
if r.ok:
try:
response_json = r.json()
data = response_json['data']
last_page = response_json['pagination']['last_page']
#print(last_page)
df = pd.DataFrame(data)
df_list.append(df)
except Exception as e:
print('Error:', e)
# Merge data
df = pd.concat(df_list)
return df
# Get unique station no to get data for
luchst_df_ = luchst_df[luchst_df['number'].isin(geo_df['luchst_number'].unique())]
luchst_df_
# Data store
luchst_data = []
stations = list(luchst_df_['number'])
for st in stations:
df = get_station_data(st)
luchst_data.append(df)
if len(luchst_data) > 0:
luchst_data_df_ = pd.concat(luchst_data)
luchst_data_df_
Getting data for 20 combinations of date
formula | station_number | timestamp_measured | value | |
---|---|---|---|---|
0 | NO | NL01908 | 2018-10-08T00:00:00+00:00 | 15.3 |
1 | NO2 | NL01908 | 2018-10-08T00:00:00+00:00 | 44.7 |
2 | PM10 | NL01908 | 2018-10-08T00:00:00+00:00 | 19.9 |
3 | NO | NL01908 | 2018-10-07T23:00:00+00:00 | 26.7 |
4 | NO2 | NL01908 | 2018-10-07T23:00:00+00:00 | 52.1 |
5 | PM10 | NL01908 | 2018-10-07T23:00:00+00:00 | 15.4 |
6 | NO | NL01908 | 2018-10-07T22:00:00+00:00 | 19.1 |
7 | NO2 | NL01908 | 2018-10-07T22:00:00+00:00 | 48.9 |
8 | PM10 | NL01908 | 2018-10-07T22:00:00+00:00 | 11.5 |
9 | NO | NL01908 | 2018-10-07T21:00:00+00:00 | 6.6 |
10 | NO2 | NL01908 | 2018-10-07T21:00:00+00:00 | 25.6 |
11 | PM10 | NL01908 | 2018-10-07T21:00:00+00:00 | 17.6 |
12 | NO | NL01908 | 2018-10-07T20:00:00+00:00 | 4.3 |
13 | NO2 | NL01908 | 2018-10-07T20:00:00+00:00 | 18.3 |
14 | PM10 | NL01908 | 2018-10-07T20:00:00+00:00 | 14.6 |
15 | NO2 | NL01908 | 2018-10-07T19:00:00+00:00 | 22.0 |
16 | PM10 | NL01908 | 2018-10-07T19:00:00+00:00 | 12.6 |
17 | NO | NL01908 | 2018-10-07T19:00:00+00:00 | 5.1 |
18 | NO | NL01908 | 2018-10-07T18:00:00+00:00 | 3.5 |
19 | NO2 | NL01908 | 2018-10-07T18:00:00+00:00 | 15.7 |
20 | PM10 | NL01908 | 2018-10-07T18:00:00+00:00 | 11.8 |
21 | NO | NL01908 | 2018-10-07T17:00:00+00:00 | 2.5 |
22 | NO2 | NL01908 | 2018-10-07T17:00:00+00:00 | 10.7 |
23 | PM10 | NL01908 | 2018-10-07T17:00:00+00:00 | 13.2 |
24 | NO | NL01908 | 2018-10-07T16:00:00+00:00 | 4.9 |
25 | NO2 | NL01908 | 2018-10-07T16:00:00+00:00 | 11.8 |
26 | PM10 | NL01908 | 2018-10-07T16:00:00+00:00 | 13.7 |
27 | NO | NL01908 | 2018-10-07T15:00:00+00:00 | 2.8 |
28 | NO2 | NL01908 | 2018-10-07T15:00:00+00:00 | 7.4 |
29 | PM10 | NL01908 | 2018-10-07T15:00:00+00:00 | 18.5 |
... | ... | ... | ... | ... |
472 | NO2 | NL01908 | 2019-02-11T10:00:00+00:00 | 36.5 |
473 | PM10 | NL01908 | 2019-02-11T10:00:00+00:00 | 24.2 |
474 | NO | NL01908 | 2019-02-11T09:00:00+00:00 | 20.3 |
475 | NO2 | NL01908 | 2019-02-11T09:00:00+00:00 | 45.5 |
476 | PM10 | NL01908 | 2019-02-11T09:00:00+00:00 | 19.8 |
477 | NO | NL01908 | 2019-02-11T08:00:00+00:00 | 13.7 |
478 | NO2 | NL01908 | 2019-02-11T08:00:00+00:00 | 39.5 |
479 | PM10 | NL01908 | 2019-02-11T08:00:00+00:00 | 16.4 |
480 | NO | NL01908 | 2019-02-11T07:00:00+00:00 | 14.1 |
481 | NO2 | NL01908 | 2019-02-11T07:00:00+00:00 | 36.7 |
482 | PM10 | NL01908 | 2019-02-11T07:00:00+00:00 | 12.8 |
483 | NO | NL01908 | 2019-02-11T06:00:00+00:00 | 12.1 |
484 | NO2 | NL01908 | 2019-02-11T06:00:00+00:00 | 37.8 |
485 | PM10 | NL01908 | 2019-02-11T06:00:00+00:00 | 20.3 |
486 | NO | NL01908 | 2019-02-11T05:00:00+00:00 | 4.4 |
487 | NO2 | NL01908 | 2019-02-11T05:00:00+00:00 | 25.0 |
488 | PM10 | NL01908 | 2019-02-11T05:00:00+00:00 | 20.6 |
489 | NO | NL01908 | 2019-02-11T04:00:00+00:00 | 0.0 |
490 | NO2 | NL01908 | 2019-02-11T04:00:00+00:00 | 10.7 |
491 | PM10 | NL01908 | 2019-02-11T04:00:00+00:00 | 19.7 |
492 | NO | NL01908 | 2019-02-11T03:00:00+00:00 | 0.4 |
493 | NO2 | NL01908 | 2019-02-11T03:00:00+00:00 | 13.8 |
494 | PM10 | NL01908 | 2019-02-11T03:00:00+00:00 | 17.0 |
495 | NO | NL01908 | 2019-02-11T02:00:00+00:00 | 0.2 |
496 | NO2 | NL01908 | 2019-02-11T02:00:00+00:00 | 11.8 |
497 | PM10 | NL01908 | 2019-02-11T02:00:00+00:00 | 16.6 |
498 | NO2 | NL01908 | 2019-02-11T01:00:00+00:00 | 7.3 |
499 | PM10 | NL01908 | 2019-02-11T01:00:00+00:00 | 8.7 |
500 | NO2 | NL01908 | 2019-02-11T00:00:00+00:00 | 7.4 |
501 | PM10 | NL01908 | 2019-02-11T00:00:00+00:00 | 8.5 |
10020 rows × 4 columns
# Make Binary Variables
luchst_data_df = luchst_data_df_.pivot_table(index=['station_number','timestamp_measured'], columns='formula').reset_index()
# Flatten Columns
luchst_data_df.columns = luchst_data_df.columns.to_series().str.join('_')
luchst_data_df
station_number_ | timestamp_measured_ | value_NO | value_NO2 | value_PM10 | |
---|---|---|---|---|---|
0 | NL01908 | 2018-10-01T00:00:00+00:00 | 0.6 | 8.8 | 9.1 |
1 | NL01908 | 2018-10-01T01:00:00+00:00 | 0.8 | 10.9 | 7.2 |
2 | NL01908 | 2018-10-01T02:00:00+00:00 | 0.9 | 11.8 | 2.5 |
3 | NL01908 | 2018-10-01T03:00:00+00:00 | 1.0 | 7.6 | 2.3 |
4 | NL01908 | 2018-10-01T04:00:00+00:00 | 8.1 | 30.2 | 5.7 |
5 | NL01908 | 2018-10-01T05:00:00+00:00 | 36.1 | 53.7 | 5.2 |
6 | NL01908 | 2018-10-01T06:00:00+00:00 | 31.9 | 47.6 | 6.0 |
7 | NL01908 | 2018-10-01T07:00:00+00:00 | 34.7 | 49.1 | 7.0 |
8 | NL01908 | 2018-10-01T08:00:00+00:00 | 19.4 | 33.0 | 8.7 |
9 | NL01908 | 2018-10-01T09:00:00+00:00 | 10.0 | 20.2 | 9.2 |
10 | NL01908 | 2018-10-01T10:00:00+00:00 | 13.3 | 26.0 | 16.8 |
11 | NL01908 | 2018-10-01T11:00:00+00:00 | 6.8 | 9.9 | 12.9 |
12 | NL01908 | 2018-10-01T12:00:00+00:00 | 3.4 | 10.5 | 17.6 |
13 | NL01908 | 2018-10-01T13:00:00+00:00 | 6.2 | 13.9 | 16.6 |
14 | NL01908 | 2018-10-01T14:00:00+00:00 | 6.4 | 14.7 | 19.3 |
15 | NL01908 | 2018-10-01T15:00:00+00:00 | 14.3 | 26.7 | 19.5 |
16 | NL01908 | 2018-10-01T16:00:00+00:00 | 8.0 | 16.6 | 22.3 |
17 | NL01908 | 2018-10-01T17:00:00+00:00 | 10.4 | 23.1 | 15.8 |
18 | NL01908 | 2018-10-01T18:00:00+00:00 | 4.2 | 16.2 | 12.7 |
19 | NL01908 | 2018-10-01T19:00:00+00:00 | 3.4 | 16.0 | 12.1 |
20 | NL01908 | 2018-10-01T20:00:00+00:00 | 6.3 | 34.2 | 10.5 |
21 | NL01908 | 2018-10-01T21:00:00+00:00 | 0.8 | 8.6 | 11.4 |
22 | NL01908 | 2018-10-01T22:00:00+00:00 | 7.6 | 40.7 | 16.1 |
23 | NL01908 | 2018-10-01T23:00:00+00:00 | 9.1 | 43.5 | 32.9 |
24 | NL01908 | 2018-10-02T00:00:00+00:00 | 10.3 | 38.4 | 17.1 |
25 | NL01908 | 2018-10-02T01:00:00+00:00 | 3.8 | 22.5 | 16.0 |
26 | NL01908 | 2018-10-02T02:00:00+00:00 | 3.7 | 19.5 | 8.8 |
27 | NL01908 | 2018-10-02T03:00:00+00:00 | 7.1 | 25.0 | 16.6 |
28 | NL01908 | 2018-10-02T04:00:00+00:00 | 16.1 | 32.9 | 15.5 |
29 | NL01908 | 2018-10-02T05:00:00+00:00 | 43.9 | 47.2 | 20.6 |
... | ... | ... | ... | ... | ... |
3329 | NL01908 | 2019-02-16T19:00:00+00:00 | 73.3 | 76.6 | 68.7 |
3330 | NL01908 | 2019-02-16T20:00:00+00:00 | 168.3 | 77.9 | 81.4 |
3331 | NL01908 | 2019-02-16T21:00:00+00:00 | 188.1 | 79.8 | 70.7 |
3332 | NL01908 | 2019-02-16T22:00:00+00:00 | 138.8 | 79.5 | 64.4 |
3333 | NL01908 | 2019-02-16T23:00:00+00:00 | 53.1 | 72.0 | 53.5 |
3334 | NL01908 | 2019-02-17T00:00:00+00:00 | 40.3 | 70.5 | 51.3 |
3335 | NL01908 | 2019-02-17T01:00:00+00:00 | 17.7 | 69.3 | 54.0 |
3336 | NL01908 | 2019-02-17T02:00:00+00:00 | 15.8 | 68.2 | 50.6 |
3337 | NL01908 | 2019-02-17T03:00:00+00:00 | 12.8 | 62.1 | 54.4 |
3338 | NL01908 | 2019-02-17T04:00:00+00:00 | 3.5 | 50.2 | 46.3 |
3339 | NL01908 | 2019-02-17T05:00:00+00:00 | 5.4 | 47.2 | 48.1 |
3340 | NL01908 | 2019-02-17T06:00:00+00:00 | 5.0 | 41.6 | 41.6 |
3341 | NL01908 | 2019-02-17T07:00:00+00:00 | 7.0 | 40.3 | 37.2 |
3342 | NL01908 | 2019-02-17T08:00:00+00:00 | 6.8 | 35.9 | 40.5 |
3343 | NL01908 | 2019-02-17T09:00:00+00:00 | 14.2 | 35.7 | 43.1 |
3344 | NL01908 | 2019-02-17T10:00:00+00:00 | 15.1 | 33.0 | 86.0 |
3345 | NL01908 | 2019-02-17T11:00:00+00:00 | 21.9 | 39.0 | 43.4 |
3346 | NL01908 | 2019-02-17T12:00:00+00:00 | 15.5 | 33.2 | 32.3 |
3347 | NL01908 | 2019-02-17T13:00:00+00:00 | 12.9 | 31.1 | 39.3 |
3348 | NL01908 | 2019-02-17T14:00:00+00:00 | 12.0 | 31.7 | 33.8 |
3349 | NL01908 | 2019-02-17T15:00:00+00:00 | 9.8 | 30.8 | 29.1 |
3350 | NL01908 | 2019-02-17T16:00:00+00:00 | 6.5 | 30.4 | 26.0 |
3351 | NL01908 | 2019-02-17T17:00:00+00:00 | 6.6 | 35.1 | 32.3 |
3352 | NL01908 | 2019-02-17T18:00:00+00:00 | 9.9 | 43.4 | 29.1 |
3353 | NL01908 | 2019-02-17T19:00:00+00:00 | 8.0 | 39.0 | 25.8 |
3354 | NL01908 | 2019-02-17T20:00:00+00:00 | 10.4 | 42.6 | 28.1 |
3355 | NL01908 | 2019-02-17T21:00:00+00:00 | 6.9 | 39.3 | 24.2 |
3356 | NL01908 | 2019-02-17T22:00:00+00:00 | 7.3 | 41.8 | 28.2 |
3357 | NL01908 | 2019-02-17T23:00:00+00:00 | 7.9 | 42.6 | 31.5 |
3358 | NL01908 | 2019-02-18T00:00:00+00:00 | 5.3 | 44.7 | 32.9 |
3359 rows × 5 columns
# PLot
stations = luchst_data_df['station_number_'].unique()
for st in stations:
print("Plotting station data for station:", st)
luchst_plotdf = luchst_data_df[luchst_data_df['station_number_'] == st]
# Make Datetime index
luchst_plotdf.index = pd.to_datetime(luchst_plotdf['timestamp_measured_'], errors='ignore')
luchst_plotdf = luchst_plotdf[luchst_plotdf.columns[2:]]
luchst_plotdf = luchst_plotdf.apply(pd.to_numeric)
# Daily Data
luchst_plotdf.resample('D', level=0).mean()
# Plot the heatmap
fig, ax = plt.subplots(figsize=(40, 40))
calendar_heatmap(ax, luchst_plotdf, 'value_NO2')
plt.show()
Plotting station data for station: NL01908
c:\users\apsac243\envs\geo\lib\site-packages\ipykernel_launcher.py:20: FutureWarning: The default of the 'keep_tz' keyword will change to True in a future release. You can set 'keep_tz=True' to obtain the future behaviour and silence this warning.
## Does not work
# MAp with popup
import ipywidgets as ipyw
maap = ipyleaflet.Map(
center=(51.8703, 4.6702),
zoom=12
)
label = ipyw.Label(layout=ipyw.Layout(width='100%'))
message1 = ipyw.HTML()
message1.value = "Try clicking the marker!"
layer = ipyleaflet.GeoJSON(data=data)
def hover_handler(properties=None, event=None, id=None, type=None, coordinates=tuple):
print(properties)
#print(type)
#print(coordinates)
label.value = json.dumps(properties)
try:
i=1+'1'
except:
pass
layer.on_click(hover_handler)
maap.add_layer(layer)
ipyw.VBox([maap, label])
# Setup API for air quality data
# Import libraries
from rasterstats import zonal_stats
query = 'SELECT * FROM bestuurlijkegrenzen_gemeentegrenzen LIMIT 1'
query = 'SELECT code, gemeentenaam, wkb_geometry FROM bestuurlijkegrenzen_gemeentegrenzen LIMIT 20'
con = postgres_test()
gdf = gpd.GeoDataFrame.from_postgis(query, con, geom_col='wkb_geometry' )
gdf.plot()
<matplotlib.axes._subplots.AxesSubplot at 0x1c7adb951d0>
a = gdf.wkb_geometry
a[5]
lucht__actueel_pm25 = os.path.join('data', 'lucht__actueel_pm25.tif')
zonal_stats([a[0]], lucht__actueel_pm25)
[{'min': 5.66, 'max': 8.0, 'mean': 6.2496617687829215, 'count': 3607}]
# This is Renovatio API
def airQualityApi(entities=None, level=None, parameters='pm10, pm25, no2, o3, lki', years='actueel', geometry='false'):
entities = entities.strip().lower()
level = level.strip().lower()
parameters = parameters.strip().lower()
years = years.strip().lower()
geometry = geometry.strip().lower()
if level == 'gementee':
gem_codes = []
gem_names = []
if entities == '' or entities == 'all' or entities is None:
whereQuery = ""
else:
entities = entities.split(",")
entities = [x.strip() for x in entities]
for enti in entities:
try:
int(enti)
gem_codes.append(enti)
except:
gem_names.append(enti)
whereQuery = "WHERE "
if len(gem_codes) > 0:
gem_codes = ["'"+ str(x) +"'" for x in gem_codes]
whereQuery+= f'code IN ({",".join(gem_codes)})'
if len(gem_names) > 0:
gem_names = ["'"+x+"'" for x in gem_names]
whereQuery+= f' OR gemeentenaam::citext IN ({",".join(gem_names)})'
print(whereQuery)
query = f'''SELECT code, gemeentenaam, ST_Simplify(wkb_geometry, 50)as wkb_geometry
FROM bestuurlijkegrenzen_gemeentegrenzen
{whereQuery}
LIMIT 20
'''
print(query)
con = postgres_test()
gdf = gpd.GeoDataFrame.from_postgis(query, con, geom_col='wkb_geometry' )
gdf['airquality'] = gdf['wkb_geometry'].apply(lambda x: getAirQuality(x, parameters, years))
if geometry == 'false':
gdf.drop(['wkb_geometry'], axis=1, inplace=True)
#air_quality = getAirQuality(gdf.wkb_geometry, parameters)
#gdf['data'] = pd.Series(air_quality)
return gdf
def getAirQuality(geometry, parameters, years):
# create object to store returning data
airQuality = {}
airQuality['Errors'] = []
# check supplied parameters otherwise raise error
valid_parameters = ['lki', 'no2', 'o3', 'pm10', 'pm25']
parameters = parameters.split(",")
parameters = [x.strip() for x in parameters]
for parameter in parameters:
if parameter not in valid_parameters:
parameters.remove(parameter)
airQuality['Errors'].append( f'Sorry Buddy but {parameter} passed in parameters is an invalid value')
# Check years
years = years.split(",")
years = [x.strip() for x in years]
for year in years:
if year != 'actueel':
try:
year_ = int(year)
if year_ > datetime.datetime.now().year:
raise Exception('Invalid Year')
except Exception as error:
years.remove(year)
airQuality['Errors'].append( f'Sorry buddy but {year} passed in years is an invalid value error: {str(error)}')
# Get Actual Data
for year in years:
airQuality[year] = {}
for parameter in parameters:
if year == 'actueel':
lucht_file = os.path.join('data', f'lucht__{year}_{parameter}.tif')
else:
lucht_file = os.path.join('data', f'gcn__conc_{parameter}_{year}.tif')
if os.path.isfile(lucht_file):
pm25_ZonalStatsData = zonal_stats(geometry, lucht_file)
airQuality[year][parameter] = pm25_ZonalStatsData[0]
else:
airQuality['Errors'].append(f'Sorry Buddy no data found for parameter {parameter} in year {year}')
return (airQuality)
gdf = airQualityApi(entities='1621,Achtkarspelen,0356,0654,Wassenaar', level='gementee', geometry='true')
gdf
WHERE code IN ('1621','0356','0654') OR gemeentenaam::citext IN ('achtkarspelen','wassenaar') SELECT code, gemeentenaam, ST_Simplify(wkb_geometry, 50)as wkb_geometry FROM bestuurlijkegrenzen_gemeentegrenzen WHERE code IN ('1621','0356','0654') OR gemeentenaam::citext IN ('achtkarspelen','wassenaar') LIMIT 20
code | gemeentenaam | wkb_geometry | airquality | |
---|---|---|---|---|
0 | 1621 | Lansingerland | (POLYGON ((94441.60400000001 449656.069, 92566... | {'Errors': [], 'actueel': {'pm10': {'min': 12.... |
1 | 0356 | Nieuwegein | (POLYGON ((132952.11 447885.813, 133552.582 44... | {'Errors': [], 'actueel': {'pm10': {'min': 15.... |
2 | 0059 | Achtkarspelen | (POLYGON ((201481.106 579247.514, 201656.815 5... | {'Errors': [], 'actueel': {'pm10': {'min': 10.... |
3 | 0654 | Borsele | (POLYGON ((39150.056 391591.526, 39144.171 391... | {'Errors': [], 'actueel': {'pm10': {'min': 10.... |
4 | 0629 | Wassenaar | (POLYGON ((87262.114 465480.798, 87136.628 465... | {'Errors': [], 'actueel': {'pm10': {'min': 8.9... |
gdf.to_json()
'{"type": "FeatureCollection", "features": [{"id": "0", "type": "Feature", "properties": {"code": "1621", "gemeentenaam": "Lansingerland", "airquality": {"Errors": [], "actueel": {"pm10": {"min": 12.68, "max": 23.71, "mean": 13.590798553144129, "count": 3594}, "pm25": {"min": 5.66, "max": 8.0, "mean": 6.2498469671675005, "count": 3594}, "no2": {"min": 25.69, "max": 117.98, "mean": 36.52251530328326, "count": 3594}, "o3": {"min": 32.8, "max": 40.1, "mean": 37.78208402893711, "count": 3594}, "lki": {"min": 3.87, "max": 5.45, "mean": 4.125239287701725, "count": 3594}}}}, "geometry": {"type": "MultiPolygon", "coordinates": [[[[94441.604, 449656.069], [92566.379, 449663.743], [91956.968, 449135.89], [91867.02, 448962.262], [91167.573, 448610.746], [91313.955, 448038.793], [91250.75, 447881.156], [91453.491, 447548.088], [91021.387, 446902.305], [91132.277, 446694.564], [91259.384, 446659.623], [91244.121, 446388.861], [90626.97, 446206.912], [90835.333, 445844.578], [90441.729, 445308.721], [88840.894, 443866.453], [90360.203, 442013.631], [90627.86, 442346.98], [91290.753, 442668.899], [91299.09, 442983.27], [91442.1, 443100.8], [91385.1, 443341.4], [91572.27, 443596.1], [91519.07, 443638.93], [91919.814, 443970.176], [93704.902, 442485.185], [93748.185, 442978.85], [94485.038, 442358.735], [94430.0, 442281.51], [94663.331, 442083.177], [94865.67, 441916.67], [94979.645, 441941.263], [95298.53, 441674.018], [95469.51, 442024.28], [95921.46, 442249.46], [96006.6, 442415.25], [96436.02, 442549.13], [96487.04, 442786.95], [96779.38, 442724.57], [97418.846, 443082.275], [97650.575, 443313.113], [97744.531, 443565.495], [97619.073, 443711.868], [97540.144, 444061.95], [97354.639, 444224.725], [97246.175, 445125.745], [97388.218, 445240.174], [97295.052, 445395.417], [97495.72, 445593.79], [97673.414, 446338.528], [97850.834, 446724.86], [98016.19, 447620.2], [97986.355, 448058.603], [98109.505, 449276.586], [98246.847, 449751.406], [98477.71, 450036.641], [98468.83, 450375.521], [98321.158, 450737.612], [98626.002, 452562.881], [98123.157, 452929.655], [97617.244, 452330.481], [97404.799, 451672.626], [97251.271, 451514.914], [96520.212, 451593.204], [95378.361, 450647.244], [94604.123, 449753.658], [94441.604, 449656.069]]]]}}, {"id": "1", "type": "Feature", "properties": {"code": "0356", "gemeentenaam": "Nieuwegein", "airquality": {"Errors": [], "actueel": {"pm10": {"min": 15.25, "max": 30.85, "mean": 18.233246200607905, "count": 1645}, "pm25": {"min": 6.07, "max": 7.4, "mean": 6.806826747720366, "count": 1645}, "no2": {"min": 41.46, "max": 138.04, "mean": 62.684261398176304, "count": 1645}, "o3": {"min": 28.5, "max": 31.7, "mean": 29.557732522796353, "count": 1645}, "lki": {"min": 3.64, "max": 8.38, "mean": 4.481544072948329, "count": 1645}}}}, "geometry": {"type": "MultiPolygon", "coordinates": [[[[132952.11, 447885.813], [133552.582, 446177.115], [133386.991, 445805.904], [133609.236, 445883.801], [133746.449, 445636.843], [133689.595, 445617.539], [133733.335, 445497.476], [134612.467, 445956.0], [135289.541, 446110.194], [135999.963, 446036.902], [136620.641, 445761.073], [137236.386, 448524.399], [137415.292, 448517.39], [136784.869, 449154.83], [137335.183, 451314.771], [136994.719, 451321.691], [137141.723, 451877.769], [136959.25, 451915.944], [136810.582, 451806.464], [136712.021, 451833.15], [136519.638, 452071.497], [136075.221, 452260.584], [135803.02, 451338.396], [135600.853, 451329.411], [135444.16, 451811.336], [135121.8, 452393.016], [134900.098, 452313.155], [134617.212, 452533.941], [133633.36, 452704.82], [133230.75, 452626.2], [132978.7, 451930.902], [132922.496, 451949.421], [132843.243, 451542.326], [132717.058, 448967.739], [132765.884, 448461.676], [132952.11, 447885.813]]]]}}, {"id": "2", "type": "Feature", "properties": {"code": "0059", "gemeentenaam": "Achtkarspelen", "airquality": {"Errors": [], "actueel": {"pm10": {"min": 10.84, "max": 14.04, "mean": 11.148737601442742, "count": 6654}, "pm25": {"min": 2.94, "max": 4.18, "mean": 3.268298767658551, "count": 6654}, "no2": {"min": 4.57, "max": 48.16, "mean": 8.222981665163811, "count": 6654}, "o3": {"min": 54.38, "max": 56.9, "mean": 56.13081454764052, "count": 6654}, "lki": {"min": 3.9, "max": 4.09, "mean": 3.9934144875263, "count": 6654}}}}, "geometry": {"type": "MultiPolygon", "coordinates": [[[[201481.106, 579247.514], [201656.815, 578844.664], [202633.051, 577912.773], [202964.121, 577201.164], [203256.858, 576869.201], [203283.295, 576950.209], [203634.794, 576833.594], [203021.046, 574136.515], [203289.01, 574183.59], [203327.562, 574051.141], [203526.207, 573963.139], [203982.087, 573881.366], [203949.65, 573471.536], [204140.605, 573390.326], [205897.621, 574836.926], [206164.622, 574061.278], [207810.735, 575044.164], [207867.68, 575977.65], [208106.53, 576277.49], [208285.353, 576926.685], [208851.072, 578346.048], [209013.888, 578622.784], [209285.47, 578816.74], [209290.528, 579382.464], [209590.21, 579544.17], [209944.99, 579562.23], [210256.57, 580011.57], [210580.74, 580249.46], [210779.38, 580563.06], [210791.18, 580755.92], [210956.9, 580916.5], [210949.97, 581209.25], [211292.91, 581562.25], [211226.88, 581721.13], [211302.0, 582088.38], [210975.25, 582420.13], [211033.44, 582573.63], [210928.03, 582923.63], [210648.47, 583147.63], [210485.35, 583102.13], [210412.75, 583301.38], [210224.035, 583380.648], [210390.45, 583402.4], [210264.41, 583498.0], [210306.216, 583695.653], [210933.705, 583881.848], [210908.494, 584004.887], [210789.088, 583980.876], [210462.487, 584248.053], [210521.94, 584320.31], [210810.33, 584404.5], [211110.09, 584623.7], [211260.15, 584570.23], [211351.19, 584646.0], [211388.19, 584844.92], [211262.53, 584941.91], [211220.1, 585135.4], [211500.756, 585247.125], [211590.58, 585532.56], [211403.39, 585696.47], [211390.378, 585920.845], [210842.776, 585956.248], [210698.684, 586046.129], [210504.119, 586245.32], [210373.54, 586844.24], [210180.493, 586905.951], [210167.484, 586854.374], [208812.678, 587357.33], [208658.95, 587321.42], [208702.052, 587251.911], [208609.678, 587193.359], [208507.974, 587337.644], [208274.342, 587043.748], [208593.747, 586613.747], [208383.046, 586542.154], [208308.885, 586481.757], [208345.92, 586429.844], [208088.748, 586428.989], [208064.72, 586343.29], [207951.809, 586347.519], [207984.419, 586192.605], [207872.17, 586124.56], [207677.16, 586341.276], [207333.42, 586377.063], [207058.453, 586627.329], [206845.604, 586659.116], [206602.913, 586436.91], [206484.604, 586624.743], [205799.715, 586210.11], [205728.462, 586333.219], [205567.755, 586223.352], [205301.273, 586690.03], [203765.461, 586195.017], [203285.646, 586165.358], [202816.449, 585801.979], [200878.147, 584872.252], [198503.333, 584201.13], [198000.029, 584151.789], [197833.426, 584210.913], [197760.633, 584058.267], [197451.402, 584211.18], [197334.334, 584180.613], [197232.703, 584000.303], [197740.971, 582804.86], [201700.157, 581160.367], [201394.597, 581052.768], [201443.507, 581011.694], [201291.244, 580948.219], [201411.415, 580728.579], [201199.45, 580671.588], [201241.661, 580534.308], [201481.149, 580596.959], [201561.661, 580428.615], [201192.614, 580230.598], [201401.378, 579717.454], [201481.106, 579247.514]]]]}}, {"id": "3", "type": "Feature", "properties": {"code": "0654", "gemeentenaam": "Borsele", "airquality": {"Errors": [], "actueel": {"pm10": {"min": 10.2, "max": 15.63, "mean": 11.590250888776028, "count": 9845}, "pm25": {"min": 4.56, "max": 6.35, "mean": 4.97082376841036, "count": 9845}, "no2": {"min": 13.9, "max": 60.69, "mean": 19.061721686135098, "count": 9845}, "o3": {"min": 37.4, "max": 43.2, "mean": 40.81337531742001, "count": 9845}, "lki": {"min": 3.82, "max": 4.21, "mean": 4.116315896394108, "count": 9845}}}}, "geometry": {"type": "MultiPolygon", "coordinates": [[[[39150.056, 391591.526], [39144.171, 391659.029], [38244.392, 391728.713], [37768.08, 390614.03], [37816.79, 389594.99], [38107.957, 389433.572], [38248.81, 389013.703], [37854.706, 388531.879], [37479.119, 388258.448], [37671.947, 388095.73], [38515.655, 388278.704], [38985.89, 388055.985], [38416.952, 386248.296], [37463.518, 385447.215], [37893.524, 384941.96], [38346.009, 384060.317], [38922.759, 383388.141], [38382.942, 382987.279], [38697.546, 382779.521], [38902.041, 382418.304], [39336.401, 381926.367], [40010.186, 381535.394], [40170.783, 381519.171], [40229.07, 379681.17], [42831.58, 379352.0], [45020.14, 375250.17], [53165.7, 377561.83], [55957.69, 382399.02], [53974.274, 385369.823], [53396.338, 385733.523], [53441.232, 386073.619], [53626.411, 386538.033], [52786.399, 387068.081], [52286.026, 387586.766], [52310.032, 387657.356], [52206.482, 387761.878], [52297.599, 387939.781], [52259.611, 388029.364], [52619.775, 388653.671], [52541.524, 388724.056], [52585.85, 388821.41], [50418.59, 389079.41], [49916.9, 388975.35], [49708.7, 389067.55], [49591.771, 389266.647], [48612.73, 389491.1], [48254.38, 389454.43], [48068.94, 389562.0], [47623.78, 389611.62], [47054.69, 389604.78], [45998.5, 389384.56], [45481.97, 389415.65], [44784.24, 389707.15], [43600.948, 390734.952], [43013.995, 391052.128], [42091.82, 391255.0], [40550.03, 391401.42], [39476.511, 391653.743], [39310.009, 391674.764], [39150.056, 391591.526]]]]}}, {"id": "4", "type": "Feature", "properties": {"code": "0629", "gemeentenaam": "Wassenaar", "airquality": {"Errors": [], "actueel": {"pm10": {"min": 8.9, "max": 17.11, "mean": 11.219989091900738, "count": 3667}, "pm25": {"min": 5.5, "max": 7.35, "mean": 6.100602672484318, "count": 3667}, "no2": {"min": 17.2, "max": 60.55, "mean": 24.941259885464955, "count": 3667}, "o3": {"min": 42.2, "max": 48.3, "mean": 45.9788355604036, "count": 3667}, "lki": {"min": 4.17, "max": 4.49, "mean": 4.364442323425143, "count": 3667}}}}, "geometry": {"type": "MultiPolygon", "coordinates": [[[[87262.114, 465480.798], [87136.628, 465626.061], [86944.948, 465681.121], [85782.119, 466980.877], [84765.0, 467670.0], [82855.0, 465000.0], [79886.222, 461327.34], [80727.363, 460600.277], [82782.451, 458023.435], [82592.289, 457871.665], [82723.561, 457724.884], [82101.961, 457308.489], [82383.963, 456898.276], [83058.457, 457244.822], [83146.783, 457095.027], [83339.311, 457193.251], [83403.438, 457096.558], [84524.504, 458001.838], [85302.933, 456911.835], [85481.565, 456765.613], [86633.087, 457767.696], [87441.014, 458612.779], [88320.013, 459712.511], [88291.781, 459772.549], [88649.926, 460023.039], [89279.84, 460988.814], [90436.547, 462403.598], [90099.753, 463211.734], [90213.604, 463476.022], [89577.757, 463799.693], [89226.364, 463887.005], [88806.588, 464239.147], [88669.473, 464144.525], [88354.819, 464409.892], [88251.444, 464371.12], [88101.942, 465027.255], [87790.145, 464826.762], [87262.114, 465480.798]]]]}}]}'
lucht__actueel_pm25 = os.path.join('data', 'lucht__actueel_pm25.tif')
zonal_stats(gdf.wkb_geometry, lucht__actueel_pm25)
[{'min': 5.66, 'max': 8.0, 'mean': 6.2498469671675005, 'count': 3594}, {'min': 6.07, 'max': 7.4, 'mean': 6.806826747720366, 'count': 1645}, {'min': 2.94, 'max': 4.18, 'mean': 3.268298767658551, 'count': 6654}, {'min': 4.56, 'max': 6.35, 'mean': 4.97082376841036, 'count': 9845}, {'min': 5.5, 'max': 7.35, 'mean': 6.100602672484318, 'count': 3667}]