44from typing import Any , Optional
55
66import ee
7-
8- # import ee_extra
9- # import ee_extra.Algorithms.core
10- # import ee_extra.QA.clouds
11- # import ee_extra.QA.pipelines
12- # import ee_extra.Spectral.core
13- # import ee_extra.STAC.core
7+ import ee_extra
8+ import ee_extra .Algorithms .core
9+ import ee_extra .QA .clouds
10+ import ee_extra .QA .pipelines
11+ import ee_extra .Spectral .core
12+ import ee_extra .STAC .core
1413import geopandas as gpd
1514import numpy as np
1615import requests
@@ -854,6 +853,7 @@ def spectralIndices(
854853 beta : float | int = 0.05 ,
855854 k : float | int = 0.0 ,
856855 fdelta : float | int = 0.581 ,
856+ epsilon : float | int = 1.0 ,
857857 kernel : str = "RBF" ,
858858 sigma : str = "0.5 * (a + b)" ,
859859 p : float | int = 2.0 ,
@@ -891,6 +891,7 @@ def spectralIndices(
891891 beta: Calibration parameter used for NDSIns, default = 0.05
892892 k: Slope parameter by soil used for NIRvH2, default = 0.0
893893 fdelta: Adjustment factor used for SEVI, default = 0.581
894+ epsilon: Adjustment constant used for EBI, default to 1.0
894895 kernel: Kernel used for kernel indices, default = 'RBF'
895896 Available options:
896897 - 'linear' : Linear Kernel.
@@ -919,16 +920,34 @@ def spectralIndices(
919920 image = ee.Image('COPERNICUS/S2_SR/20190828T151811_20190828T151809_T18GYT')
920921 image = image.geetools.spectralIndices(["NDVI", "NDFI"])
921922 """
922- raise NotImplementedError (
923- "The ee_extra package is lacking maintainer for several years, it is now incompatible with "
924- "all the latest version of Python due to use of deprecated pkg_resources. "
925- " We will try to fix this in the future, but for now please use the ee_extra package directly."
923+ return ee_extra .Spectral .core .spectralIndices (
924+ x = self ._obj ,
925+ index = index ,
926+ G = G ,
927+ C1 = C1 ,
928+ C2 = C2 ,
929+ L = L ,
930+ cexp = cexp ,
931+ nexp = nexp ,
932+ alpha = alpha ,
933+ slope = slope ,
934+ intercept = intercept ,
935+ gamma = gamma ,
936+ omega = omega ,
937+ beta = beta ,
938+ k = k ,
939+ fdelta = fdelta ,
940+ epsilon = epsilon ,
941+ kernel = kernel ,
942+ sigma = sigma ,
943+ p = p ,
944+ c = c ,
945+ lambdaN = lambdaN ,
946+ lambdaR = lambdaR ,
947+ lambdaG = lambdaG ,
948+ online = online ,
949+ drop = False ,
926950 )
927- # return ee_extra.Spectral.core.spectralIndices(
928- # self._obj, index, G, C1, C2, L, cexp, nexp, alpha, slope, intercept, gamma, omega,
929- # beta, k, fdelta, kernel, sigma, p, c, lambdaN, lambdaR, lambdaG, online,
930- # drop=False,
931- # )
932951
933952 def getScaleParams (self ) -> dict [str , float ]:
934953 """Gets the scale parameters for each band of the image.
@@ -950,12 +969,7 @@ def getScaleParams(self) -> dict[str, float]:
950969
951970 ee.ImageCollection('MODIS/006/MOD11A2').first().geetools.getScaleParams()
952971 """
953- raise NotImplementedError (
954- "The ee_extra package is lacking maintainer for several years, it is now incompatible with "
955- "all the latest version of Python due to use of deprecated pkg_resources. "
956- " We will try to fix this in the future, but for now please use the ee_extra package directly."
957- )
958- # return ee_extra.STAC.core.getScaleParams(self._obj)
972+ return ee_extra .STAC .core .getScaleParams (self ._obj )
959973
960974 def getOffsetParams (self ) -> dict [str , float ]:
961975 """Gets the offset parameters for each band of the image.
@@ -977,12 +991,7 @@ def getOffsetParams(self) -> dict[str, float]:
977991
978992 ee.ImageCollection('MODIS/006/MOD11A2').first().geetools.getOffsetParams()
979993 """
980- raise NotImplementedError (
981- "The ee_extra package is lacking maintainer for several years, it is now incompatible with "
982- "all the latest version of Python due to use of deprecated pkg_resources. "
983- " We will try to fix this in the future, but for now please use the ee_extra package directly."
984- )
985- # return ee_extra.STAC.core.getOffsetParams(self._obj)
994+ return ee_extra .STAC .core .getOffsetParams (self ._obj )
986995
987996 def scaleAndOffset (self ) -> ee .Image :
988997 """Scales bands on an image according to their scale and offset parameters.
@@ -1003,12 +1012,7 @@ def scaleAndOffset(self) -> ee.Image:
10031012
10041013 S2 = ee.ImageCollection('COPERNICUS/S2_SR').first().geetools.scaleAndOffset()
10051014 """
1006- raise NotImplementedError (
1007- "The ee_extra package is lacking maintainer for several years, it is now incompatible with "
1008- "all the latest version of Python due to use of deprecated pkg_resources. "
1009- " We will try to fix this in the future, but for now please use the ee_extra package directly."
1010- )
1011- # return ee_extra.STAC.core.scaleAndOffset(self._obj)
1015+ return ee_extra .STAC .core .scaleAndOffset (self ._obj )
10121016
10131017 def preprocess (self , ** kwargs ) -> ee .Image :
10141018 """Pre-processes the image: masks clouds and shadows, and scales and offsets the image.
@@ -1037,12 +1041,7 @@ def preprocess(self, **kwargs) -> ee.Image:
10371041 .geetools.preprocess()
10381042 )
10391043 """
1040- raise NotImplementedError (
1041- "The ee_extra package is lacking maintainer for several years, it is now incompatible with "
1042- "all the latest version of Python due to use of deprecated pkg_resources. "
1043- " We will try to fix this in the future, but for now please use the ee_extra package directly."
1044- )
1045- # return ee_extra.QA.pipelines.preprocess(self._obj, **kwargs)
1044+ return ee_extra .QA .pipelines .preprocess (self ._obj , ** kwargs )
10461045
10471046 def getSTAC (self ) -> dict [str , Any ]:
10481047 """Gets the STAC of the image.
@@ -1099,9 +1098,8 @@ def getDOI(self) -> str:
10991098
11001099 ee.ImageCollection('NASA/GPM_L3/IMERG_V06').first().geetools.getDOI()
11011100 """
1102- stac = self .getSTAC ()
11031101 error_msg = "DOI not found in the STAC"
1104- return stac .get ("sci:doi" , error_msg )
1102+ return self . getSTAC () .get ("sci:doi" , error_msg )
11051103
11061104 def getCitation (self ) -> str :
11071105 """Gets the citation of the image, if available.
@@ -1122,9 +1120,8 @@ def getCitation(self) -> str:
11221120
11231121 ee.ImageCollection('NASA/GPM_L3/IMERG_V06').first().geetools.getCitation()
11241122 """
1125- stac = self .getSTAC ()
11261123 error_msg = "Citation not found in the STAC"
1127- return stac .get ("sci:citation" , error_msg )
1124+ return self . getSTAC () .get ("sci:citation" , error_msg )
11281125
11291126 def panSharpen (self , method : str = "SFIM" , qa : str = "" , ** kwargs ) -> ee .Image :
11301127 """Apply panchromatic sharpening to the Image.
@@ -1151,14 +1148,9 @@ def panSharpen(self, method: str = "SFIM", qa: str = "", **kwargs) -> ee.Image:
11511148 source = ee.Image("LANDSAT/LC08/C01/T1_TOA/LC08_047027_20160819")
11521149 sharp = source.geetools.panSharpen(method="HPFA", qa=["MSE", "RMSE"], maxPixels=1e13)
11531150 """
1154- raise NotImplementedError (
1155- "The ee_extra package is lacking maintainer for several years, it is now incompatible with "
1156- "all the latest version of Python due to use of deprecated pkg_resources. "
1157- " We will try to fix this in the future, but for now please use the ee_extra package directly."
1151+ return ee_extra .Algorithms .core .panSharpen (
1152+ img = self ._obj , method = method , qa = qa , prefix = "geetools" , ** kwargs
11581153 )
1159- # return ee_extra.Algorithms.core.panSharpen(
1160- # img=self._obj, method=method, qa=qa, prefix="geetools", **kwargs
1161- # )
11621154
11631155 def tasseledCap (self ) -> ee .Image :
11641156 """Calculates tasseled cap brightness, wetness, and greenness components.
@@ -1218,12 +1210,7 @@ def tasseledCap(self) -> ee.Image:
12181210 image = ee.Image('COPERNICUS/S2_SR/20190828T151811_20190828T151809_T18GYT')
12191211 img = img.geetools.tasseledCap()
12201212 """
1221- raise NotImplementedError (
1222- "The ee_extra package is lacking maintainer for several years, it is now incompatible with "
1223- "all the latest version of Python due to use of deprecated pkg_resources. "
1224- " We will try to fix this in the future, but for now please use the ee_extra package directly."
1225- )
1226- # return ee_extra.Spectral.core.tasseledCap(self._obj)
1213+ return ee_extra .Spectral .core .tasseledCap (self ._obj )
12271214
12281215 def matchHistogram (
12291216 self ,
@@ -1368,23 +1355,18 @@ def maskClouds(
13681355 .geetools.maskClouds(prob = 75,buffer = 300,cdi = -0.5)
13691356 )
13701357 """
1371- raise NotImplementedError (
1372- "The ee_extra package is lacking maintainer for several years, it is now incompatible with "
1373- "all the latest version of Python due to use of deprecated pkg_resources. "
1374- " We will try to fix this in the future, but for now please use the ee_extra package directly."
1358+ return ee_extra .QA .clouds .maskClouds (
1359+ self ._obj ,
1360+ method ,
1361+ prob ,
1362+ maskCirrus ,
1363+ maskShadows ,
1364+ scaledImage ,
1365+ dark ,
1366+ cloudDist ,
1367+ buffer ,
1368+ cdi ,
13751369 )
1376- # return ee_extra.QA.clouds.maskClouds(
1377- # self._obj,
1378- # method,
1379- # prob,
1380- # maskCirrus,
1381- # maskShadows,
1382- # scaledImage,
1383- # dark,
1384- # cloudDist,
1385- # buffer,
1386- # cdi,
1387- # )
13881370
13891371 def removeProperties (self , properties : list [str ] | ee .List ) -> ee .Image :
13901372 """Remove a list of properties from an image.
0 commit comments