Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DataEvaluationDWD
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gerrit Erichsen
DataEvaluationDWD
Commits
66e10fe8
Commit
66e10fe8
authored
Jan 06, 2020
by
Gerrit Erichsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some comments and more concise naming. nothing of importance done here
parent
02d796cd
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
288 additions
and
216 deletions
+288
-216
Code/evaluation.py
Code/evaluation.py
+86
-73
Code/station.py
Code/station.py
+202
-143
No files found.
Code/evaluation.py
View file @
66e10fe8
...
...
@@ -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
_stats
1
.
set_ylabel
(
"K"
)
elif
dataType
==
'solar'
:
plt1
.
set_ylabel
(
'W / m$^2$'
)
plt
_stats
1
.
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'
fig
1
.
subplots_adjust
(
wspace
=
0.3
,
hspace
=
0.3
)
fig
1
.
savefig
(
figFileName
,
dpi
=
600
,
format
=
'png'
)
fig
Stat
.
subplots_adjust
(
wspace
=
0.3
,
hspace
=
0.3
)
fig
Stat
.
savefig
(
figFileName
,
dpi
=
600
,
format
=
'png'
)
plt
.
close
()
plt
.
clf
()
if
len
(
stations2
)
>
0
:
fig2
=
plt
.
figure
(
figsize
=
(
widthInInch
,
heightInInch
))
plt
1
=
fig
2
.
add_subplot
(
131
)
plt
2
=
fig
2
.
add_subplot
(
132
)
plt
3
=
fig
2
.
add_subplot
(
133
)
plt
1
.
boxplot
(
rmse2
,
labels
=
xLabelBox2
)
plt
1
.
set_title
(
"RMSE"
)
fig
Stat
2
=
plt
.
figure
(
figsize
=
(
widthInInch
,
heightInInch
))
plt
Stat4
=
figStat
2
.
add_subplot
(
131
)
plt
Stat5
=
figStat
2
.
add_subplot
(
132
)
plt
Stat6
=
figStat
2
.
add_subplot
(
133
)
plt
Stat4
.
boxplot
(
rmse2
,
labels
=
xLabelBox2
)
plt
Stat4
.
set_title
(
"RMSE"
)
if
dataType
==
'temperature'
:
plt
1
.
set_ylabel
(
"K"
)
plt
Stat4
.
set_ylabel
(
"K"
)
elif
dataType
==
'solar'
:
plt
1
.
set_ylabel
(
'W / m$^2$'
)
plt
Stat4
.
set_ylabel
(
'W / m$^2$'
)
else
:
plt
1
.
set_ylabel
(
'Deg'
)
plt
1
.
annotate
(
annotation
,
(
0.6
,
0.95
*
np
.
max
(
rmse2
)),
fontsize
=
8
)
plt
2
.
boxplot
(
mae2
,
labels
=
xLabelBox2
)
plt
2
.
set_title
(
"MAE"
)
plt
3
.
boxplot
(
mbe2
,
labels
=
xLabelBox2
)
plt
3
.
set_title
(
"MBE"
)
plt
Stat4
.
set_ylabel
(
'Deg'
)
plt
Stat4
.
annotate
(
annotation
,
(
0.6
,
0.95
*
np
.
max
(
rmse2
)),
fontsize
=
8
)
plt
Stat5
.
boxplot
(
mae2
,
labels
=
xLabelBox2
)
plt
Stat5
.
set_title
(
"MAE"
)
plt
Stat6
.
boxplot
(
mbe2
,
labels
=
xLabelBox2
)
plt
Stat6
.
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'
)
fig
Stat
2
.
subplots_adjust
(
wspace
=
0.3
,
hspace
=
0.3
)
fig
Stat
2
.
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.
fig
3
=
plt
.
figure
(
figsize
=
(
widthInInch
,
heightInInch2
))
fig
ScatterW
=
plt
.
figure
(
figsize
=
(
widthInInch
,
heightInInch2
))
if
dataType
!=
'temperature'
:
plt
1
=
fig3
.
add_subplot
(
231
)
plt
2
=
fig3
.
add_subplot
(
232
)
plt
3
=
fig3
.
add_subplot
(
233
)
plt
4
=
fig3
.
add_subplot
(
234
)
plt
5
=
fig3
.
add_subplot
(
235
)
plt
6
=
fig3
.
add_subplot
(
236
)
plt
SctW1
=
figScatterW
.
add_subplot
(
231
)
plt
SctW2
=
figScatterW
.
add_subplot
(
232
)
plt
SctW3
=
figScatterW
.
add_subplot
(
233
)
plt
SctW4
=
figScatterW
.
add_subplot
(
234
)
plt
SctW5
=
figScatterW
.
add_subplot
(
235
)
plt
SctW6
=
figScatterW
.
add_subplot
(
236
)
else
:
plt
1
=
fig3
.
add_subplot
(
131
)
plt
2
=
fig3
.
add_subplot
(
132
)
plt
3
=
fig3
.
add_subplot
(
133
)
plt
SctW1
=
figScatterW
.
add_subplot
(
131
)
plt
SctW2
=
figScatterW
.
add_subplot
(
132
)
plt
SctW3
=
figScatterW
.
add_subplot
(
133
)
stations
[
worstRMSE
].
createPlots
(
plt1
,
True
)
stations
[
worstMAE
].
createPlots
(
plt2
)
stations
[
worstMBE
].
createPlots
(
plt3
)
stations
[
worstRMSE
].
createPlots
(
plt
SctW
1
,
True
)
stations
[
worstMAE
].
createPlots
(
plt
SctW
2
)
stations
[
worstMBE
].
createPlots
(
plt
SctW
3
)
if
len
(
stations2
)
>
worstRMSE
:
stations2
[
worstRMSE
].
createPlots
(
plt4
,
True
)
stations2
[
worstRMSE
].
createPlots
(
plt
SctW
4
,
True
)
if
len
(
stations2
)
>
worstMAE
:
stations2
[
worstMAE
].
createPlots
(
plt5
)
stations2
[
worstMAE
].
createPlots
(
plt
SctW
5
)
if
len
(
stations2
)
>
worstMBE
:
stations2
[
worstMBE
].
createPlots
(
plt6
)
fig
3
.
subplots_adjust
(
wspace
=
0.3
,
hspace
=
0.3
)
fig
3
.
savefig
(
figFileName
,
dpi
=
600
,
format
=
'png'
)
stations2
[
worstMBE
].
createPlots
(
plt
SctW
6
)
fig
ScatterW
.
subplots_adjust
(
wspace
=
0.3
,
hspace
=
0.3
)
fig
ScatterW
.
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.
fig
4
=
plt
.
figure
(
figsize
=
(
widthInInch
,
heightInInch2
))
fig
ScatterB
=
plt
.
figure
(
figsize
=
(
widthInInch
,
heightInInch2
))
if
dataType
!=
'temperature'
:
plt
1
=
fig4
.
add_subplot
(
231
)
plt
2
=
fig4
.
add_subplot
(
232
)
plt
3
=
fig4
.
add_subplot
(
233
)
plt
4
=
fig4
.
add_subplot
(
234
)
plt
5
=
fig4
.
add_subplot
(
235
)
plt
6
=
fig4
.
add_subplot
(
236
)
plt
SctB1
=
figScatterB
.
add_subplot
(
231
)
plt
SctB2
=
figScatterB
.
add_subplot
(
232
)
plt
SctB3
=
figScatterB
.
add_subplot
(
233
)
plt
SctB4
=
figScatterB
.
add_subplot
(
234
)
plt
SctB5
=
figScatterB
.
add_subplot
(
235
)
plt
SctB6
=
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
)
plt
SctB
1
=
fig4
.
add_subplot
(
131
)
plt
SctB
2
=
fig4
.
add_subplot
(
132
)
plt
SctB
3
=
fig4
.
add_subplot
(
133
)
stations
[
bestRMSE
].
createPlots
(
plt
SctB
1
)
stations
[
bestMAE
].
createPlots
(
plt
SctB
2
)
stations
[
bestMBE
].
createPlots
(
plt
SctB
3
)
if
len
(
stations2
)
>
bestRMSE
:
stations2
[
bestRMSE
].
createPlots
(
plt4
)
stations2
[
bestRMSE
].
createPlots
(
plt
SctB
4
)
if
len
(
stations2
)
>
bestMAE
:
stations2
[
bestMAE
].
createPlots
(
plt5
)
stations2
[
bestMAE
].
createPlots
(
plt
SctB
5
)
if
len
(
stations2
)
>
bestMBE
:
stations2
[
bestMBE
].
createPlots
(
plt6
)
fig
4
.
subplots_adjust
(
wspace
=
0.3
,
hspace
=
0.3
)
fig
4
.
savefig
(
figFileName
,
dpi
=
600
,
format
=
'png'
)
stations2
[
bestMBE
].
createPlots
(
plt
SctB
6
)
fig
ScatterB
.
subplots_adjust
(
wspace
=
0.3
,
hspace
=
0.3
)
fig
ScatterB
.
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'
:
...
...
@@ -490,4 +503,4 @@ if __name__ == '__main__':
fig
.
colorbar
(
image
,
cax
=
cax
,
orientation
=
'vertical'
)
plt
.
savefig
(
figFileName
,
dpi
=
600
,
format
=
'png'
)
print
(
totalMean
)
print
(
'Finished'
)
\ No newline at end of file
print
(
'Finished'
)
Code/station.py
View file @
66e10fe8
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment