Skip to content

Commit b0af845

Browse files
committed
Update index.qmd
1 parent 9b11ce7 commit b0af845

File tree

1 file changed

+82
-38
lines changed

1 file changed

+82
-38
lines changed

docs/index.qmd

Lines changed: 82 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ A minimal, efficient Python implementation of **Standardized Precipitation Index
2929

3030
::: {.grid-container}
3131
::: {.feature-card}
32-
### 📊 Climate Indices
32+
### Climate Indices
3333

3434
- **SPI** - Standardized Precipitation Index
3535
- **SPEI** - Precipitation Evapotranspiration Index
@@ -38,7 +38,7 @@ A minimal, efficient Python implementation of **Standardized Precipitation Index
3838
:::
3939

4040
::: {.feature-card}
41-
### 🌡️ Bidirectional Analysis
41+
### Bidirectional Analysis
4242

4343
- Monitor **drought** (dry conditions)
4444
- Monitor **floods** (wet conditions)
@@ -47,7 +47,16 @@ A minimal, efficient Python implementation of **Standardized Precipitation Index
4747
:::
4848

4949
::: {.feature-card}
50-
### 📈 Run Theory Implementation
50+
### Multi-Distribution Support
51+
52+
- **Gamma** - Standard for SPI (McKee et al. 1993)
53+
- **Pearson Type III** - Recommended for SPEI
54+
- **Log-Logistic** - Better tail behavior
55+
- Automatic method selection per distribution
56+
:::
57+
58+
::: {.feature-card}
59+
### Run Theory Implementation
5160

5261
- Event identification & characterization
5362
- Duration, magnitude, intensity, peak
@@ -56,32 +65,48 @@ A minimal, efficient Python implementation of **Standardized Precipitation Index
5665
:::
5766

5867
::: {.feature-card}
59-
### 🎨 Visualization Suite
68+
### Chunked Processing
69+
70+
- Memory-efficient spatial tiling
71+
- Process global-scale data (CHIRPS, ERA5)
72+
- Automatic memory estimation
73+
- Streaming I/O for datasets exceeding RAM
74+
:::
75+
76+
::: {.feature-card}
77+
### Visualization Suite
6078

6179
- Time series plots with event highlighting
62-
- 11-category SPI/SPEI classification
80+
- 11-category WMO SPI/SPEI classification
6381
- Spatial maps of event characteristics
64-
- 5-panel evolution timelines
82+
- Cross-distribution comparison charts
6583
:::
6684
:::
6785

6886
## Quick Example
6987

70-
Here's how easy it is to calculate SPI and identify drought events:
88+
Calculate SPI with multiple distributions and identify drought events:
7189

7290
```python
7391
import xarray as xr
74-
from indices import spi
75-
from runtheory import identify_events, calculate_timeseries
76-
from visualization import plot_index, plot_events
92+
from indices import spi, spi_multi_scale
93+
from runtheory import identify_events
94+
from visualization import plot_index
7795

7896
# Load precipitation data
7997
ds = xr.open_dataset('precipitation.nc')
8098
precip = ds['precip']
8199

82-
# Calculate SPI-12
100+
# Calculate SPI-12 with Gamma (default)
83101
spi_12 = spi(precip, scale=12, periodicity='monthly')
84102

103+
# Or use Pearson III / Log-Logistic
104+
spi_12_p3 = spi(precip, scale=12, distribution='pearson3')
105+
spi_12_ll = spi(precip, scale=12, distribution='log_logistic')
106+
107+
# Multi-scale SPI in one call
108+
spi_multi = spi_multi_scale(precip, scales=[3, 6, 9, 12])
109+
85110
# Identify drought events (threshold -1.2)
86111
events = identify_events(spi_12.isel(lat=0, lon=0), threshold=-1.2)
87112

@@ -94,13 +119,13 @@ plot_index(spi_12.isel(lat=0, lon=0), threshold=-1.2)
94119
::: {.callout-note}
95120
## Bidirectional by Design
96121

97-
Unlike traditional drought-only tools, **precip-index** treats dry and wet extremes equally. Use negative thresholds for droughts, positive thresholds for floods - same functions, same methodology.
122+
Unlike traditional drought-only tools, **precip-index** treats dry and wet extremes equally. Use negative thresholds for droughts, positive thresholds for floods --- same functions, same methodology.
98123
:::
99124

100125
::: {.callout-tip}
101-
## Optimized for Scale
126+
## Multi-Distribution Fitting
102127

103-
Built for global-scale gridded data with CF conventions. Efficiently processes large datasets using NumPy, SciPy, and Numba acceleration.
128+
Choose the probability distribution that best fits your data. Gamma, Pearson III, and Log-Logistic each use their optimal fitting method (Method of Moments, MLE) --- validated to produce correct SPI/SPEI across all grid cells. See the [validation results](technical/validation.qmd).
104129
:::
105130

106131
::: {.callout-important}
@@ -109,6 +134,12 @@ Built for global-scale gridded data with CF conventions. Efficiently processes l
109134
Goes beyond simple threshold exceedance. Implements full run theory to characterize event duration, magnitude (cumulative & instantaneous), intensity, and peak values.
110135
:::
111136

137+
::: {.callout-note}
138+
## Scalable Architecture
139+
140+
Built for datasets of any size. Small regional grids run in-memory; global datasets (CHIRPS, ERA5, TerraClimate) use the chunked processing module with automatic spatial tiling and streaming I/O.
141+
:::
142+
112143
## Example Applications
113144

114145
- **Operational Drought Monitoring** - Track ongoing droughts with real-time updates
@@ -117,54 +148,67 @@ Goes beyond simple threshold exceedance. Implements full run theory to character
117148
- **Early Warning Systems** - Generate alerts based on evolving event characteristics
118149
- **Decision Support** - Gridded statistics for regional planning
119150

120-
## Real Data Example
151+
## Validation Results
121152

122-
This package includes example data from **Bali, Indonesia** (1958-2024) using [TerraClimate](https://www.climatologylab.org/terraclimate.html):
153+
All distributions are tested against TerraClimate Bali data (1958--2024). Cross-distribution correlation exceeds 0.98 for both SPI and SPEI.
123154

124155
::: {.panel-tabset}
125-
### SPI 12-month, October 2023
156+
### SPI-3 Distribution Comparison
126157

127-
![SPI-12](images/bali_terraclimate_spi12_202310.png)
158+
![](images/spi3_distribution_comparison.png)
128159

129-
### SPEI 12-month, Dry
160+
Three distributions (Gamma, Pearson III, Log-Logistic) produce consistent SPI-3 time series at a single land cell. The same drought and wet events are identified regardless of distribution choice.
130161

131-
![SPEI-12 Dry](images/bali_terraclimate_spei12_1958_2020_dry.png)
162+
### Multi-Scale SPI
132163

133-
### SPEI 12-month, Wet
164+
![](images/spi_multiscale_gamma.png)
134165

135-
![SPEI-12 Wet](images/bali_terraclimate_spei12_1958_2020_wet.png)
166+
SPI at 3-, 6-, 9-, and 12-month scales. Shorter scales capture recent anomalies; longer scales reveal persistent hydrological drought.
136167

137-
:::
168+
### Spatial Comparison
138169

139-
::: {.callout-note}
140-
## Try it with your data
170+
![](images/spi3_spatial_distribution_comparison.png)
171+
172+
Spatial SPI-3 maps across all three distributions at the same timestep. Spatial patterns remain consistent.
173+
174+
### SPEI PET Comparison
141175

142-
The tutorials use real TerraClimate data included in the repository. Follow along with actual climate data, not synthetic examples!
176+
![](images/spei6_pet_vs_temp_comparison.png)
177+
178+
SPEI-6 computed with pre-computed PET vs temperature-derived PET (Thornthwaite). Both approaches yield consistent results (r > 0.98).
179+
180+
### Drought Events
181+
182+
![](images/test_spatial_drought_events.png)
183+
184+
Spatial drought event counts (2000--2023) from run theory analysis, showing drought-prone areas across Bali.
143185
:::
144186

187+
See the full [Validation & Test Results](technical/validation.qmd) page for detailed analysis of each output.
188+
145189
## Getting Started
146190

147191
::: {.grid-container}
148192
::: {.feature-card}
149-
### 🚀 Installation
193+
### Installation
150194

151195
Install dependencies and clone the repository in minutes.
152196

153197
[Install Now](get-started/installation.qmd){.btn .btn-primary}
154198
:::
155199

156200
::: {.feature-card}
157-
### 📖 Quick Start
201+
### Quick Start
158202

159203
Follow the step-by-step guide to calculate your first SPI/SPEI.
160204

161205
[Quick Start](get-started/quick-start.qmd){.btn .btn-primary}
162206
:::
163207

164208
::: {.feature-card}
165-
### 💻 Tutorials
209+
### Tutorials
166210

167-
Learn through interactive Jupyter notebooks with real data.
211+
Learn through interactive tutorials with real TerraClimate data.
168212

169213
[View Tutorials](tutorials/01-calculate-spi.qmd){.btn .btn-primary}
170214
:::
@@ -173,17 +217,17 @@ Learn through interactive Jupyter notebooks with real data.
173217
## Documentation
174218

175219
- **[User Guide](user-guide/index.qmd)** - Detailed explanations of SPI, SPEI, run theory, and visualization
176-
- **[Data Model & Outputs](get-started/data-model.qmd)** - Input contract, calibration conventions, and output schemas
177220
- **[Technical Docs](technical/index.qmd)** - Methodology, implementation details, and API reference
221+
- **[Validation](technical/validation.qmd)** - Test results with distribution comparison plots and spatial maps
178222
- **[Changelog](changelog.qmd)** - Version history and updates
179223

180224
## Credits
181225

182226
**Modified/adapted from:** [climate-indices](https://github.com/monocongo/climate_indices) by James Adams ([monocongo](https://github.com/monocongo/))
183227

184-
**Author:** Benny Istanto
185-
**Organization:** GOST/DEC Data Group, The World Bank
186-
**Email:** bistanto@worldbank.org
228+
**Author:** Benny Istanto
229+
**Organization:** GOST/DEC Data Group, The World Bank
230+
**Email:** bistanto@worldbank.org
187231

188232
## Citation
189233

@@ -203,10 +247,10 @@ If you use this package in your research, please cite:
203247

204248
We welcome contributions! Please see our [GitHub repository](https://github.com/bennyistanto/precip-index) for:
205249

206-
- 🐛 **Bug reports** - Help us improve
207-
- 💡 **Feature requests** - Suggest enhancements
208-
- 🔧 **Pull requests** - Contribute code
209-
- 📖 **Documentation** - Improve our docs
250+
- **Bug reports** - Help us improve
251+
- **Feature requests** - Suggest enhancements
252+
- **Pull requests** - Contribute code
253+
- **Documentation** - Improve our docs
210254

211255
## License
212256

0 commit comments

Comments
 (0)