Closed guy1ziv2 closed 6 years ago
I believe the problem is in salcol.py which does not include the new Collection 1 Landsat SR collections -
LANDSAT/LT05/C01/T1_SR LANDSAT/LE07/C01/T1_SR LANDSAT/LC08/C01/T1_SR
Hi Guy, thanks for the report. I tried the example code a week ago and it was working as I expected, I'll give it a try on Monday to see what happens. About collections, I'll include those, thank you! Anyhow, as far as I know (and have checked) LEDAPS collections have all TOA images, and in 2010 there was no Landsat 8, so I'd expect to have all available images for 2010 in the LEDAPS collections.
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()
COLLECTION
col_group = satcol.ColGroup.Landsat()
SEASON
a_season = season.Season.Growing_South()
MASKS
cld_mask = masks.Clouds() equiv_mask = masks.Equivalent()
Combine masks in a tuple
masks = (cld_mask, equiv_mask)
FILTERS
filt_cld = filters.CloudsPercent() filt_mask = filters.MaskPercent()
Combine filters in a tuple
filters = (filt_cld, filt_mask)
SCORES
doy = scores.Doy() sat = scores.Satellite() op = scores.AtmosOpacity() out = scores.Outliers(("ndvi",)) ind = scores.Index("ndvi") mascpor = scores.MaskPercent() dist = scores.CloudDist()
Combine scores in a tuple
scores = (doy, sat, op, out, ind, mascpor, dist)
BAP OBJECT
bap = bap.Bap(year=2010, range=(0, 0), season=a_season, colgroup=col_group, masks=masks, scores=scores, filters=filters)
SITE
site = ee.Geometry.Polygon([[-71,-42], [-71,-43], [-72,-43], [-72,-42]])
COMPOSITE
composite = bap.bestpixel(site=site, indices=("ndvi",))
The result (composite) is a namedtuple, so
image = composite.image
image is a ee.Image object, so you can do anything
from here..
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'
It seems the final collection after filtering is 0 and the bap.py does not check if there is at least one image?