Esempio n. 1
0
 def show_forecast(self):
     try:
         place = owm.three_hours_forecast(self.city)
         tomorrow9 = timeutils.tomorrow(9)
         tomorrow12 = timeutils.tomorrow(12)
         tomorrow18 = timeutils.tomorrow(18)
         t9 = place.get_weather_at(tomorrow9)
         t12 = place.get_weather_at(tomorrow12)
         t18 = place.get_weather_at(tomorrow18)
         temp9 = t9.get_temperature('celsius')['temp']
         temp12 = t12.get_temperature('celsius')['temp']
         temp18 = t18.get_temperature('celsius')['temp']
         if place.will_be_rainy_at(tomorrow12):
             rain = 'Дощитиме'
         else:
             rain = 'Буде сухо'
         if place.will_be_sunny_at(tomorrow12):
             sun = 'та сонячно.'
         else:
             sun = 'та хмарно.'
         lbl2.config(
             text=
             f"{rain} {sun}\n9:00 - {temp9}℃\n12:00 - {temp12}℃\n18:00 - {temp18}℃"
         )
     except Exception as ex:
         lbl2.config(text=f"Вкажіть вірну назву!")
Esempio n. 2
0
    def test_snippets(self):

        # Will it be clear tomorrow at this time in Milan (Italy) ?
        f_milan = self.__owm.daily_forecast("Milan,it")
        self.assertIsNotNone(f_milan)
        self.assertTrue(isinstance(f_milan, Forecaster))
        tomorrow = timeutils.tomorrow()
        will_be_clear = f_milan.will_be_clear_at(tomorrow)
        self.assertTrue(isinstance(will_be_clear, bool))

        # Search for current weather in London (UK)
        o_london = self.__owm.weather_at_place('London,uk')
        self.assertTrue(isinstance(o_london, Observation))
        w_london = o_london.get_weather()
        self.assertTrue(isinstance(w_london, Weather))

        # Weather details
        self.assertIsNotNone(w_london.get_wind())
        self.assertIsNotNone(w_london.get_humidity())
        self.assertIsNotNone(w_london.get_temperature('celsius'))

        # Search current weather observations in the surroundings of
        # lat=22.57W, lon=43.12S (Rio de Janeiro, BR)
        os_rio = self.__owm.weather_around_coords(-22.57, -43.12)
        self.assertIsNotNone(os_rio)
        self.assertTrue(len(os_rio) > 0)
        for o in os_rio:
            self.assertTrue(isinstance(o, Observation))
Esempio n. 3
0
 def show_forecast(self):
     place = owm.three_hours_forecast(self.city)
     tomorrow9 = timeutils.tomorrow(9)
     tomorrow12 = timeutils.tomorrow(12)
     tomorrow18 = timeutils.tomorrow(18)
     t9 = place.get_weather_at(tomorrow9)
     t12 = place.get_weather_at(tomorrow12)
     t18 = place.get_weather_at(tomorrow18)
     temp9 = t9.get_temperature('celsius')['temp']
     temp12 = t12.get_temperature('celsius')['temp']
     temp18 = t18.get_temperature('celsius')['temp']
     if place.will_be_rainy_at(tomorrow12):
         rain = 'Дощитиме'
     else:
         rain = 'Буде сухо'
     if place.will_be_sunny_at(tomorrow12):
         sun = 'та сонячно.'
     else:
         sun = 'та хмарно.'
     return f"{rain} {sun}\n9:00 - {temp9}℃\n12:00 - {temp12}℃\n18:00 - {temp18}℃"
Esempio n. 4
0
def watering_data(soil_moisture, client):

    tomorrow_date = timeutils.tomorrow()
    rain_data = get_rainforecast(tomorrow_date, 'Skopje,MK')
    rain_mm = float(rain_data['3h'])

    if (float(soil_moisture) <
            50) and (rain_mm < 5):  # if soil moisture is less than 50%
        client.publish(
            "Water Pump",
            "ON")  # and rainfall less than 5 litres per square meter
    else:
        client.publish("Water Pump", "OFF")
Esempio n. 5
0
def cuaca(bot, update, args):
    spam = spamfilters(update.effective_message.text,
                       update.effective_message.from_user.id,
                       update.effective_chat.id, update.effective_message)
    if spam == True:
        return
    location = " ".join(args)
    if location.lower() == bot.first_name.lower():
        update.effective_message.reply_text(
            "Saya akan terus mengawasi di saat senang maupun sedih!")
        bot.send_sticker(update.effective_chat.id, BAN_STICKER)
        return

    try:
        bot.sendChatAction(update.effective_chat.id,
                           "typing")  # Bot typing before send message
        owm = pyowm.OWM(API_WEATHER, language='id')
        observation = owm.weather_at_place(location)
        cuacanya = observation.get_weather()
        obs = owm.weather_at_place(location)
        lokasi = obs.get_location()
        lokasinya = lokasi.get_name()
        temperatur = cuacanya.get_temperature(unit='celsius')['temp']
        fc = owm.three_hours_forecast(location)
        besok = fc.get_weather_at(timeutils.tomorrow(5))
        temperaturbesok = besok.get_temperature(unit='celsius')['temp']

        # Simbol cuaca
        statusnya = ""
        cuacaskrg = cuacanya.get_weather_code()
        if cuacaskrg < 232:  # Hujan badai
            statusnya += "⛈️ "
        elif cuacaskrg < 321:  # Gerimis
            statusnya += "🌧️ "
        elif cuacaskrg < 504:  # Hujan terang
            statusnya += "🌦️ "
        elif cuacaskrg < 531:  # Hujan berawan
            statusnya += "⛈️ "
        elif cuacaskrg < 622:  # Bersalju
            statusnya += "🌨️ "
        elif cuacaskrg < 781:  # Atmosfer
            statusnya += "🌪️ "
        elif cuacaskrg < 800:  # Cerah
            statusnya += "🌤️ "
        elif cuacaskrg < 801:  # Sedikit berawan
            statusnya += "⛅️ "
        elif cuacaskrg < 804:  # Berawan
            statusnya += "☁️ "
        statusnya += cuacanya._detailed_status

        statusbesok = ""
        cuacaskrg = besok.get_weather_code()
        if cuacaskrg < 232:  # Hujan badai
            statusbesok += "⛈️ "
        elif cuacaskrg < 321:  # Gerimis
            statusbesok += "🌧️ "
        elif cuacaskrg < 504:  # Hujan terang
            statusbesok += "🌦️ "
        elif cuacaskrg < 531:  # Hujan berawan
            statusbesok += "⛈️ "
        elif cuacaskrg < 622:  # Bersalju
            statusbesok += "🌨️ "
        elif cuacaskrg < 781:  # Atmosfer
            statusbesok += "🌪️ "
        elif cuacaskrg < 800:  # Cerah
            statusbesok += "🌤️ "
        elif cuacaskrg < 801:  # Sedikit berawan
            statusbesok += "⛅️ "
        elif cuacaskrg < 804:  # Berawan
            statusbesok += "☁️ "
        statusbesok += besok._detailed_status

        cuacabsk = besok.get_weather_code()

        update.message.reply_text(
            "{} hari ini sedang {}, sekitar {}°C.\n".format(
                lokasinya, statusnya, temperatur) +
            "Untuk besok pada pukul 06:00, akan {}, sekitar {}°C".format(
                statusbesok, temperaturbesok))

    except pyowm.exceptions.api_call_error.APICallError:
        update.effective_message.reply_text(
            "Tulis lokasi untuk mengecek cuacanya")
    except pyowm.exceptions.api_response_error.NotFoundError:
        update.effective_message.reply_text("Maaf, lokasi tidak ditemukan 😞")
    else:
        return
Esempio n. 6
0
def current_weather(input_city):
  
  #-----------------------------------------------------------------------
  #Extract City name
  #-----------------------------------------------------------------------
  city = input_city.split(',', 1)[0]  #input needs to modify with split

  #-----------------------------------------------------------------------
  #Use open weather map key
  #-----------------------------------------------------------------------
  owm = pyowm.OWM('770bab8b8abf5696883cf53b96333e9f')
  
  #-----------------------------------------------------------------------
  #Setup the observation(obs) and forecasts for a certain location
  #-----------------------------------------------------------------------
  obs = owm.weather_at_place(input_city)
  #forecast objects
  fc_object_3h = owm.three_hours_forecast(input_city)  
  fc_object_daily = owm.daily_forecast(input_city)  
  
  time_of_obs_unix = obs.get_reception_time()
  time_of_obs =  change_time_format(time_of_obs_unix)
  
  location_raw = obs.get_location()
  location_name = location_raw.get_name()
  location_id = location_raw.get_ID()
  lat = location_raw.get_lat()
  lon = location_raw.get_lon()
  
  #-----------------------------------------------------------------------
  #Set some time strings for output
  #-----------------------------------------------------------------------
  today_06 = str(time.strftime("%Y-%m-%d")) + ' 06:00:00+00'
  today_09 = str(time.strftime("%Y-%m-%d")) + ' 09:00:00+00'
  today_12 = str(time.strftime("%Y-%m-%d")) + ' 12:00:00+00'
  today_15 = str(time.strftime("%Y-%m-%d")) + ' 15:00:00+00'
  today_18 = str(time.strftime("%Y-%m-%d")) + ' 18:00:00+00'
  tomorrow_06=str(timeutils.tomorrow(6,00)) + '+00'
  tomorrow_09=str(timeutils.tomorrow(9,00)) + '+00'
  tomorrow_12=str(timeutils.tomorrow(12,00)) + '+00'
  tomorrow_15=str(timeutils.tomorrow(15,00)) + '+00'
  tomorrow_18=str(timeutils.tomorrow(18,00)) + '+00'

  fc_times_today = [today_06
                    ,today_09
                    ,today_12
                    ,today_15
                    ,today_18]
  fc_times_tomorrow = [tomorrow_06
                    ,tomorrow_09
                    ,tomorrow_12
                    ,tomorrow_15
                    ,tomorrow_18]

  fcd_vec = [dt.datetime.today().date()
            ,dt.datetime.today().date() + dt.timedelta(days=1)
            ,dt.datetime.today().date() + dt.timedelta(days=2)
            ]

  #-----------------------------------------------------------------------
  #Information of observation/forecast city
  #-----------------------------------------------------------------------
  week_number = us.week_number()
  output ='\n' + '%s(%s, %s), Woche: %s, Datum: %s' % (city,lat,lon,week_number,time_of_obs)


  #define weather from objects (observations and forecast scenarios)
  observat = obs.get_weather()
  f_3h = fc_object_3h.get_forecast()
  f_daily = fc_object_daily.get_forecast()

  #-----------------------------------------------------------------------
  #Actually start with the setup of observation and forecast
  #-----------------------------------------------------------------------

 
  weather_dict = {'forecast3':f_3h,'forecast_daily': f_daily,'observation': observat}
  #for weather in weather_list: 
  for key in sorted(weather_dict):
    weather = weather_dict[key]
    if key == 'observation':
      wind = weather.get_wind()
      wind_speed = wind['speed']
      wind_deg = wind['deg']
      temp = weather.get_temperature(unit='celsius')
      temp_max = temp['temp_max']
      temp_min = temp['temp_min']
      temperature = temp['temp']
      dew_point = weather.get_dewpoint()
      pressure = weather.get_pressure()
      press_local = pressure['press']
      press_sea = pressure['sea_level']
      sunrise_unix = weather.get_sunrise_time()
      sunrise = change_time_format(sunrise_unix)
      sunset_unix = weather.get_sunset_time()
      sunset = change_time_format(sunset_unix)

      #print(weather.get_visibility_distance())
      

      #Different logical specified weather dicts 
      wind_dict = {'Wind speed' : str(wind_speed) + ' m/s'
                   ,'Wind direction' : str(wind_deg) + u'\N{DEGREE SIGN}'
                  }
      
      sky_condition = {'Cloud cover': str(weather.get_clouds()) + '%'
                       ,'Sky' : weather.get_detailed_status()
                      }
      
      precipitation_dict = {'Humidity' : str(weather.get_humidity()) + '%'
                           ,'Rain volume last 3h' : weather.get_rain()
                           ,'Snow volume last 3h' : weather.get_snow()
                          }
      temp_dict = {'Temperature' : str(temperature) + u'\N{DEGREE SIGN}' + 'C'
                    #,'Dew point' : str(dew_point)  + u'\N{DEGREE SIGN}' + 'C'
                  }
      
      sun_dict = {'Sunrise' : sunrise
                  ,'Sunset' : sunset
                  }
      
      pressure_dict = {'Pressure' : str(press_local) + ' hPa'
                        ,'Pressure at sea level' : str(press_sea) + ' hPa'
                      }

    #end of observation if    
  
    #-----------------------------------------------------------------------
    #FORECAST
    #-----------------------------------------------------------------------
    today_fc_3h = 'Forecast for today:'
    tomorrow_fc_3h = 'Forecast for tomorrow:'
    seven_days_fc = 'Forecast for the next 3 days:'

    if key == 'forecast3':
      for weather_part in weather:
        for times in fc_times_today:
          if weather_part.get_reference_time('iso') == times: 
            time_string = str(weather_part.get_reference_time('iso'))
            fc3_datetime = dt.datetime.strptime(time_string, "%Y-%m-%d %H:%M:%S+%f")
            #str
            today_fc_3h += '\n' + str(fc3_datetime) + ' '+ str(weather_part.get_detailed_status())
        for times in fc_times_tomorrow:
          if weather_part.get_reference_time('iso') == times:
            time_string = str(weather_part.get_reference_time('iso'))
            fc3_datetime = dt.datetime.strptime(time_string, "%Y-%m-%d %H:%M:%S+%f")
            #str
            tomorrow_fc_3h += '\n' + str(fc3_datetime) + ' ' + str(weather_part.get_detailed_status())
            
    if key == 'forecast_daily':
      for weather_part in weather:
        time_string = weather_part.get_reference_time('iso')
        fcd_datetime = dt.datetime.strptime(time_string, "%Y-%m-%d %H:%M:%S+%f")
        fcd_date = fcd_datetime.date()
        for days in fcd_vec:
          if str(days) in str(fcd_date): 
            #STATUS
            caption = '[STATUS] '
            caption_bold = us.color.BOLD + '[STATUS] ' + us.color.END
            caption_red = us.color.RED + caption_bold  + us.color.END
            #str
            seven_days_fc += '\n' + caption_bold + str(fcd_date) 
            seven_days_fc += '\nForecast: '+ str(weather_part.get_detailed_status())
            seven_days_fc += '\nCloud cover: '+ str(weather_part.get_clouds()) + '%'
              
            #TEMP
            fc_temp_daily = weather_part.get_temperature(unit='celsius')
            fc_temp_daily_morn = str(fc_temp_daily['morn']) + u'\N{DEGREE SIGN}' + 'C'
            fc_temp_daily_day = str(fc_temp_daily['day']) + u'\N{DEGREE SIGN}' + 'C'
            fc_temp_daily_eve = str(fc_temp_daily['eve']) + u'\N{DEGREE SIGN}' + 'C'
            fc_temp_daily_night = str(fc_temp_daily['night']) + u'\N{DEGREE SIGN}' + 'C'
            fc_temp_daily_max = str(fc_temp_daily['max']) + u'\N{DEGREE SIGN}' + 'C'
            fc_temp_daily_min = str(fc_temp_daily['min']) + u'\N{DEGREE SIGN}' + 'C'
            caption = '[TEMP] '
            caption_bold = us.color.BOLD + '[TEMP] ' + us.color.END
            caption_red = us.color.RED + caption  + us.color.END
            #str
            seven_days_fc += '\n' + caption_bold +'\nMorning: %s \nDay: %s \nEvening: %s \nNight: %s' \
                            % (fc_temp_daily_morn, fc_temp_daily_day, fc_temp_daily_eve, fc_temp_daily_night)

            #WIND
            fc_wind_daily = weather_part.get_wind()
            fc_wind_speed_daily = fc_wind_daily['speed']
            caption = '[WIND] '
            caption_bold = us.color.BOLD + '[WIND] ' + us.color.END
            caption_red = us.color.RED + caption  + us.color.END
            #str
            seven_days_fc += '\n' + caption_bold  +'\n' + 'Average: ' + str(fc_wind_speed_daily) + ' m/s'

            #RAIN
            fc_rain_daily_raw = weather_part.get_rain()
            caption = '[PRECIPITATION] '
            caption_bold = us.color.BOLD + '[PRECIPITATION] ' + us.color.END
            caption_red = us.color.RED + caption  + us.color.END
            try:
              fc_rain_daily = fc_rain_daily_raw['all']
              #str
              seven_days_fc += '\n' + caption_bold  + '\n' + 'Rain: ' + str(fc_rain_daily) + ' mm'
            except:
              fc_rain_daily = 'No rain :)'
              #str
              seven_days_fc += '\n' + caption_bold  + '\n' + 'Rain: ' + str(fc_rain_daily)  

            seven_days_fc += '\n'+'-----------------------------------------------------------------'

    #test=fc_object_daily.when_starts('iso')
    #print(owm.weather_history_at_place('London, uk'))
    #-----------------------------------------------------------------------
    #Create output for message
    #-----------------------------------------------------------------------
    if key == 'forecast3':
      output += '\n'+'#################################################################'
      output += '\n' + today_fc_3h
      #output += '\n'+'-----------------------------------------------------------------'
      #output += '\n' + tomorrow_fc_3h
    if key == 'forecast_daily':
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n' + seven_days_fc
      output += '\n'+'#################################################################'
    if key == 'observation':
      output +='\n' + 'Weather observations %s %s(%s, %s):' % (time_of_obs,city,lat,lon)
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n'+pp_str(sun_dict)
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n'+pp_str(temp_dict)
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n'+pp_str(pressure_dict)
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n'+pp_str(wind_dict)
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n'+pp_str(precipitation_dict)
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n'+pp_str(sky_condition)
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n'+'#################################################################'
 #output += '\n' + str(test1)
  #output += '\n' + str(test2)
  #output += '\n' + str(test3)
  #output += '\n' + str(test4)
  return output
today = timeutils.now()
#today_12 = today.replace(hour=12)
#today_12 = today
if fc.when_starts('date').hour < 10:
    today_12 = today.replace(hour=12)
else:
    today_12 = today.replace(hour=fc.when_starts('date').hour)

#today_22 = today.replace(hour=22)
if fc.when_starts('date').hour < 20:
    today_22 = today.replace(hour=22)
else:
    today_22 = today.replace(hour=fc.when_starts('date').hour)

day_two_12 = timeutils.tomorrow(12, 00)
day_two_22 = timeutils.tomorrow(22, 00)
day_three_12 = timeutils._timedelta_days(2).replace(hour=12)
day_three_22 = timeutils._timedelta_days(2).replace(hour=22)
day_four_12 = timeutils._timedelta_days(3).replace(hour=12)
day_four_22 = timeutils._timedelta_days(3).replace(hour=22)

icons = [None] * 4
icons = [
    fc.get_weather_at(today_12).get_weather_icon_name(),
    fc.get_weather_at(day_two_12).get_weather_icon_name(),
    fc.get_weather_at(day_three_12).get_weather_icon_name(),
    fc.get_weather_at(day_four_12).get_weather_icon_name()
]

icons_text = [None] * 4
Esempio n. 8
0
import discord
import pyowm
from pyowm import timeutils
import schedule
import time
import asyncio
import itertools
import os
from async_timeout import timeout
from functools import partial

bot = commands.Bot(command_prefix='-')
owm = pyowm.OWM('8638c55431d913688db69d830ed8d17b', language='ru')

fc = owm.daily_forecast('Angarsk,RU')
times = timeutils.tomorrow(14)
sent = ""

def getRun():
	bot.run(os.getenv('TOKEN'))

@bot.event
async def on_ready():
	# Нахождение температуры
	global sent
	weather_cry = ""
	w = fc.get_weather_at(times)
	mor_start = str((w.get_temperature('celsius'))).find("'morn'")
	mpr_end 	= str((w.get_temperature('celsius'))).find("}")
	mor_temp 	= str((w.get_temperature('celsius')))[mor_start+8:mpr_end-1]
	day_start = str((w.get_temperature('celsius'))).find("'day'")
 def test_get_time_object_2(self):
     """get_time_object(...) with request {when:tomorrow} must return a timeutil object"""
     request_args = {"when": "tomorrow"}
     result = get_time_object(request_args)
     self.assertEqual(type(result), type(timeutils.tomorrow()))
Esempio n. 10
0
def current_weather(input_city):
  
  #-----------------------------------------------------------------------
  #Extract City name
  #-----------------------------------------------------------------------
  city = input_city.split(',', 1)[0]  #input needs to modify with split

  #-----------------------------------------------------------------------
  #Use open weather map key
  #-----------------------------------------------------------------------
  owm = pyowm.OWM('770bab8b8abf5696883cf53b96333e9f')
  
  #-----------------------------------------------------------------------
  #Setup the observation(obs) and forecasts for a certain location
  #-----------------------------------------------------------------------
  obs = owm.weather_at_place(input_city)
  #forecast objects
  fc_object_3h = owm.three_hours_forecast(input_city)  
  fc_object_daily = owm.daily_forecast(input_city)  
  
  time_of_obs_unix = obs.get_reception_time()
  time_of_obs =  change_time_format(time_of_obs_unix)
  
  location_raw = obs.get_location()
  location_name = location_raw.get_name()
  location_id = location_raw.get_ID()
  lat = location_raw.get_lat()
  lon = location_raw.get_lon()
  
  #-----------------------------------------------------------------------
  #Set some time strings for output
  #-----------------------------------------------------------------------
  today_06 = str(time.strftime("%Y-%m-%d")) + ' 06:00:00+00'
  today_09 = str(time.strftime("%Y-%m-%d")) + ' 09:00:00+00'
  today_12 = str(time.strftime("%Y-%m-%d")) + ' 12:00:00+00'
  today_15 = str(time.strftime("%Y-%m-%d")) + ' 15:00:00+00'
  today_18 = str(time.strftime("%Y-%m-%d")) + ' 18:00:00+00'
  tomorrow_06=str(timeutils.tomorrow(6,00)) + '+00'
  tomorrow_09=str(timeutils.tomorrow(9,00)) + '+00'
  tomorrow_12=str(timeutils.tomorrow(12,00)) + '+00'
  tomorrow_15=str(timeutils.tomorrow(15,00)) + '+00'
  tomorrow_18=str(timeutils.tomorrow(18,00)) + '+00'

  fc_times_today = [today_06
                    ,today_09
                    ,today_12
                    ,today_15
                    ,today_18]
  fc_times_tomorrow = [tomorrow_06
                    ,tomorrow_09
                    ,tomorrow_12
                    ,tomorrow_15
                    ,tomorrow_18]

  fcd_vec = [dt.datetime.today().date()
            ,dt.datetime.today().date() + dt.timedelta(days=1)
            ,dt.datetime.today().date() + dt.timedelta(days=2)
            ]

  #-----------------------------------------------------------------------
  #Information of observation/forecast city
  #-----------------------------------------------------------------------
  week_number = us.week_number()
  output ='\n' + '%s(%s, %s), Woche: %s, Datum: %s' % (city,lat,lon,week_number,time_of_obs)


  #define weather from objects (observations and forecast scenarios)
  observat = obs.get_weather()
  f_3h = fc_object_3h.get_forecast()
  f_daily = fc_object_daily.get_forecast()

  #-----------------------------------------------------------------------
  #Actually start with the setup of observation and forecast
  #-----------------------------------------------------------------------

 
  weather_dict = {'forecast3':f_3h,'forecast_daily': f_daily,'observation': observat}
  #for weather in weather_list: 
  for key in sorted(weather_dict):
    weather = weather_dict[key]
    if key == 'observation':
      wind = weather.get_wind()
      wind_speed = wind['speed']
      try:
        wind_deg = wind['deg']
      except:
        wind_deg = 'no_data'
      temp = weather.get_temperature(unit='celsius')
      temp_max = temp['temp_max']
      temp_min = temp['temp_min']
      temperature = temp['temp']
      dew_point = weather.get_dewpoint()
      pressure = weather.get_pressure()
      press_local = pressure['press']
      press_sea = pressure['sea_level']
      sunrise_unix = weather.get_sunrise_time()
      sunrise = change_time_format(sunrise_unix)
      sunset_unix = weather.get_sunset_time()
      sunset = change_time_format(sunset_unix)

      #print(weather.get_visibility_distance())
      

      #Different logical specified weather dicts 
      wind_dict = {'Wind speed' : str(wind_speed) + ' m/s'
                   ,'Wind direction' : str(wind_deg) + u'\N{DEGREE SIGN}'
                  }
      
      sky_condition = {'Cloud cover': str(weather.get_clouds()) + '%'
                       ,'Sky' : weather.get_detailed_status()
                      }
      
      precipitation_dict = {'Humidity' : str(weather.get_humidity()) + '%'
                           ,'Rain volume last 3h' : weather.get_rain()
                           ,'Snow volume last 3h' : weather.get_snow()
                          }
      temp_dict = {'Temperature' : str(temperature) + u'\N{DEGREE SIGN}' + 'C'
                    #,'Dew point' : str(dew_point)  + u'\N{DEGREE SIGN}' + 'C'
                  }
      
      sun_dict = {'Sunrise' : sunrise
                  ,'Sunset' : sunset
                  }
      
      pressure_dict = {'Pressure' : str(press_local) + ' hPa'
                        ,'Pressure at sea level' : str(press_sea) + ' hPa'
                      }

    #end of observation if    
  
    #-----------------------------------------------------------------------
    #FORECAST
    #-----------------------------------------------------------------------
    today_fc_3h = 'Forecast for today:'
    tomorrow_fc_3h = 'Forecast for tomorrow:'
    seven_days_fc = 'Forecast for the next 3 days:'

    if key == 'forecast3':
      for weather_part in weather:
        for times in fc_times_today:
          if weather_part.get_reference_time('iso') == times: 
            time_string = str(weather_part.get_reference_time('iso'))
            fc3_datetime = dt.datetime.strptime(time_string, "%Y-%m-%d %H:%M:%S+%f")
            #str
            today_fc_3h += '\n' + str(fc3_datetime) + ' '+ str(weather_part.get_detailed_status())
        for times in fc_times_tomorrow:
          if weather_part.get_reference_time('iso') == times:
            time_string = str(weather_part.get_reference_time('iso'))
            fc3_datetime = dt.datetime.strptime(time_string, "%Y-%m-%d %H:%M:%S+%f")
            #str
            tomorrow_fc_3h += '\n' + str(fc3_datetime) + ' ' + str(weather_part.get_detailed_status())
            
    if key == 'forecast_daily':
      for weather_part in weather:
        time_string = weather_part.get_reference_time('iso')
        fcd_datetime = dt.datetime.strptime(time_string, "%Y-%m-%d %H:%M:%S+%f")
        fcd_date = fcd_datetime.date()
        for days in fcd_vec:
          if str(days) in str(fcd_date): 
            #STATUS
            caption = '[STATUS] '
            caption_bold = us.color.BOLD + '[STATUS] ' + us.color.END
            caption_red = us.color.RED + caption_bold  + us.color.END
            #str
            seven_days_fc += '\n' + caption_bold + str(fcd_date) 
            seven_days_fc += '\nForecast: '+ str(weather_part.get_detailed_status())
            seven_days_fc += '\nCloud cover: '+ str(weather_part.get_clouds()) + '%'
              
            #TEMP
            fc_temp_daily = weather_part.get_temperature(unit='celsius')
            fc_temp_daily_morn = str(fc_temp_daily['morn']) + u'\N{DEGREE SIGN}' + 'C'
            fc_temp_daily_day = str(fc_temp_daily['day']) + u'\N{DEGREE SIGN}' + 'C'
            fc_temp_daily_eve = str(fc_temp_daily['eve']) + u'\N{DEGREE SIGN}' + 'C'
            fc_temp_daily_night = str(fc_temp_daily['night']) + u'\N{DEGREE SIGN}' + 'C'
            fc_temp_daily_max = str(fc_temp_daily['max']) + u'\N{DEGREE SIGN}' + 'C'
            fc_temp_daily_min = str(fc_temp_daily['min']) + u'\N{DEGREE SIGN}' + 'C'
            caption = '[TEMP] '
            caption_bold = us.color.BOLD + '[TEMP] ' + us.color.END
            caption_red = us.color.RED + caption  + us.color.END
            #str
            seven_days_fc += '\n' + caption_bold +'\nMorning: %s \nDay: %s \nEvening: %s \nNight: %s' \
                            % (fc_temp_daily_morn, fc_temp_daily_day, fc_temp_daily_eve, fc_temp_daily_night)

            #WIND
            fc_wind_daily = weather_part.get_wind()
            fc_wind_speed_daily = fc_wind_daily['speed']
            caption = '[WIND] '
            caption_bold = us.color.BOLD + '[WIND] ' + us.color.END
            caption_red = us.color.RED + caption  + us.color.END
            #str
            seven_days_fc += '\n' + caption_bold  +'\n' + 'Average: ' + str(fc_wind_speed_daily) + ' m/s'

            #RAIN
            fc_rain_daily_raw = weather_part.get_rain()
            caption = '[PRECIPITATION] '
            caption_bold = us.color.BOLD + '[PRECIPITATION] ' + us.color.END
            caption_red = us.color.RED + caption  + us.color.END
            try:
              fc_rain_daily = fc_rain_daily_raw['all']
              #str
              seven_days_fc += '\n' + caption_bold  + '\n' + 'Rain: ' + str(fc_rain_daily) + ' mm'
            except:
              fc_rain_daily = 'No rain :)'
              #str
              seven_days_fc += '\n' + caption_bold  + '\n' + 'Rain: ' + str(fc_rain_daily)  

            seven_days_fc += '\n'+'-----------------------------------------------------------------'

    #test=fc_object_daily.when_starts('iso')
    #print(owm.weather_history_at_place('London, uk'))
    #-----------------------------------------------------------------------
    #Create output for message
    #-----------------------------------------------------------------------
    if key == 'forecast3':
      output += '\n'+'#################################################################'
      output += '\n' + today_fc_3h
      #output += '\n'+'-----------------------------------------------------------------'
      #output += '\n' + tomorrow_fc_3h
    if key == 'forecast_daily':
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n' + seven_days_fc
      output += '\n'+'#################################################################'
    if key == 'observation':
      output +='\n' + 'Weather observations %s %s(%s, %s):' % (time_of_obs,city,lat,lon)
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n'+pp_str(sun_dict)
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n'+pp_str(temp_dict)
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n'+pp_str(pressure_dict)
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n'+pp_str(wind_dict)
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n'+pp_str(precipitation_dict)
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n'+pp_str(sky_condition)
      output += '\n'+'-----------------------------------------------------------------'
      output += '\n'+'#################################################################'
 #output += '\n' + str(test1)
  #output += '\n' + str(test2)
  #output += '\n' + str(test3)
  #output += '\n' + str(test4)
  return output