open-geocomputing / OpenEarthEngineLibrary

https://www.open-geocomputing.org/OpenEarthEngineLibrary/
127 stars 38 forks source link

weights in SavatskyGolayFilter #19

Closed kongdd closed 4 months ago

kongdd commented 1 year ago

Points with different quality, should give different weights. Any idea and any plan to implement this feature?

Thanks image

mgravey commented 1 year ago

this is an interesting idea, how do you expect to pass this information ? as an extra band ?

kongdd commented 1 year ago

@mgravey and @agathearchidoit,

Could give some explaination about the parameter extrapolate_flag? https://github.com/open-geocomputing/OpenEarthEngineLibrary/blob/5f82c48e5dde59c4728e465360c65df28acf037b/ImageCollection/SavatskyGolayFilter#L51-L54

In theory, extrapolate_flag should always be zero. https://code.earthengine.google.com/a1c4e3359e1c4fdc351238c74becfbbc

There are only three conditions:

  1. t in the range of [-nt, nt], extrapolate = 0;
  2. t in the range of [-nt, 0], extrapolate = 0;
  3. t in the range of [0, nt], extrapolate = 0;
kongdd commented 1 year ago

In my R package phenofit, I implemented the weighted SG.

But it is a little bit complex to translate. I will try whether it is possible.

mgravey commented 1 year ago

The extrapolation flag tell you when all conditioning points are on a single side. Usually it's a sign that it would be very wrong :) But why do you imagine that it should be always at 0 ?, typically the first and last point of a series are not. But it can happen even in the middle of a series if it's to parse compared to the windows.

Based on Wikipedia it doesn't look complicated.

You still didn't answer to my question! how do you expect to pass this information, as a band ? One for each variable ? As a feature for each image ?

kongdd commented 1 year ago

https://github.com/open-geocomputing/OpenEarthEngineLibrary/blob/5f82c48e5dde59c4728e465360c65df28acf037b/ImageCollection/SavatskyGolayFilter#L32

mgravey commented 1 year ago

The estimation collection can be very different of the inputCollection, if you work with MODIS, you are probably both at a daily basis, but with Landsat or Sentinel it allow to get estimation on a constant intervals, even if the input is not.

mgravey commented 1 year ago

Sorry wrong button