SmoothSignal¶
-
class
museopheno.time_series.
SmoothSignal
(dates, bands_order=False, order_by='date', output_dates=False, fmt='%Y%m%d')[source]¶ Smooth time series signal.
- Parameters
dates (list) – list of dates. E.g. [‘20180101’,’20180201’]
bands_order (list, optional.) –
order_by (str) – Default is ‘date’, ‘band’.
output_dates –
fmt (str, optional.) – Input format of dates. Default is ‘%Y%m%d’, so ‘20181231’
Example
>>> x = np.asarray([3.4825737, 4.27786 , 5.0373, 4.7196426, 4.1233397, 4.0338645,2.7735472]) >>> y = [20180429, 20180513, 20180708, 20180815, 20180915, 20181015, 20181115] >>> new_dates = generate_temporal_sampling(y[0],y[-1],10) # temporal sampling every 10 days >>> timeseries = SmoothSignal(dates=y,output_dates=new_dates) >>> timeseries.interpolation(x,kind='cubic') array([3.4825737 , 4.08649468, 4.516693 , 4.80103881, 4.96740226, 5.0436535 , 5.0576627 , 5.0373 , 5.00281393, 4.94396649, 4.84289809, 4.68186017, 4.46665263, 4.25561504, 4.11417114, 4.07489294, 4.07273781, 4.02461571, 3.84743661, 3.45811045, 2.7735472 ]) >>> timeseries.savitzski_golay(x) array([3.52581844, 3.96414587, 4.30156892, 4.49484286, 4.63045714, 4.76607143, 4.90168571, 4.96423055, 4.95370595, 4.87011189, 4.77926706, 4.65216832, 4.48881567, 4.30187759, 4.16911641, 4.09053213, 4.04814943, 3.88019043, 3.58665514, 3.18010117, 2.7735472 ])
Methods
__init__
(dates[, bands_order, order_by, …])Smooth time series signal.
convert_to_datetime
(dates[, fmt])Convert list of dates to a list of dates with datetime type.
convert_to_doy
(dates[, fmt])Convert list of dates to Day Of Year (DOY) number.
double_logistic
(X[, kind, interpolation_params])Generate a double logistic curve similar to those of the MODIS phenology product.
int_to_datetime
(dates)Convert list of int to datetime.
interpolation
(X[, kind, fill_value])Based on
scipy.interpolate.interp1d
iterative_median
(X[, window_length, …])Savitzski golay Based on
scipy.signal.median_filter
savitzski_golay
(X[, window_length, …])Savitzski golay Based on
scipy.signal.savgol_filter