ee_extra.Spectral.core.spectralIndices#
- ee_extra.Spectral.core.spectralIndices(x, index='NDVI', G=2.5, C1=6.0, C2=7.5, L=1.0, cexp=1.16, nexp=2.0, alpha=0.1, slope=1.0, intercept=0.0, gamma=1.0, omega=2.0, beta=0.05, k=0.0, fdelta=0.581, kernel='RBF', sigma='0.5 * (a + b)', p=2, c=1.0, lambdaN=858.5, lambdaR=645.0, lambdaG=555.0, online=False, drop=False)[source]#
Computes one or more spectral indices (indices are added as bands) for an image or image collection.
- Parameters:
x (
Union
[Image
,ImageCollection
]) – Image or Image Collectionto compute indices on. Must be scaled to [0,1].index (
Union
[str
,List
[str
]]) – Index or list of indices to compute.G (
Union
[float
,int
]) – Gain factor. Used just for index = ‘EVI’.C1 (
Union
[float
,int
]) – Coefficient 1 for the aerosol resistance term. Used just for index = ‘EVI’.C2 (
Union
[float
,int
]) – Coefficient 2 for the aerosol resistance term. Used just for index = ‘EVI’.L (
Union
[float
,int
]) – Canopy background adjustment. Used just for index = [‘EVI’,’SAVI’].cexp (
Union
[float
,int
]) – Exponent used for OCVI.nexp (
Union
[float
,int
]) – Exponent used for GDVI.alpha (
Union
[float
,int
]) – Weighting coefficient used for WDRVI.slope (
Union
[float
,int
]) – Soil line slope. Used just for index = [‘ATSAVI’,’SAVI2’, ‘TSAVI’, ‘WDVI’].intercept (
Union
[float
,int
]) – Soil line intercept. Used just for index = [‘ATSAVI’,’SAVI2’, ‘TSAVI’, ‘WDVI’].gamma (
Union
[float
,int
]) – Weighting coefficient used for ARVI.omega (
Union
[float
,int
]) – Weighting coefficient used for MBWI.beta (
Union
[float
,int
]) – Calibration parameter used for NDSIns.k (
Union
[float
,int
]) – Slope parameter by soil used for NIRvH2.fdelta (
Union
[float
,int
]) – Adjustment factor used for SEVI.kernel (
str
) – Kernel used for kernel indices. One of ‘linear’, ‘RBF’, ‘poly’.sigma (
Union
[float
,str
]) – Length-scale parameter. Used for kernel = ‘RBF’. If str, this must be an expression including ‘a’ and ‘b’. If numeric, this must be positive.p (
Union
[float
,int
]) – Kernel degree. Used for kernel = ‘poly’.c (
Union
[float
,int
]) – Free parameter that trades off the influence of higher-order versus lower-order terms. Used for kernel = ‘poly’. This must be greater than or equal to 0.online (
bool
) – Whether to retrieve the most recent list of indices directly from the GitHub repository and not from the local copy.lambdaN (
Union
[float
,int
]) – NIR wavelength used for NIRvH2 and NDGI.lambdaR (
Union
[float
,int
]) – Red wavelength used for NIRvH2 and NDGI.lambdaG (
Union
[float
,int
]) – Green wavelength used for NDGI.drop (
bool
) – Whether to drop all bands except the new spectral indices.
- Return type:
Union
[Image
,ImageCollection
]- Returns:
Image or Image Collection with the computed spectral index, or indices, as new bands.
Examples
>>> import ee >>> from ee_extra.Spectral.core import spectralIndices >>> ee.Initialize() >>> S2 = ee.ImageCollection("COPERNICUS/S2_SR") >>> spectralIndices(S2,["NDVI","SAVI"],L = 0.5)