File size: 5,477 Bytes
7bcb429 720f4fd 248a9af 720f4fd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | ---
title: RadarRedo
emoji: ๐ฆ๏ธ
colorFrom: blue
colorTo: gray
sdk: gradio
sdk_version: "4.44.0"
app_file: app.py
pinned: false
license: gpl-3.0
short_description: Transform Canadian radar data to American color standards
---
# ๐ฆ๏ธ RadarRedo: Radar Reclassification System
A powerful system that transforms Canadian weather radar data to American color standards while preserving meteorological accuracy.
## ๐ฅ Key Features
- **Real-time Radar Processing**: Fetches live Canadian radar data from Environment Canada
- **Intelligent Color Detection**: Uses K-means clustering to identify unique radar colors
- **DBZ Mapping**: Maps colors to accurate reflectivity values (dBZ)
- **Color Reclassification**: Converts Canadian color scheme to American NWS standards
- **Interactive Interface**: Three-tab Gradio interface for exploration and analysis
- **Color Analysis**: Detailed analysis of radar color distributions
## ๐ ๏ธ Installation
1. **Clone the repository**:
```bash
git clone <repository-url>
cd RadarRedo
```
2. **Install dependencies**:
```bash
pip install -r requirements.txt
```
3. **Run the application**:
```bash
python app.py
```
4. **Open your browser** to `http://localhost:7860`
## ๐ฏ How It Works
### 1. Data Acquisition
- Fetches radar tiles from Environment Canada's MSC GeoMet WMS service
- Supports multiple radar types: Rain, Snow, Composite, 24h/6h precipitation
### 2. Color Detection & Analysis
- Uses K-means clustering to identify dominant colors in radar images
- Handles transparency and anti-aliasing artifacts
- Maps detected colors to corresponding DBZ (reflectivity) values
### 3. Color Reclassification
- Converts Canadian color scheme to American NWS standards
- Preserves meteorological data integrity during transformation
- Maintains accurate DBZ-to-color relationships
### 4. Visualization
- Interactive maps with original and reclassified radar overlays
- Color scale comparisons between Canadian and American standards
- Detailed color analysis and distribution reports
## ๐ Color Standards
### Canadian (ECCC) Scale
- Environment and Climate Change Canada color scheme
- Optimized for Canadian meteorological standards
- Range: -30 to +70 dBZ
### American (NWS) Scale
- National Weather Service color scheme
- Standard for US meteorological applications
- Range: -30 to +70 dBZ with different color mappings
## ๐ฎ Usage
### Tab 1: Original Canadian Radar
- View real-time Canadian radar data
- Select different radar layers (Rain, Snow, Composite)
- Adjust opacity and update frequency
### Tab 2: Reclassified Radar (American Colors)
- Generate reclassified radar with American color scheme
- Customize bounding box for specific geographic areas
- Compare side-by-side with original data
### Tab 3: Color Analysis
- Analyze color distributions in radar images
- View detailed DBZ mappings
- Generate color scale comparison charts
## ๐งช Testing
Run the test suite to verify functionality:
```bash
python test_reclassification.py
```
This will test:
- Color detection accuracy
- DBZ mapping precision
- Color scale consistency
- Legend generation
## ๐๏ธ Architecture
```
RadarRedo/
โโโ app.py # Main Gradio application
โโโ radar_processor.py # Core image processing logic
โโโ test_reclassification.py # Test suite
โโโ requirements.txt # Python dependencies
โโโ CLAUDE.md # Development guidance
โโโ README.md # This file
```
### Core Components
- **CanadianRadarApp**: Main application class with Folium integration
- **RadarImageProcessor**: Image processing and color reclassification engine
- **RadarColorScale**: Predefined color standards for Canadian and American systems
- **ColorDBZMapping**: Data structure for color-to-reflectivity mappings
## ๐ Geographic Coverage
- **Primary Coverage**: Canada and northern United States
- **Data Source**: Environment and Climate Change Canada (ECCC)
- **Update Frequency**: Every 10 minutes
- **Resolution**: 1km for radar data
## ๐ง Configuration
### Bounding Box Format
Specify geographic bounds as: `West, South, East, North`
Example (Toronto area): `-80.0, 43.0, -78.0, 45.0`
### Available Radar Layers
- **RADAR_1KM_RRAI**: Rain radar (1km resolution)
- **RADAR_1KM_RSNO**: Snow radar (1km resolution)
- **RADAR_1KM_RDBR**: Composite radar
- **RDPA.24F_PR**: 24-hour precipitation accumulation
- **RDPA.6F_PR**: 6-hour precipitation accumulation
## ๐ Performance
- **Color Detection**: ~1-2 seconds for 512x512 images
- **Reclassification**: ~2-3 seconds per image
- **Memory Usage**: ~50-100MB during processing
- **Network**: Dependent on WMS response times
## ๐ Future Enhancements
- Support for additional radar color standards (European, Australian)
- Batch processing for multiple radar regions
- Historical radar data analysis
- Machine learning-based color prediction
- Real-time streaming updates
## ๐ค Contributing
1. Fork the repository
2. Create a feature branch
3. Run tests: `python test_reclassification.py`
4. Submit a pull request
## ๐ License
GPL-3.0 License - see LICENSE file for details
## ๐ Acknowledgments
- Environment and Climate Change Canada for radar data
- National Weather Service for color standard references
- Gradio team for the excellent interface framework
---
**Built with โค๏ธ for the meteorological community**
|