0
# Spectral Indices Catalogue
1
2
Interactive access to the complete spectral indices catalogue from the Awesome Spectral Indices project. Provides over 200 standardized spectral indices with comprehensive metadata, formulas, band requirements, and platform compatibility information.
3
4
## Capabilities
5
6
### Global Catalogue Access
7
8
The global `spyndex.indices` object provides access to all available spectral indices with interactive exploration and computation capabilities.
9
10
```python { .api }
11
class SpectralIndices(Box):
12
"""
13
Container for all spectral indices in the Awesome Spectral Indices catalogue.
14
15
Provides dictionary-like access to individual SpectralIndex objects.
16
"""
17
18
def __repr__(self) -> str:
19
"""Machine readable representation showing available index names."""
20
21
def __str__(self) -> str:
22
"""Human readable list of index names."""
23
```
24
25
**Usage Examples:**
26
27
```python
28
import spyndex
29
30
# Access the global catalogue
31
print(spyndex.indices)
32
# Output: SpectralIndices(['AFRI1600', 'AFRI2100', 'ARI', ..., 'kNDVI', 'kRVI', 'kVARI'])
33
34
# Get list of all index names
35
index_names = list(spyndex.indices.keys())
36
print(f"Total indices available: {len(index_names)}")
37
38
# Access specific indices
39
ndvi = spyndex.indices.NDVI
40
savi = spyndex.indices.SAVI
41
evi = spyndex.indices.EVI
42
```
43
44
### Individual Spectral Index Objects
45
46
Each spectral index in the catalogue is represented as a SpectralIndex object containing complete metadata and computation capabilities.
47
48
```python { .api }
49
class SpectralIndex:
50
"""
51
Individual spectral index with metadata and computation capability.
52
"""
53
54
short_name: str # Index abbreviation (e.g., "NDVI")
55
long_name: str # Full descriptive name
56
bands: tuple # Required bands/parameters as tuple
57
application_domain: str # Domain: 'vegetation', 'burn', 'water', 'urban', 'kernel', 'radar'
58
reference: str # URL to reference/DOI
59
formula: str # Mathematical formula as expression
60
date_of_addition: str # Date added to catalogue
61
contributor: str # GitHub contributor URL
62
platforms: list # Compatible satellite platforms
63
64
def compute(self, params=None, **kwargs) -> Any:
65
"""
66
Compute this spectral index with provided parameters.
67
68
Parameters:
69
- params: Dictionary of parameters/bands for computation
70
- **kwargs: Alternative parameter specification
71
72
Returns:
73
Computed spectral index value (type depends on input)
74
"""
75
76
def __repr__(self) -> str:
77
"""Detailed machine readable representation with metadata."""
78
79
def __str__(self) -> str:
80
"""Human readable summary with key information."""
81
```
82
83
**Usage Examples:**
84
85
```python
86
import spyndex
87
88
# Access individual index
89
ndvi = spyndex.indices.NDVI
90
91
# Explore metadata
92
print(ndvi.long_name) # "Normalized Difference Vegetation Index"
93
print(ndvi.formula) # "((N-R)/(N+R))"
94
print(ndvi.bands) # ('N', 'R')
95
print(ndvi.application_domain) # "vegetation"
96
print(ndvi.reference) # "https://doi.org/10.1016/0034-4257(79)90013-0"
97
print(ndvi.platforms) # ['Landsat-4', 'Landsat-5', 'Landsat-7', ...]
98
99
# Compute using the index object
100
result = ndvi.compute(params={"N": 0.67, "R": 0.12})
101
print(result) # 0.6971830985915493
102
103
# Alternative parameter specification
104
result = ndvi.compute(N=0.67, R=0.12)
105
print(result) # 0.6971830985915493
106
107
# Detailed information display
108
print(ndvi)
109
# Output:
110
# SpectralIndex(NDVI: Normalized Difference Vegetation Index)
111
# * Application Domain: vegetation
112
# * Bands/Parameters: ('N', 'R')
113
# * Formula: ((N-R)/(N+R))
114
# * Reference: https://doi.org/10.1016/0034-4257(79)90013-0
115
```
116
117
### Exploring Index Categories
118
119
Indices are categorized by application domain for easier discovery and selection:
120
121
```python
122
import spyndex
123
124
# Find indices by application domain
125
vegetation_indices = [
126
name for name, idx in spyndex.indices.items()
127
if idx.application_domain == 'vegetation'
128
]
129
print(f"Vegetation indices: {len(vegetation_indices)}")
130
131
water_indices = [
132
name for name, idx in spyndex.indices.items()
133
if idx.application_domain == 'water'
134
]
135
print(f"Water indices: {len(water_indices)}")
136
137
burn_indices = [
138
name for name, idx in spyndex.indices.items()
139
if idx.application_domain == 'burn'
140
]
141
print(f"Burn indices: {len(burn_indices)}")
142
143
# Find indices requiring specific bands
144
ndvi_like = [
145
name for name, idx in spyndex.indices.items()
146
if set(idx.bands) == {'N', 'R'}
147
]
148
print(f"Indices using only NIR and Red: {ndvi_like}")
149
150
# Find indices by platform compatibility
151
sentinel2_compatible = [
152
name for name, idx in spyndex.indices.items()
153
if 'Sentinel-2A' in idx.platforms or 'Sentinel-2B' in idx.platforms
154
]
155
print(f"Sentinel-2 compatible indices: {len(sentinel2_compatible)}")
156
```
157
158
### Band Requirements Analysis
159
160
Understanding band and parameter requirements across the catalogue:
161
162
```python
163
import spyndex
164
from collections import Counter
165
166
# Analyze band usage frequency
167
all_bands = []
168
for idx in spyndex.indices.values():
169
all_bands.extend(idx.bands)
170
171
band_frequency = Counter(all_bands)
172
print("Most common bands:")
173
for band, count in band_frequency.most_common(10):
174
print(f"{band}: {count} indices")
175
176
# Find indices with complex requirements
177
complex_indices = [
178
(name, idx.bands) for name, idx in spyndex.indices.items()
179
if len(idx.bands) > 5
180
]
181
print("Indices with >5 parameters:")
182
for name, bands in complex_indices:
183
print(f"{name}: {bands}")
184
185
# Find kernel-based indices
186
kernel_indices = [
187
name for name, idx in spyndex.indices.items()
188
if idx.application_domain == 'kernel'
189
]
190
print(f"Kernel-based indices: {kernel_indices}")
191
```
192
193
## Application Domains
194
195
The catalogue spans multiple remote sensing application areas:
196
197
- **vegetation**: Vegetation health, biomass, chlorophyll content, leaf area index
198
- **water**: Water quality, turbidity, chlorophyll-a, suspended sediments
199
- **burn**: Fire detection, burn severity, post-fire recovery monitoring
200
- **urban**: Urban heat islands, built-up areas, impervious surfaces
201
- **kernel**: Kernel-based indices using machine learning approaches
202
- **radar**: SAR-based indices for texture and polarimetric analysis
203
204
## Index Metadata
205
206
Each index includes comprehensive metadata:
207
208
- **Formula**: Mathematical expression using standard band notation
209
- **Reference**: Original research paper or technical documentation
210
- **Contributor**: GitHub profile of the person who added the index
211
- **Date Added**: When the index was added to the catalogue
212
- **Platforms**: Satellite/sensor systems with required bands available
213
- **Bands**: All required spectral bands and parameters
214
215
## Direct Index Computation
216
217
Individual index objects provide direct computation without needing to call `computeIndex`:
218
219
```python
220
import spyndex
221
import numpy as np
222
223
# Direct computation on index objects
224
ndvi_idx = spyndex.indices.NDVI
225
savi_idx = spyndex.indices.SAVI
226
227
# Single values
228
ndvi_val = ndvi_idx.compute(N=0.67, R=0.12)
229
savi_val = savi_idx.compute(N=0.67, R=0.12, L=0.5)
230
231
# Arrays
232
nir = np.random.normal(0.67, 0.12, 1000)
233
red = np.random.normal(0.12, 0.05, 1000)
234
235
ndvi_array = ndvi_idx.compute(N=nir, R=red)
236
savi_array = savi_idx.compute(N=nir, R=red, L=0.5)
237
```
238
239
This approach provides object-oriented access to individual indices while maintaining the same data type compatibility as the main `computeIndex` function.