fix bugs in the DWD crawler
This commit is contained in:
@@ -110,7 +110,8 @@ class DwdCrawler():
|
|||||||
for line in content.splitlines():
|
for line in content.splitlines():
|
||||||
if '' == line:
|
if '' == line:
|
||||||
if 0 != len(windTable):
|
if 0 != len(windTable):
|
||||||
windInformation.append(( areaIds, windTable ))
|
for id in areaIds:
|
||||||
|
windInformation.append([ id, windTable ])
|
||||||
areaIds = None
|
areaIds = None
|
||||||
windTable = []
|
windTable = []
|
||||||
elif line.startswith('GAFOR-Gebiete'):
|
elif line.startswith('GAFOR-Gebiete'):
|
||||||
@@ -145,13 +146,14 @@ class DwdCrawler():
|
|||||||
|
|
||||||
# receive the wind data
|
# receive the wind data
|
||||||
self.UpdateTime = None
|
self.UpdateTime = None
|
||||||
self.WindData = []
|
self.WindData = {}
|
||||||
for page in pages:
|
for page in pages:
|
||||||
next, wind = self.parseGaforPage(page)
|
next, wind = self.parseGaforPage(page)
|
||||||
if None != next:
|
if None != next:
|
||||||
if None == self.UpdateTime or self.UpdateTime > next:
|
if None == self.UpdateTime or self.UpdateTime > next:
|
||||||
self.UpdateTime = next
|
self.UpdateTime = next
|
||||||
self.WindData.extend(wind)
|
for gafor in wind:
|
||||||
|
self.WindData[gafor[0]] = gafor[1]
|
||||||
|
|
||||||
# indicate that new wind data is available
|
# indicate that new wind data is available
|
||||||
if None != self.UpdateTime:
|
if None != self.UpdateTime:
|
||||||
|
|||||||
Reference in New Issue
Block a user