Geographic Information Systems Asked by Rebecca Dell on April 8, 2021
I am having a problem with the Linear Regression function (code attached) when I try to regress latitude or longitude against B4 reflectance for a S2 image. I am getting the following error:
ReduceBands reducer must have one input: <Reducer>.
https://code.earthengine.google.com/ef8f966b9ac39b308198968d45af58be
The problem is that the way you are reducing, the inputs to the reducer will be the values of different bands in a pixel. In case of linear regression, it does not work as linear regression is trying to fit a linear equation by minimizing the rmse but one pixel is essentially just a single feature. Think of it this way, to do linear regression you need (x1,y1),(x2,y2),..... not just (x1,y1). So one of the following two is solution depending what you were trying to achieve.
var linear = albedo.select(['longitude', 'B4'])
.reduceRegion(ee.Reducer.linearRegression(1,1),image.get('system:footprint'),10);
Answered by Nishanta Khanal on April 8, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP