A Python script that automatically monitors and logs active tropical storms using data from the Joint Typhoon Warning Center (JTWC) via the Tropycal package. The script generates daily reports with detailed information about active tropical cyclones, including their location, intensity, and characteristics.
- Automatically fetches real-time tropical cyclone data from JTWC
- Generates detailed daily reports with storm information including:
- Storm name and ID
- Storm status and category
- Maximum sustained winds
- Minimum pressure
- Current location (latitude/longitude)
- Implements rotating log files for system monitoring
- Creates organized daily data files
- Handles errors gracefully with comprehensive logging
tropycal_daily_tc_monitoring/
βββ tropycal_daily_tc_check.py
βββ data/ # Storm data reports
β βββ storm_data_YYYY-MM-DD.txt
βββ logs/ # Rotating log files
βββ storm_monitor.log
- Python 3.x
- Tropycal package
- Unix-like operating system for crontab scheduling (optional)
- Clone this repository:
git clone https://github.com/estamos/tropycal-daily.git
cd tropycal-daily
- Install the required package:
pip install tropycal
- Configure the base directory in the script:
Update the
base_dir
variable inmain()
to match your installation path:
base_dir = "/path/to/your/tropycal_daily_tc_monitoring"
Run the script manually:
python3 tropycal_daily_tc_check.py
To run the script automatically every day at 9:00 AM:
- Open your crontab configuration:
crontab -e
- Add the following line (adjust paths according to your setup):
0 9 * * * /path/to/your/python3 /path/to/your/tropycal_daily_tc_check.py
Example configuration:
0 9 * * * /Users/evangelos/Desktop/my-pyenv/bin/python3 /Users/evangelos/Documents/tropycal_daily_tc_monitoring/tropycal_daily_tc_check.py
The script generates daily report files in the data
directory with the following format:
Tropical Storm Report - YYYY-MM-DD
==================================================
Number of active storms: X
Active storms details:
========================================
Storm ID: AL012024
Name: Storm_Name
Status: TROPICAL_STORM
Category: Category_Value
Maximum Sustained Winds (knots): XXX
Minimum Pressure (hPa): XXXX
Location: Lat XX.XΒ°N, Lon XX.XΒ°E
The script maintains rotating log files in the logs
directory, with:
- Maximum file size: 1MB
- Backup count: 5 files
- Log format:
timestamp - log_level - message
The script includes comprehensive error handling for:
- Network connectivity issues
- Data parsing errors
- File system operations
- Individual storm data retrieval
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Tropycal for providing the tropical weather data interface
- JTWC for the tropical cyclone data
If you encounter any issues or have questions:
- Check the log files in the
logs
directory - Ensure you have proper internet connectivity
- Verify your Python environment and dependencies
- Open an issue in this repository with the relevant log information