You are on page 1of 36

4/6/2016

Visualisation Practical
Electronic notebook
Cristina Tocu - 328579
Andrei Iessensky -328573

co2

1 of 9

http://localhost:8888/nbconvert/html/co2.ipynb?download=false

In [1]: %pylab inline


pylab.rcParams['figure.figsize'] = (100, 6)
import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
import matplotlib.lines as mlines
Populating the interactive namespace from numpy and matplotlib
In [2]: co2=list() #declaration
time=list() #declaration
with open('D:\\Year 2\\visualisation\\CO2\\CO2-Assen-March-2016--20160228_000
000.csv') as f: #the location where all the csv files from CO2 station are st
ored
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '029-CO-1':
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
print time[1]
CO2=np.array(co2,dtype=np.int16)
plot (time, CO2)
plt.plot(figsize=(20,4))
2016-02-28 00:00:18
Out[2]: []

06.04.2016 11:42

co2

2 of 9

http://localhost:8888/nbconvert/html/co2.ipynb?download=false

In [3]: co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r'D:\Year 2\visualisation\CO2')#the location where all the csv files
from CO2 station are stored
for file in glob.glob("*.csv"):# the program should read all the documents in
that file with csv format
filelist.append(file) #program loads the file in the working space
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')#program reads the data between
the semicolons
reader.next()
for row in reader:
if row[1]== '020-CO-1':#if the name of variable in row[1] matches
the name of the station introduced by the user, the program gets the data in
all files only related to that specific station
nameSensor.append(row[1]) #station
co2.append(row[2]) #co2
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S')) #
time
CO2=np.array(co2,dtype=np.int16) # define the co2 data as integer numbers
plt.figure(figsize=(130, 20))
# the size of the graph
plt.tick_params(labelsize=90)# the size of the axis labels
blue_line = mlines.Line2D([], [], color='orange', marker= '_',
markersize=80, label='CO2 20th node') # the legend
of the graph is defined
plt.legend(handles=[blue_line], prop={"size":80}) #legend is printed on the g
raph with the selected size
plot (time, CO2, 'orange') # program plots the time series of CO2
Out[3]: [<matplotlib.lines.Line2D at 0x856eb70>]

06.04.2016 11:42

co2

3 of 9

http://localhost:8888/nbconvert/html/co2.ipynb?download=false

In [4]: co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r'D:\Year 2\visualisation\CO2')
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '170-CO-1':
nameSensor.append(row[1])
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
CO2=np.array(co2,dtype=np.int16)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
blue_line = mlines.Line2D([], [], color='orange', marker= '_',
markersize=80, label='CO2 170th node')
plt.legend(handles=[blue_line], prop={"size":80})
plot (time, CO2, 'orange')

Out[4]: [<matplotlib.lines.Line2D at 0x7903e10>]

06.04.2016 11:42

co2

4 of 9

http://localhost:8888/nbconvert/html/co2.ipynb?download=false

In [5]: co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r'D:\Year 2\visualisation\CO2')
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '068-CO-1':
nameSensor.append(row[1])
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
CO2=np.array(co2,dtype=np.int16)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
blue_line = mlines.Line2D([], [], color='orange', marker= '_',
markersize=80, label='CO2 68th node')
plt.legend(handles=[blue_line], prop={"size":80})
plot (time, CO2, 'orange')
Out[5]: [<matplotlib.lines.Line2D at 0x12cd4160>]

06.04.2016 11:42

co2

5 of 9

http://localhost:8888/nbconvert/html/co2.ipynb?download=false

In [6]: co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r'D:\Year 2\visualisation\CO2')
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '098-CO-1':
nameSensor.append(row[1])
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
CO2=np.array(co2,dtype=np.int16)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
blue_line = mlines.Line2D([], [], color='orange', marker= '_',
markersize=80, label='CO2 98th node')
plt.legend(handles=[blue_line], prop={"size":80})
plot (time, CO2, 'orange')
Out[6]: [<matplotlib.lines.Line2D at 0x1dc55d68>]

06.04.2016 11:42

co2

6 of 9

http://localhost:8888/nbconvert/html/co2.ipynb?download=false

In [7]: co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r'D:\Year 2\visualisation\CO2')
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '014-CO-1':
nameSensor.append(row[1])
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
CO2=np.array(co2,dtype=np.int16)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
blue_line = mlines.Line2D([], [], color='orange', marker= '_',
markersize=80, label='CO2 14th node')
plt.legend(handles=[blue_line], prop={"size":80})
plot (time, CO2, 'orange')
Out[7]: [<matplotlib.lines.Line2D at 0x31945048>]

06.04.2016 11:42

co2

7 of 9

http://localhost:8888/nbconvert/html/co2.ipynb?download=false

In [8]: co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r'D:\Year 2\visualisation\CO2')
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '041-CO-1':
nameSensor.append(row[1])
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
CO2=np.array(co2,dtype=np.int16)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
blue_line = mlines.Line2D([], [], color='orange', marker= '_',
markersize=80, label='CO2 41st node')
plt.legend(handles=[blue_line], prop={"size":80})
plot (time, CO2, 'orange')
Out[8]: [<matplotlib.lines.Line2D at 0x3ed82e80>]

06.04.2016 11:42

co2

8 of 9

http://localhost:8888/nbconvert/html/co2.ipynb?download=false

In [9]: co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r'D:\Year 2\visualisation\CO2')
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '029-CO-1':
nameSensor.append(row[1])
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
CO2=np.array(co2,dtype=np.int16)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
blue_line = mlines.Line2D([], [], color='orange', marker= '_',
markersize=80, label='CO2 29th node')
plt.legend(handles=[blue_line], prop={"size":80})
plot (time, CO2, 'orange')
Out[9]: [<matplotlib.lines.Line2D at 0x3fb4a2e8>]

06.04.2016 11:42

co2

9 of 9

http://localhost:8888/nbconvert/html/co2.ipynb?download=false

In [10]: co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r'D:\Year 2\visualisation\CO2')
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '053-CO-1':
nameSensor.append(row[1])
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
CO2=np.array(co2,dtype=np.int16)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
blue_line = mlines.Line2D([], [], color='orange', marker= '_',
markersize=80, label='CO2 53th node')
plt.legend(handles=[blue_line], prop={"size":80})
plot (time, CO2, 'orange')
Out[10]: [<matplotlib.lines.Line2D at 0x71ea0b8>]

In [ ]:

06.04.2016 11:42

co2 - spectrogram

1 of 8

http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...

In [4]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
co2=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\CO2")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '020-CO-1':
nameSensor.append(row[1])
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

CO2=np.array(co2,dtype=np.int16)
yCO2=fft(CO2)
fs = 0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(CO2, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()

06.04.2016 11:51

co2 - spectrogram

2 of 8

http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...

In [6]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
co2=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
co2=list() #declaration
time=list() #declaration
filelist=list() #declaration
nameSensor=list() #declaration
os.chdir(r"D:\\Year 2\\visualisation\\CO2") #the location where all the csv f
iles from CO2 station are stored
for file in glob.glob("*.csv"): # the program should read all the documents i
n that file with csv format
filelist.append(file) #program loads the file in the working space
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')#program reads the data between
the semicolons
reader.next()
for row in reader:
if row[1]== '170-CO-1': #if the name of variable in row[1] matche
s the name of the station introduced by the user, the program gets the data i
n all files only related to that specific station
nameSensor.append(row[1]) #station
co2.append(row[2]) # co2
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S')) #
time
CO2=np.array(co2,dtype=np.int16) # define the co2 data as integer numbers
yCO2=fft(CO2) #perform fft of CO2 data
fs=0.1 # sampled frequency
plt.tick_params(labelsize=5) # size of the axis labels
f,t,Sxx = signal.spectrogram(CO2, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx) #plot the spectrogram of CO2
plt.xlabel(u"Time ") #x axis label
plt.ylabel(u"Frequency [Hz]") # y axis label
plt.colorbar() #plot color bar
plt.show() # display spectrogram

06.04.2016 11:51

co2 - spectrogram

3 of 8

http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...

In [20]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
co2=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\CO2")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '068-CO-1':
nameSensor.append(row[1])
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

CO2=np.array(co2,dtype=np.int16)
yCO2=fft(CO2)
fs =0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(CO2, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()

06.04.2016 11:51

co2 - spectrogram

4 of 8

http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...

In [8]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
co2=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\CO2")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '098-CO-1':
nameSensor.append(row[1])
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

CO2=np.array(co2,dtype=np.int16)
yCO2=fft(CO2)
fs =0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(CO2, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()

06.04.2016 11:51

co2 - spectrogram

5 of 8

http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...

In [12]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
co2=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\CO2")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '014-CO-1':
nameSensor.append(row[1])
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

CO2=np.array(co2,dtype=np.int16)
yCO2=fft(CO2)
fs=0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(CO2, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()

06.04.2016 11:51

co2 - spectrogram

6 of 8

http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...

In [16]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
co2=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\CO2")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '041-CO-1':
nameSensor.append(row[1])
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

CO2=np.array(co2,dtype=np.int16)
yCO2=fft(CO2)
fs=0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(CO2, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()

06.04.2016 11:51

co2 - spectrogram

7 of 8

http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...

In [18]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
co2=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\CO2")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '029-CO-1':
nameSensor.append(row[1])
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

CO2=np.array(co2,dtype=np.int16)
yCO2=fft(CO2)
fs=0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(CO2, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()

06.04.2016 11:51

co2 - spectrogram

8 of 8

http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...

In [19]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
co2=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
co2=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\CO2")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '053-CO-1':
nameSensor.append(row[1])
co2.append(row[2])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

CO2=np.array(co2,dtype=np.int16)
yCO2=fft(CO2)
fs=0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(CO2, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()
In [ ]:

06.04.2016 11:51

air_temperature

1 of 9

http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...

In [1]: %pylab inline


pylab.rcParams['figure.figsize'] = (100, 6)
import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.lines as mlines
Populating the interactive namespace from numpy and matplotlib
In [2]: weather=list() #declaration
time=list() #declaration
filelist=list() # declaration
nameSensor=list() #declaration
os.chdir("D:\\Year 2\\visualisation\\data") #the location where all the csv fi
les from weather station are stored
for file in glob.glob("*.csv"): # the program should read all the documents in
that file with csv format
filelist.append(file) #program loads the file in the working space
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';') #program reads the data between
the semicolons
reader.next() #program reads all the elements in the files
for row in reader:
if row[1]== '014-WE-1': #if the name of variable in row[1] matches
the name of the station introduced by the user, the program gets the data in
all files only related to that specific station
nameSensor.append(row[1])#station
weather.append(row[4])#air temperature
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))#ti
me
Weather=np.array(weather,dtype=np.float32) # define the air temperature data a
s float numbers
plt.figure(figsize=(130, 20)) # the size of the graph
plt.tick_params(labelsize=90) # the size of the axis labels
plot (time, Weather, 'bo') # program plots the time series graph
Out[2]: [<matplotlib.lines.Line2D at 0xc161c18>]

06.04.2016 11:40

air_temperature

2 of 9

http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...

In [3]: weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir("D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '020-WE-1':
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
Weather=np.array(weather,dtype=np.float32)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
plot (time, Weather, 'bo')
Out[3]: [<matplotlib.lines.Line2D at 0x13105b00>]

06.04.2016 11:40

air_temperature

3 of 9

http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...

In [4]: weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir("D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '170-WE-1':
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
Weather=np.array(weather,dtype=np.float32)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
plot (time, Weather, 'bo')
Out[4]: [<matplotlib.lines.Line2D at 0x13202668>]

06.04.2016 11:40

air_temperature

4 of 9

http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...

In [5]: weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir("D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '068-WE-1':
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
Weather=np.array(weather,dtype=np.float32)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
plot (time, Weather, 'bo')
Out[5]: [<matplotlib.lines.Line2D at 0x171cf320>]

06.04.2016 11:40

air_temperature

5 of 9

http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...

In [6]: weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir("D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '098-WE-1' :
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
Weather=np.array(weather,dtype=np.float32)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
plot (time, Weather, 'bo')
Out[6]: [<matplotlib.lines.Line2D at 0x1bc68470>]

06.04.2016 11:40

air_temperature

6 of 9

http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...

In [7]: weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir("D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '041-WE-1':
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
Weather=np.array(weather,dtype=np.float32)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
plot (time, Weather, 'bo')
Out[7]: [<matplotlib.lines.Line2D at 0x17288400>]

06.04.2016 11:40

air_temperature

7 of 9

http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...

In [8]: weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir("D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '029-WE-1' :
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
Weather=np.array(weather,dtype=np.float32)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
plot (time, Weather, 'bo')
Out[8]: [<matplotlib.lines.Line2D at 0x25c116d8>]

06.04.2016 11:40

air_temperature

8 of 9

http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...

In [9]: weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir("D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '053-WE-1' :
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
Weather=np.array(weather,dtype=np.float32)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
plot (time, Weather, 'bo')
Out[9]: [<matplotlib.lines.Line2D at 0x1be53748>]

06.04.2016 11:40

air_temperature

9 of 9

http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...

In [10]: weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir("D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '187-WE-1' :
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))
Weather=np.array(weather,dtype=np.float32)
#print nameSensor
#print time
plt.figure(figsize=(130, 20))
plt.tick_params(labelsize=90)
plot (time, Weather, 'bo')
Out[10]: [<matplotlib.lines.Line2D at 0x2d71c0b8>]

In [ ]:
In [ ]:
In [ ]:

06.04.2016 11:40

airtemp spectrogram

1 of 9

http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...

In [ ]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
weather=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
weather=list() #declaration
time=list() #declaration
filelist=list() #declaration
nameSensor=list() #declaration
os.chdir(r"D:\\Year 2\\visualisation\\data") #the location where all the csv
files from weather station are stored
for file in glob.glob("*.csv"): # the program should read all the documents i
n that file with csv format
filelist.append(file) #program loads the file in the working space
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')#program reads the data between
the semicolons
reader.next() #program reads all the elements in the files
for row in reader:
if row[1]== '170-WE-1': #if the name of variable in row[1] matche
s the name of the station introduced by the user, the program gets the data i
n all files only related to that specific station
nameSensor.append(row[1]) #station
weather.append(row[4])#air_temperature
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))#t
ime
WEATHER=np.array(weather,dtype=np.float32)# define the air temperature data a
s float numbers
yWEATHER=fft(WEATHER) # program performs the fft of the weather data
fs=0.1 # the sampled frequency
#plot spectrogram
plt.tick_params(labelsize=5) # set the size of the axes labels
f,t,Sxx = signal.spectrogram(WEATHER, fs, nperseg=128) # define the spectrogr
am
plt.pcolormesh(t,f,Sxx) # plot the spectrogram
plt.xlabel(u"Time ") # X axis label
plt.ylabel(u"Frequency [Hz]") # Y axis label
plt.colorbar() # plot the color bar
plt.show() # display the spectrogram

06.04.2016 11:49

airtemp spectrogram

2 of 9

http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...

In [ ]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
weather=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '020-WE-1':
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

WEATHER=np.array(weather,dtype=np.float32)
yWEATHER=fft(WEATHER)
fs=0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(WEATHER, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()

06.04.2016 11:49

airtemp spectrogram

3 of 9

http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...

In [ ]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
weather=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '068-WE-1':
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

WEATHER=np.array(weather,dtype=np.float32)
yWEATHER=fft(WEATHER)
fs=0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(WEATHER, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()

06.04.2016 11:49

airtemp spectrogram

4 of 9

http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...

In [ ]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
weather=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '098-WE-1':
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

WEATHER=np.array(weather,dtype=np.float32)
yWEATHER=fft(WEATHER)
fs=0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(WEATHER, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()

06.04.2016 11:49

airtemp spectrogram

5 of 9

http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...

In [ ]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
weather=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '014-WE-1':
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

WEATHER=np.array(weather,dtype=np.float32)
yWEATHER=fft(WEATHER)
fs=0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(WEATHER, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()

06.04.2016 11:49

airtemp spectrogram

6 of 9

http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...

In [ ]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
weather=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '041-WE-1':
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

WEATHER=np.array(weather,dtype=np.float32)
yWEATHER=fft(WEATHER)
fs=0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(WEATHER, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()

06.04.2016 11:49

airtemp spectrogram

7 of 9

http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...

In [ ]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
weather=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '029-WE-1':
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

WEATHER=np.array(weather,dtype=np.float32)
yWEATHER=fft(WEATHER)
fs=0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(WEATHER, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()

06.04.2016 11:49

airtemp spectrogram

8 of 9

http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...

In [ ]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
weather=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '053-WE-1':
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

WEATHER=np.array(weather,dtype=np.float32)
yWEATHER=fft(WEATHER)
fs=0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(WEATHER, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()

06.04.2016 11:49

airtemp spectrogram

9 of 9

http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...

In [ ]: from matplotlib.pyplot import specgram


import csv
import numpy as np
from datetime import datetime
import glob, os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
from matplotlib import style
from scipy import fftpack
from scipy import signal
from scipy.fftpack import fft
weather=list()
time=list()
filelist=list()
nameSensor=list()
plt.close('all')
weather=list()
time=list()
filelist=list()
nameSensor=list()
os.chdir(r"D:\\Year 2\\visualisation\\data")
for file in glob.glob("*.csv"):
filelist.append(file)
for index in range(len(filelist)):
with open(filelist[index]) as f:
reader = csv.reader(f, delimiter=';')
reader.next() #skip header
for row in reader:
if row[1]== '187-WE-1':
nameSensor.append(row[1])
weather.append(row[4])
time.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S'))

WEATHER=np.array(weather,dtype=np.float32)
yWEATHER=fft(WEATHER)
fs=0.1
plt.tick_params(labelsize=5)
f,t,Sxx = signal.spectrogram(WEATHER, fs, nperseg=128)
plt.pcolormesh(t,f,Sxx)
plt.xlabel(u"Time ")
plt.ylabel(u"Frequency [Hz]")
plt.colorbar()
plt.show()
In [ ]:

06.04.2016 11:49

You might also like