SWeatherpy/weathersettings.py
2024-10-21 14:39:42 -05:00

47 lines
1.3 KiB
Python

#Import necessary libraries
import sys
import requests
import matplotlib
import matplotlib.pyplot as plt
import json
import logging
import argparse
import math
from datetime import datetime
from typing import Optional, Tuple, List, Dict
from io import BytesIO
from PIL import Image
from PyQt6.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, QLabel, QLineEdit, QPushButton, QTextEdit, QCheckBox
from PyQt6.QtGui import QPixmap
from PyQt6.QtCore import Qt
HEADERS = {'User-Agent': 'Experiment Storm&Radar Weather tracker (stanton.e@gmail.com)',
'Feature-Flags': 'forecast_temperature_qv,forecast_wind_speed_qv'}
# Set up logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
# Time Data to print time
current_time = datetime.now().strftime("%H:%M:%S")
# Set up API and URL's for weather data retrieval
API_BASE_URL = "https://api.weather.gov/"
NOMINATIM_URL = "https://nominatim.openstreetmap.org/search"
BASE_URL = "https://radar.weather.gov/ridge/standard/"
def station_urls(station_id: str) -> Tuple[str, List[str]]:
loop_url = f"{BASE_URL}{station_id}_loop.gif"
static_urls = [f"{BASE_URL}{station_id}_{i}.gif" for i in range(10)]
return loop_url, static_urls