Skip to content

Commit

Permalink
Merge pull request #75 from awesome-spectral-indices/fm/jv
Browse files Browse the repository at this point in the history
Support from Julia 1.10
  • Loading branch information
MartinuzziFrancesco authored Dec 17, 2024
2 parents 9edcf4c + 38c0433 commit ebeac1d
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
fail-fast: false
matrix:
version:
- '1.9'
- '1'
- '1.10'
- '1.11'
os:
- ubuntu-latest
arch:
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SpectralIndices"
uuid = "df0093a1-273d-40bc-819a-796ec3476907"
authors = ["MartinuzziFrancesco <[email protected]>"]
version = "0.2.10"
version = "0.2.11"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand All @@ -24,7 +24,7 @@ DimensionalData = "0.26, 0.27, 0.28"
Downloads = "1"
JSON = "0.21"
YAXArrays = "0.5"
julia = "1.6"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
[cc-img]: https://codecov.io/gh/awesome-spectral-indices/SpectralIndices.jl/graph/badge.svg?token=0IRRDAZM0U
[cc-url]: https://codecov.io/gh/awesome-spectral-indices/SpectralIndices.jl

[julia-img]: https://img.shields.io/badge/julia-v1.9+-blue.svg
[julia-img]: https://img.shields.io/badge/julia-v1.10+-blue.svg
[julia-url]: https://julialang.org/

[style-img]: https://img.shields.io/badge/code%20style-blue-4495d1.svg
Expand Down
51 changes: 44 additions & 7 deletions data/spectral-indices-dict.json
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,43 @@
"reference": "https://doi.org/10.1078/0176-1617-00887",
"short_name": "CIRE"
},
"CRI550": {
"application_domain": "vegetation",
"bands": [
"B",
"G"
],
"contributor": "https://github.com/eomasters-repos",
"date_of_addition": "2024-08-08",
"formula": "(1.0 / B) - (1.0 / G)",
"long_name": "Carotenoid Reflectance Index using 550 nm",
"platforms": [
"Sentinel-2",
"Landsat-OLI",
"Landsat-TM",
"Landsat-ETM+",
"MODIS",
"Planet-Fusion"
],
"reference": "https://doi.org/10.1562/0031-8655(2002)0750272ACCIPL2.0.CO2",
"short_name": "CRI550"
},
"CRI700": {
"application_domain": "vegetation",
"bands": [
"B",
"RE1"
],
"contributor": "https://github.com/eomasters-repos",
"date_of_addition": "2024-08-08",
"formula": "(1.0 / B) - (1.0 / RE1)",
"long_name": "Carotenoid Reflectance Index using 700 nm",
"platforms": [
"Sentinel-2"
],
"reference": "https://doi.org/10.1562/0031-8655(2002)0750272ACCIPL2.0.CO2",
"short_name": "CRI700"
},
"CSI": {
"application_domain": "burn",
"bands": [
Expand Down Expand Up @@ -985,7 +1022,7 @@
"MODIS",
"Planet-Fusion"
],
"reference": "https://doi.org/10.22541/essoar.171561872.22414664/v1",
"reference": "https://doi.org/10.1029/2024JG008240",
"short_name": "EVIv"
},
"ExG": {
Expand Down Expand Up @@ -4662,7 +4699,7 @@
"MODIS",
"Planet-Fusion"
],
"reference": "https://doi.org/10.22541/essoar.171561872.22414664/v1",
"reference": "https://doi.org/10.1029/2024JG008240",
"short_name": "bNIRv"
},
"kEVI": {
Expand Down Expand Up @@ -4826,7 +4863,7 @@
"Landsat-ETM+",
"MODIS"
],
"reference": "https://doi.org/10.22541/essoar.171561872.22414664/v1",
"reference": "https://doi.org/10.1029/2024JG008240",
"short_name": "sNIRvLSWI"
},
"sNIRvNDPI": {
Expand All @@ -4848,7 +4885,7 @@
"Landsat-ETM+",
"MODIS"
],
"reference": "https://doi.org/10.22541/essoar.171561872.22414664/v1",
"reference": "https://doi.org/10.1029/2024JG008240",
"short_name": "sNIRvNDPI"
},
"sNIRvNDVILSWIP": {
Expand All @@ -4869,7 +4906,7 @@
"Landsat-ETM+",
"MODIS"
],
"reference": "https://doi.org/10.22541/essoar.171561872.22414664/v1",
"reference": "https://doi.org/10.1029/2024JG008240",
"short_name": "sNIRvNDVILSWIP"
},
"sNIRvNDVILSWIS": {
Expand All @@ -4890,7 +4927,7 @@
"Landsat-ETM+",
"MODIS"
],
"reference": "https://doi.org/10.22541/essoar.171561872.22414664/v1",
"reference": "https://doi.org/10.1029/2024JG008240",
"short_name": "sNIRvNDVILSWIS"
},
"sNIRvSWIR": {
Expand All @@ -4911,7 +4948,7 @@
"Landsat-ETM+",
"MODIS"
],
"reference": "https://doi.org/10.22541/essoar.171561872.22414664/v1",
"reference": "https://doi.org/10.1029/2024JG008240",
"short_name": "sNIRvSWIR"
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/SpectralIndices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ include("compute_index.jl")
include("compute_kernel.jl")
include("datasets.jl")

if !isdefined(Base, :get_extension)
include("../ext/SpectralIndicesDataFramesExt.jl")
include("../ext/SpectralIndicesYAXArraysExt.jl")
end

indices = _create_indices()
bands = _create_bands()
constants = _create_constants()
Expand Down
24 changes: 18 additions & 6 deletions src/indices_funcs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ end

indices_funcs["MBI"] = MBI_func

function CRI700_func(::Type{TFL}, B, RE1; const1::Number=TFL(1.0), const2::Number=TFL(1.0)) where {TFL <: Number}
return (const1 / B) - (const2 / RE1)
end

indices_funcs["CRI700"] = CRI700_func

function WRI_func(::Type{TFL}, G, R, N, S1) where {TFL <: Number}
return (G + R)/(N + S1)
end
Expand Down Expand Up @@ -264,6 +270,12 @@ end

indices_funcs["NDBaI"] = NDBaI_func

function CRI550_func(::Type{TFL}, B, G; const1::Number=TFL(1.0), const2::Number=TFL(1.0)) where {TFL <: Number}
return (const1 / B) - (const2 / G)
end

indices_funcs["CRI550"] = CRI550_func

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
Expand Down Expand Up @@ -1272,18 +1284,18 @@ end

indices_funcs["NBRT2"] = NBRT2_func

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, R, G; const1::Number=TFL(2.0)) where {TFL <: Number}
return (N * R) / (G ^ const1)
end

indices_funcs["CVI"] = CVI_func

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 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
Expand Down

2 comments on commit ebeac1d

@MartinuzziFrancesco
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/121547

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.11 -m "<description of version>" ebeac1d97626d97cc510bd1d9aac90f42a5bccfa
git push origin v0.2.11

Please sign in to comment.