def process_weather_knmi_current(): '''Function downloads and print a actual weather values to the screen''' console.header('START DOWNLOAD CURRENT VALUES KNMI WEATHERSTATIONS...', True) ok, t = False, '' if utils.has_internet(): ok, t = mcurweather.knmi_stations() if ok: t = '\n' + vt.clean_up(t) console.log(t, True) else: console.log('Not ok. Something went wrong along the way.', True) else: console.log('No internet connection...', True) console.footer('END DOWNLOAD CURRENT VALUES KNMI WEATHERSTATIONS...', True) cask.ask_back_to_main_menu()
def process_weather_buienradar_global(): '''Function downloads and print a global weather forecast from the website from the knmi''' console.header('START DOWNLOAD BUIENRADAR GLOBAL FORECAST...', True) ok = False if utils.has_internet(): t, url = '', cfg.buienradar_json_data ok, t = mcurweather.buienradar_weather() if ok: t = '\n' + vt.clean_up(t) console.log(t, True) else: console.log('Not ok. Something went wrong along the way.', True) else: console.log('No internet connection...', True) console.footer('END DOWNLOAD BUIENRADAR GLOBAL FORECAST...', True) cask.ask_back_to_main_menu()
def process_weather_knmi_global(): '''Function downloads and print a global weather forecast from the website from the knmi''' console.header('START DOWNLOAD KNMI GLOBAL FORECAST...', True) ok, t = False, '' if utils.has_internet(): sd = utils.loc_date_now().strftime('%Y%m%d') url = cfg.knmi_forecast_global_url file = utils.mk_path(cfg.dir_forecasts_txt, f'basisverwachting-{sd}.txt') ok = fio.download(url, file) if ok: ok, t = fio.read(file) if ok: t = '\n' + vt.clean_up(t) console.log(t, True) else: console.log('Not ok. Something went wrong along the way.', True) else: console.log('No internet connection...', True) console.footer('END DOWNLOAD KNMI GLOBAL FORECAST...', True) cask.ask_back_to_main_menu()
def process_weather_knmi_guidance(): '''Function downloads and prints a global a more in depth forecast from the website from the knmi''' console.header('START DOWNLOAD KNMI GUIDANCE...', True) ok, t = False, '' if utils.has_internet(): sd = utils.loc_date_now().strftime('%Y%m%d') url = cfg.knmi_forecast_guidance_url name = f'guidance_meerdaagse-{sd}.txt' file = utils.mk_path(cfg.dir_forecasts_txt, name) ok = fio.download(url, file) if ok: ok, t = fio.read(file) if ok: t = '\n' + vt.clean_up(t) console.log(t, True) else: console.log('Not ok. Something went wrong along the way.', True) else: console.log('No internet connection...', True) console.footer('END DOWNLOAD KNMI GUIDANCE...', True) cask.ask_back_to_main_menu()
def process_weather_knmi_model(): '''Function downloads and prints a discussion about the weather models from the website from the knmi''' console.header('START DOWNLOAD KNMI DISCUSSION WEATHER MODELS...', True) ok, t = False, '' if utils.has_internet(): sd = utils.loc_date_now().strftime('%Y%m%d') url = cfg.knmi_forecast_model_url name = f'guidance_model-{sd}.txt' file = utils.mk_path(cfg.dir_forecasts_txt, name) ok = fio.download(url, file) if ok: ok, t = fio.read(file) if ok: t = '\n' + vt.clean_up(t) console.log(t, True) else: console.log('Not ok. Something went wrong along the way.', True) else: console.log('No internet connection...', True) console.footer('END DOWNLOAD KNMI DISCUSSION WEATHER MODELS...', True) cask.ask_back_to_main_menu()