From 947a75a981087bee9b39da0aaee847186b654117 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Tue, 20 Feb 2024 10:19:59 +0000 Subject: [PATCH] build based on 1c8f1de --- dev/.documenter-siteinfo.json | 2 +- dev/api/axioms/index.html | 12 +-- dev/api/compute/index.html | 10 +- dev/api/datasets/index.html | 6 +- dev/assets/docs.css | 132 +++++++++++++++++++++++++++ dev/index.html | 4 +- dev/tutorials/basic_types/index.html | 4 +- dev/tutorials/dataframes/index.html | 4 +- dev/tutorials/yaxarrays/index.html | 4 +- 9 files changed, 155 insertions(+), 23 deletions(-) create mode 100644 dev/assets/docs.css diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 385fdb7..0b8c3f0 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.1","generation_timestamp":"2024-02-17T23:02:20","documenter_version":"1.2.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.1","generation_timestamp":"2024-02-20T10:19:54","documenter_version":"1.2.1"}} \ No newline at end of file diff --git a/dev/api/axioms/index.html b/dev/api/axioms/index.html index 408160a..82acddb 100644 --- a/dev/api/axioms/index.html +++ b/dev/api/axioms/index.html @@ -1,8 +1,8 @@ -Axioms · SpectralIndices.jl

Axioms

SpectralIndices.SpectralIndexType
SpectralIndex(index::Dict{String, Any})

This object allows interaction with specific Spectral Indices in the Awesome Spectral Indices list. Attributes of the Spectral Index can be accessed and the index itself can be computed.

Arguments

  • index::Dict{String, Any}: A dictionary with the following keys:

    • "short_name": Short name of the spectral index.
    • "long_name": Long name or description of the spectral index.
    • "bands": List of bands or wavelengths used in the index calculation.
    • "application_domain": Application domain or use case of the spectral index.
    • "reference": Reference or source of the spectral index formula.
    • "formula": Mathematical formula of the spectral index.
    • "date_of_addition": Date when the spectral index was added (in "yyyy-mm-dd" format).
    • "contributor": Contributor or source of the spectral index information.
    • "platforms": Platforms or sensors for which the index is applicable.

Returns

A SpectralIndex object containing the specified index information.

Examples

julia> indices["NIRv"]
-

Or, accessing directly the provided Dict of spectral indices:

NIRv
source
SpectralIndices.computeFunction
compute(si::SpectralIndex, params::Dict=Dict(); kwargs...) -> Any

Computes a Spectral Index based on the provided SpectralIndex instance, parameters, and optional keyword arguments.

Parameters

  • si: An instance of SpectralIndex which includes the name and details of the spectral index to be computed.
  • params: (Optional) Dictionary of parameters used as inputs for the computation. If not provided, parameters can be passed using keyword arguments.
  • kwargs: Additional parameters used as inputs for the computation, provided as keyword pairs. These are used if params is empty.

Returns

  • The computed Spectral Index, the type of return value depends on the input parameters and the specific spectral index being computed.

Examples

julia> compute(NDVI; N=0.643, R=0.175)
+Axioms · SpectralIndices.jl

Axioms

SpectralIndices.SpectralIndexType
SpectralIndex(index::Dict{String, Any})

This object allows interaction with specific Spectral Indices in the Awesome Spectral Indices list. Attributes of the Spectral Index can be accessed and the index itself can be computed.

Arguments

  • index::Dict{String, Any}: A dictionary with the following keys:

    • "short_name": Short name of the spectral index.
    • "long_name": Long name or description of the spectral index.
    • "bands": List of bands or wavelengths used in the index calculation.
    • "application_domain": Application domain or use case of the spectral index.
    • "reference": Reference or source of the spectral index formula.
    • "formula": Mathematical formula of the spectral index.
    • "date_of_addition": Date when the spectral index was added (in "yyyy-mm-dd" format).
    • "contributor": Contributor or source of the spectral index information.
    • "platforms": Platforms or sensors for which the index is applicable.

Returns

A SpectralIndex object containing the specified index information.

Examples

julia> indices["NIRv"]
+

Or, accessing directly the provided Dict of spectral indices:

NIRv
source
SpectralIndices.computeFunction
compute(si::SpectralIndex, params::Dict=Dict(); kwargs...) -> Any

Computes a Spectral Index based on the provided SpectralIndex instance, parameters, and optional keyword arguments.

Parameters

  • si: An instance of SpectralIndex which includes the name and details of the spectral index to be computed.
  • params: (Optional) Dictionary of parameters used as inputs for the computation. If not provided, parameters can be passed using keyword arguments.
  • kwargs: Additional parameters used as inputs for the computation, provided as keyword pairs. These are used if params is empty.

Returns

  • The computed Spectral Index, the type of return value depends on the input parameters and the specific spectral index being computed.

Examples

julia> compute(NDVI; N=0.643, R=0.175)
 
julia> compute(NDVI; N=fill(0.643, (5, 5)), R=fill(0.175, (5, 5)))
-
source
SpectralIndices.PlatformBandType
PlatformBand(platform_band::Dict{String, Any})

This struct provides information about a specific band for a specific sensor or platform.

Arguments

  • platform_band::Dict{String, Any}: A dictionary with the following keys:

    • "platform": Name of the platform or sensor.
    • "band": Band number or name for the specific platform.
    • "name": Description or name of the band for the specific platform.
    • "wavelength": Center wavelength of the band (in nm) for the specific platform.
    • "bandwidth": Bandwidth of the band (in nm) for the specific platform.

Returns

A PlatformBand object containing the specified band information.

Examples

platform_band_dict = Dict(
+
source
SpectralIndices.PlatformBandType
PlatformBand(platform_band::Dict{String, Any})

This struct provides information about a specific band for a specific sensor or platform.

Arguments

  • platform_band::Dict{String, Any}: A dictionary with the following keys:

    • "platform": Name of the platform or sensor.
    • "band": Band number or name for the specific platform.
    • "name": Description or name of the band for the specific platform.
    • "wavelength": Center wavelength of the band (in nm) for the specific platform.
    • "bandwidth": Bandwidth of the band (in nm) for the specific platform.

Returns

A PlatformBand object containing the specified band information.

Examples

platform_band_dict = Dict(
     "platform" => "Sentinel-2A",
     "band" => "B2",
     "name" => "Blue",
@@ -12,7 +12,7 @@
 
 platform_band = PlatformBand(platform_band_dict)

Or, accessing directly the provided Dict of platforms:

julia> bands["B"].platforms["sentinel2a"]
 
julia> bands["B"].platforms["sentinel2a"].wavelength
-
source
SpectralIndices.BandType
Band(band::Dict{String, Any})

Constructs a Band object to interact with specific bands in the list of required bands for Spectral Indices in the Awesome Spectral Indices list.

Arguments

  • band::Dict{String, Any}: A dictionary containing band information with the following keys:

    • "short_name": Short name of the band.
    • "long_name": Description or name of the band.
    • "common_name": Common name of the band according to the Electro-Optical Extension Specification for STAC.
    • "min_wavelength": Minimum wavelength of the spectral range of the band (in nm).
    • "max_wavelength": Maximum wavelength of the spectral range of the band (in nm).
    • "platforms": A dictionary of platform information associated with this band.

Returns

A Band object representing the specified band.

Examples

julia> bands["B"]
+
source
SpectralIndices.BandType
Band(band::Dict{String, Any})

Constructs a Band object to interact with specific bands in the list of required bands for Spectral Indices in the Awesome Spectral Indices list.

Arguments

  • band::Dict{String, Any}: A dictionary containing band information with the following keys:

    • "short_name": Short name of the band.
    • "long_name": Description or name of the band.
    • "common_name": Common name of the band according to the Electro-Optical Extension Specification for STAC.
    • "min_wavelength": Minimum wavelength of the spectral range of the band (in nm).
    • "max_wavelength": Maximum wavelength of the spectral range of the band (in nm).
    • "platforms": A dictionary of platform information associated with this band.

Returns

A Band object representing the specified band.

Examples

julia> bands["B"]
 band_dict = Dict{String, Any}(
     "short_name" => "B",
     "long_name" => "Blue",
@@ -27,7 +27,7 @@
 )
 
 band = Band(band_dict)

Or, using the provided bands

julia> bands["B"].long_name
-
source
SpectralIndices.ConstantType
Constant(constant::Dict{String, Any}) -> Constant

Create a Constant object from a dictionary.

Arguments

  • constant::Dict{String, Any}: A dictionary containing the following keys:

    • "description": Description of the constant.
    • "short_name": Short name of the constant.
    • "default": Default value of the constant.

Returns

  • Constant: An instance of the Constant struct with fields populated based on the provided dictionary.

Example

constant_dict = Dict(
+
source
SpectralIndices.ConstantType
Constant(constant::Dict{String, Any}) -> Constant

Create a Constant object from a dictionary.

Arguments

  • constant::Dict{String, Any}: A dictionary containing the following keys:

    • "description": Description of the constant.
    • "short_name": Short name of the constant.
    • "default": Default value of the constant.

Returns

  • Constant: An instance of the Constant struct with fields populated based on the provided dictionary.

Example

constant_dict = Dict(
     "description" => "Speed of light in vacuum", "short_name" => "c", "default" => 299792458
 )
-constant = Constant(constant_dict)
source
+constant = Constant(constant_dict)
source
diff --git a/dev/api/compute/index.html b/dev/api/compute/index.html index 61c7359..19a1ab4 100644 --- a/dev/api/compute/index.html +++ b/dev/api/compute/index.html @@ -1,5 +1,5 @@ -Compute · SpectralIndices.jl

Compute Index

SpectralIndices.compute_indexFunction
compute_index(index::String, params::Dict=Dict(), online::Bool=false; kwargs...) -> Any

Computes one or more Spectral Indices from a predefined list, based on the provided index name, parameters, and optional keyword arguments.

Parameters

  • index: Name of the spectral index or a list of index names to compute.
  • params: (Optional) Dictionary of parameters used as inputs for the computation. If not provided, parameters can be passed using keyword arguments.
  • online: (Optional) Flag indicating whether to retrieve the most recent list of indices online.
  • kwargs: Additional parameters used as inputs for the computation, provided as keyword pairs.

Returns

  • Computed Spectral Indices, the type of return value depends on the input parameters.

Examples

julia> compute_index("NDVI"; N=0.643, R=0.175)
+Compute · SpectralIndices.jl

Compute Index

SpectralIndices.compute_indexFunction
compute_index(index::String, params::Dict=Dict(), online::Bool=false; kwargs...) -> Any

Computes one or more Spectral Indices from a predefined list, based on the provided index name, parameters, and optional keyword arguments.

Parameters

  • index: Name of the spectral index or a list of index names to compute.
  • params: (Optional) Dictionary of parameters used as inputs for the computation. If not provided, parameters can be passed using keyword arguments.
  • online: (Optional) Flag indicating whether to retrieve the most recent list of indices online.
  • kwargs: Additional parameters used as inputs for the computation, provided as keyword pairs.

Returns

  • Computed Spectral Indices, the type of return value depends on the input parameters.

Examples

julia> compute_index("NDVI"; N=0.643, R=0.175)
 
julia> compute_index("NDVI"; N=fill(0.643, (5, 5)), R=fill(0.175, (5, 5)))
 
julia> compute_index("NDVI"; N=fill(0.643, 5), R=fill(0.175, 5))
 
julia> compute_index(["NDVI", "SAVI"]; N=fill(0.643, 5), R=fill(0.175, 5), L=fill(0.5, 5))
@@ -7,7 +7,7 @@
 
julia> compute_index(
            ["NDVI", "SAVI"]; N=fill(0.643, (5, 5)), R=fill(0.175, (5, 5)), L=fill(0.5, (5, 5))
        )
-
source
SpectralIndices.compute_kernelFunction
compute_kernel(kernel, params=nothing; kwargs...)

Compute a specified kernel using either provided parameters or keyword arguments.

Arguments

  • kernel: The kernel function to use. Should be one of linear, poly, or RBF.
  • params: (Optional) A Dict, DataFrame, or YAXArray containing parameters for the kernel computation.
  • kwargs...: Keyword arguments that will be converted to parameters if params is not provided.

Returns

  • The result of the kernel computation, the type of which depends on the input type.

Examples

result = compute_kernel(linear; params=Dict("a" => 1, "b" => 2))
source
SpectralIndices.compute_kernelFunction
compute_kernel(kernel, params=nothing; kwargs...)

Compute a specified kernel using either provided parameters or keyword arguments.

Arguments

  • kernel: The kernel function to use. Should be one of linear, poly, or RBF.
  • params: (Optional) A Dict, DataFrame, or YAXArray containing parameters for the kernel computation.
  • kwargs...: Keyword arguments that will be converted to parameters if params is not provided.

Returns

  • The result of the kernel computation, the type of which depends on the input type.

Examples

result = compute_kernel(linear; params=Dict("a" => 1, "b" => 2))
source
SpectralIndices.linearFunction
linear(a::Number, b::Number)
 linear(a::AbstractArray, b::AbstractArray)
 linear(params::Dict{String, T})
 linear(params::DataFrame)
@@ -22,7 +22,7 @@
 
 # Using a DataFrame
 df = DataFrame(; a=[1, 2, 3], b=[4, 5, 6])
-result = linear(df)
source
SpectralIndices.polyFunction
poly(a::T, b::T, c::T, p::T) where T <: Number
 poly(a::T, b::T, c::T, p::T) where T <: AbstractArray
 poly(params::Dict{String, T})
 poly(params::DataFrame)
@@ -37,7 +37,7 @@
 
 # Using a DataFrame
 df = DataFrame(; a=[1, 2, 3], b=[4, 5, 6], c=[1, 1, 1], p=[2, 2, 2])
-result = poly(df)
source
SpectralIndices.RBFFunction
RBF(a::T, b::T, sigma::T) where T <: Number
 RBF(a::T, b::T, sigma::T) where T <: AbstractArray
 RBF(params::Dict{String, T})
 RBF(params::DataFrame)
@@ -52,4 +52,4 @@
 
 # Using a DataFrame
 df = DataFrame(; a=[1, 2, 3], b=[4, 5, 6], sigma=[0.5, 0.5, 0.5])
-result = RBF(df)
source
+result = RBF(df)
source
diff --git a/dev/api/datasets/index.html b/dev/api/datasets/index.html index 65dbbf3..4950a1b 100644 --- a/dev/api/datasets/index.html +++ b/dev/api/datasets/index.html @@ -1,9 +1,9 @@ -Datasets · SpectralIndices.jl

Datasets

SpectralIndices.get_datasetsFunction
get_datasets(; datasets=["S2_10m.json", "spectral.json"], data_loc=joinpath(dirname(@__FILE__), "..", "data"))

Download predefined datasets from a specified remote location and save them to a local directory.

Keyword Arguments

  • datasets::Array{String,1}: A list of dataset filenames to download. Defaults to ["S2_10m.json", "spectral.json"].
  • data_loc::String: The local directory path where the downloaded datasets will be saved. Defaults to a data directory located one level up from the script's directory.

Description

This function iterates over a list of dataset filenames, downloads each dataset from a predefined remote URL, and saves them into a specified local directory. The remote URL is currently hardcoded to download specifically the "S2_10m.json" file for any given dataset in the list. Adjust the function or its usage accordingly if different URLs are needed for different datasets.

Example

get_datasets()  # Downloads the default datasets to the default location
+Datasets · SpectralIndices.jl

Datasets

SpectralIndices.get_datasetsFunction
get_datasets(; datasets=["S2_10m.json", "spectral.json"], data_loc=joinpath(dirname(@__FILE__), "..", "data"))

Download predefined datasets from a specified remote location and save them to a local directory.

Keyword Arguments

  • datasets::Array{String,1}: A list of dataset filenames to download. Defaults to ["S2_10m.json", "spectral.json"].
  • data_loc::String: The local directory path where the downloaded datasets will be saved. Defaults to a data directory located one level up from the script's directory.

Description

This function iterates over a list of dataset filenames, downloads each dataset from a predefined remote URL, and saves them into a specified local directory. The remote URL is currently hardcoded to download specifically the "S2_10m.json" file for any given dataset in the list. Adjust the function or its usage accordingly if different URLs are needed for different datasets.

Example

get_datasets()  # Downloads the default datasets to the default location
 
-get_datasets(; datasets=["custom_dataset.json"], data_loc="path/to/custom/directory")

This is particularly useful for setting up local environments with necessary data files for further processing or analysis.

source
SpectralIndices.load_datasetFunction
load_dataset(dataset::String) -> YAXArray
+get_datasets(; datasets=["custom_dataset.json"], data_loc="path/to/custom/directory")

This is particularly useful for setting up local environments with necessary data files for further processing or analysis.

source
SpectralIndices.load_datasetFunction
load_dataset(dataset::String) -> YAXArray
 load_dataset(dataset::String) -> DataFrame

Load a specified dataset and convert it into either a YAXArray or a DataFrame, depending on the loaded packages.

Arguments

  • dataset::String: The name of the dataset to load. Currently supports "sentinel" and "spectral".

Returns

  • If YAXArrays is loaded in the namespace, returns a YAXArray object containing the loaded dataset, with dimensions labeled as :x, :y, and :bands. The spatial dimensions (:x and :y) are assumed to have a size of 300 each, and the :bands dimension includes ["B02", "B03", "B04", "B08"] bands.
  • If DataFrames is loaded in the namespace, returns a DataFrame with the dataset loaded into it.

Errors

Throws an error if the dataset argument does not match one of the predefined dataset names.

Example

# Load dataset as YAXArray
 yax_ds = SpectralIndices.load_dataset("sentinel")
 
 # Load dataset as DataFrame
-df_ds = SpectralIndices.load_dataset("spectral")

The current implementation expects the JSON files ("S2_10m.json" for "sentinel" and "spectral.json" for "spectral") to follow a specific format: a vector of vectors where each inner vector represents a band's data in a 300x300 spatial grid for the YAXArray version, or a suitable structure that can be directly converted into a DataFrame for the DataFrame version. The files are already provided for examples in the package in the folder data.

source
+df_ds = SpectralIndices.load_dataset("spectral")

The current implementation expects the JSON files ("S2_10m.json" for "sentinel" and "spectral.json" for "spectral") to follow a specific format: a vector of vectors where each inner vector represents a band's data in a 300x300 spatial grid for the YAXArray version, or a suitable structure that can be directly converted into a DataFrame for the DataFrame version. The files are already provided for examples in the package in the folder data.

source
diff --git a/dev/assets/docs.css b/dev/assets/docs.css new file mode 100644 index 0000000..35670aa --- /dev/null +++ b/dev/assets/docs.css @@ -0,0 +1,132 @@ +/* mercylessy yannked from ColorSchemes.jl, all credits to them */ +/* https://github.com/JuliaGraphics/ColorSchemes.jl/blob/master/docs/src/assets/colorschemes-docs.css */ +/* change Bulma Dark styles */ + +/* disclaimer - I hate CSS */ + +:root { + --signage: hsl(193, 46%, 60%); + --verydark: hsl(237, 20%, 10%); + --quitedark: hsl(237, 20%, 13%); + --lessdark: hsl(237, 20%, 16%); +} + +html.theme--documenter-dark body { + background-color: var(--verydark); + color: #eff; + font-size: 1.1em; + font-weight: 400; + line-height: 1.8rem; +} + +html.theme--documenter-dark a { + color: var(--signage); +} + +html.theme--documenter-dark p > a:after { + padding-left:0.2rem; + font-family: "JuliaMono"; + content: "⮻"; + color: var(--signage); + background-color: inherit; + font-size: 120%; +} + +html.theme--documenter-light p > a:after { + padding-left:0.2rem; + font-family: "JuliaMono"; + content: "⮻"; + background-color: inherit; + font-size: 120%; +} + +html.theme--documenter-dark .has-text-left, +html.theme--documenter-dark body, +html.theme--documenter-dark #documenter .docs-sidebar, +html.theme--documenter-dark .documenter-example-output, +html.theme--documenter-dark #documenter .docs-sidebar ul.docs-menu .tocitem, +html.theme--documenter-dark #documenter .docs-sidebar ul.docs-menu .tocitem:hover, +html.theme--documenter-dark #documenter .docs-sidebar ul.docs-menu li.is-active .tocitem, +html.theme--documenter-dark #documenter .docs-sidebar ul.docs-menu li.is-active .tocitem:hover, +html.theme--documenter-dark #documenter .docs-main header.docs-navbar { + background-color: var(--verydark); + border: 0.5px solid hsla(237, 20%, 10%, 0.3) !important; +} + +html.theme--documenter-dark .modal-card-body , +html.theme--documenter-dark .modal-card-head , +html.theme--documenter-dark .modal-card-foot , +html.theme--documenter-dark #documenter .docs-sidebar ul.docs-menu , +html.theme--documenter-dark #documenter .docs-sidebar ul.docs-menu li.is-active { + background-color: var(--verydark); +} + +html.theme--documenter-dark .docstring , +html.theme--documenter-dark .docstring>header { + background-color: var(--lessdark); +} + +html.theme--documenter-dark .content pre, +html.theme--documenter-dark pre { + background-color: var(--lessdark); + border: 0.5px solid hsla(237, 20%, 10%, 0.3) !important; +} + +html.theme--documenter-dark a { + color: var(--signage); +} + +html.theme--documenter-dark .modal-card-head { + border: none; +} + + +.schemename { + font-family: "JuliaMono"; +} + +.swatch { + +} + +.category { + font-family: "JuliaMono"; + font-size: 0.8em; +} + +html.theme--documenter-dark p > code { + color: #eff !important; +} + + +html.theme--documenter-dark li > code { + color: #eff !important; +} + + +html.theme--documenter-dark a > code { + color: #eff !important; +} + +html.theme--documenter-dark p > a { + color: #eff !important; + } + +html.theme--documenter-dark .select select:focus, +html.theme--documenter-dark .textarea:focus, +html.theme--documenter-dark .input:focus, +html.theme--documenter-dark #documenter .docs-sidebar form.docs-search>input:focus, +html.theme--documenter-dark .select select.is-focused, +html.theme--documenter-dark .is-focused.textarea, +html.theme--documenter-dark .is-focused.input, +html.theme--documenter-dark #documenter .docs-sidebar form.docs-search>input.is-focused, +html.theme--documenter-dark .select select:active, +html.theme--documenter-dark .textarea:active, +html.theme--documenter-dark .input:active, +html.theme--documenter-dark #documenter .docs-sidebar form.docs-search>input:active, +html.theme--documenter-dark .select select.is-active, +html.theme--documenter-dark .is-active.textarea, +html.theme--documenter-dark .is-active.input, +html.theme--documenter-dark #documenter .docs-sidebar form.docs-search>input.is-active { + border-color: var(--signage); +} diff --git a/dev/index.html b/dev/index.html index 3cb7de3..c8dcba6 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,5 +1,5 @@ -SpectralIndices.jl · SpectralIndices.jl

SpectralIndices.jl Documentation

Welcome to the documentation for SpectralIndices.jl, a comprehensive Julia package for calculating a wide array of spectral indices used in remote sensing and environmental monitoring.

Overview

SpectralIndices.jl simplifies the computation of spectral indices, offering support for both standard and custom indices. The package is designed for efficiency and ease of use, catering to both researchers and practitioners in the field of remote sensing.

Features

  • Supports a broad range of predefined spectral indices.
  • Custom index creation capabilities.
  • Flexible input options for various data types.
  • Efficient computation for large datasets.

Getting Started

To get started with SpectralIndices.jl, follow these steps:

Installation

To install SpectralIndices.jl, use the following Julia command:

using Pkg
+SpectralIndices.jl · SpectralIndices.jl

SpectralIndices.jl Documentation

Welcome to the documentation for SpectralIndices.jl, a comprehensive Julia package for calculating a wide array of spectral indices used in remote sensing and environmental monitoring.

Overview

SpectralIndices.jl simplifies the computation of spectral indices, offering support for both standard and custom indices. The package is designed for efficiency and ease of use, catering to both researchers and practitioners in the field of remote sensing.

Features

  • Supports a broad range of predefined spectral indices.
  • Custom index creation capabilities.
  • Flexible input options for various data types.
  • Efficient computation for large datasets.

Getting Started

To get started with SpectralIndices.jl, follow these steps:

Installation

To install SpectralIndices.jl, use the following Julia command:

using Pkg
 Pkg.add("SpectralIndices")

Basic usage

Here's a simple example to compute the NDVI spectral index:

using SpectralIndices
 
 NDVI_result = compute_index("NDVI", N = 0.643, R = 0.175)

License

SpectralIndices.jl is released under the MIT License.

Citation

If you use SpectralIndices.jl in your research, please cite it as follows:

@article{montero2023standardized,
@@ -11,4 +11,4 @@
   pages={197},
   year={2023},
   publisher={Nature Publishing Group UK London}
-}
+}
diff --git a/dev/tutorials/basic_types/index.html b/dev/tutorials/basic_types/index.html index 2c17d25..661821b 100644 --- a/dev/tutorials/basic_types/index.html +++ b/dev/tutorials/basic_types/index.html @@ -1,5 +1,5 @@ -Basics · SpectralIndices.jl

Built-in types

This guide provides a comprehensive overview of utilizing SpectralIndices.jl with Julia's built-in types and data structures. By exploring these foundational elements, you'll gain valuable insights into the package's functionality and its application in calculating spectral indices like NDVI and SAVI.

Introduction to Indices Calculation

Let's begin with an example involving two data points representing the near-infrared (NIR) and red reflectances of vegetation, stored as Int values:

nir = 6723
+Basics · SpectralIndices.jl

Built-in types

This guide provides a comprehensive overview of utilizing SpectralIndices.jl with Julia's built-in types and data structures. By exploring these foundational elements, you'll gain valuable insights into the package's functionality and its application in calculating spectral indices like NDVI and SAVI.

Introduction to Indices Calculation

Let's begin with an example involving two data points representing the near-infrared (NIR) and red reflectances of vegetation, stored as Int values:

nir = 6723
 red = 1243
1243

Our goal is to calculate the Normalized Difference Vegetation Index (NDVI). NDVI is a widely used spectral index for monitoring vegetation health, calculated using NIR and red reflectances. The formula for NDVI is:

\[NDVI = \frac{NIR-Red}{NIR+Red}\]

Direct Calculation with NDVI Struct

SpectralIndices.jl provides a straightforward method for computing NDVI:

using SpectralIndices
 NDVI
NDVI: Normalized Difference Vegetation Index
 * Application Domain: vegetation
@@ -124,4 +124,4 @@
  0.3333333333333333
  0.3333333333333333
compute_index(["NDVI", "SAVI"]; params...)
2-element Vector{Any}:
  [0.3333333333333333, 0.3333333333333333, 0.3333333333333333, 0.3333333333333333, 0.3333333333333333, 0.3333333333333333, 0.3333333333333333, 0.3333333333333333, 0.3333333333333333, 0.3333333333333333]
- [0.18750000000000003, 0.18750000000000003, 0.18750000000000003, 0.18750000000000003, 0.18750000000000003, 0.18750000000000003, 0.18750000000000003, 0.18750000000000003, 0.18750000000000003, 0.18750000000000003]
+ [0.18750000000000003, 0.18750000000000003, 0.18750000000000003, 0.18750000000000003, 0.18750000000000003, 0.18750000000000003, 0.18750000000000003, 0.18750000000000003, 0.18750000000000003, 0.18750000000000003]
diff --git a/dev/tutorials/dataframes/index.html b/dev/tutorials/dataframes/index.html index 9c95a72..aab874a 100644 --- a/dev/tutorials/dataframes/index.html +++ b/dev/tutorials/dataframes/index.html @@ -1,5 +1,5 @@ -DataFrames.jl · SpectralIndices.jl

DataFrames.jl

This section of the documentation will help you understand how to work with SpectralIndices.jl using DataFrames.jl as input.

This tutorial relies on data stored in data. To access it we are going to use the following:

using SpectralIndices, DataFrames
+DataFrames.jl · SpectralIndices.jl

DataFrames.jl

This section of the documentation will help you understand how to work with SpectralIndices.jl using DataFrames.jl as input.

This tutorial relies on data stored in data. To access it we are going to use the following:

using SpectralIndices, DataFrames
 df = load_dataset("spectral", DataFrame)
 first(df, 5)
5×9 DataFrame
RowSR_B5ST_B10SR_B2SR_B6classSR_B4SR_B7SR_B3SR_B1
AnyAnyAnyAnyAnyAnyAnyAnyAny
10.269054297.3280.1007950.306206Urban0.1657640.2519490.1322270.08985
20.281264297.1080.086990.267596Urban0.1609790.2179170.1244040.0738588
30.28422297.4360.08602750.258384Urban0.1402030.2000980.1209940.0729375
40.254479297.2040.1039160.25958Urban0.1639760.2167350.1359810.0877325
50.269535297.0980.1093060.273234Urban0.181260.2195540.150350.0905925

Each column of this dataset is the Surface Reflectance from Landsat 8 for 3 different classes. The samples were taken over Oporto. The data is taken from spyndex and this tutorial is meant to closely mirror the python version.

This dataset specifically contains three different classes:

unique(df[!, "class"])
3-element Vector{Any}:
  "Urban"
@@ -61,4 +61,4 @@
            S1 = df[!, "SR_B6"])
3-element Vector{Any}:
  [0.23754793677807357, 0.2719887844338796, 0.33932578974960087, 0.21627773595727137, 0.19582071673377036, 0.16771383579896465, 0.21944767233340506, 0.2251996432295527, 0.1655330261746833, 0.2675545906704802  …  0.810365666144593, 0.8104049969776344, 0.7616768543153676, 0.8027222040013119, 0.7929365431300779, 0.7862750574070626, 0.8080303042462863, 0.8025822103946664, 0.7135886988619672, 0.7672440264304153]
  [-0.3409734444357916, -0.38667135030536093, -0.4028151808767594, -0.3034817907083952, -0.28385153077628394, -0.29071730449057526, -0.32313861250513676, -0.3563320964589312, -0.24060392753715099, -0.34356689100134846  …  -0.7698492602846995, -0.7547124120206541, -0.7128263753013682, -0.7716516398212895, -0.7491201313937117, -0.7510114068441064, -0.7257608604061496, -0.7401234567901236, -0.6752241340558899, -0.7074355283543386]
- [0.06458384035045028, -0.02490161425500128, -0.04761531780788457, 0.009923476645422341, 0.006814596455672831, 0.08634934501415456, 0.01133569522728392, 0.03875665342611921, 0.006910176170362171, -0.0322322650047355  …  -0.47115094032591764, -0.46672499804111056, -0.40825671490715415, -0.5414949557901297, -0.43083696212857336, -0.43525525151156264, -0.4700842430846934, -0.4585879184008887, -0.4050436713235448, -0.44864683453438614]
+ [0.06458384035045028, -0.02490161425500128, -0.04761531780788457, 0.009923476645422341, 0.006814596455672831, 0.08634934501415456, 0.01133569522728392, 0.03875665342611921, 0.006910176170362171, -0.0322322650047355 … -0.47115094032591764, -0.46672499804111056, -0.40825671490715415, -0.5414949557901297, -0.43083696212857336, -0.43525525151156264, -0.4700842430846934, -0.4585879184008887, -0.4050436713235448, -0.44864683453438614]
diff --git a/dev/tutorials/yaxarrays/index.html b/dev/tutorials/yaxarrays/index.html index 70985ea..3562102 100644 --- a/dev/tutorials/yaxarrays/index.html +++ b/dev/tutorials/yaxarrays/index.html @@ -1,5 +1,5 @@ -YAXArrays.jl · SpectralIndices.jl

YAXArrays.jl

This tutorial will illustrate how to use SpectralIndices.jl using YAXArrays.jl as input data.

First we need to download the data, like in the previous tutorial. Only this time the data is going to be higher dimensional and slightly more complex, hence the need for YAXArrays.jl. In order to do so we are going to use the load_dataset function:

using YAXArrays, DimensionalData
+YAXArrays.jl · SpectralIndices.jl

YAXArrays.jl

This tutorial will illustrate how to use SpectralIndices.jl using YAXArrays.jl as input data.

First we need to download the data, like in the previous tutorial. Only this time the data is going to be higher dimensional and slightly more complex, hence the need for YAXArrays.jl. In order to do so we are going to use the load_dataset function:

using YAXArrays, DimensionalData
 using SpectralIndices
 yaxa = load_dataset("sentinel", YAXArray)
300×300×4 YAXArray{Int64,3} with dimensions: 
   Dim{:x} Sampled{Int64} 1:300 ForwardOrdered Regular Points,
@@ -68,4 +68,4 @@
 ax = Axis(fig[1, 1])
 image!(ax, kndvi.data, colormap=:haline)
 ylims!(300, 0)
-fig
Example block output
+fig
Example block output