Commit 1d9990e8 authored by Gerrit Erichsen's avatar Gerrit Erichsen
Browse files

trying something to check bugginess

parent 02d796cd
...@@ -103,16 +103,20 @@ def findStationId(stations, stationId): ...@@ -103,16 +103,20 @@ def findStationId(stations, stationId):
return -1 return -1
if __name__ == '__main__': if __name__ == '__main__':
dataType = 'solar' #either solar, temperature or wind dataType = 'wind' #either solar, temperature or wind
dataTypeShort = '' dataTypeShort = ''
dataTypeShort2 = '' dataTypeShort2 = ''
startYear = 2011 # while for map creation the loop for each year in range was quite
endYear = 2017 # successful, it had its problems with the statistics part creating
# accurate plots so for the statistic plots,
# the limits were set to one year only
startYear = 2015
endYear = 2015
path = 'D:/WetterdatenCDC' path = 'D:/WetterdatenCDC'
path2 = 'D:/WetterdatenPamore' path2 = 'D:/WetterdatenPamore'
pathFigs = 'J:/wka/user/erichsen/DataDocumentation/images/' pathFigs = 'J:/wka/user/erichsen/DataDocumentation/images/'
validate = True validate = True
createMap = True createMap = False
font = {'family' : 'Cambria', font = {'family' : 'Cambria',
'weight' : 'normal', 'weight' : 'normal',
'size' : 10} 'size' : 10}
...@@ -337,7 +341,7 @@ if __name__ == '__main__': ...@@ -337,7 +341,7 @@ if __name__ == '__main__':
fig1.subplots_adjust(wspace=0.3, hspace=0.3) fig1.subplots_adjust(wspace=0.3, hspace=0.3)
fig1.savefig(figFileName, dpi=600, format='png') fig1.savefig(figFileName, dpi=600, format='png')
plt.close() plt.close()
plt.clf() fig1.clf()
if len(stations2) > 0: if len(stations2) > 0:
fig2= plt.figure(figsize=(widthInInch, heightInInch)) fig2= plt.figure(figsize=(widthInInch, heightInInch))
...@@ -362,7 +366,7 @@ if __name__ == '__main__': ...@@ -362,7 +366,7 @@ if __name__ == '__main__':
fig2.subplots_adjust(wspace=0.3, hspace=0.3) fig2.subplots_adjust(wspace=0.3, hspace=0.3)
fig2.savefig(figFileName, dpi=600, format='png') fig2.savefig(figFileName, dpi=600, format='png')
plt.close() plt.close()
plt.clf() fig2.clf()
worstRMSE, worstMAE, worstMBE = findWorstStation(stations) worstRMSE, worstMAE, worstMBE = findWorstStation(stations)
bestRMSE, bestMAE, bestMBE = findBestStation(stations) bestRMSE, bestMAE, bestMBE = findBestStation(stations)
...@@ -396,7 +400,7 @@ if __name__ == '__main__': ...@@ -396,7 +400,7 @@ if __name__ == '__main__':
fig3.subplots_adjust(wspace=0.3, hspace=0.3) fig3.subplots_adjust(wspace=0.3, hspace=0.3)
fig3.savefig(figFileName, dpi=600, format='png') fig3.savefig(figFileName, dpi=600, format='png')
plt.close() plt.close()
plt.clf() fig3.clf()
# plotting best ----------------------------------------------- # plotting best -----------------------------------------------
figFileName = pathFigs + year + '_' + dataType + '_best.png' figFileName = pathFigs + year + '_' + dataType + '_best.png'
heightInInch2 = heightInInch heightInInch2 = heightInInch
...@@ -426,10 +430,12 @@ if __name__ == '__main__': ...@@ -426,10 +430,12 @@ if __name__ == '__main__':
fig4.subplots_adjust(wspace=0.3, hspace=0.3) fig4.subplots_adjust(wspace=0.3, hspace=0.3)
fig4.savefig(figFileName, dpi=600, format='png') fig4.savefig(figFileName, dpi=600, format='png')
plt.close() plt.close()
plt.clf() fig4.clf()
#- year's statistics ------------------------------------------------- #- year's statistics -------------------------------------------------
if createMap: if createMap:
widthInInch = 16 / 2.54 # might not be defined by now
heightInInch = 8 / 2.54 # dito
figFileName = pathFigs + year + '_' + dataType + '_map.png' figFileName = pathFigs + year + '_' + dataType + '_map.png'
if dataType == 'temperature': if dataType == 'temperature':
with h5py.File(fileNameH5, 'r') as h5File: with h5py.File(fileNameH5, 'r') as h5File:
......
...@@ -213,7 +213,10 @@ class WeatherStation: ...@@ -213,7 +213,10 @@ class WeatherStation:
print(self.m_type, column, entries[column], self.m_measuredData) print(self.m_type, column, entries[column], self.m_measuredData)
lastHour = hour lastHour = hour
counter += 1 counter += 1
if len(self.m_measuredData) < 8760: supposedLength = 8760
if (int(targetYear) % 4 == 0):
supposedLength = 8784
if len(self.m_measuredData) < supposedLength:
print(self.m_name, 'only has', len(self.m_measuredData)) print(self.m_name, 'only has', len(self.m_measuredData))
self.m_measuredData = [] self.m_measuredData = []
...@@ -315,8 +318,8 @@ class WeatherStation: ...@@ -315,8 +318,8 @@ class WeatherStation:
# plt.legend() # plt.legend()
# plt.show() # plt.show()
# plt.figure() # plt.figure()
fig.scatter(valuesObs, valuesMod, s=0.5, color="tab:orange") fig.scatter(valuesObs, valuesMod, s=0.5, color="tab:blue")
fig.plot(valuesObs, valuesObs) fig.plot(valuesObs, valuesObs, color='k')
maxY = max(np.array(valuesObs).max(), np.array(valuesMod).max()) maxY = max(np.array(valuesObs).max(), np.array(valuesMod).max())
annotation = 'RMSE: %.1f\n' \ annotation = 'RMSE: %.1f\n' \
'MAE: %.1f\n' \ 'MAE: %.1f\n' \
......
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