Skip to content

Commit ad6ee91

Browse files
committed
Update docs
1 parent 79eb718 commit ad6ee91

37 files changed

+836
-749
lines changed

docs/_quarto.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ website:
2828
href: get-started/quick-start.qmd
2929
- text: "Configuration"
3030
href: get-started/configuration.qmd
31+
- text: "Data Model & Outputs"
32+
href: get-started/data-model.qmd
3133
- text: "Examples"
3234
href: get-started/examples.qmd
3335
- text: "Tutorials"
@@ -62,6 +64,7 @@ website:
6264
- get-started/installation.qmd
6365
- get-started/quick-start.qmd
6466
- get-started/configuration.qmd
67+
- get-started/data-model.qmd
6568
- get-started/examples.qmd
6669

6770
- title: "Tutorials"
@@ -90,6 +93,7 @@ website:
9093
- technical/index.qmd
9194
- text: "---"
9295
- technical/methodology.qmd
96+
- technical/distributions.qmd
9397
- technical/implementation.qmd
9498
- technical/api-reference.qmd
9599
- text: "---"

docs/changelog.qmd

Lines changed: 33 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -5,172 +5,66 @@ subtitle: "Version History and Updates"
55

66
All notable changes to this project will be documented in this file.
77

8-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
9-
and this project adheres to [Calendar Versioning](https://calver.org/) (YYYY.M).
8+
This project adheres to [Calendar Versioning](https://calver.org/) (YYYY.M).
109

1110
---
1211

13-
## [2026.1.2] - 2026-01-27
14-
15-
### Pluggable Probability Distributions
16-
17-
Added support for multiple probability distributions across the entire SPI/SPEI pipeline. Default behavior (Gamma) is fully backward compatible.
18-
19-
**New Module: `distributions.py`**
20-
21-
- Unified API: `fit_distribution()`, `compute_cdf()`, `cdf_to_standard_normal()`
22-
- Five distributions: Gamma, Pearson III, Log-Logistic, GEV, Generalized Logistic
23-
- L-moments, Method of Moments, and MLE fitting with automatic fallback chains
24-
- Data diagnostics: `diagnose_data()`, `diagnose_fitting_failure()`
25-
- Goodness-of-fit testing and distribution comparison/selection
26-
- Robust parameter bounding and zero-inflation handling
27-
28-
**Updated: `config.py`**
29-
30-
- Distribution-aware variable naming: `spi_{distribution}_{scale}_{periodicity}`
31-
- `DISTRIBUTION_PARAM_NAMES` mapping for all five distribution types
32-
33-
**Updated: `utils.py`**
34-
35-
- Updated `get_variable_name()`, `get_variable_attributes()`, `get_fitting_param_name()`, `get_fitting_param_attributes()` with `distribution` parameter
36-
37-
**Updated: `compute.py`**
38-
39-
- `compute_index_parallel()``distribution` parameter with Gamma fast path and generic path
40-
- `_compute_params_generic()` — Generic parameter fitting via `distributions.py`
41-
- `_transform_to_normal_generic()` — Generic CDF-to-normal transformation
42-
- `compute_spi_1d()`, `compute_spei_1d()` — Distribution routing
43-
- `compute_index_dask()`, `compute_index_dask_to_zarr()` — Distribution pass-through
44-
45-
**Updated: `indices.py`**
46-
47-
- `spi()`, `spei()``distribution` parameter (default: `'gamma'`)
48-
- `spi_multi_scale()`, `spei_multi_scale()``distribution` parameter
49-
- `spi_global()`, `spei_global()``distribution` parameter
50-
- `save_fitting_params()` — Generic distribution-aware parameter storage
51-
- `load_fitting_params()` — Auto-detects distribution type from file attributes
52-
53-
**Updated: `chunked.py`**
54-
55-
- `compute_spi_chunked()`, `compute_spei_chunked()``distribution` parameter
56-
- Generic parameter array collection using `DISTRIBUTION_PARAM_NAMES`
57-
- `compute_spi_global()`, `compute_spei_global()``distribution` parameter
58-
59-
**New Documentation**
60-
61-
- [Probability Distributions](technical/distributions.qmd) — Distribution selection guide, mathematical background, usage examples
62-
63-
### Configurable Metadata Attributes
64-
65-
Added centralized, user-configurable metadata for all NetCDF output files. Institution, source, and other global attributes are no longer hardcoded.
66-
67-
**New in `config.py`**
68-
69-
- `DEFAULT_METADATA` — Module-level dict for default NetCDF global attributes (institution, source, references, etc.)
70-
- `get_global_attributes()` — Helper that merges defaults, computed attributes, and user overrides
71-
72-
**Updated: `indices.py`**
73-
74-
- `spi_multi_scale()`, `spei_multi_scale()``global_attrs` parameter for per-call metadata override
75-
- `spi_global()`, `spei_global()``global_attrs` parameter
76-
- `save_fitting_params()` — Now uses centralized metadata defaults (existing `global_attrs` parameter preserved)
77-
78-
**Updated: `chunked.py`**
79-
80-
- `compute_spi_chunked()`, `compute_spei_chunked()``distribution` and `global_attrs` parameters
81-
- `compute_spi_global()`, `compute_spei_global()``distribution` and `global_attrs` parameters
82-
83-
**Updated: Notebook 05**
84-
85-
- Configurable `BASE_DIR` for input/output paths — supports both Windows and WSL/Linux paths
86-
- Auto-detection of repository root and `src` directory
87-
- All example paths use configurable directory variables
88-
89-
### Centralized Configuration Hub
90-
91-
Refactored `config.py` as the single source of truth for all user-configurable settings. Helper functions moved to `utils.py`.
92-
93-
**New in `config.py`**
94-
95-
- `DISTRIBUTION_DISPLAY_NAMES` — Human-readable names for all five distributions
96-
- `PRECIP_VAR_PATTERNS` — Auto-detection patterns for precipitation variables in NetCDF
97-
- `PET_VAR_PATTERNS` — Auto-detection patterns for PET variables
98-
- `TEMP_VAR_PATTERNS` — Auto-detection patterns for temperature variables
99-
- `SPEI_WATER_BALANCE_OFFSET` — Configurable offset for SPEI water balance (default: 1000.0)
100-
- `__version__` — Package version string (moved from `__init__.py`)
101-
102-
**Moved from `config.py` to `utils.py`**
103-
104-
- `get_logger()`, `get_variable_name()`, `get_fitting_param_name()`, `get_long_name()`, `get_variable_attributes()`, `get_fitting_param_attributes()`, `get_global_attributes()` — all helper functions now in `utils.py`
105-
106-
**Updated: All source modules**
107-
108-
- Import paths updated across `compute.py`, `indices.py`, `chunked.py`, `visualization.py`, `runtheory.py`, `__init__.py`
109-
- Replaced duplicated `dist_display` dicts with `DISTRIBUTION_DISPLAY_NAMES` from config
110-
- Replaced inline variable detection patterns with configurable constants
111-
- Replaced hardcoded `1000.0` water balance offset with `SPEI_WATER_BALANCE_OFFSET`
112-
113-
**New Documentation**
114-
115-
- [Configuration Reference](get-started/configuration.qmd) — Complete guide to all configurable settings
116-
117-
---
118-
119-
## [2026.1] - 2026-01-21
12+
## [2026.1] - January 2026
12013

12114
### Initial Release
12215

123-
First public release of the precip-index package - a streamlined implementation of SPI and SPEI for climate extremes monitoring.
16+
First public release of the precip-index package a streamlined Python implementation for calculating SPI and SPEI climate indices with comprehensive event analysis capabilities.
12417

125-
**Modified/adapted from:** [climate-indices](https://github.com/monocongo/climate_indices) by James Adams (monocongo)
18+
### Core Features
12619

127-
### Features
20+
**Climate Indices**
12821

129-
**Climate Indices:**
130-
- SPI (Standardized Precipitation Index) calculation using Gamma distribution
131-
- SPEI (Standardized Precipitation Evapotranspiration Index) with Thornthwaite PET
132-
- Multi-scale support (1, 3, 6, 12, 24 months)
133-
- Parameter save/load functionality for faster recomputation
134-
- CF-compliant NetCDF output
22+
- SPI (Standardized Precipitation Index) and SPEI (Standardized Precipitation Evapotranspiration Index)
23+
- Multi-scale support: 1, 3, 6, 12, 24 months
24+
- Five probability distributions: Gamma, Pearson III, Log-Logistic, GEV, Generalized Logistic
25+
- Automatic PET calculation from temperature (Thornthwaite method)
26+
- Parameter save/load for operational workflows
27+
- CF-compliant NetCDF output with customizable metadata
13528

136-
**Climate Extremes Analysis (Run Theory):**
137-
- Event identification for both drought (dry) and wet conditions
138-
- Time-series monitoring with dual magnitude (cumulative & instantaneous)
29+
**Run Theory Analysis**
30+
31+
- Event identification for both dry (drought) and wet (flood) conditions
32+
- Dual magnitude tracking: cumulative and instantaneous
13933
- Gridded period statistics for decision support
140-
- Event characteristics: duration, magnitude, intensity, peak
141-
- Spatial aggregation and period comparison tools
34+
- Event characteristics: duration, magnitude, intensity, peak, inter-arrival
35+
36+
**Visualization**
14237

143-
**Visualization:**
144-
- WMO standard 11-category SPI/SPEI color classification
145-
- Event plots with automatic dry/wet differentiation
146-
- Timeline visualizations with multiple characteristics
38+
- WMO standard 11-category classification
39+
- Time series plots with event highlighting
14740
- Spatial statistics maps
41+
- Cross-distribution comparison charts
14842

149-
### Technical Details
43+
### Technical Highlights
15044

151-
- Optimized for global-scale gridded data
152-
- NumPy vectorization + Numba JIT compilation
153-
- CF Convention compliance (time, lat, lon)
154-
- Gamma distribution only (robust for arid regions)
155-
- Python 3.8+ support
45+
- Modular architecture: `indices.py`, `runtheory.py`, `distributions.py`, `visualization.py`
46+
- Centralized configuration via `config.py`
47+
- Memory-efficient chunked processing for global-scale data
48+
- NumPy vectorization with Numba JIT compilation
49+
- Robust fitting with automatic fallback chains (L-moments → Method of Moments → MLE)
50+
- Data diagnostics and goodness-of-fit testing
15651

15752
### Documentation
15853

159-
- Comprehensive user guides for SPI, SPEI, and run theory
160-
- Jupyter notebook tutorials
161-
- Technical implementation documentation
162-
- Quick start guide
54+
- Comprehensive user guides for SPI, SPEI, run theory, and magnitude concepts
55+
- Technical documentation: methodology, distributions, implementation, API reference
56+
- Interactive Jupyter notebook tutorials
57+
- Quick start guide and configuration reference
16358

16459
---
16560

16661
## Future Releases
16762

168-
Version 2026.2 and beyond will include:
16963
- Bug fixes and performance improvements
17064
- Additional test coverage
17165
- Enhanced documentation and examples
17266
- Community-requested features
17367

17468
---
17569

176-
**For detailed technical implementation notes, see [Technical Documentation](technical/implementation.qmd)**
70+
**For detailed technical notes, see [Implementation Details](technical/implementation.qmd)**

docs/get-started/configuration.qmd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,12 @@ All configurable constants in `config.py`:
224224
| `DEFAULT_CHUNK_LON` | `500` | Chunked processing |
225225
| `MEMORY_MULTIPLIER` | `12.0` | Memory estimation |
226226
| `MEMORY_SAFETY_FACTOR` | `0.7` | Memory estimation |
227+
228+
---
229+
230+
## See Also
231+
232+
- [Installation](installation.qmd) - Setup and dependencies
233+
- [Quick Start](quick-start.qmd) - First SPI/SPEI calculation
234+
- [Data Model & Outputs](data-model.qmd) - Input/output contracts
235+
- [Examples](examples.qmd) - Common use cases and code snippets

0 commit comments

Comments
 (0)