Skip to content

Advanced Weather Application with real-time forecasts, astronomical visualization (Sun/Moon arc charts with live tracking, Solar System with VSOP87 calculations), historical statistics, multi-language support (EN/FA), and responsive design. Built with Vanilla JavaScript and Open-Meteo API.

Notifications You must be signed in to change notification settings

MOHAMMADREZAABEDINPOOR/PIMX_WEATHER

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒฆ๏ธ PIMX_WEATHER

A comprehensive, feature-rich weather application with real-time forecasts, advanced astronomical visualizations, historical data analytics, and a beautiful responsive UI. Built with pure JavaScript and modern web technologies.

Live Demo: pimx.pages.dev


โœจ Key Features

๐ŸŒ Smart Location Services

  • Automatic GPS Detection: Get instant weather data for your current location
  • IP-based Fallback: Automatic location detection via IP geolocation if GPS is unavailable
  • Advanced City Search: Autocomplete city search with real-time suggestions
  • Multi-City Management: Save up to 20 cities and switch between them seamlessly
  • Persistent Storage: Cities and preferences saved in browser localStorage

๐ŸŒค๏ธ Comprehensive Weather Data

Current Conditions

  • Real-time Temperature: Current, feels-like, and daily min/max temperatures
  • Detailed Weather Stats (13 stat cards with animated progress bars):
    • ๐ŸŒก๏ธ Feels Like Temperature
    • ๐Ÿ’ง Humidity
    • ๐Ÿ’จ Wind Speed & Direction
    • ๐Ÿ”ฝ Atmospheric Pressure
    • ๐Ÿ‘๏ธ Visibility
    • ๐Ÿ’ฆ Dew Point
    • ๐ŸŒง๏ธ Precipitation
    • โ˜€๏ธ UV Index
    • ๐Ÿญ Air Quality Index (AQI)
    • ๐ŸŒ… Sunrise Time
    • ๐ŸŒ‡ Sunset Time
    • ๐ŸŒ™ Moon Phase

Forecasts

  • 24-Hour Hourly Forecast: Detailed hour-by-hour predictions with weather icons
  • Extended Daily Forecast: Choose between 7 or 14-day forecasts
  • Visual Weather Icons: Beautiful animated icons for all weather conditions
  • Dynamic Themes: UI automatically adapts to weather conditions (sunny, cloudy, rainy, snowy, night)

๐Ÿ“Š Historical Data & Analytics

Interactive Charts

  • Precipitation History:
    • View data for past week, month, 6 months, or year
    • Interactive Chart.js line charts
    • Statistics: Total precipitation, average max/min, max daily precipitation
  • Temperature History:
    • Historical temperature trends
    • Visual temperature charts

โ˜€๏ธ๐ŸŒ™ Advanced Astronomy Features

Sun Arc Visualization ๐ŸŽจ

  • Beautiful Arc Chart: Real-time visualization of sun's path across the sky using Quadratic Bezier Curves
  • Time Markers: Visual markers for 9 AM, 12 PM, 3 PM, and 6 PM
  • Color Gradient: Smooth gradient from sunrise to sunset
  • Glow Effects: Animated glow effects and pulse animations
  • Live Position Tracking: Real-time sun position with altitude angle display
  • Detailed Sun Information:
    • ๐ŸŒ… Sunrise Time
    • ๐ŸŒ‡ Sunset Time
    • โฑ๏ธ Day Length
    • ๐ŸŒž Solar Noon
    • ๐Ÿ“ Sun Altitude
    • ๐Ÿงญ Sun Azimuth
    • โฌ†๏ธ Maximum Altitude
    • ๐ŸŒ Distance from Sun

Moon Arc Visualization ๐ŸŒ™

  • Moon Path Visualization: Beautiful arc chart showing moon's journey across the sky
  • Twinkling Stars: Animated stars in the night sky background
  • Night Visual Effects: Atmospheric night-time visuals
  • Live Moon Tracking: Real-time moon position display
  • Detailed Moon Information:
    • ๐ŸŒ• Moon Phase (8 phases with graphical display)
    • ๐Ÿ’ก Illumination Percentage
    • ๐Ÿ“… Moon Age (days since new moon)
    • ๐ŸŒœ Moonrise Time
    • ๐ŸŒ› Moonset Time
    • โฑ๏ธ Duration Above Horizon
    • ๐Ÿ“ Moon Altitude
    • ๐Ÿ“ Distance from Earth

Solar System Visualization ๐Ÿช

  • Real Astronomical Positions: All 8 planets (Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune) with accurate VSOP87 calculations
  • Interactive Time Control:
    • Hour slider (00:00 - 23:00) to observe planetary motion throughout the day
    • "Now" button to jump to current time
    • Real-time position updates
  • Zoom Controls: Zoom in/out and reset for better viewing (0.5x to 2.0x)
  • Planet Details: Click any planet to see:
    • Distance from Sun (AU)
    • 3D Coordinates (X, Y, Z)
    • Angle and position information
  • Visual Features:
    • Saturn's rings
    • Earth's moon
    • Color-coded planet legend
  • Accuracy: Positions accurate for any date/time (1800-2200 CE)

๐ŸŽฏ User Experience

Navigation & Controls

  • Day Navigation: Click any day in the forecast to see detailed hourly breakdown
  • Date Selector: Previous/Next day buttons with live date display
  • Live Clock: Real-time local time display for selected city
  • Auto-refresh: Weather data updates automatically

Customization

  • Multi-language Support:
    • ๐Ÿ‡ซ๐Ÿ‡ท Persian (Farsi)
    • ๐Ÿ‡ฌ๐Ÿ‡ง English
    • Auto-detection based on browser/geolocation
  • Temperature Units: Toggle between Celsius (ยฐC) and Fahrenheit (ยฐF)
  • Responsive Zoom: Auto-optimized zoom levels for mobile, tablet, and desktop

Visual Design

  • Beautiful Animations:
    • Weather-specific animations (sun, clouds, rain, snow, night)
    • Loading screen animations
    • Smooth transitions and hover effects
  • Dynamic Color Themes: UI adapts colors based on weather conditions
  • Progress Bar Animations: Animated progress bars for all stat cards
  • SVG Graphics: Custom SVG elements for astronomical visualizations

๐Ÿ“ฑ Responsive Design

  • Mobile-First: Optimized for all screen sizes
  • Breakpoint Support:
    • Mobile (โ‰ค560px)
    • Tablet (โ‰ค880px)
    • Desktop (>880px)
  • Touch-Friendly: Optimized touch targets and gestures
  • Adaptive Layouts: Grid and Flexbox layouts that adapt to screen size

๐Ÿš€ Getting Started

Quick Start

  1. Clone the repository

    git clone https://github.com/MOHAMMADREZAABEDINPOOR/PIMX_WEATHER.git
    cd PIMX_WEATHER
  2. Open in browser

    • Simply open index.html in any modern web browser
    • No build process or dependencies required!
  3. Start using

    • Allow location access when prompted (optional)
    • Or search for any city worldwide

Browser Requirements

  • Modern Browser: Chrome, Firefox, Safari, Edge (latest versions)
  • JavaScript: Must be enabled
  • Internet Connection: Required for API calls

No Installation Needed!

This is a pure client-side application:

  • โœ… No server required
  • โœ… No build process
  • โœ… No npm/node dependencies (except CDN libraries)
  • โœ… Works offline for saved cities (after initial load)

๐ŸŒ Data Sources & APIs

Weather APIs

  • Primary: Open-Meteo - Free, accurate, and reliable weather API
    • Forecast API: Real-time and future weather data
    • Archive API: Historical weather data
    • Air Quality API: Air pollution and AQI data
    • Geocoding API: City search and reverse geocoding

Location Services

  • GPS: Native browser geolocation API
  • IP Geolocation: ipapi.co - IP-based location detection

Astronomical Calculations

  • VSOP87: Variations Sรฉculaires des Orbites Planรฉtaires - Planetary position calculations
  • Kepler's Equation: Solving for planetary orbits
  • Julian Day: Astronomical date/time conversion
  • Reference Standards:

๐ŸŽจ Technologies Used

Core Technologies

  • HTML5: Semantic markup and modern HTML features
  • CSS3:
    • CSS Grid & Flexbox for layouts
    • CSS Animations & Transitions
    • CSS Variables (Custom Properties)
    • Media Queries for responsive design
  • Vanilla JavaScript (ES6+):
    • Modern ES6+ syntax
    • Async/Await for API calls
    • LocalStorage for data persistence
    • Canvas API for charts

Libraries & Dependencies

  • Chart.js 4.4.0: Interactive charts for historical data
  • Vazirmatn Font: Persian/Arabic font support
  • Open-Meteo API: Weather data provider

File Structure

PIMX_WEATHER/
โ”œโ”€โ”€ index.html          # Main HTML structure
โ”œโ”€โ”€ styles.css          # Main stylesheet
โ”œโ”€โ”€ animations.css      # Weather animations
โ”œโ”€โ”€ app.js             # Main application logic
โ”œโ”€โ”€ i18n.js            # Internationalization (i18n)
โ””โ”€โ”€ README.md          # Documentation

๐Ÿ“ Technical Details

Sun/Moon Arc Calculation

The application uses Quadratic Bezier Curves to accurately represent the sun and moon's paths:

Mathematical Formula

Arc Path: M 20,130 Q 200,20 380,130
- Start point (sunrise): (20, 130)
- Control point (zenith): (200, 20)
- End point (sunset): (380, 130)

Position Calculation (JavaScript)

t = (current time - sunrise) / (sunset - sunrise)  // 0 to 1
x = (1-t)ยฒ ร— xโ‚€ + 2(1-t)t ร— xc + tยฒ ร— xโ‚
y = (1-t)ยฒ ร— yโ‚€ + 2(1-t)t ร— yc + tยฒ ร— yโ‚

Planetary Position Calculation

The solar system uses precision astronomical algorithms:

  1. Julian Day Number (JD): Converts any date/time to astronomical Julian Day
  2. VSOP87 Orbital Elements: Calculates planetary orbital parameters
    • Semi-major axis (a)
    • Eccentricity (e)
    • Inclination (I)
    • Mean longitude (L)
    • Longitude of perihelion (ฯ‰ฬƒ)
    • Longitude of ascending node (ฮฉ)
  3. Kepler's Equation: Solves M = E - eยทsin(E) using Newton-Raphson iteration
  4. True Anomaly: Calculates actual planet position
  5. Heliocentric Coordinates: Converts to 3D (X, Y, Z) coordinate system

Accuracy

  • โœ… Valid for years 1800-2200 CE
  • โœ… Position error < 1 degree
  • โœ… Real-time updates
  • โœ… Timezone-aware calculations

Moon Phase Calculation

  • Uses high-precision Julian Day formulas
  • Moon age calculated to 0.1 day accuracy
  • 8 distinct moon phases with visual representations

๐Ÿ”ง Advanced Features

State Management

  • Centralized app state object
  • LocalStorage persistence for:
    • Saved cities (up to 20)
    • Temperature unit preference
    • Active city index
    • Solar system zoom level

Performance Optimizations

  • Lazy Loading: Charts loaded only when needed
  • Debounced Search: City search debounced for performance
  • Efficient Rendering: Only updates changed DOM elements
  • CDN Resources: External libraries loaded from CDN

Accessibility

  • Semantic HTML: Proper HTML5 semantic elements
  • ARIA Labels: Screen reader support
  • Keyboard Navigation: Full keyboard accessibility
  • Responsive Text: Scalable font sizes

๐ŸŽจ UI/UX Highlights

Visual Design

  • Modern Card-Based Layout: Clean, organized sections
  • Smooth Animations: Weather-specific animations enhance user experience
  • Progress Indicators: Animated progress bars for all metrics
  • Loading States: Beautiful loading screen with progress bar
  • Toast Notifications: User-friendly notification system

Color Themes

Automatically switches based on weather:

  • โ˜€๏ธ Sunny Day: Warm yellows and oranges
  • โ˜๏ธ Cloudy: Soft grays and whites
  • ๐ŸŒง๏ธ Rainy: Cool blues and grays
  • โ„๏ธ Snowy: Bright whites and blues
  • ๐ŸŒ™ Night: Dark blues and purples

๐Ÿ“Š Features Summary

Feature Category Count Details
Weather Metrics 13 Comprehensive stat cards
Forecast Periods 2 7-day / 14-day options
Historical Periods 4 Week, Month, 6 Months, Year
Astronomy Objects 11 Sun, Moon, 8 Planets
Languages 2 Persian, English
Temperature Units 2 Celsius, Fahrenheit
Saved Cities 20 Maximum storage
Chart Types 2 Precipitation, Temperature

๐Ÿ› Troubleshooting

Common Issues

Location not detected

  • Check browser permissions for location access
  • Try using IP-based location fallback
  • Manually search for your city

Weather data not loading

  • Check internet connection
  • Verify API endpoints are accessible
  • Check browser console for errors

Sun/Moon position incorrect

  • Ensure device timezone is correct
  • Refresh the page
  • Check console logs for debug information

Charts not displaying

  • Ensure Chart.js library loaded correctly
  • Check browser console for errors
  • Try refreshing the page

๐Ÿ”ฎ Future Enhancements

Potential features for future versions:

  • ๐ŸŒ Weather maps integration
  • ๐Ÿ“ฑ Progressive Web App (PWA) support
  • ๐Ÿ”” Weather alerts and notifications
  • ๐Ÿ“ˆ More detailed climate data
  • ๐ŸŒ Additional language support
  • ๐ŸŽจ More theme customization options

๐Ÿ“„ License

This project is released under the MIT License. Feel free to use, modify, and distribute as needed.


๐Ÿ‘ค Author

Mohammadreza Abedinpour


๐Ÿค Contributing

Contributions are welcome! If you find a bug or have a feature suggestion:

  1. Open an Issue: Describe the problem or feature request
  2. Fork the Repository: Create your own fork
  3. Create a Branch: Work on your changes
  4. Submit a Pull Request: Share your improvements

For bug reports, please include:

  • Browser and version
  • Operating system
  • Steps to reproduce
  • Expected vs actual behavior

๐Ÿ™ Acknowledgments

  • Open-Meteo for free weather API
  • Chart.js for beautiful charts
  • JPL Horizons for astronomical reference
  • Jean Meeus for astronomical algorithms reference
  • All contributors and users

Made with โค๏ธ and โ˜• by Mohammadreza Abedinpour

Last updated: 2025

About

Advanced Weather Application with real-time forecasts, astronomical visualization (Sun/Moon arc charts with live tracking, Solar System with VSOP87 calculations), historical statistics, multi-language support (EN/FA), and responsive design. Built with Vanilla JavaScript and Open-Meteo API.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published