Home

Awesome

SpectralIndices.jl

<p align="center"> <img width="400px" src="docs/src/assets/logo.png"/> </p>
DocumentationBuild StatusJuliaTesting
docsCI codecovJulia Code Style: BlueAqua QA

Overview 📖

SpectralIndices.jl is a Julia package for working with spectral indices commonly used in remote sensing and earth observation applications. It provides a convenient way to compute various spectral indices using Julia's high-performance capabilities.

Features 🚀

Installation 💻

SpectralIndices.jl is registered in the general registry, please install it using the following:

julia> ]
pkg> add SpectralIndices

or

using Pkg
Pkg.add("SpectralIndices")

Usage 🛠️

You can compute spectral indices either by specifying the index and its parameters or using predefined SpectralIndex instances.

Using compute_index

using SpectralIndices
using DataFrames

# Compute NDVI with direct parameter input
result = compute_index("NDVI", N = 0.643, R = 0.175)

# Compute NDVI with direct parameter input and direct NDVI call
result = compute_index(NDVI, N = 0.643, R = 0.175)

# Compute multiple indices with array inputs
multi_result = compute_index(["NDVI", "SAVI"], N = fill(0.643, 5), R = fill(0.175, 5), L = fill(0.5, 5))

# use Dataframes
df = DataFrame(N = [0.643, 0.560], R = [0.175, 0.225])
result_df_single = compute_index("NDVI", df)
# Multiple inputs in a dataframe
df = DataFrame(N = [0.643, 0.560], R = [0.175, 0.225], L = [0.5, 0.5])
result_df_multiple = compute_index(["NDVI", "SAVI"], df)

To compute at custom Float precision input the bands at the chosen precision and specify the Float type to the compute_index function

# Compute NDVI with direct parameter input
result = compute_index(Float32, "NDVI", N = Float32(0.643), R = Float32(0.175))

Using compute

# Define a SpectralIndex instance

# Compute using the instance with keyword arguments
result = compute(NDVI, N = 0.643, R = 0.175) #NDVI is autmatically in namespace with the import of SpectraIndices.jl

# Compute with array inputs
array_result = compute(NDVI, N = fill(0.643, (5, 5)), R = fill(0.175, (5, 5)))

For more advanced usage and detailed documentation, please refer to the documentation.

Code Structure

fig1

Contributing 🤝

Contributions to SpectralIndices.jl are welcome! If you would like to contribute, please see our Contribution Guidelines for more information.

License 📜

SpectralIndices.jl is licensed under the MIT License. See LICENSE for more information.

Acknowledgments ✨

This package is inspired by the Spyndex Python library for spectral indices. The logo is AI-generated by dalle3 through ChatGPT and modified by the talented David Montero.

Support 🆘

If you have any questions, issues, or feature requests, please open an issue or contact us via email.

Citation 🔗

If you use SpectralIndices.jl in your research, please consider citing it using the following DOI:

@article{martinuzzi2024spectral,
  title = {SpectralIndices.jl: Streamlining spectral indices access and computation for Earth system research},
  volume = {XLVIII-4/W12-2024},
  ISSN = {2194-9034},
  url = {http://dx.doi.org/10.5194/isprs-archives-XLVIII-4-W12-2024-89-2024},
  DOI = {10.5194/isprs-archives-xlviii-4-w12-2024-89-2024},
  journal = {The International Archives of the Photogrammetry,  Remote Sensing and Spatial Information Sciences},
  publisher = {Copernicus GmbH},
  author = {Martinuzzi,  Francesco and Mahecha,  Miguel D. and Montero,  David and Alonso,  Lazaro and Mora,  Karin},
  year = {2024},
  month = jun,
  pages = {89–95}
}

Also consider citing the paper introducing the Awesome Spectral Indices collection:

@article{montero2023standardized,
  title={A standardized catalogue of spectral indices to advance the use of remote sensing in Earth system research},
  author={Montero, David and Aybar, C{\'e}sar and Mahecha, Miguel D and Martinuzzi, Francesco and S{\"o}chting, Maximilian and Wieneke, Sebastian},
  journal={Scientific Data},
  volume={10},
  number={1},
  pages={197},
  year={2023},
  publisher={Nature Publishing Group UK London}
}

RSC4Earth