Time series · Date alignment · Interpolation
INTERPOLATE
Interpolate one series onto another series' observation dates.
Syntax
alignedY=INTERPOLATE(Y,X)
Y supplies the values. X supplies the dates. X's measured values are not inputs to the interpolation. The returned object is a numeric SeriesOperator.
The command calls Y.getInterpolatedDates(X) directly, including when both inputs
have the same frequency. Equal frequency labels do not guarantee equal observation dates.
Solar radiation and buoy temperature
water=NDBC("42040","WTMP",2000,2025)
location=GEO_LOCATION(29.207,-88.237)
solar=SOLAR(water,location)
radiation=EXTRACT(solar,"RADIATION")
alignedSolar=INTERPOLATE(radiation,water)
reg=REGRESSION(water,alignedSolar)
residualModel=SPECTRAL_ARIMA(EXTRACT(reg,"residuals"))
slide(reg,residualModel)
For lag discovery, keep temperature first in the transfer-function list:
aligned=SAME_DATE_RANGE(water,alignedSolar)
transfer=MVTRANSFER_FUNCTION(aligned,90,4)
EXTRACT(transfer,"model")
SOLAR already calculates on its input series' dates. In this example the solar calendar is therefore already aligned; INTERPOLATE is useful when the source calendar differs.
Behavior and interpretation
Both arguments must be nonempty numeric dated series. An empty interpolation result is reported as an error. Interpolation is linear in elapsed milliseconds; exact timestamp matches retain source values. Target dates outside Y's span and interpolated NaN values are omitted. There is no extrapolation. The returned series preserves Y's code, name, units and source and takes X's frequency. Missing source intervals can be bridged; no maximum gap length is imposed by the existing method.
This is date alignment, not period aggregation. Inspect resulting dates, frequency and coverage. A complete daily grid requires a complete daily X calendar. Interpolation alone does not establish how a downstream model counts lags or handles gaps.
Interpolated observations are estimates. Avoid treating estimated environmental measurements as newly observed data. Astronomical solar variables can instead be calculated directly on the desired dates with SOLAR(X,location). RADIATION is extraterrestrial solar energy, not measured surface sunlight.