eMapR / LT-GEE

Google Earth Engine implementation of the LandTrendr spectral-temporal segmentation algorithm. For documentation see:
https://emapr.github.io/LT-GEE
Apache License 2.0
198 stars 65 forks source link

Errors with Fitted Line for NDVI zonal time series #7

Closed kharris91 closed 4 years ago

kharris91 commented 4 years ago

I've been encountering many instances where the fitted line for my NDVI zonal time series seems completely off.

For example, I am looking at a 40m buffer around a wetland point below, and am using parameters suggested in the literature. `// my area of interest is a 40m buffer around this point var aoi = ee.Geometry.Point([-76.2845001, 38.45196685]).buffer(40);

// define parameters var startYear = 1985; var endYear = 2019; var startDay = '06-20'; var endDay = '09-20'; var index = 'NDVI'; var maskThese = ['cloud', 'shadow', 'snow']; var summaryScale = 1; var runParams = { maxSegments: 6, spikeThreshold: 0.75, vertexCountOvershoot: 3, preventOneYearRecovery: true, recoveryThreshold: 1, pvalThreshold: 0.1, bestModelProportion: 0.75, minObservationsNeeded: 6 };`

The fitted line produced in this instance does not seem to accurately describe the time series trend. image

In other cases the fitted slope seems correct, but the values fall above or below the original time series values.

image

jdbcode commented 4 years ago

Could you share the scripts that produced these charts to help identify the problem.

kharris91 commented 4 years ago

Sure, thanks @jdbcode. The script I'm using is basically the provided script for the zonal time series provided on GEE.

Here is a link to the code that produced the chart in the first picture: https://code.earthengine.google.com/d6b81ee199ce0cc4641e57972ae1db0b

jdbcode commented 4 years ago

Thanks for sharing the script! I see the problem I think: the index that is used for LandTrendr fitting (NDVI) is different than what is being fitted (NBR). The hard coded NBR in the ltgee.transformSRcollection(annualSRcollection, ['NBR']); line is to blame here.

image

I've updated that example script to remove the hard coded argument and also reduced a little unnecessary complexity. Please give it a try now and let me know if you think it is working as expected. Thanks for raising the issue!

Updated example: https://code.earthengine.google.com/?as_external&scriptPath=users%2Femaprlab%2Fpublic%3AScripts%2FLandTrendr%20Examples%2FLandTrendr%20Zonal%20Time%20Series%20Plotter

Your script updated: https://code.earthengine.google.com/fa10719ecaa2a8be7400dd9c32b21ab1

kharris91 commented 4 years ago

Thanks again for the quick response @jdbcode! The updated script is working as expected for the NDVI and EVI time series I've tested.

jdbcode commented 4 years ago

Glad to hear it!