Flask web app that predicts local weather conditions from zipcode-based historical weather patterns.
The project combines geolocation lookup, historical weather retrieval, feature engineering, and pretrained neural network models to estimate:
- daily high temperature (
TMAX) - daily low temperature (
TMIN) - precipitation (
PRCP) - snowfall (
SNOW) - average wind speed (
AWND)
This project started as a machine learning weather forecasting experiment focused on Colorado. A user enters a US zipcode, the app resolves the location, gathers recent historical weather data for nearby stations, builds the same feature set used during training, and runs local models to generate a forecast.
To keep the app demoable without private credentials, the runtime supports multiple data paths:
NOAA + local ML model: preferred path using NOAA station history and local pretrained modelsOpen-Meteo historical + local ML model: no-token fallback that still predicts from historical weather patternsOpen-Meteo fallback: last-resort direct weather fallback when the historical/model path is unavailable
- Python
- Flask
- TensorFlow / Keras
- pandas / NumPy / scikit-learn
- NOAA CDO API
- Zippopotam.us API
- Open-Meteo API
.
├── weather_app.py # root compatibility wrapper for the Flask app
├── src/
│ ├── app/
│ │ ├── main.py # Flask app and inference pipeline
│ │ ├── __init__.py
│ │ └── templates/
│ │ └── index.html # single-page UI
│ ├── training/
│ │ ├── model_training.py # training and model generation workflow
│ │ └── __init__.py
│ ├── tests/
│ │ └── test_app_main.py
│ └── models/
│ ├── scaler.pkl # persisted feature scaler
│ ├── TMAX_model.pkl # trained model artifact
│ ├── TMIN_model.pkl # trained model artifact
│ ├── PRCP_model.pkl # trained model artifact
│ ├── SNOW_model.pkl # trained model artifact
│ └── AWND_model.pkl # trained model artifact
├── requirements.txt # Python dependencies
└── README.md
- The user enters a US zipcode.
- The app resolves latitude and longitude with Zippopotam.us.
- The app collects weather history from NOAA when a token is available.
- If NOAA is unavailable, the app falls back to Open-Meteo archive history and still builds prediction features.
- The app applies the same transformations used during training, including interaction features and
log1pscaling. - The pretrained neural networks generate predictions for temperature, precipitation, snowfall, and wind.
- Python 3.12
pip
git clone https://github.com/AustynGriegoMSU/Not_So_Accurate_Weather_App.git
cd Not_So_Accurate_Weather_App
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txtThe app works without a NOAA token, but the preferred forecast path uses one.
export NOAA_API_TOKEN="your_token_here"python weather_app.pyThen open http://127.0.0.1:5000 in a browser.
The root app entrypoint is intentionally kept as a wrapper so existing commands still work after the folder reorganization.
python -m pytest -qGitHub Actions is configured to run tests on pushes and pull requests to main.
Workflow file: .github/workflows/ci.yml
Install hooks once:
python -m pre_commit installAfter this, tests run automatically before each commit.
For local development, python weather_app.py is still the primary entrypoint.
For a production-style WSGI run:
FLASK_DEBUG=0 gunicorn --bind 0.0.0.0:5000 src.app.main:appYou can also disable Flask debug mode for the standard entrypoint:
FLASK_DEBUG=0 python weather_app.py- The local models were trained on weather features engineered from historical observations.
- Temperature, precipitation, snowfall, and wind inputs are transformed before inference.
- Forecast quality is strongest in the region the model was originally tuned around, especially Colorado.
- Forecast accuracy is inconsistent outside the model's strongest geography.
- Fallback historical sources do not perfectly match NOAA station features.
- Prediction quality can vary by zipcode depending on station coverage and feature drift.
- This is a project/demo app, not a production weather service.
- Building a small end-to-end ML application
- Working with multiple external APIs
- Data cleaning and feature engineering for inference
- Serving local model artifacts through a Flask web interface
- Improving reliability with fallback data paths and runtime validation
- Retrain models on broader and newer data
- Add forecast confidence or error bands
- Add charts showing the historical window used for prediction
- Refactor training and inference code into reusable modules
- Add tests for zipcode handling, feature construction, and fallback behavior
- NOAA CDO API
- Zippopotam.us
- Open-Meteo
- Heroku (Originally deployed)