using Savitzky-Golay to calculate NDVI,but it happened some problems #1825
Unanswered
lizeshuo1999
asked this question in
Q&A
Replies: 1 comment 1 reply
-
@giswqs Professor, could you please take the time to help solve the following problem? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
the code:
degree = 3
kernelSize = 3
time_Filter = ee.Filter.maxDifference(max_Diff=1000360024*48, left_Field='system:time_start', right_Field='system:time_start')
def savitzky_golay(image):
inImage = image.select(['NDVI']) # 使用 'NDVI' 替换 'NDVI' 以匹配您的数据
smoothed = inImage.addBands(inImage).convolve(ee.Kernel.square(kernelSize))
weights = ee.List([
ee.List([1, 2, 1]),
ee.List([2, 4, 2]),
ee.List([1, 2, 1])
])
smoothed = smoothed.updateMask(smoothed.select(0).neq(0))
outImage = smoothed.divide(ee.Image.constant(16)).multiply(ee.Image(weights))
return outImage.rename('d_0_NDVI')
SG_NDVI = NDVI.filter(time_Filter).map(savitzky_golay)
map.addLayer(SG_NDVI , 'vis1' , 'SG_NDVI')
#problem
'ApiFunction' object has no attribute 'name'
the timeFilter is wrong,but i don't know how to solve it
Beta Was this translation helpful? Give feedback.
All reactions