Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .agent/workflows/ui-skills.md

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
pull_request:
branches: [main]
push:
branches: [main]

permissions:
contents: read

jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: npm

- run: npm ci
- run: npm run lint
- run: npm run type-check
- run: npm run build
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 David Mease

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
205 changes: 34 additions & 171 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,199 +1,62 @@
# 🧊 Ice Storm Monitor
# Ice Storm Monitor

A real-time ice storm monitoring and power outage risk assessment dashboard powered by Google's WeatherNext AI API. Built with React, TypeScript, and Tailwind CSS.
A small hobby dashboard for exploring hourly winter-weather data from the Google Weather API. It
turns forecast ice, temperature, precipitation, and wind data into simple condition flags and an
ice-and-wind risk score.

![Ice Storm Monitor Dashboard](https://via.placeholder.com/800x400?text=Ice+Storm+Monitor+Dashboard)
The score is a project-specific heuristic, not an official forecast or outage prediction. Use local
National Weather Service guidance and emergency alerts for real-world decisions.

## ✨ Features
![Ice Storm Monitor dashboard](screenshot.png)

- **🔮 Power Outage Risk Prediction** - Proprietary algorithm based on NWS ice storm severity scales
- **📊 Real-time Visualization** - Interactive charts showing ice accumulation, temperature, and wind data
- **⚠️ Smart Alerts** - Automatic weather warnings based on forecast thresholds
- **📥 CSV Export** - Download complete forecast data for offline analysis
- **💾 Smart Caching** - 15-minute cache reduces API costs on repeated refreshes
- **🌙 Dark Mode** - Full dark mode support with system preference detection
- **📍 Geolocation** - Use your current location or enter custom coordinates
- **📱 Responsive Design** - Works great on desktop, tablet, and mobile
- **🧪 Demo Mode** - Try the app without an API key using simulated data
## What it does

- Displays hourly ice, temperature, wind, and precipitation data.
- Highlights combinations that may be worth watching during freezing weather.
- Supports location search, browser geolocation, dark mode, and CSV/JSON export.
- Includes demo data so the interface can be explored without an API key.

## 🚀 Quick Start
This is a best-effort hobby project built for personal weather watching. Issues and small
improvements are welcome, but the calculations should not be treated as safety advice.

### Prerequisites
## Run locally

- [Node.js](https://nodejs.org/) 18+
- [npm](https://www.npmjs.com/) or [pnpm](https://pnpm.io/)
- Google Cloud account with Weather API enabled

### Installation
Requirements: Node.js 18 or newer and a Google Cloud project with the Weather API enabled.

```bash
# Clone the repository
git clone https://github.com/yourusername/ice-storm-monitor.git
cd ice-storm-monitor

# Install dependencies
npm install

# Copy environment template
git clone https://github.com/GoWithitRoger/Local-Google-Weather.git
cd Local-Google-Weather
npm ci
cp .env.example .env

# Add your API key to .env
# VITE_WEATHER_API_KEY=your_key_here

# Start development server
npm run dev
```

The app will open at [http://localhost:3000](http://localhost:3000)
Add your key to `.env`:

## 🔑 Getting a Google Weather API Key

1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Create a new project or select an existing one
3. Enable the [Weather API](https://console.cloud.google.com/apis/library/weather.googleapis.com)
4. Go to **APIs & Services > Credentials**
5. Click **Create Credentials > API Key**
6. (Optional) Restrict the key to the Weather API for security
7. Add the key to your `.env` file

> ⚠️ **Note**: The Weather API requires billing to be enabled, though it includes a free tier.

## 📁 Project Structure

```
src/
├── components/ # React components
│ ├── Header.tsx # App header with controls
│ ├── KpiCards.tsx # Metric display cards
│ ├── AlertsPanel.tsx # Weather alerts
│ ├── RiskCharts.tsx # Data visualizations
│ ├── DataTable.tsx # Hourly data table
│ └── ...
├── hooks/
│ └── useWeatherData.ts # Main data fetching hook
├── context/
│ └── ThemeContext.tsx # Dark mode provider
├── utils/
│ └── index.ts # Risk calculation & helpers
├── constants/
│ └── index.ts # Configuration & thresholds
├── types/
│ └── index.ts # TypeScript definitions
├── App.tsx # Main application
└── main.tsx # Entry point
```bash
VITE_WEATHER_API_KEY=your_key_here
```

## ⚙️ Configuration

### Environment Variables

| Variable | Description | Required |
|----------|-------------|----------|
| `VITE_WEATHER_API_KEY` | Google Weather API key | Yes |
| `VITE_DEFAULT_LAT` | Default latitude | No (default: 32.846) |
| `VITE_DEFAULT_LON` | Default longitude | No (default: -96.711) |

### Risk Thresholds

The power outage risk algorithm uses these configurable thresholds:
The key is used by browser code, so restrict it in Google Cloud to the required APIs and expected
website origins. The app also uses the Google Maps Geocoding API for location search.

```typescript
// Ice accumulation thresholds (inches)
ICE_THRESHOLDS = {
LIGHT: 0.01, // Minimal risk
MODERATE: 0.10, // Tree limbs stressed
HEAVY: 0.25, // Significant damage likely
SEVERE: 0.50, // Catastrophic
}

// Wind gust thresholds (mph)
WIND_THRESHOLDS = {
ELEVATED: 20, // Elevated risk with ice
DANGEROUS: 40, // High risk of downed lines
}
```

## 🏗️ Development
## Development

```bash
# Start dev server
npm run dev

# Type checking
npm run type-check

# Linting
npm run lint

# Production build
npm run type-check
npm run build

# Preview production build
npm run preview
```

## 📊 Risk Algorithm

The power outage probability is calculated using a weighted scoring system:

1. **Ice Accumulation** (0-100 points)
- Light glaze (>0.01"): +10 points
- Moderate ice (>0.10"): +20 points
- Heavy ice (>0.25"): +40 points
- Severe ice (>0.50"): +30 points

2. **Wind Stress Multiplier**
- Dangerous gusts (>40 mph): +30 points
- Elevated gusts with ice (>20 mph + >0.10" ice): +20 points

The final score is capped at 100 and categorized as:
- **Low Risk** (0-19): Normal conditions
- **Moderate** (20-39): Be prepared
- **High Risk** (40-69): Likely outages
- **Critical** (70-100): Widespread outages expected

## 🎨 Customization

### Theming

The app supports three theme modes:
- **Light** - Clean, bright interface
- **Dark** - Easy on the eyes at night
- **System** - Follows your OS preference

Click the theme toggle button in the header to cycle through modes.

### Styling

Built with Tailwind CSS. Customize colors in `tailwind.config.js`:

```javascript
theme: {
extend: {
colors: {
risk: {
low: '#10b981',
moderate: '#eab308',
high: '#f97316',
critical: '#ef4444',
}
}
}
}
```

## 📝 License

MIT License - feel free to use this project however you like.
## How the score works

## 🙏 Acknowledgments
The dashboard combines estimated radial ice accretion with wind thresholds to produce a 0–100
relative score. The thresholds are inspired by common ice-storm impact categories, but the result
has not been calibrated as an outage probability.

- [Google Weather API](https://developers.google.com/maps/documentation/weather) for forecast data
- [Recharts](https://recharts.org/) for beautiful charts
- [Lucide](https://lucide.dev/) for icons
- [Tailwind CSS](https://tailwindcss.com/) for styling
The implementation lives in `src/utils/` and `src/constants/` so the assumptions remain visible and
easy to adjust.

---
## License

Built with ☕ in Dallas, TX
MIT. See [LICENSE](LICENSE).
48 changes: 0 additions & 48 deletions analyze_data.cjs

This file was deleted.

Binary file removed debug.png
Binary file not shown.
Loading
Loading