From 2435d82450a6d208b3b84cafda9dbd63c724882c Mon Sep 17 00:00:00 2001 From: Lazaro Alonso Date: Wed, 27 Mar 2024 22:57:23 +0100 Subject: [PATCH 1/3] new docs and less restrictive args types --- .github/workflows/CI.yml | 25 +- .github/workflows/Documentation.yml | 59 ++ .gitignore | 4 +- Project.toml | 2 +- docs/Project.toml | 4 +- docs/make.jl | 18 +- docs/package.json | 18 + docs/pages.jl | 7 +- docs/src/getting_started.md | 55 + docs/src/index.md | 85 +- docs/src/tutorials/basic_types.md | 7 +- docs/src/tutorials/yaxarrays.md | 95 +- src/indices_funcs.jl | 1501 +++++++-------------------- src/utils.jl | 2 +- 14 files changed, 655 insertions(+), 1227 deletions(-) create mode 100644 .github/workflows/Documentation.yml create mode 100644 docs/package.json create mode 100644 docs/src/getting_started.md diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b11535e..0078752 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -42,27 +42,4 @@ jobs: - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v1 with: - file: lcov.info - docs: - name: Documentation - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 - with: - version: '1' - - run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev - - run: | - julia --project=docs -e ' - using Pkg - Pkg.develop(PackageSpec(path=pwd())) - Pkg.instantiate()' - - run: | - DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs -e ' - using Documenter: doctest - using SpectralIndices - doctest(SpectralIndices)' - - run: xvfb-run -s '-screen 0 1024x768x24' julia --project=docs docs/make.jl - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} \ No newline at end of file + file: lcov.info \ No newline at end of file diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml new file mode 100644 index 0000000..234cf30 --- /dev/null +++ b/.github/workflows/Documentation.yml @@ -0,0 +1,59 @@ +# Sample workflow for building and deploying a VitePress site to GitHub Pages +# +name: Documenter + +on: + # Runs on pushes targeting the `master` branch. Change this to `main` if you're + # using the `main` branch as the default branch. + push: + branches: + - main + tags: ['*'] + pull_request: + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: write + pages: write + id-token: write + statuses: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: pages + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node # This is still useful because it caches the node_modules so we don't constantly re-install. You don't technically need this, though. + uses: actions/setup-node@v3 + with: + node-version: 20 + cache: npm # or pnpm / yarn + cache-dependency-path: 'docs/package-lock.json' # this should be a package-lock.json file + - name: Setup Julia + uses: julia-actions/setup-julia@v1 + - name: Pull Julia cache + uses: julia-actions/cache@v1 + - name: Install documentation dependencies + run: julia --project=docs -e 'using Pkg; pkg"dev ."; Pkg.instantiate(); Pkg.precompile(); Pkg.status()' + - name: Instantiate NPM + run: cd docs/; npm i; cd .. + #- name: Creating new mds from src + - name: Build and deploy docs + uses: julia-actions/julia-docdeploy@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key + GKSwstype: "100" # for Plots.jl plots (if you have them) + JULIA_DEBUG: "Documenter" + DATADEPS_ALWAYS_ACCEPT: true \ No newline at end of file diff --git a/.gitignore b/.gitignore index 57eea35..2209659 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,7 @@ deps/src/ docs/build/ docs/site/ - +docs/node_modules +docs/package-lock.json +.vscode Manifest.toml \ No newline at end of file diff --git a/Project.toml b/Project.toml index c35b9dc..065bf99 100644 --- a/Project.toml +++ b/Project.toml @@ -20,7 +20,7 @@ SpectralIndicesYAXArraysExt = ["YAXArrays", "DimensionalData"] [compat] DataFrames = "1" Dates = "1" -DimensionalData = "0.25" +DimensionalData = "0.26" Downloads = "1" JSON = "0.21" YAXArrays = "0.5" diff --git a/docs/Project.toml b/docs/Project.toml index 9c58364..dc6a279 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,7 +1,9 @@ [deps] +CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" -GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a" +DocumenterVitepress = "4710194d-e776-4893-9690-8d956a29c365" +PartialFunctions = "570af359-4316-4cb7-8c74-252c00c2016b" SpectralIndices = "df0093a1-273d-40bc-819a-796ec3476907" YAXArrays = "c21b50f5-aa40-41ea-b809-c0f5e47bfa5c" diff --git a/docs/make.jl b/docs/make.jl index 1b70ccb..e9eb95e 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,5 +1,6 @@ using SpectralIndices using Documenter +using DocumenterVitepress include("pages.jl") @@ -10,14 +11,21 @@ makedocs(; doctest=true, linkcheck=true, warnonly=[:missing_docs], - format=Documenter.HTML(; - size_threshold=nothing, - prettyurls=get(ENV, "CI", nothing) == "true", - assets=["assets/docs.css"], + format=DocumenterVitepress.MarkdownVitepress( + repo = "github.com/awesome-spectral-indices/SpectralIndices.jl", # this must be the full URL! + devbranch = "main", + devurl = "dev"; ), + draft = false, + source = "src", + build = "build", pages=pages, ) deploydocs(; - repo="github.com/awesome-spectral-indices/SpectralIndices.jl.git", push_preview=true + repo="github.com/awesome-spectral-indices/SpectralIndices.jl", + target = "build", # this is where Vitepress stores its output + branch = "gh-pages", + devbranch = "main", + push_preview = true ) diff --git a/docs/package.json b/docs/package.json new file mode 100644 index 0000000..bfd4da9 --- /dev/null +++ b/docs/package.json @@ -0,0 +1,18 @@ +{ + "devDependencies": { + "markdown-it": "^14.0.0", + "markdown-it-mathjax3": "^4.3.2", + "vitepress": "^1.0.0-rc.43", + "vitepress-plugin-tabs": "^0.5.0", + "vitest": "^1.3.0" + }, + "scripts": { + "docs:dev": "vitepress dev build/.documenter", + "docs:build": "vitepress build build/.documenter", + "docs:preview": "vitepress preview build/.documenter" + }, + "dependencies": { + "@shikijs/transformers": "^1.1.7", + "markdown-it-footnote": "^4.0.0" + } + } \ No newline at end of file diff --git a/docs/pages.jl b/docs/pages.jl index a4e6749..558f993 100644 --- a/docs/pages.jl +++ b/docs/pages.jl @@ -1,11 +1,12 @@ pages = [ - "SpectralIndices.jl" => "index.md", - "Tutorials" => Any[ + "Home" => "index.md", + "Getting Started" => "getting_started.md", + "Tutorials" => [ "Basics" => "tutorials/basic_types.md", "DataFrames.jl" => "tutorials/dataframes.md", "YAXArrays.jl" => "tutorials/yaxarrays.md", ], - "API Documentation" => Any[ + "API Documentation" => [ "Axioms" => "api/axioms.md", "Compute" => "api/compute.md", "Datasets" => "api/datasets.md", diff --git a/docs/src/getting_started.md b/docs/src/getting_started.md new file mode 100644 index 0000000..476da23 --- /dev/null +++ b/docs/src/getting_started.md @@ -0,0 +1,55 @@ +# 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: + +```julia +using Pkg +Pkg.add("SpectralIndices") +``` + +### Basic usage + +Here's a simple example to compute the NDVI spectral index: +```julia +using SpectralIndices + +NDVI_result = compute_index("NDVI", N = 0.643, R = 0.175) +``` + +## License +SpectralIndices.jl is released under the [MIT License](https://github.com/awesome-spectral-indices/SpectralIndices.jl/blob/main/LICENSE). + +## Citation +If you use SpectralIndices.jl in your research, please cite it as follows: + +```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} +} +``` \ No newline at end of file diff --git a/docs/src/index.md b/docs/src/index.md index 476da23..0dd2b0d 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,55 +1,44 @@ -# 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: - -```julia -using Pkg -Pkg.add("SpectralIndices") +```@raw html +--- +# https://vitepress.dev/reference/default-theme-home-page +layout: home + +hero: + name: "SpectralIndices.jl" + text: "Easy formulas" + tagline: Indices used in remote sensing and environmental monitoring. + image: + src: /logo.png + alt: SpectralIndices + actions: + - theme: brand + text: Getting Started + link: /getting_started + - theme: alt + text: View on Github + link: https://github.com/awesome-spectral-indices/SpectralIndices.jl + - theme: alt + text: API Axioms + link: /api/axioms + +features: + - title: Support + details: Supports a broad range of predefined spectral indices. + - title: Creation + details: Custom index creation capabilities. + - title: Flexibility + details: Flexible input options for various data types. Efficient computation for large datasets. +--- ``` -### Basic usage - -Here's a simple example to compute the NDVI spectral index: -```julia +```@example index using SpectralIndices - -NDVI_result = compute_index("NDVI", N = 0.643, R = 0.175) +NDVI ``` -## License -SpectralIndices.jl is released under the [MIT License](https://github.com/awesome-spectral-indices/SpectralIndices.jl/blob/main/LICENSE). - -## Citation -If you use SpectralIndices.jl in your research, please cite it as follows: +> [!TIP] +> See some more with: -```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} -} +```@example index +indices ``` \ No newline at end of file diff --git a/docs/src/tutorials/basic_types.md b/docs/src/tutorials/basic_types.md index 099bc3f..515d11f 100644 --- a/docs/src/tutorials/basic_types.md +++ b/docs/src/tutorials/basic_types.md @@ -13,9 +13,7 @@ red = 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: -```math -NDVI = \frac{NIR-Red}{NIR+Red} -``` +$$NDVI = \frac{NIR-Red}{NIR+Red}$$ ### Direct Calculation with NDVI Struct @@ -51,7 +49,8 @@ params = Dict( ndvi = compute(NDVI, params) ``` -!!! warn Please ensure dictionary keys match the band names specified in the `bands` field. +!!! warning + Please ensure dictionary keys match the band names specified in the `bands` field. Additionally you can pass the values as kwargs as follows: diff --git a/docs/src/tutorials/yaxarrays.md b/docs/src/tutorials/yaxarrays.md index 4218090..8abf309 100644 --- a/docs/src/tutorials/yaxarrays.md +++ b/docs/src/tutorials/yaxarrays.md @@ -1,4 +1,4 @@ -# YAXArrays.jl +## YAXArrays.jl This tutorial will illustrate how to use SpectralIndices.jl using YAXArrays.jl as input data. @@ -7,6 +7,9 @@ First we need to download the data, like in the previous tutorial. Only this tim ```@example yaxarrays using YAXArrays, DimensionalData using SpectralIndices +``` + +```@ansi yaxarrays yaxa = load_dataset("sentinel", YAXArray) ``` @@ -14,18 +17,72 @@ As it is possible to observe we have a `YAXArray` object with three dimensions: The data is stored as `Int64`, so let us convert it to `Float` and rescale it: -```@example yaxarrays +```@ansi yaxarrays yaxa = yaxa./10000 ``` Now let's compute the NDVI for this dataset! +First, let's define the bands to be used: +```@example yaxarrays +b8 = yaxa[bands = At("B08")] +b4 = yaxa[bands = At("B04")] +nothing # hide +``` + +now, let's compute the index + +```@ansi yaxarrays +ndvi_compute = compute_index("NDVI"; N=b8, R=b4) +``` + +### map + +Due to the `type` design, in order to use `map` we will use the `PartialFunctions` package to specify the first initial `type` on each function, namely + +```@example yaxarrays +using PartialFunctions +ndvi_p = NDVI.compute $Float64 +``` +now, we can compute the index + +```@ansi yaxarrays +ndvi_map = map(ndvi_p, b8, b4) +``` +Let's check that we have the same output: + +```@example yaxarrays +ndvi_compute.data == ndvi_map.data +``` + +### mapCube +For out of memory calculations then using `mapCube` is the way to go. This can be implemented as follows. First, we wrap our function of interest into a function compatible with `mapCube`, namely + +```@example yaxarrays +function ndvi_out(xout, x1, x2) + xout .= NDVI.(Float64, x1, x2) # note the . +end +``` +next, define the input and output dimensions of your `YAXArray`'s. ```@example yaxarrays -ndvi = compute_index("NDVI"; - N=yaxa[bands = At("B08")], - R=yaxa[bands = At("B04")]) +in_dims = InDims("x") # the second one will be inferred +out_dims = OutDims("x") # dito +nothing # hide ``` +```@ansi yaxarrays +ndvi_cube = mapCube(ndvi_out, (b8, b4), indims=(in_dims, in_dims), + outdims=OutDims("x", outtype=Float64)) +``` + +and we check again the data output matches + +```@example yaxarrays +ndvi_compute.data == ndvi_cube.data +``` + +## compute index by named dims + As usual we can also just feed a properly constructed `YAXArray` to the `compute_index` function. Let's built the array: ```@example yaxarrays @@ -34,14 +91,18 @@ index_N = findfirst(yaxa.bands.val .== "B08") new_bands_dim = Dim{:Variables}(["R", "N"]) nr_data = cat(yaxa[:, :, index_R], yaxa[:, :, index_N], dims=3) +nothing # hide +``` +```@ansi yaxarrays new_yaxa = YAXArray((yaxa.x, yaxa.y, new_bands_dim), nr_data) ``` -!!!warn Please notice how the `Dim` is called `Variables`. This is needed for the internal computation to work properly. +!!! warning + Please notice how the `Dim` is called `Variables`. This is needed for the internal computation to work properly. Also, note that this does not work for out of memory datasets. Now that we have our `YAXArray` with the correctly names `Dim`s we can use it direcly into `compute_index`: -```@example yaxarrays +```@ansi yaxarrays ndvi = compute_index( "NDVI", new_yaxa ) @@ -63,8 +124,8 @@ kNDVI.reference Onto the calculations: -```@example yaxarrays -knn = YAXArray((yaxa.x, yaxa.y), fill(1.0, 300, 300)) +```@ansi yaxarrays +knn = YAXArray((yaxa.x, yaxa.y), fill(1.0, 300, 300)); knr = compute_kernel( RBF; a = Float64.(yaxa[bands = At("B08")]), @@ -82,23 +143,27 @@ sigma = yaxa[bands = At("B08")].+yaxa[bands = At("B04")] ./ 2 kernel_dims = Dim{:Variables}(["a", "b", "sigma"]) params = concatenatecubes([a, b, sigma], kernel_dims) +nothing # hide +``` +```@ansi yaxarrays knr = compute_kernel(RBF, params) ``` We can finally compute the kNDVI: -```@example yaxarrays +```@ansi yaxarrays kndvi = compute_index("kNDVI"; kNN = knn, kNR=knr) ``` Let's plot it! ```@example yaxarrays -using GLMakie -fig = Figure(resolution = (500, 500)) -ax = Axis(fig[1, 1]) -image!(ax, kndvi.data, colormap=:haline) -ylims!(300, 0) +using CairoMakie +fig, ax, plt = heatmap(kndvi; colormap=:haline, + axis = (; aspect=DataAspect()), + figure = (; size=(600, 400))) +Colorbar(fig[1,2], plt) +colsize!(fig.layout, 1, Aspect(1, 1.0)) fig ``` \ No newline at end of file diff --git a/src/indices_funcs.jl b/src/indices_funcs.jl index 2566de3..fa9ca09 100644 --- a/src/indices_funcs.jl +++ b/src/indices_funcs.jl @@ -1,2147 +1,1400 @@ indices_funcs = Dict() -function SWI_func(::Type{TFL}, G::Number, N::Number, S1::Number) where {TFL<:Number} +function SWI_func(::Type{TFL}, G, N, S1) where {TFL <: Number} return (G * (N - S1)) / ((G + N) * (N + S1)) end indices_funcs["SWI"] = SWI_func -function WI1_func(::Type{TFL}, G::Number, S2::Number) where {TFL<:Number} +function WI1_func(::Type{TFL}, G, S2) where {TFL <: Number} return (G - S2) / (G + S2) end indices_funcs["WI1"] = WI1_func -function NDVIMNDWI_func( - ::Type{TFL}, N::Number, R::Number, G::Number, S1::Number -) where {TFL<:Number} - return ((N - R) / (N + R)) - ((G - S1) / (G + S1)) +function NDVIMNDWI_func(::Type{TFL}, N, R, G, S1) where {TFL <: Number} + return ((N - R)/(N + R)) - ((G - S1)/(G + S1)) end indices_funcs["NDVIMNDWI"] = NDVIMNDWI_func -function BAIS2_func( - ::Type{TFL}, - RE2::Number, - RE3::Number, - N2::Number, - R::Number, - S2::Number; - const1::Number=TFL(1.0), - const2::Number=TFL(0.5), - const3::Number=TFL(0.5), - const4::Number=TFL(1.0), -) where {TFL<:Number} - return (const1 - ((RE2 * RE3 * N2) / R)^const2) * - (((S2 - N2) / (S2 + N2)^const3) + const4) +function BAIS2_func(::Type{TFL}, RE2, RE3, N2, R, S2; const1::Number=TFL(1.0), const2::Number=TFL(0.5), const3::Number=TFL(0.5), const4::Number=TFL(1.0)) where {TFL <: Number} + return (const1 - ((RE2 * RE3 * N2) / R) ^ const2) * (((S2 - N2)/(S2 + N2) ^ const3) + const4) end indices_funcs["BAIS2"] = BAIS2_func -function PSRI_func(::Type{TFL}, R::Number, B::Number, RE2::Number) where {TFL<:Number} - return (R - B) / RE2 +function PSRI_func(::Type{TFL}, R, B, RE2) where {TFL <: Number} + return (R - B)/RE2 end indices_funcs["PSRI"] = PSRI_func -function MGRVI_func( - ::Type{TFL}, - G::Number, - R::Number; - const1::Number=TFL(2.0), - const2::Number=TFL(2.0), - const3::Number=TFL(2.0), - const4::Number=TFL(2.0), -) where {TFL<:Number} - return (G^const1 - R^const2) / (G^const3 + R^const4) +function MGRVI_func(::Type{TFL}, G, R; const1::Number=TFL(2.0), const2::Number=TFL(2.0), const3::Number=TFL(2.0), const4::Number=TFL(2.0)) where {TFL <: Number} + return (G ^ const1 - R ^ const2) / (G ^ const3 + R ^ const4) end indices_funcs["MGRVI"] = MGRVI_func -function SR_func(::Type{TFL}, N::Number, R::Number) where {TFL<:Number} - return N / R +function SR_func(::Type{TFL}, N, R) where {TFL <: Number} + return N/R end indices_funcs["SR"] = SR_func -function MBI_func( - ::Type{TFL}, S1::Number, S2::Number, N::Number; const1::Number=TFL(0.5) -) where {TFL<:Number} - return ((S1 - S2 - N) / (S1 + S2 + N)) + const1 +function MBI_func(::Type{TFL}, S1, S2, N; const1::Number=TFL(0.5)) where {TFL <: Number} + return ((S1 - S2 - N)/(S1 + S2 + N)) + const1 end indices_funcs["MBI"] = MBI_func -function WRI_func( - ::Type{TFL}, G::Number, R::Number, N::Number, S1::Number -) where {TFL<:Number} - return (G + R) / (N + S1) +function WRI_func(::Type{TFL}, G, R, N, S1) where {TFL <: Number} + return (G + R)/(N + S1) end indices_funcs["WRI"] = WRI_func -function NDISIg_func( - ::Type{TFL}, - T::Number, - G::Number, - N::Number, - S1::Number; - const1::Number=TFL(3.0), - const2::Number=TFL(3.0), -) where {TFL<:Number} - return (T - (G + N + S1) / const1) / (T + (G + N + S1) / const2) +function NDISIg_func(::Type{TFL}, T, G, N, S1; const1::Number=TFL(3.0), const2::Number=TFL(3.0)) where {TFL <: Number} + return (T - (G + N + S1) / const1)/(T + (G + N + S1) / const2) end indices_funcs["NDISIg"] = NDISIg_func -function IRECI_func( - ::Type{TFL}, RE3::Number, R::Number, RE1::Number, RE2::Number -) where {TFL<:Number} +function IRECI_func(::Type{TFL}, RE3, R, RE1, RE2) where {TFL <: Number} return (RE3 - R) / (RE1 / RE2) end indices_funcs["IRECI"] = IRECI_func -function MTVI2_func( - ::Type{TFL}, - N::Number, - G::Number, - R::Number; - const1::Number=TFL(1.5), - const2::Number=TFL(1.2), - const3::Number=TFL(2.5), - const4::Number=TFL(2.0), - const5::Number=TFL(1), - const6::Number=TFL(2), - const7::Number=TFL(6.0), - const8::Number=TFL(5), - const9::Number=TFL(0.5), - const10::Number=TFL(0.5), - const11::Number=TFL(0.5), -) where {TFL<:Number} - return (const1 * (const2 * (N - G) - const3 * (R - G))) / ( - ( - ((const4 * N + const5)^const6) - (const7 * N - const8 * (R^const9)) - const10 - )^const11 - ) +function MTVI2_func(::Type{TFL}, N, G, R; const1::Number=TFL(1.5), const2::Number=TFL(1.2), const3::Number=TFL(2.5), const4::Number=TFL(2.0), const5::Number=TFL(1), const6::Number=TFL(2), const7::Number=TFL(6.0), const8::Number=TFL(5), const9::Number=TFL(0.5), const10::Number=TFL(0.5), const11::Number=TFL(0.5)) where {TFL <: Number} + return (const1 * (const2 * (N - G) - const3 * (R - G))) / ((((const4 * N + const5) ^ const6) - (const7 * N - const8 * (R ^ const9)) - const10) ^ const11) end indices_funcs["MTVI2"] = MTVI2_func -function VIG_func(::Type{TFL}, G::Number, R::Number) where {TFL<:Number} +function VIG_func(::Type{TFL}, G, R) where {TFL <: Number} return (G - R) / (G + R) end indices_funcs["VIG"] = VIG_func -function TCARIOSAVI705_func( - ::Type{TFL}, - RE2::Number, - RE1::Number, - G::Number; - const1::Number=TFL(3), - const2::Number=TFL(0.2), - const3::Number=TFL(1.16), - const4::Number=TFL(0.16), -) where {TFL<:Number} - return (const1 * ((RE2 - RE1) - const2 * (RE2 - G) * (RE2 / RE1))) / - (const3 * (RE2 - RE1) / (RE2 + RE1 + const4)) +function TCARIOSAVI705_func(::Type{TFL}, RE2, RE1, G; const1::Number=TFL(3), const2::Number=TFL(0.2), const3::Number=TFL(1.16), const4::Number=TFL(0.16)) where {TFL <: Number} + return (const1 * ((RE2 - RE1) - const2 * (RE2 - G) * (RE2 / RE1))) / (const3 * (RE2 - RE1) / (RE2 + RE1 + const4)) end indices_funcs["TCARIOSAVI705"] = TCARIOSAVI705_func -function BaI_func(::Type{TFL}, R::Number, S1::Number, N::Number) where {TFL<:Number} +function BaI_func(::Type{TFL}, R, S1, N) where {TFL <: Number} return R + S1 - N end indices_funcs["BaI"] = BaI_func -function CCI_func(::Type{TFL}, G1::Number, R::Number) where {TFL<:Number} - return (G1 - R) / (G1 + R) +function CCI_func(::Type{TFL}, G1, R) where {TFL <: Number} + return (G1 - R)/(G1 + R) end indices_funcs["CCI"] = CCI_func -function NRFIr_func(::Type{TFL}, R::Number, S2::Number) where {TFL<:Number} +function NRFIr_func(::Type{TFL}, R, S2) where {TFL <: Number} return (R - S2) / (R + S2) end indices_funcs["NRFIr"] = NRFIr_func -function NBRplus_func( - ::Type{TFL}, S2::Number, N2::Number, G::Number, B::Number -) where {TFL<:Number} - return (S2 - N2 - G - B) / (S2 + N2 + G + B) +function NBRplus_func(::Type{TFL}, S2, N2, G, B) where {TFL <: Number} + return (S2 - N2 - G - B)/(S2 + N2 + G + B) end indices_funcs["NBRplus"] = NBRplus_func -function NDBI_func(::Type{TFL}, S1::Number, N::Number) where {TFL<:Number} +function NDBI_func(::Type{TFL}, S1, N) where {TFL <: Number} return (S1 - N) / (S1 + N) end indices_funcs["NDBI"] = NDBI_func -function NDSInw_func(::Type{TFL}, N::Number, S1::Number, beta::Number) where {TFL<:Number} - return (N - S1 - beta) / (N + S1) +function NDSInw_func(::Type{TFL}, N, S1, beta) where {TFL <: Number} + return (N - S1 - beta)/(N + S1) end indices_funcs["NDSInw"] = NDSInw_func -function DSWI3_func(::Type{TFL}, S1::Number, R::Number) where {TFL<:Number} - return S1 / R +function DSWI3_func(::Type{TFL}, S1, R) where {TFL <: Number} + return S1/R end indices_funcs["DSWI3"] = DSWI3_func -function NIRv_func(::Type{TFL}, N::Number, R::Number) where {TFL<:Number} +function NIRv_func(::Type{TFL}, N, R) where {TFL <: Number} return ((N - R) / (N + R)) * N end indices_funcs["NIRv"] = NIRv_func -function GEMI_func( - ::Type{TFL}, - N::Number, - R::Number; - const1::Number=TFL(2.0), - const2::Number=TFL(2.0), - const3::Number=TFL(2.0), - const4::Number=TFL(1.5), - const5::Number=TFL(0.5), - const6::Number=TFL(0.5), - const7::Number=TFL(1.0), - const8::Number=TFL(0.25), - const9::Number=TFL(2.0), - const10::Number=TFL(2.0), - const11::Number=TFL(2), - const12::Number=TFL(1.5), - const13::Number=TFL(0.5), - const14::Number=TFL(0.5), - const15::Number=TFL(0.125), - const16::Number=TFL(1), -) where {TFL<:Number} - return ( - (const1 * ((N^const2) - (R^const3)) + const4 * N + const5 * R) / (N + R + const6) - ) * ( - const7 - - const8 * ( - (const9 * ((N^const10) - (R^const11)) + const12 * N + const13 * R) / - (N + R + const14) - ) - ) - ((R - const15) / (const16 - R)) +function GEMI_func(::Type{TFL}, N, R; const1::Number=TFL(2.0), const2::Number=TFL(2.0), const3::Number=TFL(2.0), const4::Number=TFL(1.5), const5::Number=TFL(0.5), const6::Number=TFL(0.5), const7::Number=TFL(1.0), const8::Number=TFL(0.25), const9::Number=TFL(2.0), const10::Number=TFL(2.0), const11::Number=TFL(2), const12::Number=TFL(1.5), const13::Number=TFL(0.5), const14::Number=TFL(0.5), const15::Number=TFL(0.125), const16::Number=TFL(1)) where {TFL <: Number} + return ((const1*((N ^ const2)-(R ^ const3)) + const4*N + const5*R)/(N + R + const6))*(const7 - const8*((const9 * ((N ^ const10) - (R ^ const11)) + const12 * N + const13 * R)/(N + R + const14)))-((R - const15)/(const16 - R)) end indices_funcs["GEMI"] = GEMI_func -function FCVI_func( - ::Type{TFL}, N::Number, R::Number, G::Number, B::Number; const1::Number=TFL(3.0) -) where {TFL<:Number} - return N - ((R + G + B) / const1) +function FCVI_func(::Type{TFL}, N, R, G, B; const1::Number=TFL(3.0)) where {TFL <: Number} + return N - ((R + G + B)/const1) end indices_funcs["FCVI"] = FCVI_func -function VHVVR_func(::Type{TFL}, VH::Number, VV::Number) where {TFL<:Number} - return VH / VV +function VHVVR_func(::Type{TFL}, VH, VV) where {TFL <: Number} + return VH/VV end indices_funcs["VHVVR"] = VHVVR_func -function GCC_func(::Type{TFL}, G::Number, R::Number, B::Number) where {TFL<:Number} +function GCC_func(::Type{TFL}, G, R, B) where {TFL <: Number} return G / (R + G + B) end indices_funcs["GCC"] = GCC_func -function WDRVI_func(::Type{TFL}, alpha::Number, N::Number, R::Number) where {TFL<:Number} +function WDRVI_func(::Type{TFL}, alpha, N, R) where {TFL <: Number} return (alpha * N - R) / (alpha * N + R) end indices_funcs["WDRVI"] = WDRVI_func -function ExGR_func( - ::Type{TFL}, - G::Number, - R::Number, - B::Number; - const1::Number=TFL(2.0), - const2::Number=TFL(1.3), -) where {TFL<:Number} +function ExGR_func(::Type{TFL}, G, R, B; const1::Number=TFL(2.0), const2::Number=TFL(1.3)) where {TFL <: Number} return (const1 * G - R - B) - (const2 * R - G) end indices_funcs["ExGR"] = ExGR_func -function DSI_func(::Type{TFL}, S1::Number, N::Number) where {TFL<:Number} - return S1 / N +function DSI_func(::Type{TFL}, S1, N) where {TFL <: Number} + return S1/N end indices_funcs["DSI"] = DSI_func -function ExG_func( - ::Type{TFL}, G::Number, R::Number, B::Number; const1::Number=TFL(2) -) where {TFL<:Number} +function ExG_func(::Type{TFL}, G, R, B; const1::Number=TFL(2)) where {TFL <: Number} return const1 * G - R - B end indices_funcs["ExG"] = ExG_func -function GSAVI_func( - ::Type{TFL}, L::Number, N::Number, G::Number; const1::Number=TFL(1.0) -) where {TFL<:Number} +function GSAVI_func(::Type{TFL}, L, N, G; const1::Number=TFL(1.0)) where {TFL <: Number} return (const1 + L) * (N - G) / (N + G + L) end indices_funcs["GSAVI"] = GSAVI_func -function ATSAVI_func( - ::Type{TFL}, - sla::Number, - N::Number, - R::Number, - slb::Number; - const1::Number=TFL(0.08), - const2::Number=TFL(1), - const3::Number=TFL(2.0), -) where {TFL<:Number} - return sla * (N - sla * R - slb) / - (sla * N + R - sla * slb + const1 * (const2 + sla^const3)) +function ATSAVI_func(::Type{TFL}, sla, N, R, slb; const1::Number=TFL(0.08), const2::Number=TFL(1), const3::Number=TFL(2.0)) where {TFL <: Number} + return sla * (N - sla * R - slb) / (sla * N + R - sla * slb + const1 * (const2 + sla ^ const3)) end indices_funcs["ATSAVI"] = ATSAVI_func -function MLSWI27_func( - ::Type{TFL}, N::Number, S2::Number; const1::Number=TFL(1.0), const2::Number=TFL(1.0) -) where {TFL<:Number} - return (const1 - N - S2) / (const2 - N + S2) +function MLSWI27_func(::Type{TFL}, N, S2; const1::Number=TFL(1.0), const2::Number=TFL(1.0)) where {TFL <: Number} + return (const1 - N - S2)/(const2 - N + S2) end indices_funcs["MLSWI27"] = MLSWI27_func -function SeLI_func(::Type{TFL}, N2::Number, RE1::Number) where {TFL<:Number} +function SeLI_func(::Type{TFL}, N2, RE1) where {TFL <: Number} return (N2 - RE1) / (N2 + RE1) end indices_funcs["SeLI"] = SeLI_func -function NDPI_func( - ::Type{TFL}, - N::Number, - alpha::Number, - R::Number, - S1::Number; - const1::Number=TFL(1.0), - const2::Number=TFL(1.0), -) where {TFL<:Number} - return (N - (alpha * R + (const1 - alpha) * S1)) / - (N + (alpha * R + (const2 - alpha) * S1)) +function NDPI_func(::Type{TFL}, N, alpha, R, S1; const1::Number=TFL(1.0), const2::Number=TFL(1.0)) where {TFL <: Number} + return (N - (alpha * R + (const1 - alpha) * S1))/(N + (alpha * R + (const2 - alpha) * S1)) end indices_funcs["NDPI"] = NDPI_func -function NDGI_func( - ::Type{TFL}, - lambdaN::Number, - lambdaR::Number, - lambdaG::Number, - G::Number, - N::Number, - R::Number; - const1::Number=TFL(1.0), - const2::Number=TFL(1.0), -) where {TFL<:Number} - return ( - ((lambdaN - lambdaR) / (lambdaN - lambdaG)) * G + - (const1 - ((lambdaN - lambdaR) / (lambdaN - lambdaG))) * N - R - ) / ( - ((lambdaN - lambdaR) / (lambdaN - lambdaG)) * G + - (const2 - ((lambdaN - lambdaR) / (lambdaN - lambdaG))) * N + - R - ) +function NDGI_func(::Type{TFL}, lambdaN, lambdaR, lambdaG, G, N, R; const1::Number=TFL(1.0), const2::Number=TFL(1.0)) where {TFL <: Number} + return (((lambdaN - lambdaR)/(lambdaN - lambdaG)) * G + (const1 - ((lambdaN - lambdaR)/(lambdaN - lambdaG))) * N - R)/(((lambdaN - lambdaR)/(lambdaN - lambdaG)) * G + (const2 - ((lambdaN - lambdaR)/(lambdaN - lambdaG))) * N + R) end indices_funcs["NDGI"] = NDGI_func -function SR2_func(::Type{TFL}, N::Number, G::Number) where {TFL<:Number} - return N / G +function SR2_func(::Type{TFL}, N, G) where {TFL <: Number} + return N/G end indices_funcs["SR2"] = SR2_func -function NGRDI_func(::Type{TFL}, G::Number, R::Number) where {TFL<:Number} +function NGRDI_func(::Type{TFL}, G, R) where {TFL <: Number} return (G - R) / (G + R) end indices_funcs["NGRDI"] = NGRDI_func -function NBR2_func(::Type{TFL}, S1::Number, S2::Number) where {TFL<:Number} +function NBR2_func(::Type{TFL}, S1, S2) where {TFL <: Number} return (S1 - S2) / (S1 + S2) end indices_funcs["NBR2"] = NBR2_func -function NDVI705_func(::Type{TFL}, RE2::Number, RE1::Number) where {TFL<:Number} +function NDVI705_func(::Type{TFL}, RE2, RE1) where {TFL <: Number} return (RE2 - RE1) / (RE2 + RE1) end indices_funcs["NDVI705"] = NDVI705_func -function TVI_func( - ::Type{TFL}, N::Number, R::Number; const1::Number=TFL(0.5), const2::Number=TFL(0.5) -) where {TFL<:Number} - return (((N - R) / (N + R)) + const1)^const2 +function TVI_func(::Type{TFL}, N, R; const1::Number=TFL(0.5), const2::Number=TFL(0.5)) where {TFL <: Number} + return (((N - R)/(N + R)) + const1) ^ const2 end indices_funcs["TVI"] = TVI_func -function NDBaI_func(::Type{TFL}, S1::Number, T::Number) where {TFL<:Number} +function NDBaI_func(::Type{TFL}, S1, T) where {TFL <: Number} return (S1 - T) / (S1 + T) end indices_funcs["NDBaI"] = NDBaI_func -function SAVIT_func( - ::Type{TFL}, - L::Number, - N::Number, - R::Number, - T::Number; - const1::Number=TFL(1.0), - const2::Number=TFL(10000.0), - const3::Number=TFL(10000.0), -) where {TFL<:Number} +function SAVIT_func(::Type{TFL}, L, N, R, T; const1::Number=TFL(1.0), const2::Number=TFL(10000.0), const3::Number=TFL(10000.0)) where {TFL <: Number} return (const1 + L) * (N - (R * T / const2)) / (N + (R * T / const3) + L) end indices_funcs["SAVIT"] = SAVIT_func -function WI2_func(::Type{TFL}, B::Number, S2::Number) where {TFL<:Number} +function WI2_func(::Type{TFL}, B, S2) where {TFL <: Number} return (B - S2) / (B + S2) end indices_funcs["WI2"] = WI2_func -function NBAI_func(::Type{TFL}, S2::Number, S1::Number, G::Number) where {TFL<:Number} - return ((S2 - S1) / G) / ((S2 + S1) / G) +function NBAI_func(::Type{TFL}, S2, S1, G) where {TFL <: Number} + return ((S2 - S1)/G)/((S2 + S1)/G) end indices_funcs["NBAI"] = NBAI_func -function BI_func( - ::Type{TFL}, S1::Number, R::Number, N::Number, B::Number -) where {TFL<:Number} - return ((S1 + R) - (N + B)) / ((S1 + R) + (N + B)) +function BI_func(::Type{TFL}, S1, R, N, B) where {TFL <: Number} + return ((S1 + R) - (N + B))/((S1 + R) + (N + B)) end indices_funcs["BI"] = BI_func -function RDVI_func( - ::Type{TFL}, N::Number, R::Number; const1::Number=TFL(0.5) -) where {TFL<:Number} - return (N - R) / ((N + R)^const1) +function RDVI_func(::Type{TFL}, N, R; const1::Number=TFL(0.5)) where {TFL <: Number} + return (N - R) / ((N + R) ^ const1) end indices_funcs["RDVI"] = RDVI_func -function TGI_func( - ::Type{TFL}, - R::Number, - G::Number, - B::Number; - const1::Number=TFL(0.5), - const2::Number=TFL(190), - const3::Number=TFL(120), -) where {TFL<:Number} - return -const1 * (const2 * (R - G) - const3 * (R - B)) +function TGI_func(::Type{TFL}, R, G, B; const1::Number=TFL(0.5), const2::Number=TFL(190), const3::Number=TFL(120)) where {TFL <: Number} + return - const1 * (const2 * (R - G) - const3 * (R - B)) end indices_funcs["TGI"] = TGI_func -function NRFIg_func(::Type{TFL}, G::Number, S2::Number) where {TFL<:Number} +function NRFIg_func(::Type{TFL}, G, S2) where {TFL <: Number} return (G - S2) / (G + S2) end indices_funcs["NRFIg"] = NRFIg_func -function MSR_func( - ::Type{TFL}, - N::Number, - R::Number; - const1::Number=TFL(1), - const2::Number=TFL(1), - const3::Number=TFL(0.5), -) where {TFL<:Number} - return (N / R - const1) / ((N / R + const2)^const3) +function MSR_func(::Type{TFL}, N, R; const1::Number=TFL(1), const2::Number=TFL(1), const3::Number=TFL(0.5)) where {TFL <: Number} + return (N / R - const1) / ((N / R + const2) ^ const3) end indices_funcs["MSR"] = MSR_func -function TriVI_func( - ::Type{TFL}, - N::Number, - G::Number, - R::Number; - const1::Number=TFL(0.5), - const2::Number=TFL(120), - const3::Number=TFL(200), -) where {TFL<:Number} +function TriVI_func(::Type{TFL}, N, G, R; const1::Number=TFL(0.5), const2::Number=TFL(120), const3::Number=TFL(200)) where {TFL <: Number} return const1 * (const2 * (N - G) - const3 * (R - G)) end indices_funcs["TriVI"] = TriVI_func -function ARI_func( - ::Type{TFL}, G::Number, RE1::Number; const1::Number=TFL(1), const2::Number=TFL(1) -) where {TFL<:Number} +function ARI_func(::Type{TFL}, G, RE1; const1::Number=TFL(1), const2::Number=TFL(1)) where {TFL <: Number} return (const1 / G) - (const2 / RE1) end indices_funcs["ARI"] = ARI_func -function NBRSWIR_func( - ::Type{TFL}, S2::Number, S1::Number; const1::Number=TFL(0.02), const2::Number=TFL(0.1) -) where {TFL<:Number} - return (S2 - S1 - const1) / (S2 + S1 + const2) +function NBRSWIR_func(::Type{TFL}, S2, S1; const1::Number=TFL(0.02), const2::Number=TFL(0.1)) where {TFL <: Number} + return (S2 - S1 - const1)/(S2 + S1 + const2) end indices_funcs["NBRSWIR"] = NBRSWIR_func -function OCVI_func( - ::Type{TFL}, N::Number, G::Number, R::Number, cexp::Number -) where {TFL<:Number} - return (N / G) * (R / G)^cexp +function OCVI_func(::Type{TFL}, N, G, R, cexp) where {TFL <: Number} + return (N / G) * (R / G) ^ cexp end indices_funcs["OCVI"] = OCVI_func -function NormG_func(::Type{TFL}, G::Number, N::Number, R::Number) where {TFL<:Number} - return G / (N + G + R) +function NormG_func(::Type{TFL}, G, N, R) where {TFL <: Number} + return G/(N + G + R) end indices_funcs["NormG"] = NormG_func -function BLFEI_func( - ::Type{TFL}, - G::Number, - R::Number, - S2::Number, - S1::Number; - const1::Number=TFL(3.0), - const2::Number=TFL(3.0), -) where {TFL<:Number} - return (((G + R + S2) / const1) - S1) / (((G + R + S2) / const2) + S1) +function BLFEI_func(::Type{TFL}, G, R, S2, S1; const1::Number=TFL(3.0), const2::Number=TFL(3.0)) where {TFL <: Number} + return (((G+R+S2)/const1)-S1)/(((G+R+S2)/const2)+S1) end indices_funcs["BLFEI"] = BLFEI_func -function DVI_func(::Type{TFL}, N::Number, R::Number) where {TFL<:Number} +function DVI_func(::Type{TFL}, N, R) where {TFL <: Number} return N - R end indices_funcs["DVI"] = DVI_func -function MuWIR_func( - ::Type{TFL}, - B::Number, - G::Number, - N::Number, - S2::Number, - S1::Number; - const1::Number=TFL(4.0), - const2::Number=TFL(2.0), - const3::Number=TFL(2.0), -) where {TFL<:Number} - return -const1 * ((B - G) / (B + G)) + - const2 * ((G - N) / (G + N)) + - const3 * ((G - S2) / (G + S2)) - ((G - S1) / (G + S1)) +function MuWIR_func(::Type{TFL}, B, G, N, S2, S1; const1::Number=TFL(4.0), const2::Number=TFL(2.0), const3::Number=TFL(2.0)) where {TFL <: Number} + return -const1 * ((B - G)/(B + G)) + const2 * ((G - N)/(G + N)) + const3 * ((G - S2)/(G + S2)) - ((G - S1)/(G + S1)) end indices_funcs["MuWIR"] = MuWIR_func -function MNLI_func( - ::Type{TFL}, - L::Number, - N::Number, - R::Number; - const1::Number=TFL(1), - const2::Number=TFL(2), - const3::Number=TFL(2), -) where {TFL<:Number} - return (const1 + L) * ((N^const2) - R) / ((N^const3) + R + L) +function MNLI_func(::Type{TFL}, L, N, R; const1::Number=TFL(1), const2::Number=TFL(2), const3::Number=TFL(2)) where {TFL <: Number} + return (const1 + L)*((N ^ const2) - R)/((N ^ const3) + R + L) end indices_funcs["MNLI"] = MNLI_func -function NDSoiI_func(::Type{TFL}, S2::Number, G::Number) where {TFL<:Number} - return (S2 - G) / (S2 + G) +function NDSoiI_func(::Type{TFL}, S2, G) where {TFL <: Number} + return (S2 - G)/(S2 + G) end indices_funcs["NDSoI"] = NDSoiI_func -function NDWIns_func(::Type{TFL}, G::Number, alpha::Number, N::Number) where {TFL<:Number} - return (G - alpha * N) / (G + N) +function NDWIns_func(::Type{TFL}, G, alpha, N) where {TFL <: Number} + return (G - alpha * N)/(G + N) end indices_funcs["NDWIns"] = NDWIns_func -function RI_func(::Type{TFL}, R::Number, G::Number) where {TFL<:Number} - return (R - G) / (R + G) +function RI_func(::Type{TFL}, R, G) where {TFL <: Number} + return (R - G)/(R + G) end indices_funcs["RI"] = RI_func -function SARVI_func( - ::Type{TFL}, L::Number, N::Number, R::Number, B::Number; const1::Number=TFL(1) -) where {TFL<:Number} - return (const1 + L) * (N - (R - (R - B))) / (N + (R - (R - B)) + L) +function SARVI_func(::Type{TFL}, L, N, R, B; const1::Number=TFL(1)) where {TFL <: Number} + return (const1 + L)*(N - (R - (R - B))) / (N + (R - (R - B)) + L) end indices_funcs["SARVI"] = SARVI_func -function kIPVI_func(::Type{TFL}, kNN::Number, kNR::Number) where {TFL<:Number} - return kNN / (kNN + kNR) +function kIPVI_func(::Type{TFL}, kNN, kNR) where {TFL <: Number} + return kNN/(kNN + kNR) end indices_funcs["kIPVI"] = kIPVI_func -function TWI_func( - ::Type{TFL}, - RE1::Number, - RE2::Number, - G::Number, - S2::Number, - B::Number, - N::Number; - const1::Number=TFL(2.84), - const2::Number=TFL(1.25), - const3::Number=TFL(1.25), - const4::Number=TFL(0.25), -) where {TFL<:Number} - return (const1 * (RE1 - RE2) / (G + S2)) + - ((const2 * (G - B) - (N - B)) / (N + const3 * G - const4 * B)) +function TWI_func(::Type{TFL}, RE1, RE2, G, S2, B, N; const1::Number=TFL(2.84), const2::Number=TFL(1.25), const3::Number=TFL(1.25), const4::Number=TFL(0.25)) where {TFL <: Number} + return (const1 * (RE1 - RE2) / (G + S2)) + ((const2 * (G - B) - (N - B)) / (N + const3 * G - const4 * B)) end indices_funcs["TWI"] = TWI_func -function MSAVI_func( - ::Type{TFL}, - N::Number, - R::Number; - const1::Number=TFL(0.5), - const2::Number=TFL(2.0), - const3::Number=TFL(1), - const4::Number=TFL(2), - const5::Number=TFL(1), - const6::Number=TFL(2), - const7::Number=TFL(8), - const8::Number=TFL(0.5), -) where {TFL<:Number} - return const1 * ( - const2 * N + const3 - (((const4 * N + const5)^const6) - const7 * (N - R))^const8 - ) +function MSAVI_func(::Type{TFL}, N, R; const1::Number=TFL(0.5), const2::Number=TFL(2.0), const3::Number=TFL(1), const4::Number=TFL(2), const5::Number=TFL(1), const6::Number=TFL(2), const7::Number=TFL(8), const8::Number=TFL(0.5)) where {TFL <: Number} + return const1 * (const2 * N + const3 - (((const4 * N + const5) ^ const6) - const7 * (N - R)) ^ const8) end indices_funcs["MSAVI"] = MSAVI_func -function DpRVIVV_func( - ::Type{TFL}, VH::Number, VV::Number; const1::Number=TFL(4.0) -) where {TFL<:Number} - return (const1 * VH) / (VV + VH) +function DpRVIVV_func(::Type{TFL}, VH, VV; const1::Number=TFL(4.0)) where {TFL <: Number} + return (const1 * VH)/(VV + VH) end indices_funcs["DpRVIVV"] = DpRVIVV_func -function RVI_func(::Type{TFL}, RE2::Number, R::Number) where {TFL<:Number} +function RVI_func(::Type{TFL}, RE2, R) where {TFL <: Number} return RE2 / R end indices_funcs["RVI"] = RVI_func -function MRBVI_func( - ::Type{TFL}, - R::Number, - B::Number; - const1::Number=TFL(2.0), - const2::Number=TFL(2.0), - const3::Number=TFL(2.0), - const4::Number=TFL(2.0), -) where {TFL<:Number} - return (R^const1 - B^const2) / (R^const3 + B^const4) +function MRBVI_func(::Type{TFL}, R, B; const1::Number=TFL(2.0), const2::Number=TFL(2.0), const3::Number=TFL(2.0), const4::Number=TFL(2.0)) where {TFL <: Number} + return (R ^ const1 - B ^ const2)/(R ^ const3 + B ^ const4) end indices_funcs["MRBVI"] = MRBVI_func -function NSTv2_func(::Type{TFL}, N::Number, S2::Number, T::Number) where {TFL<:Number} - return (N - (S2 + T)) / (N + (S2 + T)) +function NSTv2_func(::Type{TFL}, N, S2, T) where {TFL <: Number} + return (N-(S2+T))/(N+(S2+T)) end indices_funcs["NSTv2"] = NSTv2_func -function TCI_func( - ::Type{TFL}, - RE1::Number, - G::Number, - R::Number; - const1::Number=TFL(1.2), - const2::Number=TFL(1.5), - const3::Number=TFL(0.5), -) where {TFL<:Number} - return const1 * (RE1 - G) - const2 * (R - G) * (RE1 / R)^const3 +function TCI_func(::Type{TFL}, RE1, G, R; const1::Number=TFL(1.2), const2::Number=TFL(1.5), const3::Number=TFL(0.5)) where {TFL <: Number} + return const1 * (RE1 - G) - const2 * (R - G) * (RE1 / R) ^ const3 end indices_funcs["TCI"] = TCI_func -function ExR_func( - ::Type{TFL}, R::Number, G::Number; const1::Number=TFL(1.3) -) where {TFL<:Number} +function ExR_func(::Type{TFL}, R, G; const1::Number=TFL(1.3)) where {TFL <: Number} return const1 * R - G end indices_funcs["ExR"] = ExR_func -function CIG_func( - ::Type{TFL}, N::Number, G::Number; const1::Number=TFL(1.0) -) where {TFL<:Number} +function CIG_func(::Type{TFL}, N, G; const1::Number=TFL(1.0)) where {TFL <: Number} return (N / G) - const1 end indices_funcs["CIG"] = CIG_func -function NDPolI_func(::Type{TFL}, VV::Number, VH::Number) where {TFL<:Number} - return (VV - VH) / (VV + VH) +function NDPolI_func(::Type{TFL}, VV, VH) where {TFL <: Number} + return (VV - VH)/(VV + VH) end indices_funcs["NDPolI"] = NDPolI_func -function BCC_func(::Type{TFL}, B::Number, R::Number, G::Number) where {TFL<:Number} +function BCC_func(::Type{TFL}, B, R, G) where {TFL <: Number} return B / (R + G + B) end indices_funcs["BCC"] = BCC_func -function SI_func( - ::Type{TFL}, - B::Number, - G::Number, - R::Number; - const1::Number=TFL(1.0), - const2::Number=TFL(1.0), - const3::Number=TFL(1.0), - const4::Number=TFL(1), - const5::Number=TFL(3), -) where {TFL<:Number} - return ((const1 - B) * (const2 - G) * (const3 - R))^(const4 / const5) +function SI_func(::Type{TFL}, B, G, R; const1::Number=TFL(1.0), const2::Number=TFL(1.0), const3::Number=TFL(1.0), const4::Number=TFL(1), const5::Number=TFL(3)) where {TFL <: Number} + return ((const1 - B) * (const2 - G) * (const3 - R)) ^ (const4/const5) end indices_funcs["SI"] = SI_func -function mSR705_func(::Type{TFL}, RE2::Number, A::Number) where {TFL<:Number} - return (RE2 - A) / (RE2 + A) +function mSR705_func(::Type{TFL}, RE2, A) where {TFL <: Number} + return (RE2 - A)/(RE2 + A) end indices_funcs["mSR705"] = mSR705_func -function SR555_func(::Type{TFL}, RE2::Number, G::Number) where {TFL<:Number} +function SR555_func(::Type{TFL}, RE2, G) where {TFL <: Number} return RE2 / G end indices_funcs["SR555"] = SR555_func -function NBRT1_func( - ::Type{TFL}, - N::Number, - S2::Number, - T::Number; - const1::Number=TFL(10000.0), - const2::Number=TFL(10000.0), -) where {TFL<:Number} +function NBRT1_func(::Type{TFL}, N, S2, T; const1::Number=TFL(10000.0), const2::Number=TFL(10000.0)) where {TFL <: Number} return (N - (S2 * T / const1)) / (N + (S2 * T / const2)) end indices_funcs["NBRT1"] = NBRT1_func -function ANDWI_func( - ::Type{TFL}, B::Number, G::Number, R::Number, N::Number, S1::Number, S2::Number -) where {TFL<:Number} - return (B + G + R - N - S1 - S2) / (B + G + R + N + S1 + S2) +function ANDWI_func(::Type{TFL}, B, G, R, N, S1, S2) where {TFL <: Number} + return (B + G + R - N - S1 - S2)/(B + G + R + N + S1 + S2) end indices_funcs["ANDWI"] = ANDWI_func -function WDVI_func(::Type{TFL}, N::Number, sla::Number, R::Number) where {TFL<:Number} +function WDVI_func(::Type{TFL}, N, sla, R) where {TFL <: Number} return N - sla * R end indices_funcs["WDVI"] = WDVI_func -function NWI_func( - ::Type{TFL}, B::Number, N::Number, S1::Number, S2::Number -) where {TFL<:Number} - return (B - (N + S1 + S2)) / (B + (N + S1 + S2)) +function NWI_func(::Type{TFL}, B, N, S1, S2) where {TFL <: Number} + return (B - (N + S1 + S2))/(B + (N + S1 + S2)) end indices_funcs["NWI"] = NWI_func -function GARI_func( - ::Type{TFL}, N::Number, G::Number, B::Number, R::Number -) where {TFL<:Number} +function GARI_func(::Type{TFL}, N, G, B, R) where {TFL <: Number} return (N - (G - (B - R))) / (N - (G + (B - R))) end indices_funcs["GARI"] = GARI_func -function MCARI705_func( - ::Type{TFL}, RE2::Number, RE1::Number, G::Number; const1::Number=TFL(0.2) -) where {TFL<:Number} +function MCARI705_func(::Type{TFL}, RE2, RE1, G; const1::Number=TFL(0.2)) where {TFL <: Number} return ((RE2 - RE1) - const1 * (RE2 - G)) * (RE2 / RE1) end indices_funcs["MCARI705"] = MCARI705_func -function NormNIR_func(::Type{TFL}, N::Number, G::Number, R::Number) where {TFL<:Number} - return N / (N + G + R) +function NormNIR_func(::Type{TFL}, N, G, R) where {TFL <: Number} + return N/(N + G + R) end indices_funcs["NormNIR"] = NormNIR_func -function SWM_func( - ::Type{TFL}, B::Number, G::Number, N::Number, S1::Number -) where {TFL<:Number} - return (B + G) / (N + S1) +function SWM_func(::Type{TFL}, B, G, N, S1) where {TFL <: Number} + return (B + G)/(N + S1) end indices_funcs["SWM"] = SWM_func -function mND705_func(::Type{TFL}, RE2::Number, RE1::Number, A::Number) where {TFL<:Number} - return (RE2 - RE1) / (RE2 + RE1 - A) +function mND705_func(::Type{TFL}, RE2, RE1, A) where {TFL <: Number} + return (RE2 - RE1)/(RE2 + RE1 - A) end indices_funcs["mND705"] = mND705_func -function SAVI_func( - ::Type{TFL}, L::Number, N::Number, R::Number; const1::Number=TFL(1.0) -) where {TFL<:Number} +function SAVI_func(::Type{TFL}, L, N, R; const1::Number=TFL(1.0)) where {TFL <: Number} return (const1 + L) * (N - R) / (N + R + L) end indices_funcs["SAVI"] = SAVI_func -function EVI2_func( - ::Type{TFL}, g::Number, N::Number, R::Number, L::Number; const1::Number=TFL(2.4) -) where {TFL<:Number} +function EVI2_func(::Type{TFL}, g, N, R, L; const1::Number=TFL(2.4)) where {TFL <: Number} return g * (N - R) / (N + const1 * R + L) end indices_funcs["EVI2"] = EVI2_func -function DPDD_func( - ::Type{TFL}, VV::Number, VH::Number; const1::Number=TFL(2.0), const2::Number=TFL(0.5) -) where {TFL<:Number} - return (VV + VH) / const1^const2 +function DPDD_func(::Type{TFL}, VV, VH; const1::Number=TFL(2.0), const2::Number=TFL(0.5)) where {TFL <: Number} + return (VV + VH)/const1 ^ const2 end indices_funcs["DPDD"] = DPDD_func -function NIRvP_func(::Type{TFL}, N::Number, R::Number, PAR::Number) where {TFL<:Number} +function NIRvP_func(::Type{TFL}, N, R, PAR) where {TFL <: Number} return ((N - R) / (N + R)) * N * PAR end indices_funcs["NIRvP"] = NIRvP_func -function VHVVD_func(::Type{TFL}, VH::Number, VV::Number) where {TFL<:Number} +function VHVVD_func(::Type{TFL}, VH, VV) where {TFL <: Number} return VH - VV end indices_funcs["VHVVD"] = VHVVD_func -function SR3_func(::Type{TFL}, N2::Number, G::Number, RE1::Number) where {TFL<:Number} - return N2 / (G * RE1) +function SR3_func(::Type{TFL}, N2, G, RE1) where {TFL <: Number} + return N2/(G * RE1) end indices_funcs["SR3"] = SR3_func -function NBR_func(::Type{TFL}, N::Number, S2::Number) where {TFL<:Number} +function NBR_func(::Type{TFL}, N, S2) where {TFL <: Number} return (N - S2) / (N + S2) end indices_funcs["NBR"] = NBR_func -function EMBI_func( - ::Type{TFL}, - S1::Number, - S2::Number, - N::Number, - G::Number; - const1::Number=TFL(0.5), - const2::Number=TFL(0.5), - const3::Number=TFL(0.5), - const4::Number=TFL(1.5), -) where {TFL<:Number} - return ((((S1 - S2 - N) / (S1 + S2 + N)) + const1) - ((G - S1) / (G + S1)) - const2) / - ((((S1 - S2 - N) / (S1 + S2 + N)) + const3) + ((G - S1) / (G + S1)) + const4) +function EMBI_func(::Type{TFL}, S1, S2, N, G; const1::Number=TFL(0.5), const2::Number=TFL(0.5), const3::Number=TFL(0.5), const4::Number=TFL(1.5)) where {TFL <: Number} + return ((((S1 - S2 - N)/(S1 + S2 + N)) + const1) - ((G - S1)/(G + S1)) - const2)/((((S1 - S2 - N)/(S1 + S2 + N)) + const3) + ((G - S1)/(G + S1)) + const4) end indices_funcs["EMBI"] = EMBI_func -function GDVI_func(::Type{TFL}, N::Number, nexp::Number, R::Number) where {TFL<:Number} - return ((N^nexp) - (R^nexp)) / ((N^nexp) + (R^nexp)) +function GDVI_func(::Type{TFL}, N, nexp, R) where {TFL <: Number} + return ((N ^ nexp) - (R ^ nexp)) / ((N ^ nexp) + (R ^ nexp)) end indices_funcs["GDVI"] = GDVI_func -function MCARIOSAVI_func( - ::Type{TFL}, - RE1::Number, - R::Number, - G::Number, - N::Number; - const1::Number=TFL(0.2), - const2::Number=TFL(1.16), - const3::Number=TFL(0.16), -) where {TFL<:Number} - return (((RE1 - R) - const1 * (RE1 - G)) * (RE1 / R)) / - (const2 * (N - R) / (N + R + const3)) +function MCARIOSAVI_func(::Type{TFL}, RE1, R, G, N; const1::Number=TFL(0.2), const2::Number=TFL(1.16), const3::Number=TFL(0.16)) where {TFL <: Number} + return (((RE1 - R) - const1 * (RE1 - G)) * (RE1 / R)) / (const2 * (N - R) / (N + R + const3)) end indices_funcs["MCARIOSAVI"] = MCARIOSAVI_func -function EBI_func( - ::Type{TFL}, R::Number, G::Number, B::Number, epsilon::Number -) where {TFL<:Number} - return (R + G + B) / ((G / B) * (R - B + epsilon)) +function EBI_func(::Type{TFL}, R, G, B, epsilon) where {TFL <: Number} + return (R + G + B)/((G/B) * (R - B + epsilon)) end indices_funcs["EBI"] = EBI_func -function AWEInsh_func( - ::Type{TFL}, - G::Number, - S1::Number, - N::Number, - S2::Number; - const1::Number=TFL(4.0), - const2::Number=TFL(0.25), - const3::Number=TFL(2.75), -) where {TFL<:Number} +function AWEInsh_func(::Type{TFL}, G, S1, N, S2; const1::Number=TFL(4.0), const2::Number=TFL(0.25), const3::Number=TFL(2.75)) where {TFL <: Number} return const1 * (G - S1) - const2 * N + const3 * S2 end indices_funcs["AWEInsh"] = AWEInsh_func -function NDYI_func(::Type{TFL}, G::Number, B::Number) where {TFL<:Number} +function NDYI_func(::Type{TFL}, G, B) where {TFL <: Number} return (G - B) / (G + B) end indices_funcs["NDYI"] = NDYI_func -function RCC_func(::Type{TFL}, R::Number, G::Number, B::Number) where {TFL<:Number} +function RCC_func(::Type{TFL}, R, G, B) where {TFL <: Number} return R / (R + G + B) end indices_funcs["RCC"] = RCC_func -function ARVI_func( - ::Type{TFL}, N::Number, R::Number, gamma::Number, B::Number -) where {TFL<:Number} +function ARVI_func(::Type{TFL}, N, R, gamma, B) where {TFL <: Number} return (N - (R - gamma * (R - B))) / (N + (R - gamma * (R - B))) end indices_funcs["ARVI"] = ARVI_func -function IPVI_func(::Type{TFL}, N::Number, R::Number) where {TFL<:Number} - return N / (N + R) +function IPVI_func(::Type{TFL}, N, R) where {TFL <: Number} + return N/(N + R) end indices_funcs["IPVI"] = IPVI_func -function NDSIWV_func(::Type{TFL}, G::Number, Y::Number) where {TFL<:Number} - return (G - Y) / (G + Y) +function NDSIWV_func(::Type{TFL}, G, Y) where {TFL <: Number} + return (G - Y)/(G + Y) end indices_funcs["NDSIWV"] = NDSIWV_func -function DSWI4_func(::Type{TFL}, G::Number, R::Number) where {TFL<:Number} - return G / R +function DSWI4_func(::Type{TFL}, G, R) where {TFL <: Number} + return G/R end indices_funcs["DSWI4"] = DSWI4_func -function VVVHR_func(::Type{TFL}, VV::Number, VH::Number) where {TFL<:Number} - return VV / VH +function VVVHR_func(::Type{TFL}, VV, VH) where {TFL <: Number} + return VV/VH end indices_funcs["VVVHR"] = VVVHR_func -function kNDVI_func(::Type{TFL}, kNN::Number, kNR::Number) where {TFL<:Number} - return (kNN - kNR) / (kNN + kNR) +function kNDVI_func(::Type{TFL}, kNN, kNR) where {TFL <: Number} + return (kNN - kNR)/(kNN + kNR) end indices_funcs["kNDVI"] = kNDVI_func -function GOSAVI_func( - ::Type{TFL}, N::Number, G::Number; const1::Number=TFL(0.16) -) where {TFL<:Number} +function GOSAVI_func(::Type{TFL}, N, G; const1::Number=TFL(0.16)) where {TFL <: Number} return (N - G) / (N + G + const1) end indices_funcs["GOSAVI"] = GOSAVI_func -function OSAVI_func( - ::Type{TFL}, N::Number, R::Number; const1::Number=TFL(0.16) -) where {TFL<:Number} +function OSAVI_func(::Type{TFL}, N, R; const1::Number=TFL(0.16)) where {TFL <: Number} return (N - R) / (N + R + const1) end indices_funcs["OSAVI"] = OSAVI_func -function AFRI2100_func( - ::Type{TFL}, N::Number, S2::Number; const1::Number=TFL(0.5), const2::Number=TFL(0.5) -) where {TFL<:Number} +function AFRI2100_func(::Type{TFL}, N, S2; const1::Number=TFL(0.5), const2::Number=TFL(0.5)) where {TFL <: Number} return (N - const1 * S2) / (N + const2 * S2) end indices_funcs["AFRI2100"] = AFRI2100_func -function GNDVI_func(::Type{TFL}, N::Number, G::Number) where {TFL<:Number} - return (N - G) / (N + G) +function GNDVI_func(::Type{TFL}, N, G) where {TFL <: Number} + return (N - G)/(N + G) end indices_funcs["GNDVI"] = GNDVI_func -function LSWI_func(::Type{TFL}, N::Number, S1::Number) where {TFL<:Number} - return (N - S1) / (N + S1) +function LSWI_func(::Type{TFL}, N, S1) where {TFL <: Number} + return (N - S1)/(N + S1) end indices_funcs["LSWI"] = LSWI_func -function UI_func(::Type{TFL}, S2::Number, N::Number) where {TFL<:Number} - return (S2 - N) / (S2 + N) +function UI_func(::Type{TFL}, S2, N) where {TFL <: Number} + return (S2 - N)/(S2 + N) end indices_funcs["UI"] = UI_func -function S2WI_func(::Type{TFL}, RE1::Number, S2::Number) where {TFL<:Number} - return (RE1 - S2) / (RE1 + S2) +function S2WI_func(::Type{TFL}, RE1, S2) where {TFL <: Number} + return (RE1 - S2)/(RE1 + S2) end indices_funcs["S2WI"] = S2WI_func -function VIBI_func(::Type{TFL}, N::Number, R::Number, S1::Number) where {TFL<:Number} - return ((N - R) / (N + R)) / (((N - R) / (N + R)) + ((S1 - N) / (S1 + N))) +function VIBI_func(::Type{TFL}, N, R, S1) where {TFL <: Number} + return ((N-R)/(N+R))/(((N-R)/(N+R)) + ((S1-N)/(S1+N))) end indices_funcs["VIBI"] = VIBI_func -function NSDSI1_func(::Type{TFL}, S1::Number, S2::Number) where {TFL<:Number} - return (S1 - S2) / S1 +function NSDSI1_func(::Type{TFL}, S1, S2) where {TFL <: Number} + return (S1-S2)/S1 end indices_funcs["NSDSI1"] = NSDSI1_func -function VVVHS_func(::Type{TFL}, VV::Number, VH::Number) where {TFL<:Number} +function VVVHS_func(::Type{TFL}, VV, VH) where {TFL <: Number} return VV + VH end indices_funcs["VVVHS"] = VVVHS_func -function VI6T_func( - ::Type{TFL}, - N::Number, - T::Number; - const1::Number=TFL(10000.0), - const2::Number=TFL(10000.0), -) where {TFL<:Number} - return (N - T / const1) / (N + T / const2) +function VI6T_func(::Type{TFL}, N, T; const1::Number=TFL(10000.0), const2::Number=TFL(10000.0)) where {TFL <: Number} + return (N - T/const1)/(N + T/const2) end indices_funcs["VI6T"] = VI6T_func -function kVARI_func(::Type{TFL}, kGG::Number, kGR::Number, kGB::Number) where {TFL<:Number} +function kVARI_func(::Type{TFL}, kGG, kGR, kGB) where {TFL <: Number} return (kGG - kGR) / (kGG + kGR - kGB) end indices_funcs["kVARI"] = kVARI_func -function BWDRVI_func(::Type{TFL}, alpha::Number, N::Number, B::Number) where {TFL<:Number} +function BWDRVI_func(::Type{TFL}, alpha, N, B) where {TFL <: Number} return (alpha * N - B) / (alpha * N + B) end indices_funcs["BWDRVI"] = BWDRVI_func -function BAIM_func( - ::Type{TFL}, - N::Number, - S2::Number; - const1::Number=TFL(1.0), - const2::Number=TFL(0.05), - const3::Number=TFL(2.0), - const4::Number=TFL(0.2), - const5::Number=TFL(2.0), -) where {TFL<:Number} - return const1 / ((const2 - N)^const3) + ((const4 - S2)^const5) +function BAIM_func(::Type{TFL}, N, S2; const1::Number=TFL(1.0), const2::Number=TFL(0.05), const3::Number=TFL(2.0), const4::Number=TFL(0.2), const5::Number=TFL(2.0)) where {TFL <: Number} + return const1/((const2 - N) ^ const3) + ((const4 - S2) ^ const5) end indices_funcs["BAIM"] = BAIM_func -function VDDPI_func(::Type{TFL}, VV::Number, VH::Number) where {TFL<:Number} - return (VV + VH) / VV +function VDDPI_func(::Type{TFL}, VV, VH) where {TFL <: Number} + return (VV + VH)/VV end indices_funcs["VDDPI"] = VDDPI_func -function BIXS_func( - ::Type{TFL}, - G::Number, - R::Number; - const1::Number=TFL(2.0), - const2::Number=TFL(2.0), - const3::Number=TFL(2.0), - const4::Number=TFL(0.5), -) where {TFL<:Number} - return (((G^const1) + (R^const2)) / const3)^const4 +function BIXS_func(::Type{TFL}, G, R; const1::Number=TFL(2.0), const2::Number=TFL(2.0), const3::Number=TFL(2.0), const4::Number=TFL(0.5)) where {TFL <: Number} + return (((G^const1)+(R^const2))/const3)^const4 end indices_funcs["BIXS"] = BIXS_func -function MCARIOSAVI705_func( - ::Type{TFL}, - RE2::Number, - RE1::Number, - G::Number; - const1::Number=TFL(0.2), - const2::Number=TFL(1.16), - const3::Number=TFL(0.16), -) where {TFL<:Number} - return (((RE2 - RE1) - const1 * (RE2 - G)) * (RE2 / RE1)) / - (const2 * (RE2 - RE1) / (RE2 + RE1 + const3)) +function MCARIOSAVI705_func(::Type{TFL}, RE2, RE1, G; const1::Number=TFL(0.2), const2::Number=TFL(1.16), const3::Number=TFL(0.16)) where {TFL <: Number} + return (((RE2 - RE1) - const1 * (RE2 - G)) * (RE2 / RE1)) / (const2 * (RE2 - RE1) / (RE2 + RE1 + const3)) end indices_funcs["MCARIOSAVI705"] = MCARIOSAVI705_func -function NDSI_func(::Type{TFL}, G::Number, S1::Number) where {TFL<:Number} +function NDSI_func(::Type{TFL}, G, S1) where {TFL <: Number} return (G - S1) / (G + S1) end indices_funcs["NDSI"] = NDSI_func -function NDVI_func(::Type{TFL}, N::Number, R::Number) where {TFL<:Number} - return (N - R) / (N + R) +function NDVI_func(::Type{TFL}, N, R) where {TFL <: Number} + return (N - R)/(N + R) end indices_funcs["NDVI"] = NDVI_func -function MCARI_func( - ::Type{TFL}, RE1::Number, R::Number, G::Number; const1::Number=TFL(0.2) -) where {TFL<:Number} +function MCARI_func(::Type{TFL}, RE1, R, G; const1::Number=TFL(0.2)) where {TFL <: Number} return ((RE1 - R) - const1 * (RE1 - G)) * (RE1 / R) end indices_funcs["MCARI"] = MCARI_func -function MLSWI26_func( - ::Type{TFL}, N::Number, S1::Number; const1::Number=TFL(1.0), const2::Number=TFL(1.0) -) where {TFL<:Number} - return (const1 - N - S1) / (const2 - N + S1) +function MLSWI26_func(::Type{TFL}, N, S1; const1::Number=TFL(1.0), const2::Number=TFL(1.0)) where {TFL <: Number} + return (const1 - N - S1)/(const2 - N + S1) end indices_funcs["MLSWI26"] = MLSWI26_func -function VgNIRBI_func(::Type{TFL}, G::Number, N::Number) where {TFL<:Number} - return (G - N) / (G + N) +function VgNIRBI_func(::Type{TFL}, G, N) where {TFL <: Number} + return (G - N)/(G + N) end indices_funcs["VgNIRBI"] = VgNIRBI_func -function TCARIOSAVI_func( - ::Type{TFL}, - RE1::Number, - R::Number, - G::Number, - N::Number; - const1::Number=TFL(3), - const2::Number=TFL(0.2), - const3::Number=TFL(1.16), - const4::Number=TFL(0.16), -) where {TFL<:Number} - return (const1 * ((RE1 - R) - const2 * (RE1 - G) * (RE1 / R))) / - (const3 * (N - R) / (N + R + const4)) +function TCARIOSAVI_func(::Type{TFL}, RE1, R, G, N; const1::Number=TFL(3), const2::Number=TFL(0.2), const3::Number=TFL(1.16), const4::Number=TFL(0.16)) where {TFL <: Number} + return (const1 * ((RE1 - R) - const2 * (RE1 - G) * (RE1 / R))) / (const3 * (N - R) / (N + R + const4)) end indices_funcs["TCARIOSAVI"] = TCARIOSAVI_func -function AVI_func( - ::Type{TFL}, - N::Number, - R::Number; - const1::Number=TFL(1.0), - const2::Number=TFL(1), - const3::Number=TFL(3), -) where {TFL<:Number} - return (N * (const1 - R) * (N - R))^(const2 / const3) +function AVI_func(::Type{TFL}, N, R; const1::Number=TFL(1.0), const2::Number=TFL(1), const3::Number=TFL(3)) where {TFL <: Number} + return (N * (const1 - R) * (N - R)) ^ (const2/const3) end indices_funcs["AVI"] = AVI_func -function NormR_func(::Type{TFL}, R::Number, N::Number, G::Number) where {TFL<:Number} - return R / (N + G + R) +function NormR_func(::Type{TFL}, R, N, G) where {TFL <: Number} + return R/(N + G + R) end indices_funcs["NormR"] = NormR_func -function VHVVP_func(::Type{TFL}, VH::Number, VV::Number) where {TFL<:Number} +function VHVVP_func(::Type{TFL}, VH, VV) where {TFL <: Number} return VH * VV end indices_funcs["VHVVP"] = VHVVP_func -function NSDS_func(::Type{TFL}, S1::Number, S2::Number) where {TFL<:Number} - return (S1 - S2) / (S1 + S2) +function NSDS_func(::Type{TFL}, S1, S2) where {TFL <: Number} + return (S1 - S2)/(S1 + S2) end indices_funcs["NSDS"] = NSDS_func -function NDSWIR_func(::Type{TFL}, N::Number, S1::Number) where {TFL<:Number} - return (N - S1) / (N + S1) +function NDSWIR_func(::Type{TFL}, N, S1) where {TFL <: Number} + return (N - S1)/(N + S1) end indices_funcs["NDSWIR"] = NDSWIR_func -function REDSI_func( - ::Type{TFL}, - RE3::Number, - R::Number, - RE1::Number; - const1::Number=TFL(705.0), - const2::Number=TFL(665.0), - const3::Number=TFL(783.0), - const4::Number=TFL(665.0), - const5::Number=TFL(2.0), -) where {TFL<:Number} +function REDSI_func(::Type{TFL}, RE3, R, RE1; const1::Number=TFL(705.0), const2::Number=TFL(665.0), const3::Number=TFL(783.0), const4::Number=TFL(665.0), const5::Number=TFL(2.0)) where {TFL <: Number} return ((const1 - const2) * (RE3 - R) - (const3 - const4) * (RE1 - R)) / (const5 * R) end indices_funcs["REDSI"] = REDSI_func -function DBI_func( - ::Type{TFL}, B::Number, T1::Number, N::Number, R::Number -) where {TFL<:Number} - return ((B - T1) / (B + T1)) - ((N - R) / (N + R)) +function DBI_func(::Type{TFL}, B, T1, N, R) where {TFL <: Number} + return ((B - T1)/(B + T1)) - ((N - R)/(N + R)) end indices_funcs["DBI"] = DBI_func -function ND705_func(::Type{TFL}, RE2::Number, RE1::Number) where {TFL<:Number} - return (RE2 - RE1) / (RE2 + RE1) +function ND705_func(::Type{TFL}, RE2, RE1) where {TFL <: Number} + return (RE2 - RE1)/(RE2 + RE1) end indices_funcs["ND705"] = ND705_func -function MNDWI_func(::Type{TFL}, G::Number, S1::Number) where {TFL<:Number} +function MNDWI_func(::Type{TFL}, G, S1) where {TFL <: Number} return (G - S1) / (G + S1) end indices_funcs["MNDWI"] = MNDWI_func -function RGBVI_func( - ::Type{TFL}, - G::Number, - B::Number, - R::Number; - const1::Number=TFL(2.0), - const2::Number=TFL(2.0), -) where {TFL<:Number} - return (G^const1 - B * R) / (G^const2 + B * R) +function RGBVI_func(::Type{TFL}, G, B, R; const1::Number=TFL(2.0), const2::Number=TFL(2.0)) where {TFL <: Number} + return (G ^ const1 - B * R)/(G ^ const2 + B * R) end indices_funcs["RGBVI"] = RGBVI_func -function MSI_func(::Type{TFL}, S1::Number, N::Number) where {TFL<:Number} - return S1 / N +function MSI_func(::Type{TFL}, S1, N) where {TFL <: Number} + return S1/N end indices_funcs["MSI"] = MSI_func -function RGRI_func(::Type{TFL}, R::Number, G::Number) where {TFL<:Number} - return R / G +function RGRI_func(::Type{TFL}, R, G) where {TFL <: Number} + return R/G end indices_funcs["RGRI"] = RGRI_func -function GRVI_func(::Type{TFL}, N::Number, G::Number) where {TFL<:Number} - return N / G +function GRVI_func(::Type{TFL}, N, G) where {TFL <: Number} + return N/G end indices_funcs["GRVI"] = GRVI_func -function VARI_func(::Type{TFL}, G::Number, R::Number, B::Number) where {TFL<:Number} +function VARI_func(::Type{TFL}, G, R, B) where {TFL <: Number} return (G - R) / (G + R - B) end indices_funcs["VARI"] = VARI_func -function NMDI_func(::Type{TFL}, N::Number, S1::Number, S2::Number) where {TFL<:Number} - return (N - (S1 - S2)) / (N + (S1 - S2)) +function NMDI_func(::Type{TFL}, N, S1, S2) where {TFL <: Number} + return (N - (S1 - S2))/(N + (S1 - S2)) end indices_funcs["NMDI"] = NMDI_func -function RENDVI_func(::Type{TFL}, RE2::Number, RE1::Number) where {TFL<:Number} - return (RE2 - RE1) / (RE2 + RE1) +function RENDVI_func(::Type{TFL}, RE2, RE1) where {TFL <: Number} + return (RE2 - RE1)/(RE2 + RE1) end indices_funcs["RENDVI"] = RENDVI_func -function NSDSI2_func(::Type{TFL}, S1::Number, S2::Number) where {TFL<:Number} - return (S1 - S2) / S2 +function NSDSI2_func(::Type{TFL}, S1, S2) where {TFL <: Number} + return (S1-S2)/S2 end indices_funcs["NSDSI2"] = NSDSI2_func -function TCARI_func( - ::Type{TFL}, - RE1::Number, - R::Number, - G::Number; - const1::Number=TFL(3), - const2::Number=TFL(0.2), -) where {TFL<:Number} +function TCARI_func(::Type{TFL}, RE1, R, G; const1::Number=TFL(3), const2::Number=TFL(0.2)) where {TFL <: Number} return const1 * ((RE1 - R) - const2 * (RE1 - G) * (RE1 / R)) end indices_funcs["TCARI"] = TCARI_func -function kEVI_func( - ::Type{TFL}, - g::Number, - kNN::Number, - kNR::Number, - C1::Number, - C2::Number, - kNB::Number, - kNL::Number, -) where {TFL<:Number} +function kEVI_func(::Type{TFL}, g, kNN, kNR, C1, C2, kNB, kNL) where {TFL <: Number} return g * (kNN - kNR) / (kNN + C1 * kNR - C2 * kNB + kNL) end indices_funcs["kEVI"] = kEVI_func -function ARI2_func( - ::Type{TFL}, - N::Number, - G::Number, - RE1::Number; - const1::Number=TFL(1), - const2::Number=TFL(1), -) where {TFL<:Number} +function ARI2_func(::Type{TFL}, N, G, RE1; const1::Number=TFL(1), const2::Number=TFL(1)) where {TFL <: Number} return N * ((const1 / G) - (const2 / RE1)) end indices_funcs["ARI2"] = ARI2_func -function GM1_func(::Type{TFL}, RE2::Number, G::Number) where {TFL<:Number} - return RE2 / G +function GM1_func(::Type{TFL}, RE2, G) where {TFL <: Number} + return RE2/G end indices_funcs["GM1"] = GM1_func -function SLAVI_func(::Type{TFL}, N::Number, R::Number, S2::Number) where {TFL<:Number} - return N / (R + S2) +function SLAVI_func(::Type{TFL}, N, R, S2) where {TFL <: Number} + return N/(R + S2) end indices_funcs["SLAVI"] = SLAVI_func -function GVMI_func( - ::Type{TFL}, - N::Number, - S2::Number; - const1::Number=TFL(0.1), - const2::Number=TFL(0.02), - const3::Number=TFL(0.1), - const4::Number=TFL(0.02), -) where {TFL<:Number} +function GVMI_func(::Type{TFL}, N, S2; const1::Number=TFL(0.1), const2::Number=TFL(0.02), const3::Number=TFL(0.1), const4::Number=TFL(0.02)) where {TFL <: Number} return ((N + const1) - (S2 + const2)) / ((N + const3) + (S2 + const4)) end indices_funcs["GVMI"] = GVMI_func -function NBSIMS_func( - ::Type{TFL}, - G::Number, - R::Number, - N::Number, - B::Number, - S2::Number, - S1::Number; - const1::Number=TFL(0.36), -) where {TFL<:Number} - return const1 * (G + R + N) - (((B + S2) / G) + S1) +function NBSIMS_func(::Type{TFL}, G, R, N, B, S2, S1; const1::Number=TFL(0.36)) where {TFL <: Number} + return const1 * (G + R + N) - (((B + S2)/G) + S1) end indices_funcs["NBSIMS"] = NBSIMS_func -function NBLIOLI_func(::Type{TFL}, R::Number, T1::Number) where {TFL<:Number} - return (R - T1) / (R + T1) +function NBLIOLI_func(::Type{TFL}, R, T1) where {TFL <: Number} + return (R - T1)/(R + T1) end indices_funcs["NBLIOLI"] = NBLIOLI_func -function AWEIsh_func( - ::Type{TFL}, - B::Number, - G::Number, - N::Number, - S1::Number, - S2::Number; - const1::Number=TFL(2.5), - const2::Number=TFL(1.5), - const3::Number=TFL(0.25), -) where {TFL<:Number} +function AWEIsh_func(::Type{TFL}, B, G, N, S1, S2; const1::Number=TFL(2.5), const2::Number=TFL(1.5), const3::Number=TFL(0.25)) where {TFL <: Number} return B + const1 * G - const2 * (N + S1) - const3 * S2 end indices_funcs["AWEIsh"] = AWEIsh_func -function RFDI_func(::Type{TFL}, HH::Number, HV::Number) where {TFL<:Number} - return (HH - HV) / (HH + HV) +function RFDI_func(::Type{TFL}, HH, HV) where {TFL <: Number} + return (HH - HV)/(HH + HV) end indices_funcs["RFDI"] = RFDI_func -function SIPI_func(::Type{TFL}, N::Number, A::Number, R::Number) where {TFL<:Number} +function SIPI_func(::Type{TFL}, N, A, R) where {TFL <: Number} return (N - A) / (N - R) end indices_funcs["SIPI"] = SIPI_func -function DpRVIHH_func( - ::Type{TFL}, HV::Number, HH::Number; const1::Number=TFL(4.0) -) where {TFL<:Number} - return (const1 * HV) / (HH + HV) +function DpRVIHH_func(::Type{TFL}, HV, HH; const1::Number=TFL(4.0)) where {TFL <: Number} + return (const1 * HV)/(HH + HV) end indices_funcs["DpRVIHH"] = DpRVIHH_func -function NDISImndwi_func( - ::Type{TFL}, - T::Number, - G::Number, - S1::Number, - N::Number; - const1::Number=TFL(3.0), - const2::Number=TFL(3.0), -) where {TFL<:Number} - return (T - (((G - S1) / (G + S1)) + N + S1) / const1) / - (T + (((G - S1) / (G + S1)) + N + S1) / const2) +function NDISImndwi_func(::Type{TFL}, T, G, S1, N; const1::Number=TFL(3.0), const2::Number=TFL(3.0)) where {TFL <: Number} + return (T - (((G - S1)/(G + S1)) + N + S1) / const1)/(T + (((G - S1)/(G + S1)) + N + S1) / const2) end indices_funcs["NDISImndwi"] = NDISImndwi_func -function MBWI_func( - ::Type{TFL}, omega::Number, G::Number, R::Number, N::Number, S1::Number, S2::Number -) where {TFL<:Number} +function MBWI_func(::Type{TFL}, omega, G, R, N, S1, S2) where {TFL <: Number} return (omega * G) - R - N - S1 - S2 end indices_funcs["MBWI"] = MBWI_func -function GM2_func(::Type{TFL}, RE2::Number, RE1::Number) where {TFL<:Number} - return RE2 / RE1 +function GM2_func(::Type{TFL}, RE2, RE1) where {TFL <: Number} + return RE2/RE1 end indices_funcs["GM2"] = GM2_func -function VVVHD_func(::Type{TFL}, VV::Number, VH::Number) where {TFL<:Number} +function VVVHD_func(::Type{TFL}, VV, VH) where {TFL <: Number} return VV - VH end indices_funcs["VVVHD"] = VVVHD_func -function VrNIRBI_func(::Type{TFL}, R::Number, N::Number) where {TFL<:Number} - return (R - N) / (R + N) +function VrNIRBI_func(::Type{TFL}, R, N) where {TFL <: Number} + return (R - N)/(R + N) end indices_funcs["VrNIRBI"] = VrNIRBI_func -function SEVI_func( - ::Type{TFL}, N::Number, R::Number, fdelta::Number; const1::Number=TFL(1.0) -) where {TFL<:Number} - return (N / R) + fdelta * (const1 / R) +function SEVI_func(::Type{TFL}, N, R, fdelta; const1::Number=TFL(1.0)) where {TFL <: Number} + return (N/R) + fdelta * (const1/R) end indices_funcs["SEVI"] = SEVI_func -function NSTv1_func(::Type{TFL}, N::Number, S2::Number, T::Number) where {TFL<:Number} - return ((N - S2) / (N + S2)) * T +function NSTv1_func(::Type{TFL}, N, S2, T) where {TFL <: Number} + return ((N-S2)/(N+S2))*T end indices_funcs["NSTv1"] = NSTv1_func -function NDISIndwi_func( - ::Type{TFL}, - T::Number, - G::Number, - N::Number, - S1::Number; - const1::Number=TFL(3.0), - const2::Number=TFL(3.0), -) where {TFL<:Number} - return (T - (((G - N) / (G + N)) + N + S1) / const1) / - (T + (((G - N) / (G + N)) + N + S1) / const2) +function NDISIndwi_func(::Type{TFL}, T, G, N, S1; const1::Number=TFL(3.0), const2::Number=TFL(3.0)) where {TFL <: Number} + return (T - (((G - N)/(G + N)) + N + S1) / const1)/(T + (((G - N)/(G + N)) + N + S1) / const2) end indices_funcs["NDISIndwi"] = NDISIndwi_func -function NDGlaI_func(::Type{TFL}, G::Number, R::Number) where {TFL<:Number} - return (G - R) / (G + R) +function NDGlaI_func(::Type{TFL}, G, R) where {TFL <: Number} + return (G - R)/(G + R) end indices_funcs["NDGlaI"] = NDGlaI_func -function GBNDVI_func(::Type{TFL}, N::Number, G::Number, B::Number) where {TFL<:Number} - return (N - (G + B)) / (N + (G + B)) +function GBNDVI_func(::Type{TFL}, N, G, B) where {TFL <: Number} + return (N - (G + B))/(N + (G + B)) end indices_funcs["GBNDVI"] = GBNDVI_func -function BRBA_func(::Type{TFL}, R::Number, S1::Number) where {TFL<:Number} - return R / S1 +function BRBA_func(::Type{TFL}, R, S1) where {TFL <: Number} + return R/S1 end indices_funcs["BRBA"] = BRBA_func -function CSI_func(::Type{TFL}, N::Number, S2::Number) where {TFL<:Number} - return N / S2 +function CSI_func(::Type{TFL}, N, S2) where {TFL <: Number} + return N/S2 end indices_funcs["CSI"] = CSI_func -function NDVIT_func( - ::Type{TFL}, - N::Number, - R::Number, - T::Number; - const1::Number=TFL(10000.0), - const2::Number=TFL(10000.0), -) where {TFL<:Number} - return (N - (R * T / const1)) / (N + (R * T / const2)) +function NDVIT_func(::Type{TFL}, N, R, T; const1::Number=TFL(10000.0), const2::Number=TFL(10000.0)) where {TFL <: Number} + return (N - (R * T / const1))/(N + (R * T / const2)) end indices_funcs["NDVIT"] = NDVIT_func -function MNDVI_func(::Type{TFL}, N::Number, S2::Number) where {TFL<:Number} - return (N - S2) / (N + S2) +function MNDVI_func(::Type{TFL}, N, S2) where {TFL <: Number} + return (N - S2)/(N + S2) end indices_funcs["MNDVI"] = MNDVI_func -function BAI_func( - ::Type{TFL}, - R::Number, - N::Number; - const1::Number=TFL(1.0), - const2::Number=TFL(0.1), - const3::Number=TFL(2.0), - const4::Number=TFL(0.06), - const5::Number=TFL(2.0), -) where {TFL<:Number} - return const1 / ((const2 - R)^const3 + (const4 - N)^const5) +function BAI_func(::Type{TFL}, R, N; const1::Number=TFL(1.0), const2::Number=TFL(0.1), const3::Number=TFL(2.0), const4::Number=TFL(0.06), const5::Number=TFL(2.0)) where {TFL <: Number} + return const1 / ((const2 - R) ^ const3 + (const4 - N) ^ const5) end indices_funcs["BAI"] = BAI_func -function TRRVI_func( - ::Type{TFL}, RE2::Number, R::Number, N::Number; const1::Number=TFL(1.0) -) where {TFL<:Number} +function TRRVI_func(::Type{TFL}, RE2, R, N; const1::Number=TFL(1.0)) where {TFL <: Number} return ((RE2 - R) / (RE2 + R)) / (((N - R) / (N + R)) + const1) end indices_funcs["TRRVI"] = TRRVI_func -function EVI_func( - ::Type{TFL}, - g::Number, - N::Number, - R::Number, - C1::Number, - C2::Number, - B::Number, - L::Number, -) where {TFL<:Number} +function EVI_func(::Type{TFL}, g, N, R, C1, C2, B, L) where {TFL <: Number} return g * (N - R) / (N + C1 * R - C2 * B + L) end indices_funcs["EVI"] = EVI_func -function DBSI_func( - ::Type{TFL}, S1::Number, G::Number, N::Number, R::Number -) where {TFL<:Number} - return ((S1 - G) / (S1 + G)) - ((N - R) / (N + R)) +function DBSI_func(::Type{TFL}, S1, G, N, R) where {TFL <: Number} + return ((S1 - G)/(S1 + G)) - ((N - R)/(N + R)) end indices_funcs["DBSI"] = DBSI_func -function NDPonI_func(::Type{TFL}, S1::Number, G::Number) where {TFL<:Number} - return (S1 - G) / (S1 + G) +function NDPonI_func(::Type{TFL}, S1, G) where {TFL <: Number} + return (S1-G)/(S1+G) end indices_funcs["NDPonI"] = NDPonI_func -function NLI_func( - ::Type{TFL}, N::Number, R::Number; const1::Number=TFL(2), const2::Number=TFL(2) -) where {TFL<:Number} - return ((N^const1) - R) / ((N^const2) + R) +function NLI_func(::Type{TFL}, N, R; const1::Number=TFL(2), const2::Number=TFL(2)) where {TFL <: Number} + return ((N ^ const1) - R)/((N ^ const2) + R) end indices_funcs["NLI"] = NLI_func -function NDSaII_func(::Type{TFL}, R::Number, S1::Number) where {TFL<:Number} +function NDSaII_func(::Type{TFL}, R, S1) where {TFL <: Number} return (R - S1) / (R + S1) end indices_funcs["NDSaII"] = NDSaII_func -function MSR705_func( - ::Type{TFL}, - RE2::Number, - RE1::Number; - const1::Number=TFL(1), - const2::Number=TFL(1), - const3::Number=TFL(0.5), -) where {TFL<:Number} - return (RE2 / RE1 - const1) / ((RE2 / RE1 + const2)^const3) +function MSR705_func(::Type{TFL}, RE2, RE1; const1::Number=TFL(1), const2::Number=TFL(1), const3::Number=TFL(0.5)) where {TFL <: Number} + return (RE2 / RE1 - const1) / ((RE2 / RE1 + const2) ^ const3) end indices_funcs["MSR705"] = MSR705_func -function MTVI1_func( - ::Type{TFL}, - N::Number, - G::Number, - R::Number; - const1::Number=TFL(1.2), - const2::Number=TFL(1.2), - const3::Number=TFL(2.5), -) where {TFL<:Number} +function MTVI1_func(::Type{TFL}, N, G, R; const1::Number=TFL(1.2), const2::Number=TFL(1.2), const3::Number=TFL(2.5)) where {TFL <: Number} return const1 * (const2 * (N - G) - const3 * (R - G)) end indices_funcs["MTVI1"] = MTVI1_func -function IKAW_func(::Type{TFL}, R::Number, B::Number) where {TFL<:Number} - return (R - B) / (R + B) +function IKAW_func(::Type{TFL}, R, B) where {TFL <: Number} + return (R - B)/(R + B) end indices_funcs["IKAW"] = IKAW_func -function MIRBI_func( - ::Type{TFL}, - S2::Number, - S1::Number; - const1::Number=TFL(10.0), - const2::Number=TFL(9.8), - const3::Number=TFL(2.0), -) where {TFL<:Number} +function MIRBI_func(::Type{TFL}, S2, S1; const1::Number=TFL(10.0), const2::Number=TFL(9.8), const3::Number=TFL(2.0)) where {TFL <: Number} return const1 * S2 - const2 * S1 + const3 end indices_funcs["MIRBI"] = MIRBI_func -function CSIT_func( - ::Type{TFL}, N::Number, S2::Number, T::Number; const1::Number=TFL(10000.0) -) where {TFL<:Number} +function CSIT_func(::Type{TFL}, N, S2, T; const1::Number=TFL(10000.0)) where {TFL <: Number} return N / (S2 * T / const1) end indices_funcs["CSIT"] = CSIT_func -function TDVI_func( - ::Type{TFL}, - N::Number, - R::Number; - const1::Number=TFL(1.5), - const2::Number=TFL(2.0), - const3::Number=TFL(0.5), - const4::Number=TFL(0.5), -) where {TFL<:Number} - return const1 * ((N - R) / ((N^const2 + R + const3)^const4)) +function TDVI_func(::Type{TFL}, N, R; const1::Number=TFL(1.5), const2::Number=TFL(2.0), const3::Number=TFL(0.5), const4::Number=TFL(0.5)) where {TFL <: Number} + return const1 * ((N - R)/((N ^ const2 + R + const3) ^ const4)) end indices_funcs["TDVI"] = TDVI_func -function DSWI2_func(::Type{TFL}, S1::Number, G::Number) where {TFL<:Number} - return S1 / G +function DSWI2_func(::Type{TFL}, S1, G) where {TFL <: Number} + return S1/G end indices_funcs["DSWI2"] = DSWI2_func -function CIRE_func( - ::Type{TFL}, N::Number, RE1::Number; const1::Number=TFL(1) -) where {TFL<:Number} +function CIRE_func(::Type{TFL}, N, RE1; const1::Number=TFL(1)) where {TFL <: Number} return (N / RE1) - const1 end indices_funcs["CIRE"] = CIRE_func -function NDISIr_func( - ::Type{TFL}, - T::Number, - R::Number, - N::Number, - S1::Number; - const1::Number=TFL(3.0), - const2::Number=TFL(3.0), -) where {TFL<:Number} - return (T - (R + N + S1) / const1) / (T + (R + N + S1) / const2) +function NDISIr_func(::Type{TFL}, T, R, N, S1; const1::Number=TFL(3.0), const2::Number=TFL(3.0)) where {TFL <: Number} + return (T - (R + N + S1) / const1)/(T + (R + N + S1) / const2) end indices_funcs["NDISIr"] = NDISIr_func -function NDDI_func(::Type{TFL}, N::Number, R::Number, G::Number) where {TFL<:Number} - return (((N - R) / (N + R)) - ((G - N) / (G + N))) / - (((N - R) / (N + R)) + ((G - N) / (G + N))) +function NDDI_func(::Type{TFL}, N, R, G) where {TFL <: Number} + return (((N - R)/(N + R)) - ((G - N)/(G + N)))/(((N - R)/(N + R)) + ((G - N)/(G + N))) end indices_funcs["NDDI"] = NDDI_func -function NDREI_func(::Type{TFL}, N::Number, RE1::Number) where {TFL<:Number} +function NDREI_func(::Type{TFL}, N, RE1) where {TFL <: Number} return (N - RE1) / (N + RE1) end indices_funcs["NDREI"] = NDREI_func -function NDTI_func(::Type{TFL}, R::Number, G::Number) where {TFL<:Number} - return (R - G) / (R + G) +function NDTI_func(::Type{TFL}, R, G) where {TFL <: Number} + return (R-G)/(R+G) end indices_funcs["NDTI"] = NDTI_func -function QpRVI_func( - ::Type{TFL}, - HV::Number, - HH::Number, - VV::Number; - const1::Number=TFL(8.0), - const2::Number=TFL(2.0), -) where {TFL<:Number} - return (const1 * HV) / (HH + VV + const2 * HV) +function QpRVI_func(::Type{TFL}, HV, HH, VV; const1::Number=TFL(8.0), const2::Number=TFL(2.0)) where {TFL <: Number} + return (const1 * HV)/(HH + VV + const2 * HV) end indices_funcs["QpRVI"] = QpRVI_func -function DSWI1_func(::Type{TFL}, N::Number, S1::Number) where {TFL<:Number} - return N / S1 +function DSWI1_func(::Type{TFL}, N, S1) where {TFL <: Number} + return N/S1 end indices_funcs["DSWI1"] = DSWI1_func -function EBBI_func( - ::Type{TFL}, - S1::Number, - N::Number, - T::Number; - const1::Number=TFL(10.0), - const2::Number=TFL(0.5), -) where {TFL<:Number} - return (S1 - N) / (const1 * ((S1 + T)^const2)) +function EBBI_func(::Type{TFL}, S1, N, T; const1::Number=TFL(10.0), const2::Number=TFL(0.5)) where {TFL <: Number} + return (S1 - N) / (const1 * ((S1 + T) ^ const2)) end indices_funcs["EBBI"] = EBBI_func -function MCARI1_func( - ::Type{TFL}, - N::Number, - R::Number, - G::Number; - const1::Number=TFL(1.2), - const2::Number=TFL(2.5), - const3::Number=TFL(1.3), -) where {TFL<:Number} +function MCARI1_func(::Type{TFL}, N, R, G; const1::Number=TFL(1.2), const2::Number=TFL(2.5), const3::Number=TFL(1.3)) where {TFL <: Number} return const1 * (const2 * (N - R) - const3 * (N - G)) end indices_funcs["MCARI1"] = MCARI1_func -function BNDVI_func(::Type{TFL}, N::Number, B::Number) where {TFL<:Number} - return (N - B) / (N + B) +function BNDVI_func(::Type{TFL}, N, B) where {TFL <: Number} + return (N - B)/(N + B) end indices_funcs["BNDVI"] = BNDVI_func -function NDSII_func(::Type{TFL}, G::Number, N::Number) where {TFL<:Number} - return (G - N) / (G + N) +function NDSII_func(::Type{TFL}, G, N) where {TFL <: Number} + return (G - N)/(G + N) end indices_funcs["NDSII"] = NDSII_func -function NIRvH2_func( - ::Type{TFL}, N::Number, R::Number, k::Number, lambdaN::Number, lambdaR::Number -) where {TFL<:Number} +function NIRvH2_func(::Type{TFL}, N, R, k, lambdaN, lambdaR) where {TFL <: Number} return N - R - k * (lambdaN - lambdaR) end indices_funcs["NIRvH2"] = NIRvH2_func -function NBRT2_func( - ::Type{TFL}, - N::Number, - T::Number, - S2::Number; - const1::Number=TFL(10000.0), - const2::Number=TFL(10000.0), -) where {TFL<:Number} +function NBRT2_func(::Type{TFL}, N, T, S2; const1::Number=TFL(10000.0), const2::Number=TFL(10000.0)) where {TFL <: Number} return ((N / (T / const1)) - S2) / ((N / (T / const2)) + S2) end indices_funcs["NBRT2"] = NBRT2_func -function DVIplus_func( - ::Type{TFL}, - lambdaN::Number, - lambdaR::Number, - lambdaG::Number, - G::Number, - N::Number, - R::Number; - const1::Number=TFL(1.0), -) where {TFL<:Number} - return ((lambdaN - lambdaR) / (lambdaN - lambdaG)) * G + - (const1 - ((lambdaN - lambdaR) / (lambdaN - lambdaG))) * N - R +function DVIplus_func(::Type{TFL}, lambdaN, lambdaR, lambdaG, G, N, R; const1::Number=TFL(1.0)) where {TFL <: Number} + return ((lambdaN - lambdaR)/(lambdaN - lambdaG)) * G + (const1 - ((lambdaN - lambdaR)/(lambdaN - lambdaG))) * N - R end indices_funcs["DVIplus"] = DVIplus_func -function CVI_func( - ::Type{TFL}, N::Number, R::Number, G::Number; const1::Number=TFL(2.0) -) where {TFL<:Number} - return (N * R) / (G^const1) +function CVI_func(::Type{TFL}, N, R, G; const1::Number=TFL(2.0)) where {TFL <: Number} + return (N * R) / (G ^ const1) end indices_funcs["CVI"] = CVI_func -function RI4XS_func( - ::Type{TFL}, R::Number, G::Number; const1::Number=TFL(2.0), const2::Number=TFL(4.0) -) where {TFL<:Number} - return (R^const1) / (G^const2) +function RI4XS_func(::Type{TFL}, R, G; const1::Number=TFL(2.0), const2::Number=TFL(4.0)) where {TFL <: Number} + return (R^const1)/(G^const2) end indices_funcs["RI4XS"] = RI4XS_func -function kRVI_func(::Type{TFL}, kNN::Number, kNR::Number) where {TFL<:Number} +function kRVI_func(::Type{TFL}, kNN, kNR) where {TFL <: Number} return kNN / kNR end indices_funcs["kRVI"] = kRVI_func -function AFRI1600_func( - ::Type{TFL}, N::Number, S1::Number; const1::Number=TFL(0.66), const2::Number=TFL(0.66) -) where {TFL<:Number} +function AFRI1600_func(::Type{TFL}, N, S1; const1::Number=TFL(0.66), const2::Number=TFL(0.66)) where {TFL <: Number} return (N - const1 * S1) / (N + const2 * S1) end indices_funcs["AFRI1600"] = AFRI1600_func -function SR705_func(::Type{TFL}, RE2::Number, RE1::Number) where {TFL<:Number} +function SR705_func(::Type{TFL}, RE2, RE1) where {TFL <: Number} return RE2 / RE1 end indices_funcs["SR705"] = SR705_func -function IBI_func( - ::Type{TFL}, - S1::Number, - N::Number, - R::Number, - L::Number, - G::Number; - const1::Number=TFL(1.0), - const2::Number=TFL(2.0), - const3::Number=TFL(1.0), - const4::Number=TFL(2.0), -) where {TFL<:Number} - return ( - ((S1 - N) / (S1 + N)) - - (((N - R) * (const1 + L) / (N + R + L)) + ((G - S1) / (G + S1))) / const2 - ) / ( - ((S1 - N) / (S1 + N)) + - (((N - R) * (const3 + L) / (N + R + L)) + ((G - S1) / (G + S1))) / const4 - ) +function IBI_func(::Type{TFL}, S1, N, R, L, G; const1::Number=TFL(1.0), const2::Number=TFL(2.0), const3::Number=TFL(1.0), const4::Number=TFL(2.0)) where {TFL <: Number} + return (((S1-N)/(S1+N))-(((N-R)*(const1+L)/(N+R+L))+((G-S1)/(G+S1)))/const2)/(((S1-N)/(S1+N))+(((N-R)*(const3+L)/(N+R+L))+((G-S1)/(G+S1)))/const4) end indices_funcs["IBI"] = IBI_func -function VARI700_func( - ::Type{TFL}, - RE1::Number, - R::Number, - B::Number; - const1::Number=TFL(1.7), - const2::Number=TFL(0.7), - const3::Number=TFL(1.3), - const4::Number=TFL(1.3), -) where {TFL<:Number} +function VARI700_func(::Type{TFL}, RE1, R, B; const1::Number=TFL(1.7), const2::Number=TFL(0.7), const3::Number=TFL(1.3), const4::Number=TFL(1.3)) where {TFL <: Number} return (RE1 - const1 * R + const2 * B) / (RE1 + const3 * R - const4 * B) end indices_funcs["VARI700"] = VARI700_func -function NBLI_func(::Type{TFL}, R::Number, T::Number) where {TFL<:Number} - return (R - T) / (R + T) +function NBLI_func(::Type{TFL}, R, T) where {TFL <: Number} + return (R - T)/(R + T) end indices_funcs["NBLI"] = NBLI_func -function NDII_func(::Type{TFL}, N::Number, S1::Number) where {TFL<:Number} - return (N - S1) / (N + S1) +function NDII_func(::Type{TFL}, N, S1) where {TFL <: Number} + return (N - S1)/(N + S1) end indices_funcs["NDII"] = NDII_func -function S2REP_func( - ::Type{TFL}, - RE3::Number, - R::Number, - RE1::Number, - RE2::Number; - const1::Number=TFL(705.0), - const2::Number=TFL(35.0), - const3::Number=TFL(2.0), -) where {TFL<:Number} +function S2REP_func(::Type{TFL}, RE3, R, RE1, RE2; const1::Number=TFL(705.0), const2::Number=TFL(35.0), const3::Number=TFL(2.0)) where {TFL <: Number} return const1 + const2 * ((((RE3 + R) / const3) - RE1) / (RE2 - RE1)) end indices_funcs["S2REP"] = S2REP_func -function NDMI_func(::Type{TFL}, N::Number, S1::Number) where {TFL<:Number} - return (N - S1) / (N + S1) +function NDMI_func(::Type{TFL}, N, S1) where {TFL <: Number} + return (N - S1)/(N + S1) end indices_funcs["NDMI"] = NDMI_func -function NBUI_func( - ::Type{TFL}, - S1::Number, - N::Number, - T::Number, - R::Number, - L::Number, - G::Number; - const1::Number=TFL(10.0), - const2::Number=TFL(0.5), - const3::Number=TFL(1.0), -) where {TFL<:Number} - return ((S1 - N) / (const1 * (T + S1)^const2)) - - (((N - R) * (const3 + L)) / (N - R + L)) - (G - S1) / (G + S1) +function NBUI_func(::Type{TFL}, S1, N, T, R, L, G; const1::Number=TFL(10.0), const2::Number=TFL(0.5), const3::Number=TFL(1.0)) where {TFL <: Number} + return ((S1 - N)/(const1 * (T + S1) ^ const2)) - (((N - R) * (const3 + L))/(N - R + L)) - (G - S1)/(G + S1) end indices_funcs["NBUI"] = NBUI_func -function GRNDVI_func(::Type{TFL}, N::Number, G::Number, R::Number) where {TFL<:Number} - return (N - (G + R)) / (N + (G + R)) +function GRNDVI_func(::Type{TFL}, N, G, R) where {TFL <: Number} + return (N - (G + R))/(N + (G + R)) end indices_funcs["GRNDVI"] = GRNDVI_func -function NBRT3_func( - ::Type{TFL}, - N::Number, - T::Number, - S2::Number; - const1::Number=TFL(10000.0), - const2::Number=TFL(10000.0), -) where {TFL<:Number} +function NBRT3_func(::Type{TFL}, N, T, S2; const1::Number=TFL(10000.0), const2::Number=TFL(10000.0)) where {TFL <: Number} return ((N - (T / const1)) - S2) / ((N - (T / const2)) + S2) end indices_funcs["NBRT3"] = NBRT3_func -function TSAVI_func( - ::Type{TFL}, sla::Number, N::Number, R::Number, slb::Number -) where {TFL<:Number} +function TSAVI_func(::Type{TFL}, sla, N, R, slb) where {TFL <: Number} return sla * (N - sla * R - slb) / (sla * N + R - sla * slb) end indices_funcs["TSAVI"] = TSAVI_func -function NDWI_func(::Type{TFL}, G::Number, N::Number) where {TFL<:Number} +function NDWI_func(::Type{TFL}, G, N) where {TFL <: Number} return (G - N) / (G + N) end indices_funcs["NDWI"] = NDWI_func -function NSDSI3_func(::Type{TFL}, S1::Number, S2::Number) where {TFL<:Number} - return (S1 - S2) / (S1 + S2) +function NSDSI3_func(::Type{TFL}, S1, S2) where {TFL <: Number} + return (S1-S2)/(S1+S2) end indices_funcs["NSDSI3"] = NSDSI3_func -function PISI_func( - ::Type{TFL}, - B::Number, - N::Number; - const1::Number=TFL(0.8192), - const2::Number=TFL(0.5735), - const3::Number=TFL(0.0750), -) where {TFL<:Number} +function PISI_func(::Type{TFL}, B, N; const1::Number=TFL(0.8192), const2::Number=TFL(0.5735), const3::Number=TFL(0.0750)) where {TFL <: Number} return const1 * B - const2 * N + const3 end indices_funcs["PISI"] = PISI_func -function MTCI_func(::Type{TFL}, RE2::Number, RE1::Number, R::Number) where {TFL<:Number} +function MTCI_func(::Type{TFL}, RE2, RE1, R) where {TFL <: Number} return (RE2 - RE1) / (RE1 - R) end indices_funcs["MTCI"] = MTCI_func -function MCARI2_func( - ::Type{TFL}, - N::Number, - R::Number, - G::Number; - const1::Number=TFL(1.5), - const2::Number=TFL(2.5), - const3::Number=TFL(1.3), - const4::Number=TFL(2.0), - const5::Number=TFL(1), - const6::Number=TFL(2), - const7::Number=TFL(6.0), - const8::Number=TFL(5), - const9::Number=TFL(0.5), - const10::Number=TFL(0.5), - const11::Number=TFL(0.5), -) where {TFL<:Number} - return (const1 * (const2 * (N - R) - const3 * (N - G))) / ( - ( - ((const4 * N + const5)^const6) - (const7 * N - const8 * (R^const9)) - const10 - )^const11 - ) +function MCARI2_func(::Type{TFL}, N, R, G; const1::Number=TFL(1.5), const2::Number=TFL(2.5), const3::Number=TFL(1.3), const4::Number=TFL(2.0), const5::Number=TFL(1), const6::Number=TFL(2), const7::Number=TFL(6.0), const8::Number=TFL(5), const9::Number=TFL(0.5), const10::Number=TFL(0.5), const11::Number=TFL(0.5)) where {TFL <: Number} + return (const1 * (const2 * (N - R) - const3 * (N - G))) / ((((const4 * N + const5) ^ const6) - (const7 * N - const8 * (R ^ const9)) - const10) ^ const11) end indices_funcs["MCARI2"] = MCARI2_func -function GLI_func( - ::Type{TFL}, - G::Number, - R::Number, - B::Number; - const1::Number=TFL(2.0), - const2::Number=TFL(2.0), -) where {TFL<:Number} +function GLI_func(::Type{TFL}, G, R, B; const1::Number=TFL(2.0), const2::Number=TFL(2.0)) where {TFL <: Number} return (const1 * G - R - B) / (const2 * G + R + B) end indices_funcs["GLI"] = GLI_func -function VI700_func(::Type{TFL}, RE1::Number, R::Number) where {TFL<:Number} +function VI700_func(::Type{TFL}, RE1, R) where {TFL <: Number} return (RE1 - R) / (RE1 + R) end indices_funcs["VI700"] = VI700_func -function NDISIb_func( - ::Type{TFL}, - T::Number, - B::Number, - N::Number, - S1::Number; - const1::Number=TFL(3.0), - const2::Number=TFL(3.0), -) where {TFL<:Number} - return (T - (B + N + S1) / const1) / (T + (B + N + S1) / const2) +function NDISIb_func(::Type{TFL}, T, B, N, S1; const1::Number=TFL(3.0), const2::Number=TFL(3.0)) where {TFL <: Number} + return (T - (B + N + S1) / const1)/(T + (B + N + S1) / const2) end indices_funcs["NDISIb"] = NDISIb_func -function WI2015_func( - ::Type{TFL}, - G::Number, - R::Number, - N::Number, - S1::Number, - S2::Number; - const1::Number=TFL(1.7204), - const2::Number=TFL(171), - const3::Number=TFL(3), - const4::Number=TFL(70), - const5::Number=TFL(45), - const6::Number=TFL(71), -) where {TFL<:Number} +function WI2015_func(::Type{TFL}, G, R, N, S1, S2; const1::Number=TFL(1.7204), const2::Number=TFL(171), const3::Number=TFL(3), const4::Number=TFL(70), const5::Number=TFL(45), const6::Number=TFL(71)) where {TFL <: Number} return const1 + const2 * G + const3 * R - const4 * N - const5 * S1 - const6 * S2 end indices_funcs["WI2015"] = WI2015_func -function BITM_func( - ::Type{TFL}, - B::Number, - G::Number, - R::Number; - const1::Number=TFL(2.0), - const2::Number=TFL(2.0), - const3::Number=TFL(2.0), - const4::Number=TFL(3.0), - const5::Number=TFL(0.5), -) where {TFL<:Number} - return (((B^const1) + (G^const2) + (R^const3)) / const4)^const5 +function BITM_func(::Type{TFL}, B, G, R; const1::Number=TFL(2.0), const2::Number=TFL(2.0), const3::Number=TFL(2.0), const4::Number=TFL(3.0), const5::Number=TFL(0.5)) where {TFL <: Number} + return (((B^const1)+(G^const2)+(R^const3))/const4)^const5 end indices_funcs["BITM"] = BITM_func -function S3_func(::Type{TFL}, N::Number, R::Number, S1::Number) where {TFL<:Number} +function S3_func(::Type{TFL}, N, R, S1) where {TFL <: Number} return (N * (R - S1)) / ((N + R) * (N + S1)) end indices_funcs["S3"] = S3_func -function TTVI_func( - ::Type{TFL}, - RE3::Number, - RE2::Number, - N2::Number; - const1::Number=TFL(0.5), - const2::Number=TFL(865.0), - const3::Number=TFL(740.0), - const4::Number=TFL(783.0), - const5::Number=TFL(740), -) where {TFL<:Number} +function TTVI_func(::Type{TFL}, RE3, RE2, N2; const1::Number=TFL(0.5), const2::Number=TFL(865.0), const3::Number=TFL(740.0), const4::Number=TFL(783.0), const5::Number=TFL(740)) where {TFL <: Number} return const1 * ((const2 - const3) * (RE3 - RE2) - (N2 - RE2) * (const4 - const5)) end indices_funcs["TTVI"] = TTVI_func -function NDCI_func(::Type{TFL}, RE1::Number, R::Number) where {TFL<:Number} - return (RE1 - R) / (RE1 + R) +function NDCI_func(::Type{TFL}, RE1, R) where {TFL <: Number} + return (RE1 - R)/(RE1 + R) end indices_funcs["NDCI"] = NDCI_func -function NHFD_func(::Type{TFL}, RE1::Number, A::Number) where {TFL<:Number} +function NHFD_func(::Type{TFL}, RE1, A) where {TFL <: Number} return (RE1 - A) / (RE1 + A) end indices_funcs["NHFD"] = NHFD_func -function SAVI2_func( - ::Type{TFL}, N::Number, R::Number, slb::Number, sla::Number -) where {TFL<:Number} +function SAVI2_func(::Type{TFL}, N, R, slb, sla) where {TFL <: Number} return N / (R + (slb / sla)) end indices_funcs["SAVI2"] = SAVI2_func -function DSWI5_func( - ::Type{TFL}, N::Number, G::Number, S1::Number, R::Number -) where {TFL<:Number} - return (N + G) / (S1 + R) +function DSWI5_func(::Type{TFL}, N, G, S1, R) where {TFL <: Number} + return (N + G)/(S1 + R) end indices_funcs["DSWI5"] = DSWI5_func -function IAVI_func( - ::Type{TFL}, N::Number, R::Number, gamma::Number, B::Number -) where {TFL<:Number} - return (N - (R - gamma * (B - R))) / (N + (R - gamma * (B - R))) +function IAVI_func(::Type{TFL}, N, R, gamma, B) where {TFL <: Number} + return (N - (R - gamma * (B - R)))/(N + (R - gamma * (B - R))) end indices_funcs["IAVI"] = IAVI_func + diff --git a/src/utils.jl b/src/utils.jl index d26210d..9e15890 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -104,7 +104,7 @@ function _create_indexfun( ) bands = index_info["bands"] - bands_args = join(bands, "::Number, ") * "::Number" + bands_args = join(bands, ", ") kwargs = join(const_defs, ", ") untyped_kwargs = join(untyped_const_defs, ", ") From f89bf7f64db33274998bdc8315c180cd76435c56 Mon Sep 17 00:00:00 2001 From: Lazaro Alonso Date: Wed, 27 Mar 2024 22:58:34 +0100 Subject: [PATCH 2/3] rm old css --- docs/src/assets/docs.css | 132 --------------------------------------- 1 file changed, 132 deletions(-) delete mode 100644 docs/src/assets/docs.css diff --git a/docs/src/assets/docs.css b/docs/src/assets/docs.css deleted file mode 100644 index 35670aa..0000000 --- a/docs/src/assets/docs.css +++ /dev/null @@ -1,132 +0,0 @@ -/* 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); -} From c8ac13c84c7de0c714165bdf51e0da83f2835d8f Mon Sep 17 00:00:00 2001 From: Lazaro Alonso Date: Thu, 28 Mar 2024 10:34:09 +0100 Subject: [PATCH 3/3] rm old wf --- .github/workflows/CI.yml | 31 ++++++++++++++- .github/workflows/Documentation.yml | 59 ----------------------------- 2 files changed, 29 insertions(+), 61 deletions(-) delete mode 100644 .github/workflows/Documentation.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0078752..469bf66 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -22,7 +22,7 @@ jobs: arch: - x64 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} @@ -42,4 +42,31 @@ jobs: - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v1 with: - file: lcov.info \ No newline at end of file + file: lcov.info + docs: + name: Documentation + runs-on: ubuntu-latest + permissions: + actions: write # needed to allow julia-actions/cache to proactively delete old caches that it has created + contents: write + statuses: write + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v1 + with: + version: '1' + - run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev + - run: | + julia --project=docs -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate()' + - run: | + DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs -e ' + using Documenter: doctest + using SpectralIndices + doctest(SpectralIndices)' + - run: xvfb-run -s '-screen 0 1024x768x24' julia --project=docs docs/make.jl + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} \ No newline at end of file diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml deleted file mode 100644 index 234cf30..0000000 --- a/.github/workflows/Documentation.yml +++ /dev/null @@ -1,59 +0,0 @@ -# Sample workflow for building and deploying a VitePress site to GitHub Pages -# -name: Documenter - -on: - # Runs on pushes targeting the `master` branch. Change this to `main` if you're - # using the `main` branch as the default branch. - push: - branches: - - main - tags: ['*'] - pull_request: - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: write - pages: write - id-token: write - statuses: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: pages - cancel-in-progress: false - -jobs: - # Build job - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Node # This is still useful because it caches the node_modules so we don't constantly re-install. You don't technically need this, though. - uses: actions/setup-node@v3 - with: - node-version: 20 - cache: npm # or pnpm / yarn - cache-dependency-path: 'docs/package-lock.json' # this should be a package-lock.json file - - name: Setup Julia - uses: julia-actions/setup-julia@v1 - - name: Pull Julia cache - uses: julia-actions/cache@v1 - - name: Install documentation dependencies - run: julia --project=docs -e 'using Pkg; pkg"dev ."; Pkg.instantiate(); Pkg.precompile(); Pkg.status()' - - name: Instantiate NPM - run: cd docs/; npm i; cd .. - #- name: Creating new mds from src - - name: Build and deploy docs - uses: julia-actions/julia-docdeploy@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token - DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key - GKSwstype: "100" # for Plots.jl plots (if you have them) - JULIA_DEBUG: "Documenter" - DATADEPS_ALWAYS_ACCEPT: true \ No newline at end of file