Overview
Real measurements are sparse: a station reports at fixed times, a survey samples a handful of points. This project fills the gaps. I implemented and compared linear, polynomial and cubic-spline interpolation on NOAA weather data and looked at trend, seasonal and residual components with time-series decomposition, Fourier analysis and autocorrelation.
Cubic splines win for smooth physical signals: the curve passes through every sample, and its slope and curvature stay continuous, so there are no kinks and none of the wild swings a single high-degree polynomial produces.
What the code computes
Show the data
| Distance (km) | Elevation (m) | Type |
|---|---|---|
| 0 | 100 | sample |
| 5 | 150 | sample |
| 10 | 120 | sample |
| 15 | 170 | sample |
| 20 | 130 | sample |
| 7.5 | 132.66 | spline value |
How it works
- SamplesStart from the measured points — here five elevation samples between 0 and 20 km.
- FitFit a natural cubic spline: a cubic between each pair of points, joined so slope and curvature are continuous, with zero curvature at both ends.
- EvaluateRead the curve anywhere between the samples — the script reports the value at 7.5 km.
- PlotDraw the curve on a 250-point grid together with the original samples.
What’s in the source code
The public repository holds the cubic-spline part of the coursework — the computation charted above.
COE_ErvaSengul_Assignment1.pyNatural cubic spline with SciPy’sCubicSpline(x, y, bc_type='natural'), evaluated at 7.5 km and plotted with MatplotlibREADME.mdProject description
from scipy.interpolate import CubicSpline
spline = CubicSpline(x, y, bc_type='natural')
print(f'{spline(7.5):.2f}')