a ¬dob> ã@sddlZGdd„dƒZdS)éNc@s¬eZdZUeed<eed<gZgZgZeed<eed<eed<eed<eed<eed<eed <eed <d d „Z eed œdd„Z eed œdd„Z eeedœdd„Z dd„Z dS)Úweather_stationÚwindGust1minSpeedÚwindGust1minDirectionÚgustDataCounterÚwindDataCounterÚ windSpeedÚ windDirectionÚwind2MinAverageMPHÚwind2MinAverageDirectionÚwind10MinGustMPHÚwind10MinGustDirectioncCs*tdƒd|_d|_d|_d|_d|_dS)Nzstarting weather stationçé<éx)Úprintrrrr)Úself©rú`/Users/jjulich/Documents/working/iot-expresslink/examples/python/sara_example/weather_station.pyÚ__init__s zweather_station.__init__)ÚspeedÚ directioncCsª|jd8_||jkr$||_||_|jdkr¦d|_|j|jf}|j |¡d|_t|jƒdkrn|j d¡qRd}|jD]}|d|dkrx|}qx|d|_|d|_dS)Nérré )r r ) rrrÚwindGustÚappendÚlenÚpopr r )rrrZgdataZgustÚgrrrÚ_doGustss"      zweather_station._doGustscCsn|jd8_||_||_|j |¡|j |¡| ||¡|jdkrjd|_| ¡|j ¡|j ¡dS)Nrrr) rrrÚ windDataSpeedrÚwindDataDirectionrÚ _calcWeatherÚclear)rrrrrrÚaddWind2s     zweather_station.addWind)Ú direction1Ú direction2ÚreturncCs0||}|dkr|dS|dkr(|dS|SdS)Ng€fÀihg€f@r)rr$r%ZdeltarrrÚ _addDirectionBs zweather_station._addDirectioncCs|d}|jD] }||7}q |t|jƒ|_|jd}|jd}|jdd…D]}|| ||¡7}||7}qJ|t|jƒ|_dS)Nrr)rrr r r'r )rZ speedAverageÚwÚsumÚDÚdrrrr!Ks     zweather_station._calcWeatherN)Ú__name__Ú __module__Ú __qualname__ÚfloatÚ__annotations__rr rÚintrrr#r'r!rrrrrs$   r)ÚtimerrrrrÚs