Skip to content

Khushi-Rajput77/Weather_Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

"""

WeatherPulse 🌤️ Real-time weather intelligence for anywhere on Earth

DESCRIPTION

WeatherPulse is a beautifully designed Streamlit weather dashboard that delivers live weather data for any city in the world — completely free, with no API key required. It uses the Open-Meteo API for weather data and the Open-Meteo Geocoding API for city lookups.

FEATURES

  • 🔍 City search with geocoding (search any city on Earth)
  • 🌡️ Current conditions: temperature, feels-like, weather description
  • 💧 Stats: humidity, wind speed & direction, gusts, pressure, visibility, precipitation, cloud cover, sunrise
  • ⏱️ 36-hour hourly forecast with weather icons and rain probability
  • 📊 24-hour temperature trend chart
  • 🌧️ 24-hour precipitation probability & wind speed chart
  • 📅 7-day daily forecast with UV index badges
  • 📈 7-day temperature range chart (min/max)
  • 🌡️ / °F Toggle between Celsius and Fahrenheit
  • 🎨 Stunning dark space-themed UI with animations

PROJECT STRUCTURE

weatherpulse/ ├── app.py ← Main Streamlit application (this file) └── README.py ← Project documentation

REQUIREMENTS

Python >= 3.8

Install dependencies:

  pip install streamlit requests matplotlib numpy

Or using a requirements file:

  pip install -r requirements.txt

requirements.txt contents: streamlit requests matplotlib numpy

INSTALLATION

  1. Clone or download the project:

    git clone https://github.com/your-username/weatherpulse.git cd weatherpulse

  2. (Optional) Create and activate a virtual environment:

    python -m venv venv source venv/bin/activate # macOS/Linux venv\Scripts\activate # Windows

  3. Install dependencies:

    pip install streamlit requests matplotlib numpy

USAGE

Run the Streamlit app:

  streamlit run app.py

The app will open automatically in your default browser at: http://localhost:8501

Search for any city using the search bar and press "Get Weather" or hit Enter. Toggle between °C and °F using the radio buttons. The app defaults to London on first load.

APIs USED

  1. Open-Meteo Weather API URL : https://api.open-meteo.com/v1/forecast Docs : https://open-meteo.com/en/docs Cost : Free, no API key required

  2. Open-Meteo Geocoding API URL : https://geocoding-api.open-meteo.com/v1/search Docs : https://open-meteo.com/en/docs/geocoding-api Cost : Free, no API key required

DATA PROVIDED BY THE APIs

Current: temperature_2m, relative_humidity_2m, apparent_temperature, precipitation, weather_code, cloud_cover, wind_speed_10m, wind_direction_10m, wind_gusts_10m, surface_pressure, visibility, uv_index, is_day

Hourly (36h): temperature_2m, weather_code, precipitation_probability, wind_speed_10m

Daily (7 days): weather_code, temperature_2m_max, temperature_2m_min, precipitation_sum, precipitation_probability_max, wind_speed_10m_max, uv_index_max, sunrise, sunset

WMO WEATHER CODE MAPPING

Code Description Icon


0 Clear Sky ☀️ 1 Mainly Clear 🌤️ 2 Partly Cloudy ⛅ 3 Overcast ☁️ 45 Foggy 🌫️ 48 Icy Fog 🌫️ 51 Light Drizzle 🌦️ 53 Drizzle 🌦️ 55 Heavy Drizzle 🌧️ 61 Slight Rain 🌧️ 63 Rain 🌧️ 65 Heavy Rain 🌧️ 71 Slight Snow 🌨️ 73 Snow ❄️ 75 Heavy Snow ❄️ 77 Snow Grains 🌨️ 80 Slight Showers 🌦️ 81 Showers 🌧️ 82 Heavy Showers ⛈️ 85 Snow Showers 🌨️ 86 Heavy Snow Showers 🌨️ 95 Thunderstorm ⛈️ 96 Thunderstorm + Hail ⛈️ 99 Heavy Thunderstorm ⛈️

UV INDEX BADGE THRESHOLDS

UV < 3 → 🟢 Low UV 3–5 → 🟡 Moderate UV 6–7 → 🟠 High UV >= 8 → 🔴 Very High

DESIGN & THEMING

  • Dark space-themed UI (#060d1a background)
  • Animated star background
  • Google Fonts: Outfit (UI) + JetBrains Mono (data values)
  • Animated weather icons and gradient temperature display
  • Responsive layout (collapses to 2-column stat grid on mobile)
  • All charts styled with dark matplotlib theme (#080f1c figure background)

KEY FUNCTIONS

geocode(city) → Calls geocoding API, returns (lat, lon, name, country, region) or None fetch_weather(lat, lon) → Calls weather API, returns full JSON response wmo(code) → Maps WMO weather code to (description, emoji) fmt_temp(c, unit) → Formats temperature string in °C or °F fmt_temp_val(c, unit) → Returns numeric temperature value in °C or °F wind_dir(deg) → Converts wind degrees to compass direction uv_badge(uv) → Returns HTML badge string for UV level styled_chart(fig, axes) → Applies dark theme styling to matplotlib figure

CONFIGURATION

No configuration file needed. The app works out of the box. To change the default city (currently London), find this line in app.py:

  geo = geocode("London")

and replace "London" with your preferred default city.

LIMITATIONS

  • Weather data is sourced from Open-Meteo's free tier (no login required).
  • Forecast accuracy depends on Open-Meteo's underlying NWP models.
  • Historical data is not supported; only current + 7-day forecast.
  • API requests time out after 8–10 seconds; check your internet connection if weather fails to load.

LICENSE

MIT License — free to use, modify, and distribute.

AUTHOR

Built with ❤️ using Streamlit + Open-Meteo

================================================================================ """

This file is documentation only.

To run the app, execute: streamlit run app.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages