================================================================================
  Experiment 13: Open-Meteo Weather Trend & Statistical Analysis (Kochi)
================================================================================

FULL QUESTION:
Analyze weather data collected from the Open-Meteo API and visualize temperature and humidity trends using bar charts and perform statistical analysis.

SHORT QUESTION:
Retrieve weather parameters for Kochi from Open-Meteo, compute statistical metrics, and visualize temperature and humidity bar charts.

================================================================================
README & SETUP INSTRUCTIONS:
================================================================================
# Experiment 13: Open-Meteo Weather Trend & Statistical Analysis

## Objective
Retrieve meteorological readings for Kochi from Open-Meteo, compute statistical indicators, and visualize temperature and humidity variations using bar charts.

## Requirements
```bash
pip install requests pandas matplotlib
```

## How to Run
```bash
python weather_analysis.py
```

================================================================================
SOURCE CODE FILES:
================================================================================

1. weather_analysis.py
--------------------------------------------------------------------------------
import requests
import pandas as pd
import matplotlib.pyplot as plt

API_URL = (
    "https://api.open-meteo.com/v1/forecast"
    "?latitude=9.93&longitude=76.27"
    "&hourly=temperature_2m,relative_humidity_2m,wind_speed_10m"
    "&timezone=auto"
)

response = requests.get(API_URL, timeout=10).json()
hourly = response["hourly"]

df = pd.DataFrame({
    "Time": pd.to_datetime(hourly["time"]),
    "Temperature": hourly["temperature_2m"],
    "Humidity": hourly["relative_humidity_2m"],
    "Wind_Speed": hourly["wind_speed_10m"]
})

df_day = df.head(24).copy()
df_day["Hour"] = df_day["Time"].dt.strftime("%H:00")

print("Weather Statistical Analysis (24-Hour Horizon):")
print(df_day[["Temperature", "Humidity", "Wind_Speed"]].describe())

fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(12, 8))

ax1.bar(df_day["Hour"], df_day["Temperature"], )
ax1.set_ylabel("Temperature (°C)")
ax1.set_title("Hourly Temperature Trend - Kochi")
ax1.tick_params(axis="x", rotation=45)

ax2.bar(df_day["Hour"], df_day["Humidity"], )
ax2.set_ylabel("Relative Humidity (%)")
ax2.set_xlabel("Hour of Day")
ax2.set_title("Hourly Humidity Trend - Kochi")
ax2.tick_params(axis="x", rotation=45)

plt.tight_layout()
plt.savefig("weather_trends.png")
print("Saved bar chart visualization to weather_trends.png")
plt.show()
--------------------------------------------------------------------------------
