fitoprincipe / geebap Goto Github PK
View Code? Open in Web Editor NEWBest Available Pixel (BAP) composite in Google Earth Engine (GEE) using the Python API
License: GNU General Public License v3.0
Best Available Pixel (BAP) composite in Google Earth Engine (GEE) using the Python API
License: GNU General Public License v3.0
Hi Rodrigo,
Thanks for the updates. I have updated to 0.2.2, Conda 3.6 and I get this error during import. Any idea why?
Thanks a lot
S
>>> from geebap import bap
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/sebastien/anaconda3/envs/ee/lib/python3.6/site-packages/geebap/__init__.py", line 24, in <module>
from . import bap, date, expgen, expressions, filters, functions,\
File "/Users/sebastien/anaconda3/envs/ee/lib/python3.6/site-packages/geebap/bap.py", line 5, in <module>
from . import scores, priority, functions, utils, __version__
File "/Users/sebastien/anaconda3/envs/ee/lib/python3.6/site-packages/geebap/scores.py", line 33, in <module>
from . import priority
File "/Users/sebastien/anaconda3/envs/ee/lib/python3.6/site-packages/geebap/priority.py", line 23, in <module>
class SeasonPriority(object):
File "/Users/sebastien/anaconda3/envs/ee/lib/python3.6/site-packages/geebap/priority.py", line 55, in SeasonPriority
ee_relation = ee.Dictionary(relation)
File "/Users/sebastien/anaconda3/envs/ee/lib/python3.6/site-packages/ee/computedobject.py", line 32, in __call__
return type.__call__(cls, *args, **kwargs)
File "/Users/sebastien/anaconda3/envs/ee/lib/python3.6/site-packages/ee/dictionary.py", line 27, in __init__
self.initialize()
File "/Users/sebastien/anaconda3/envs/ee/lib/python3.6/site-packages/ee/dictionary.py", line 48, in initialize
apifunction.ApiFunction.importApi(cls, 'Dictionary', 'Dictionary')
File "/Users/sebastien/anaconda3/envs/ee/lib/python3.6/site-packages/ee/apifunction.py", line 180, in importApi
cls.initialize()
File "/Users/sebastien/anaconda3/envs/ee/lib/python3.6/site-packages/ee/apifunction.py", line 151, in initialize
signatures = data.getAlgorithms()
File "/Users/sebastien/anaconda3/envs/ee/lib/python3.6/site-packages/ee/data.py", line 426, in getAlgorithms
return send_('/algorithms', {}, 'GET')
File "/Users/sebastien/anaconda3/envs/ee/lib/python3.6/site-packages/ee/data.py", line 838, in send_
response.status)
ee.ee_exception.EEException: Server returned HTTP code: 404
@fitoprincipe - super cool tool. I've just started playing around with it. One thing you might want to consider changing is this line in your Best_Available_Pixel_Composite,ipynb
script:
bap = bap.Bap(year=2000, range=(0, 0),
season=a_season,
masks=(cld_mask,),
scores=(doy, sat, atm_op, dist, out, maskper, ind),
filters=(filt_cld, filt_mask))
If a user steps through the code sequentially, but then comes back and changes reruns this block, the variable name bap
has now clobbered the module name. Minor annoyance, but might trip up some people. Thanks for your work on this.
Hi there,
I was just wondering if you had an updated version of the code anywhere?
Thanks a lot for the great work!
S
The sample code does not work. This is the code:
`rom geebap import bap, season, filters, masks,
scores, satcol, functions
from geetools import tools
import ee
ee.Initialize()
col_group = satcol.ColGroup.Landsat()
a_season = season.Season.Growing_South()
cld_mask = masks.Clouds()
equiv_mask = masks.Equivalent()
masks = (cld_mask, equiv_mask)
filt_cld = filters.CloudsPercent()
filt_mask = filters.MaskPercent()
filters = (filt_cld, filt_mask)
doy = scores.Doy()
sat = scores.Satellite()
op = scores.AtmosOpacity()
out = scores.Outliers(("ndvi",))
ind = scores.Index("ndvi")
mascpor = scores.MaskPercent()
dist = scores.CloudDist()
scores = (doy, sat, op, out, ind, mascpor, dist)
bap = bap.Bap(year=2010, range=(0, 0),
season=a_season,
colgroup=col_group,
masks=masks,
scores=scores,
filters=filters)
site = ee.Geometry.Polygon([[-71,-42],
[-71,-43],
[-72,-43],
[-72,-42]])
composite = bap.bestpixel(site=site,
indices=("ndvi",))
image = composite.image
one_value = tools.get_value(image,
site.centroid(),
30, 'client')
print(one_value)
See below for the debug output:
scores: ['score-doy', 'score-sat', 'score-atm-op', 'score-outlier', 'score-inde
', 'score-maskper', 'score-cld-dist']
Satellite: LEDAPS/LT5_L1T_SR
ini: 2009-11-15 ,end: 2010-03-15
size after filters: 15
** score-doy **
** score-sat **
** score-atm-op **
** score-outlier **
1.2.3.4.5.6.7.8.9.10.** score-index **
** score-maskper **
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.3
.** score-cld-dist **
1.2.3.4.5.6.7.8.9.10.
Satellite: LANDSAT/LT5_SR
ini: 2009-11-15 ,end: 2010-03-15
size after filters: 0
Satellite: LANDSAT/LE7_SR
ini: 2009-11-15 ,end: 2010-03-15
size after filters: 0
Satellite: LEDAPS/LE7_L1T_SR
ini: 2009-11-15 ,end: 2010-03-15
size after filters: 29
** score-doy **
** score-sat **
** score-atm-op **
** score-outlier **
1.2.3.4.5.6.7.8.9.10.** score-index **
** score-maskper **
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.3
.** score-cld-dist **
1.2.3.4.5.6.7.8.9.10.final collection size: 0
Traceback (most recent call last):
File "", line 3, in
File "C:\Users\geogz\AppData\Local\Continuum\Anaconda2\lib\site-packages\geeb
p\bap.py", line 474, in bestpixel
imgCol = colbap.col
AttributeError: 'NoneType' object has no attribute 'col'
The result (composite) is a namedtuple, so
... image = composite.image
Traceback (most recent call last):
File "", line 2, in
NameError: name 'composite' is not defined
image is a ee.Image object, so you can do anything
... # from here..
...
one_value = tools.get_value(image,
... site.centroid(),
... 30, 'client')
Traceback (most recent call last):
File "", line 1, in
NameError: name 'tools' is not definedprint(one_value)
It seems the final collection after filtering is 0 and the bap.py does not check if there is at least one image?
when i import all the library in the sample code, errors occur as following:
AttributeError Traceback (most recent call last)
in ()
----> 1 from geebap import bap, season, filters, masks, scores, satcol, functions
2 from geetools import tools
3
4 import pprint
5 pp = pprint.PrettyPrinter(indent=2)f:\Anaconda3\envs\GEE\lib\site-packages\geebap\bap.py in ()
10 if not ee.data._initialized: ee.Initialize()
11
---> 12 import satcol
13 import season as temp
14 import functionsf:\Anaconda3\envs\GEE\lib\site-packages\geebap\satcol.py in ()
901
902
--> 903 GROUPS = {'Landsat': [col.ID for col in ColGroup.Landsat().collections],
904 'MSS': [col.ID for col in ColGroup.MSS().collections],
905 'Landsat_Sentinel': [col.ID for col in ColGroup.Landsat_Sentinel().collections],f:\Anaconda3\envs\GEE\lib\site-packages\geebap\satcol.py in Landsat(cls)
827 Collection.Landsat2(),
828 Collection.Landsat3(),
--> 829 Collection.Landsat4TOA(),
830 Collection.Landsat4USGS(),
831 Collection.Landsat5TOA(),f:\Anaconda3\envs\GEE\lib\site-packages\geebap\satcol.py in Landsat4TOA(cls)
428
429 obj.clouds_band = "BQA"
--> 430 obj.fclouds = cld.landsatTOA()
431 # obj.ID = "LANDSAT/LT4_L1T_TOA_FMASK"
432 obj.ID = IDS[obj.short]AttributeError: 'module' object has no attribute 'landsatTOA'
Hellow,
When I tried to run ,I have returned the following error:
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-EMcAa9/geetools/
Can you help me?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.