This project retrieves weather data for specified cities using the OpenWeatherMap API, stores the data in a PostgreSQL database, and visualizes the results using Seaborn and Matplotlib. The visualizations are saved in a dedicated folder.
project_root/
│
├── config/
│ └── config.json # Configuration file containing API key, database config, and city list
│
├── weather_etl/
│ ├── init.py # Package initialization file
│ ├── config.py # Module for loading configuration settings
│ ├── weather_api.py # Module for fetching weather data from the API
│ ├── database.py # Module for database operations (loading and fetching data)
│ └── visualization.py # Module for visualizing weather data
│
├── visualizations/ # Folder for saving generated plots
│ └── (this folder will contain the saved plots)
│
└── main.py # Main entry point of the application
- Python 3.x
- PostgreSQL
- Required Python packages (listed in `requirements.txt`)
- Clone the repository:
git clone [email protected]:MGadhvi/weather-etl.git cd weather-etl
- Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Install required packages:
pip install -r requirements.txt
- Configure the project:
- Create `config/config.json` and fill in your OpenWeatherMap API key and PostgreSQL database configuration.
- Specify the list of cities you want to retrieve weather data for:
{ "api_key": "YOUR_API_KEY", "db_config": { "dbname": "your_db_name", "user": "your_username", "password": "your_password", "host": "localhost", "port": 5432 }, "cities": ["City1", "City2", "City3"] }
- **Run the application**:
python main.py
- The weather data will be stored in the specified PostgreSQL database.
- Visualizations will be saved in the `visualizations/` folder as PNG files.
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenWeatherMap API for providing weather data.
- Seaborn and Matplotlib for data visualization.