The URI of TUHH Docker Registry changed from "docker.rz.tu-harburg.de:5000" to "docker.rz.tu-harburg.de". Please update your gitlab-ci.yml files if you use images from this registry.

Commit 66e10fe8 authored by Gerrit Erichsen's avatar Gerrit Erichsen

Some comments and more concise naming. nothing of importance done here

parent 02d796cd
......@@ -3,7 +3,17 @@
Created on Thu Aug 29 08:00:58 2019
@author: Gerrit Erichsen
@brief:
@brief: script to evaluate weather data published at
@details: This script is meant to make a somewhat concise evaluation of the
quality of the data obtained from the DWD's COSMO model and published
in an easy access format under <link>.
Therefore the data is compared to the data of DWD's weather
observation stations taken from DWD's climate data center (CDC).
The grid cell with its center coordinates closest to the coordinates
of the observation station is used to make this comparison.
@remarks: This is neither well-coded, well-commented, nor pretty, as it was
hastily implemented. You're welcome to make changes as you like.
@license: BSD license
"""
from station import WeatherStation
......@@ -316,119 +326,122 @@ if __name__ == '__main__':
annotation = 'n: %i' % (len(rmse))
fig1= plt.figure(figsize=(widthInInch, heightInInch))
plt1 = fig1.add_subplot(131)
plt2 = fig1.add_subplot(132)
plt3 = fig1.add_subplot(133)
plt1.boxplot(rmse, labels=xLabelBox1)
plt1.set_title("RMSE")
# plotting the statistics ------------------------------------------
figStat= plt.figure(figsize=(widthInInch, heightInInch))
plt_stats1 = figStat.add_subplot(131)
plt_stat2 = figStat.add_subplot(132)
plt_stat3 = figStat.add_subplot(133)
plt_stats1.boxplot(rmse, labels=xLabelBox1)
plt_stats1.set_title("RMSE")
if dataType == 'temperature':
plt1.set_ylabel("K")
plt_stats1.set_ylabel("K")
elif dataType == 'solar':
plt1.set_ylabel('W / m$^2$')
plt_stats1.set_ylabel('W / m$^2$')
else:
plt1.set_ylabel('m / s')
plt1.annotate(annotation, (0.6, 0.95 * np.max(rmse)), fontsize=8)
plt2.boxplot(mae, labels=xLabelBox1)
plt2.set_title("MAE")
plt3.boxplot(mbe, labels=xLabelBox1)
plt3.set_title("MBE")
plt_stats1.annotate(annotation, (0.6, 0.95 * np.max(rmse)), \
fontsize=8)
plt_stat2.boxplot(mae, labels=xLabelBox1)
plt_stat2.set_title("MAE")
plt_stat3.boxplot(mbe, labels=xLabelBox1)
plt_stat3.set_title("MBE")
figFileName = pathFigs + year + '_' + dataType + '_stats.png'
fig1.subplots_adjust(wspace=0.3, hspace=0.3)
fig1.savefig(figFileName, dpi=600, format='png')
figStat.subplots_adjust(wspace=0.3, hspace=0.3)
figStat.savefig(figFileName, dpi=600, format='png')
plt.close()
plt.clf()
if len(stations2) > 0:
fig2= plt.figure(figsize=(widthInInch, heightInInch))
plt1 = fig2.add_subplot(131)
plt2 = fig2.add_subplot(132)
plt3 = fig2.add_subplot(133)
plt1.boxplot(rmse2, labels=xLabelBox2)
plt1.set_title("RMSE")
figStat2= plt.figure(figsize=(widthInInch, heightInInch))
pltStat4 = figStat2.add_subplot(131)
pltStat5 = figStat2.add_subplot(132)
pltStat6 = figStat2.add_subplot(133)
pltStat4.boxplot(rmse2, labels=xLabelBox2)
pltStat4.set_title("RMSE")
if dataType == 'temperature':
plt1.set_ylabel("K")
pltStat4.set_ylabel("K")
elif dataType == 'solar':
plt1.set_ylabel('W / m$^2$')
pltStat4.set_ylabel('W / m$^2$')
else:
plt1.set_ylabel('Deg')
plt1.annotate(annotation, (0.6, 0.95 * np.max(rmse2)),
pltStat4.set_ylabel('Deg')
pltStat4.annotate(annotation, (0.6, 0.95 * np.max(rmse2)),
fontsize=8)
plt2.boxplot(mae2, labels=xLabelBox2)
plt2.set_title("MAE")
plt3.boxplot(mbe2, labels=xLabelBox2)
plt3.set_title("MBE")
pltStat5.boxplot(mae2, labels=xLabelBox2)
pltStat5.set_title("MAE")
pltStat6.boxplot(mbe2, labels=xLabelBox2)
pltStat6.set_title("MBE")
figFileName = pathFigs + year + '_' + dataType + '_stats2.png'
fig2.subplots_adjust(wspace=0.3, hspace=0.3)
fig2.savefig(figFileName, dpi=600, format='png')
figStat2.subplots_adjust(wspace=0.3, hspace=0.3)
figStat2.savefig(figFileName, dpi=600, format='png')
plt.close()
plt.clf()
#finding out, who did worst/best -----------------------------------
worstRMSE, worstMAE, worstMBE = findWorstStation(stations)
bestRMSE, bestMAE, bestMBE = findBestStation(stations)
#plotting worst ------------------------------------------------
#plotting worst ----------------------------------------------------
figFileName = pathFigs + year + '_' + dataType + '_worst.png'
heightInInch2 = heightInInch
if dataType != 'temperature':
heightInInch2 *= 2.
fig3 = plt.figure(figsize=(widthInInch, heightInInch2))
figScatterW = plt.figure(figsize=(widthInInch, heightInInch2))
if dataType != 'temperature':
plt1 = fig3.add_subplot(231)
plt2 = fig3.add_subplot(232)
plt3 = fig3.add_subplot(233)
plt4 = fig3.add_subplot(234)
plt5 = fig3.add_subplot(235)
plt6 = fig3.add_subplot(236)
pltSctW1 = figScatterW.add_subplot(231)
pltSctW2 = figScatterW.add_subplot(232)
pltSctW3 = figScatterW.add_subplot(233)
pltSctW4 = figScatterW.add_subplot(234)
pltSctW5 = figScatterW.add_subplot(235)
pltSctW6 = figScatterW.add_subplot(236)
else:
plt1 = fig3.add_subplot(131)
plt2 = fig3.add_subplot(132)
plt3 = fig3.add_subplot(133)
pltSctW1 = figScatterW.add_subplot(131)
pltSctW2 = figScatterW.add_subplot(132)
pltSctW3 = figScatterW.add_subplot(133)
stations[worstRMSE].createPlots(plt1, True)
stations[worstMAE].createPlots(plt2)
stations[worstMBE].createPlots(plt3)
stations[worstRMSE].createPlots(pltSctW1, True)
stations[worstMAE].createPlots(pltSctW2)
stations[worstMBE].createPlots(pltSctW3)
if len(stations2) > worstRMSE:
stations2[worstRMSE].createPlots(plt4, True)
stations2[worstRMSE].createPlots(pltSctW4, True)
if len(stations2) > worstMAE:
stations2[worstMAE].createPlots(plt5)
stations2[worstMAE].createPlots(pltSctW5)
if len(stations2) > worstMBE:
stations2[worstMBE].createPlots(plt6)
fig3.subplots_adjust(wspace=0.3, hspace=0.3)
fig3.savefig(figFileName, dpi=600, format='png')
stations2[worstMBE].createPlots(pltSctW6)
figScatterW.subplots_adjust(wspace=0.3, hspace=0.3)
figScatterW.savefig(figFileName, dpi=600, format='png')
plt.close()
plt.clf()
# plotting best -----------------------------------------------
# plotting best ----------------------------------------------------
figFileName = pathFigs + year + '_' + dataType + '_best.png'
heightInInch2 = heightInInch
if dataType != 'temperature':
heightInInch2 *= 2.
fig4 = plt.figure(figsize=(widthInInch, heightInInch2))
figScatterB = plt.figure(figsize=(widthInInch, heightInInch2))
if dataType != 'temperature':
plt1 = fig4.add_subplot(231)
plt2 = fig4.add_subplot(232)
plt3 = fig4.add_subplot(233)
plt4 = fig4.add_subplot(234)
plt5 = fig4.add_subplot(235)
plt6 = fig4.add_subplot(236)
pltSctB1 = figScatterB.add_subplot(231)
pltSctB2 = figScatterB.add_subplot(232)
pltSctB3 = figScatterB.add_subplot(233)
pltSctB4 = figScatterB.add_subplot(234)
pltSctB5 = figScatterB.add_subplot(235)
pltSctB6 = figScatterB.add_subplot(236)
else:
plt1 = fig4.add_subplot(131)
plt2 = fig4.add_subplot(132)
plt3 = fig4.add_subplot(133)
stations[bestRMSE].createPlots(plt1)
stations[bestMAE].createPlots(plt2)
stations[bestMBE].createPlots(plt3)
pltSctB1 = fig4.add_subplot(131)
pltSctB2 = fig4.add_subplot(132)
pltSctB3 = fig4.add_subplot(133)
stations[bestRMSE].createPlots(pltSctB1)
stations[bestMAE].createPlots(pltSctB2)
stations[bestMBE].createPlots(pltSctB3)
if len(stations2) > bestRMSE:
stations2[bestRMSE].createPlots(plt4)
stations2[bestRMSE].createPlots(pltSctB4)
if len(stations2) > bestMAE:
stations2[bestMAE].createPlots(plt5)
stations2[bestMAE].createPlots(pltSctB5)
if len(stations2) > bestMBE:
stations2[bestMBE].createPlots(plt6)
fig4.subplots_adjust(wspace=0.3, hspace=0.3)
fig4.savefig(figFileName, dpi=600, format='png')
stations2[bestMBE].createPlots(pltSctB6)
figScatterB.subplots_adjust(wspace=0.3, hspace=0.3)
figScatterB.savefig(figFileName, dpi=600, format='png')
plt.close()
plt.clf()
#- year's statistics -------------------------------------------------
#- year's statistics ---------------------------------------------------
if createMap:
figFileName = pathFigs + year + '_' + dataType + '_map.png'
if dataType == 'temperature':
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment