All projects

Project 05 · Numerical analysis · 2025

Weather Interpolation

Reconstructing smooth curves from sparse measurements — interpolation methods compared on NOAA weather data, with cubic splines at the core.

Top-down illustration of a small weather station in a field: an anemometer mast, a rain gauge, an instrument box and Erva holding a tablet

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

Elevation along the route Natural cubic spline through the five samples in the script — hover or use the arrow keys to read the curve
10012515017505101520distance (km)m7.5 km → 132.66 m
Show the data
Distance (km)Elevation (m)Type
0100sample
5150sample
10120sample
15170sample
20130sample
7.5132.66spline value

How it works

  1. SamplesStart from the measured points — here five elevation samples between 0 and 20 km.
  2. 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.
  3. EvaluateRead the curve anywhere between the samples — the script reports the value at 7.5 km.
  4. 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’s CubicSpline(x, y, bc_type='natural'), evaluated at 7.5 km and plotted with Matplotlib
  • README.mdProject description
from scipy.interpolate import CubicSpline
spline = CubicSpline(x, y, bc_type='natural')
print(f'{spline(7.5):.2f}')