# SpectralIndices.jl

| **Documentation** | **Build Status** | **Julia** | **Testing** | |:-----------------:|:----------------:|:---------:|:-----------:| | [![docs][docs-img]][docs-url] | [![CI][ci-img]][ci-url] | [![Julia][julia-img]][julia-url] [![Code Style: Blue][style-img]][style-url] | [![Aqua QA][aqua-img]][aqua-url] [![JET][jet-img]][jet-url] [![codecov][cc-img]][cc-url] | [docs-img]: https://img.shields.io/badge/docs-stable-blue.svg [docs-url]: https://awesome-spectral-indices.github.io/SpectralIndices.jl/dev/ [ci-img]: https://github.com/awesome-spectral-indices/SpectralIndices.jl/actions/workflows/CI.yml/badge.svg [ci-url]: https://github.com/awesome-spectral-indices/SpectralIndices.jl/actions/workflows/CI.yml [cc-img]: https://codecov.io/gh/awesome-spectral-indices/SpectralIndices.jl/graph/badge.svg?token=0IRRDAZM0U [cc-url]: https://codecov.io/gh/awesome-spectral-indices/SpectralIndices.jl [julia-img]: https://img.shields.io/badge/julia-v1.10+-blue.svg [julia-url]: https://julialang.org/ [style-img]: https://img.shields.io/static/v1?label=code%20style&message=SciML&color=9558b2&labelColor=389826 [style-url]: https://github.com/SciML/SciMLStyle [aqua-img]: https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg [aqua-url]: https://github.com/JuliaTesting/Aqua.jl [jet-img]: https://img.shields.io/badge/%E2%9C%88%EF%B8%8F%20tested%20with%20-%20JET.jl%20-%20red [jet-url]: https://github.com/aviatesk/JET.jl ## 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 🚀 - Computation for a wide range of spectral indices - Computation support for `Float64`, `Float32` and `Float16` at index formula level to support fast computation for ML applications - Support for various data types, including but not limited to (see this [issue](https://github.com/awesome-spectral-indices/SpectralIndices.jl/issues/8) for an updated list and WIP) - [x] Arrays - [x] DataFrames - [x] YAXArrays - Flexible parameter input options - Compatibility with multiple remote sensing platforms and sensors ## Installation 💻 SpectralIndices.jl is registered in the general registry, please install it using the following: ```julia_repl julia> ] pkg> add SpectralIndices ``` or ```julia using Pkg Pkg.add("SpectralIndices") ``` ## Usage 🛠️ ```julia 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 ```julia # Compute NDVI with direct parameter input result = compute_index(Float32, "NDVI", N = Float32(0.643), R = Float32(0.175)) ``` ## Code Structure ![fig1](https://github.com/awesome-spectral-indices/SpectralIndices.jl/assets/10376688/fb680f5a-7130-49fc-ae20-386fed3777ed) ## 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](https://github.com/awesome-spectral-indices/SpectralIndices.jl/blob/main/LICENSE) for more information. ## Acknowledgments ✨ This package is inspired by the [Spyndex](https://github.com/awesome-spectral-indices/spyndex) Python library for spectral indices. The logo is AI-generated by dalle3 through ChatGPT and modified by the talented [David Montero](https://github.com/davemlz). ## 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: ```bibtex @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: ```bibtex @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](https://github.com/davemlz/sen2nbar/raw/main/docs/_static/esds.png)](https://rsc4earth.de/authors/esds/)