Übersicht_Lueftung

Bibliotheken importieren

# Name des aktuellen Notebooks für die exportierten Datein
file_name = "Analyse_CO2_Konzentration" 
# Ordner auf dem Server (nach files/)
ftp_folder = 'Notebooks/Auswertung'
## Bibliotheken, Module und Text- bzw- Grafikformatierungen aus zentraler Datei laden
%run ../Template/libraries_and_styles.ipynb 
## Warum auch immer muss rcParams.update() in eine eigene Zelle...
mpl.rcParams.update(params)

Daten Import

daten = pd.read_csv('../1_Daten/Arbeitsdaten/Daten_15s.csv')
daten["Zeit"] = pd.to_datetime(daten["Zeit"],dayfirst=True)
daten.set_index(['Zeit'], inplace=True)

CO2 Plots

von        = pd.to_datetime("2017-05-01 00:00:00",infer_datetime_format=True)
bis        = pd.to_datetime("2018-04-30 23:00:00",infer_datetime_format=True)

fig, ax = plt.subplots(nrows=2, ncols=1)
## Liniendiagramm
daten['L_Seminarraum_1_CO2'].plot(ax=ax[0],linewidth=0.5,color=colo('blau',1))  
daten['L_Seminarraum_2_CO2'].plot(ax=ax[0],linewidth=0.5,color=colo('orange',1))  
ax[0].set_title('CO2 Konzentration')
ax[0].set_xlabel('') 
ax[0].set_xlim(von, bis) 
ax[0].xaxis.set_major_formatter(mdates.DateFormatter('%b'))
plt.setp(ax[0].get_xticklabels(), rotation=0, horizontalalignment='left')
ax[0].legend()
## Histogramm 
daten['L_Seminarraum_1_CO2'].plot.hist(bins=600, density=False,linewidth=0.8, color=colo('blau',1), ax=ax[1], histtype='step') 
daten['L_Seminarraum_2_CO2'].plot.hist(bins=600, density=False,linewidth=0.8, color=colo('orange',1), ax=ax[1], histtype='step') 
ax[1].set_ylabel('')
ax[1].legend()
<matplotlib.legend.Legend at 0x2010751a408>

Mittelwerte stündlich

Sem1 = []
Sem2 = []
for i in range(0, 24):
    Sem1.append(daten.L_Seminarraum_1_CO2.loc[(daten.index.hour==i)].resample("1H").mean().mean().sum())
    Sem2.append(daten.L_Seminarraum_2_CO2.loc[(daten.index.hour==i)].resample("1H").mean().mean().sum())



labels = range(0, 24)
width = 0.35 
x = np.arange(len(labels))

fig, ax = plt.subplots()
rects1 = ax.bar(x - width/2, Sem1, width, edgecolor="k", color=colo('blau',1),  label='Sem1 CO2')
rects2 = ax.bar(x + width/2, Sem2, width, edgecolor="k", color=colo('orange',1),  label='Sem2 CO2')
ax.set(ylim=[400,700]) 
ax.set_ylabel('ppm')
ax.set_title('CO2 stündliche Mittelwerte')
ax.set_xticks(x)
ax.set_xticklabels(labels)
ax.legend()
<matplotlib.legend.Legend at 0x2010b0c3e08>

Medianwerte stündlich

Sem1 = []
Sem2 = []
for i in range(0, 24):
    Sem1.append(daten.L_Seminarraum_1_CO2.loc[(daten.index.hour==i)].resample("1H").median().mean().sum())
    Sem2.append(daten.L_Seminarraum_2_CO2.loc[(daten.index.hour==i)].resample("1H").median().mean().sum())



labels = range(0, 24)
width = 0.35 
x = np.arange(len(labels))

fig, ax = plt.subplots()
rects1 = ax.bar(x - width/2, Sem1, width, edgecolor="k", color=colo('blau',1),  label='Sem1 CO2')
rects2 = ax.bar(x + width/2, Sem2, width, edgecolor="k", color=colo('orange',1),  label='Sem2 CO2')
ax.set(ylim=[400,700]) 
ax.set_ylabel('ppm')
ax.set_title('CO2 stündliche Medianwerte')
ax.set_xticks(x)
ax.set_xticklabels(labels)
ax.legend()
<matplotlib.legend.Legend at 0x2010aa16b88>

Mittelwerte täglich

daten_sub = daten.loc['2017-08-12':'2018-04-30']

Sem1 = []
Sem2 = [] 
for i in range(1,8):
    Sem1.append(daten_sub.L_Seminarraum_1_CO2.loc[(daten_sub.index.day==i)].resample("1D").mean().mean().sum())
    Sem2.append(daten_sub.L_Seminarraum_2_CO2.loc[(daten_sub.index.day==i)].resample("1D").mean().mean().sum())



labels = range(1,8)
width = 0.35 
x = np.arange(len(labels))

fig, ax = plt.subplots()
rects1 = ax.bar(x - width/2, Sem1, width, edgecolor="k", color=colo('blau',1),  label='Sem1 CO2')
rects2 = ax.bar(x + width/2, Sem2, width, edgecolor="k", color=colo('orange',1),  label='Sem2 CO2')
ax.set(ylim=[400,700]) 
ax.set_ylabel('ppm')
ax.set_title('CO2 tägliche Mittelwerte August bis April ')
ax.set_xticks(x)
ax.set_xticklabels(['Mo','Di','Mi','Do','Fr','Sa','So'])
ax.legend()
<matplotlib.legend.Legend at 0x2010ab8cfc8>

quadriert

daten_sub = daten.loc['2017-08-12':'2018-04-30']

Sem1 = []
Sem2 = []
pot = 4.
for i in range(1,8):
    Sem1.append(pow(daten_sub.L_Seminarraum_1_CO2.loc[(daten_sub.index.day==i)],pot).resample("1D").mean().mean().sum()**(1./pot))
    Sem2.append(pow(daten_sub.L_Seminarraum_2_CO2.loc[(daten_sub.index.day==i)],pot).resample("1D").mean().mean().sum()**(1./pot))



labels = range(1,8)
width = 0.35 
x = np.arange(len(labels))

fig, ax = plt.subplots()
rects1 = ax.bar(x - width/2, Sem1, width, edgecolor="k", color=colo('blau',1),  label='Sem1 CO2')
rects2 = ax.bar(x + width/2, Sem2, width, edgecolor="k", color=colo('orange',1),  label='Sem2 CO2')
ax.set(ylim=[400,700]) 
ax.set_ylabel('ppm')
ax.set_title('CO2 tägliche Mittelwerte August bis April '+str(pot))
ax.set_xticks(x)
ax.set_xticklabels(['Mo','Di','Mi','Do','Fr','Sa','So'])
ax.legend()
<matplotlib.legend.Legend at 0x2010ab8ec08>

Medianwerte täglich

daten_sub = daten.loc['2017-08-12':'2018-04-30']

Sem1 = []
Sem2 = [] 
for i in range(1,8):
    Sem1.append(daten_sub.L_Seminarraum_1_CO2.loc[(daten_sub.index.day==i)].resample("1D").median().mean().sum())
    Sem2.append(daten_sub.L_Seminarraum_2_CO2.loc[(daten_sub.index.day==i)].resample("1D").median().mean().sum())



labels = range(1,8)
width = 0.35 
x = np.arange(len(labels))

fig, ax = plt.subplots()
rects1 = ax.bar(x - width/2, Sem1, width, edgecolor="k", color=colo('blau',1),  label='Sem1 CO2')
rects2 = ax.bar(x + width/2, Sem2, width, edgecolor="k", color=colo('orange',1),  label='Sem2 CO2')
ax.set(ylim=[400,700]) 
ax.set_ylabel('ppm')
ax.set_title('CO2 tägliche Medianwerte August bis April '+str(pot))
ax.set_xticks(x)
ax.set_xticklabels(['Mo','Di','Mi','Do','Fr','Sa','So'])
ax.legend()
<matplotlib.legend.Legend at 0x2010acc4dc8>

Mittelwerte wöchentlich

# daten_sub = daten.loc['2017-08-12':'2018-04-30']

Sem1 = []
Sem2 = []
for i in range(1,53):
    Sem1.append(daten.L_Seminarraum_1_CO2.loc[(daten.index.week==i)].resample("1W").mean().mean().sum())
    Sem2.append(daten.L_Seminarraum_2_CO2.loc[(daten.index.week==i)].resample("1W").mean().mean().sum())



labels = range(1,53)
width = 0.35 
x = np.arange(len(labels))

fig, ax = plt.subplots()
rects1 = ax.bar(x - width/2, Sem1, width, edgecolor="k", color=colo('blau',1),  label='Sem1 CO2')
rects2 = ax.bar(x + width/2, Sem2, width, edgecolor="k", color=colo('orange',1),  label='Sem2 CO2')
ax.set(ylim=[400,700]) 
ax.set_ylabel('ppm')
ax.set_title('CO2 wöchentliche Mittelwerte August bis April')


# ax.set_xticklabels(['Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez','Jan','Feb','Mrz','Apr'])
# ax.set_xticks(x*2[::2])
# ax.set_xticklabels(x*2[::2])
# ax.set_xticks(x)
# ax.set_xticks(ax.get_xticks()[0:207:4])
# plt.xticks(list(range(0, 0,4))) 

ax.set_xticklabels(labels)
ax.legend()
<matplotlib.legend.Legend at 0x2010ad98bc8>

Mittelwerte monatlich

# daten_sub = daten.loc['2017-08-12':'2018-04-30']

Sem1 = []
Sem2 = []
for i in range(1,13):
    Sem1.append(daten.L_Seminarraum_1_CO2.loc[(daten.index.month==i)].resample("1M").mean().mean().sum())
    Sem2.append(daten.L_Seminarraum_2_CO2.loc[(daten.index.month==i)].resample("1M").mean().mean().sum())



labels = range(1,13)
width = 0.35 
x = np.arange(len(labels))

fig, ax = plt.subplots()
rects1 = ax.bar(x - width/2, Sem1, width, edgecolor="k", color=colo('blau',1), label='Sem1 CO2')
rects2 = ax.bar(x + width/2, Sem2, width, edgecolor="k", color=colo('orange',1), label='Sem2 CO2')
ax.set(ylim=[400,700]) 
ax.set_ylabel('ppm')
ax.set_title('CO2 monatliche Mittelwerte August bis April')
ax.set_xticks(x)
# ax.xaxis.set_major_locator(ticker.MultipleLocator(4))
ax.set_xticklabels(['Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez','Jan','Feb','Mrz','Apr'])
ax.legend()
<matplotlib.legend.Legend at 0x201578bb5c8>

Save & Upload

## Skriptlaufzeit Ende (Funktion in: libraries_and_styles.ipynb)
hours, minutes, seconds = laufzeit()
## Notebook speichern vor dem Upload (Funktion in: libraries_and_styles.ipynb)
save_notebook() 
## Notebook als Markdown Datei mit eingebetten Grafiken speichern und auf den Server laden
%run ../Template/save_and_upload.ipynb  
 Gasverbrauch16_20 Lueftung_aus