Beispiel #1
0
 def get_current(self):
     fore = next(iter(self.iter_forecast()))
     ret = Current()
     for f in ('date', 'text', 'wind_direction', 'wind_speed', 'humidity'):
         setattr(ret, f, getattr(fore, f))
     ret.temp = fore.high
     return ret
Beispiel #2
0
 def get_current(self):
     fore = next(iter(self.iter_forecast()))
     ret = Current()
     for f in ('date', 'text', 'wind_direction', 'wind_speed', 'humidity'):
         setattr(ret, f, getattr(fore, f))
     ret.temp = fore.high
     return ret
Beispiel #3
0
 def get_current(self):
     obj = Current()
     obj.id = date.today()
     obj.date = date.fromtimestamp(self.doc['latestObservationTime']/1000)
     obj.temp = Temperature(max(self.doc['t2m'])[1], u'C')
     last_hour_precipitations = int(max(self.doc['Precipitation1h'])[1])
     nebulosity = int(max(self.doc['TotalCloudCover'])[1])
     wind_speed = int(max(self.doc['WindSpeedMS'])[1])
     wind_direction = self.WINDS[int(max(self.doc['WindDirection'])[1] / 22.5)]
     obj.text = u'1h precipitations %d mm, wind %d m/s (%s), nebulosity %d/8' % (
         last_hour_precipitations, wind_speed, wind_direction, nebulosity)
     return obj
Beispiel #4
0
 def get_current(self):
     obj = Current()
     obj.id = date.today()
     obj.date = date.fromtimestamp(self.doc['latestObservationTime'] / 1000)
     obj.temp = Temperature(max(self.doc['t2m'])[1], u'C')
     last_hour_precipitations = int(max(self.doc['Precipitation1h'])[1])
     nebulosity = int(max(self.doc['TotalCloudCover'])[1])
     wind_speed = int(max(self.doc['WindSpeedMS'])[1])
     wind_direction = self.WINDS[int(
         max(self.doc['WindDirection'])[1] / 22.5)]
     obj.text = u'1h precipitations %d mm, wind %d m/s (%s), nebulosity %d/8' % (
         last_hour_precipitations, wind_speed, wind_direction, nebulosity)
     return obj