Visualisation Not Final
-
Upload
andrei-victor -
Category
Documents
-
view
224 -
download
0
Transcript of Visualisation Not Final
-
8/18/2019 Visualisation Not Final
1/36
4/6/2016 Visualisation Practical
Electronic notebook
Cristina Tocu - 328579
Andrei Iessensky -328573
-
8/18/2019 Visualisation Not Final
2/36
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 pltimport 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
ith 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]: []
http://localhost:8888/nbconvert/html/co2.ipynb?download=false
9 06.04.2016 11:42
-
8/18/2019 Visualisation Not Final
3/36
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]: []
http://localhost:8888/nbconvert/html/co2.ipynb?download=false
9 06.04.2016 11:42
-
8/18/2019 Visualisation Not Final
4/36
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]: []
http://localhost:8888/nbconvert/html/co2.ipynb?download=false
9 06.04.2016 11:42
-
8/18/2019 Visualisation Not Final
5/36
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]: []
http://localhost:8888/nbconvert/html/co2.ipynb?download=false
9 06.04.2016 11:42
-
8/18/2019 Visualisation Not Final
6/36
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]: []
http://localhost:8888/nbconvert/html/co2.ipynb?download=false
9 06.04.2016 11:42
-
8/18/2019 Visualisation Not Final
7/36
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]: []
http://localhost:8888/nbconvert/html/co2.ipynb?download=false
9 06.04.2016 11:42
-
8/18/2019 Visualisation Not Final
8/36
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]: []
http://localhost:8888/nbconvert/html/co2.ipynb?download=false
9 06.04.2016 11:42
-
8/18/2019 Visualisation Not Final
9/36
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]: []
http://localhost:8888/nbconvert/html/co2.ipynb?download=false
9 06.04.2016 11:42
-
8/18/2019 Visualisation Not Final
10/36
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]: []
In [ ]:
http://localhost:8888/nbconvert/html/co2.ipynb?download=false
9 06.04.2016 11:42
-
8/18/2019 Visualisation Not Final
11/36
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 cbookfrom 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()
- spectrogram http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...
8 06.04.2016 11:51
-
8/18/2019 Visualisation Not Final
12/36
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 fftpackfrom 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() #declarationnameSensor=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
- spectrogram http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...
8 06.04.2016 11:51
-
8/18/2019 Visualisation Not Final
13/36
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 fftpackfrom 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()
- spectrogram http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...
8 06.04.2016 11:51
-
8/18/2019 Visualisation Not Final
14/36
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 fftpackfrom 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()
- spectrogram http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...
8 06.04.2016 11:51
-
8/18/2019 Visualisation Not Final
15/36
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 fftpackfrom 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()
- spectrogram http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...
8 06.04.2016 11:51
-
8/18/2019 Visualisation Not Final
16/36
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 fftpackfrom 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()
- spectrogram http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...
8 06.04.2016 11:51
-
8/18/2019 Visualisation Not Final
17/36
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 fftpackfrom 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()
- spectrogram http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...
8 06.04.2016 11:51
-
8/18/2019 Visualisation Not Final
18/36
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 fftpackfrom 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 [ ]:
- spectrogram http://localhost:8888/nbconvert/html/co2 - spectrogram.ipynb?downloa...
8 06.04.2016 11:51
-
8/18/2019 Visualisation Not Final
19/36
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]: []
temperature http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...
9 06.04.2016 11:40
-
8/18/2019 Visualisation Not Final
20/36
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]: []
temperature http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...
9 06.04.2016 11:40
-
8/18/2019 Visualisation Not Final
21/36
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]: []
temperature http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...
9 06.04.2016 11:40
-
8/18/2019 Visualisation Not Final
22/36
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]: []
temperature http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...
9 06.04.2016 11:40
-
8/18/2019 Visualisation Not Final
23/36
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]: []
temperature http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...
9 06.04.2016 11:40
-
8/18/2019 Visualisation Not Final
24/36
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]: []
temperature http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...
9 06.04.2016 11:40
-
8/18/2019 Visualisation Not Final
25/36
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]: []
temperature http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...
9 06.04.2016 11:40
-
8/18/2019 Visualisation Not Final
26/36
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]: []
temperature http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...
9 06.04.2016 11:40
-
8/18/2019 Visualisation Not Final
27/36
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]: []
In [ ]:
In [ ]:
In [ ]:
temperature http://localhost:8888/nbconvert/html/air_temperature.ipynb?download=...
9 06.04.2016 11:40
-
8/18/2019 Visualisation Not Final
28/36
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 cbookfrom 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 numbersyWEATHER=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
mp spectrogram http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...
9 06.04.2016 11:49
-
8/18/2019 Visualisation Not Final
29/36
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 fftpackfrom 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()
mp spectrogram http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...
9 06.04.2016 11:49
-
8/18/2019 Visualisation Not Final
30/36
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 fftpackfrom 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()
mp spectrogram http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...
9 06.04.2016 11:49
-
8/18/2019 Visualisation Not Final
31/36
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 fftpackfrom 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()
mp spectrogram http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...
9 06.04.2016 11:49
-
8/18/2019 Visualisation Not Final
32/36
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 fftpackfrom 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()
mp spectrogram http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...
9 06.04.2016 11:49
-
8/18/2019 Visualisation Not Final
33/36
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 fftpackfrom 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()
mp spectrogram http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...
9 06.04.2016 11:49
-
8/18/2019 Visualisation Not Final
34/36
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 fftpackfrom 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()
mp spectrogram http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...
9 06.04.2016 11:49
-
8/18/2019 Visualisation Not Final
35/36
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 fftpackfrom 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()
mp spectrogram http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...
9 06.04.2016 11:49
-
8/18/2019 Visualisation Not Final
36/36
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 fftpackfrom 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 [ ]:
mp spectrogram http://localhost:8888/nbconvert/html/airtemp spectrogram.ipynb?downl...