A collection of Python and Perl scripts for collecting weather data from various online sources and storing it in a database for visualization and analysis.
These scripts collect weather data (temperature, wind speed/direction, barometric pressure) from multiple sources and store it in a database. The data is then used by the Waconia weather charting application to generate visualizations and analysis.
The scripts collect data from four main sources:
- Hanford Meteorological Station (HMS) - Weather data from the Hanford site in Washington state
- NOAA - Weather data from Washington and Oregon, particularly in the Columbia River basin
- Aviation Weather (AW) - METAR data from airports, primarily in Minnesota
- Mesonet/Synoptic Data - JSON-based weather data from the Mesonet API
The scripts follow a naming convention with wgl_ prefix (Weather Gleaner):
wgl_perl_module.pm- Shared Perl module with common functionswgl_perl_hanford.pl- Collects data from the Hanford Meteorological Stationwgl_perl_noaa.pl- Collects data from NOAA weather pageswgl_perl_hanford_URLfetch.py- Python helper for the Hanford Perl scriptwgl_perl_postToSheet.py- Python helper for posting data
wgl_python_module.py- Shared Python module with common functionswgl_python_aw.py- Collects METAR data from Aviation Weather XML feedswgl_python_meso.py- Collects data from the Mesonet JSON API
The scripts store data in a database with tables including:
fifteenmindata- Main weather data with timestamps, station information, and measurementsdaysgleaned- Record of data collection activity
wgl_runAll.bat- Runs all scripts in sequencewgl_runAll_log.txt- Log file (console output) from one run of all scripts
The batch files are scheduled to run every 5-15 minutes to collect current weather data.
In Windows scheduled tasks, the "actions" tab fields have the following values:
- Script:
C:\Users\[your name]\Documents\webcontent\waconia\wgl_runAll.bat - Arguments:
\> C:\Users\[your name]\Documents\webcontent\waconia\wgl_runAll_log.txt 2>&1
The scripts are typically run via scheduled tasks every 5-15 minutes to collect current weather data. Each script:
- Connects to its respective data source
- Parses the retrieved data
- Stores the processed data in the database
- Handles errors and logging
- Python 3.x
- Perl 5.x
- Database access (originally MS Access, with MySQL support)
- Internet connection to access weather data sources
MIT License
Jim Miller
This repository contains the data collection components of the Waconia weather charting system. For more information about the complete system, visit the Waconia website.