Geographic Information Systems Asked on October 28, 2020
I’m struggling to get the Verdet Temporal Segmentaion Algorithm to run (https://developers.google.com/earth-engine/apidocs/ee-algorithms-temporalsegmentation-verdet). I get vague "Internal Server Errors" when displaying the output.
As per the documentation I think I’m providing the correct style of input – 1 image per year. I’m thinking this is a bug in the Verdet code, given that I have noticed other similar posts on Verdet.
Link to code: https://code.earthengine.google.com/fdf8bdd1ecac7551b2dfd89f52d7417c
Started a thread in GEE developer’s forum as well: https://groups.google.com/g/google-earth-engine-developers/c/cORUs-lFyCs/m/2UWkTX_DAAAJ
Code used (everything works, except adding the verdet layer to the map):
function mask(img) {
var clearBitMask = 1 << 1;
var qa = img.select('pixel_qa');
var masked_img = img.updateMask(
qa.bitwiseAnd(clearBitMask)
).copyProperties(img, ['system:time_start'])
return(masked_img)
}
function addNDVI(img) {
var ndvi = img.normalizedDifference(["nir", "red"]).rename('NDVI')
img = img.addBands(ndvi)
return(img)
}
var start_yr = 2015
var end_yr = 2020
var coords = [
[-74.31961, 43.94047],
[-74.1584, 43.94047],
[-74.1584, 44.07021],
[-74.31961, 44.07021]
]
var aoi = ee.Geometry.Polygon(coords)
var yearlyComposites = ee.ImageCollection([]);
for (var i = start_yr; i < end_yr; i++) {
var ls8Col = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR').select(
['B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'pixel_qa'],
['blue', 'green', 'red', 'nir', 'swir1', 'swir2', 'pixel_qa']
).filterMetadata(
'IMAGE_QUALITY_OLI', 'not_less_than', 9
).filterMetadata(
'CLOUD_COVER', 'not_greater_than', 33
).filterBounds(
aoi
).filterDate(
ee.Date(i + '-06-15'),
ee.Date(i + '-8-30')
)
ls8Col = ls8Col.map(addNDVI)
ls8Col = ls8Col.map(mask)
ls8Col = ls8Col.map(function(img) {return(img.clip(aoi))});
yearlyComposites = yearlyComposites.merge(ls8Col.median());
}
yearlyComposites = yearlyComposites
print(yearlyComposites.getInfo())
var centerCoords = aoi.centroid().coordinates()
print(centerCoords.get(0))
print(centerCoords.get(1))
var verdet = ee.Algorithms.TemporalSegmentation.Verdet(yearlyComposites.select('NDVI'));
print(verdet.getInfo())
Map.setCenter( -74.23900500000029, 44.00534468585141, 12)
Map.addLayer(verdet, {}, 'verdet')
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP