Skip to content

Axioms

SpectralIndices.SpectralIndex Type
julia
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

SpectralIndices.jl's indices are loaded in two different ways. The first one is through the Dict indices:

julia
julia> using SpectralIndices

julia> indices["NIRv"]
NIRv: Near-Infrared Reflectance of Vegetation
* Application Domain: vegetation
* Bands/Parameters: Any["N", "R"]
* Formula: ((N-R)/(N+R))*N
* Reference: https://doi.org/10.1126/sciadv.1602244

Additioanlly, SpectralIndices.jl loads into memory all the short names of the indices, so you can easily access them on your REPL:

julia
julia> NDVI
NDVI: Normalized Difference Vegetation Index
* Application Domain: vegetation
* Bands/Parameters: Any["N", "R"]
* Formula: (N-R)/(N+R)
* Reference: https://ntrs.nasa.gov/citations/19740022614
source
SpectralIndices.compute Function
julia
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
julia> compute(NDVI; N=0.643, R=0.175)
julia
julia> compute(NDVI; N=fill(0.643, (5, 5)), R=fill(0.175, (5, 5)))
source
SpectralIndices.PlatformBand Type
julia
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.

Examples

julia
julia> using SpectralIndices

julia> platform_band_dict = Dict(
           "platform" => "Sentinel-2A",
           "band" => "B2",
           "name" => "Blue",
           "wavelength" => 492.4,
           "bandwidth" => 66.0
       )
Dict{String, Any} with 5 entries:
  "name"       => "Blue"
  "wavelength" => 492.4
  "platform"   => "Sentinel-2A"
  "bandwidth"  => 66.0
  "band"       => "B2"

julia> platform_band = PlatformBand(platform_band_dict)
Platform: Sentinel-2A, Band: Blue
* Band: B2
* Center Wavelength (nm): 492.4
* Bandwidth (nm): 66.0

Additionally, SpectralIndices.jl provides already computed platforms as a Dict:

julia
julia> bands["B"].platforms["sentinel2a"]
Platform: Sentinel-2A, Band: Blue
* Band: B2
* Center Wavelength (nm): 492.4
* Bandwidth (nm): 66.0
source
SpectralIndices.Band Type
julia
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.

source
SpectralIndices.Constant Type
julia
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

julia
julia> using SpectralIndices

julia> constant_dict = Dict(
           "description" => "Speed of light in vacuum",
           "short_name" => "c",
           "default" => 299792458
       )
Dict{String, Any} with 3 entries:
  "short_name"  => "c"
  "default"     => 299792458
  "description" => "Speed of light in vacuum"

julia> constant = Constant(constant_dict)
c: Speed of light in vacuum
* Description: Speed of light in vacuum
* Standard: c
* Default value: 299792458
* Current value: 299792458
source