r-spatial / dtwSat

Time-Weighted Dynamic Time Warping for satellite image time series analysis
https://www.victor-maus.com/dtwSat/
GNU General Public License v3.0
131 stars 39 forks source link

Degrees of Freedom error #55

Closed RossDF closed 2 years ago

RossDF commented 2 years ago

Hey,

I'm just trying to run your example code over a test case I have and I'm encountering the following error:

>   # Create temporal patterns 
>   profiles_library <- createPatterns(training_ts, freq = 8, formula = y ~ s(x))
Error in smooth.construct.tp.smooth.spec(object, dk$data, dk$knots) : 
  A term has fewer unique covariate combinations than specified maximum degrees of freedom

I believe this may relate to gam, I'll be trying to add in an argument for k and see if I can lower the DoF.

What would your recommendations be in terms of frequency of time-series data, my dataset (below) is pretty sparse earlier on in the time-series. Should I interpolate some dates between Feb-June?

Some brief details on my image/sample set: Sentinel-2 over the following dates: 2022-02-08 2022-02-18 2022-03-20 2022-04-14 2022-05-04 2022-06-08 2022-06-13 2022-06-18 2022-06-23 2022-06-28 2022-07-08 2022-07-13 2022-07-18 2022-07-28 2022-08-02 2022-08-07

With 331 sample points (some of which are over the period 2022/02/18 - 2022/06/08)