Sampling, resampling,
and irregular data

Session 6 · Mon Oct 12 · Book sections 2.5–2.6

🌊

Today’s question

Downsample a series, fill a gap, average a network — each changes the data.

Can you change the sampling without inventing signal that was never measured?

Gridded data from micrometers to the globe

Drawn for this course from spacings and extents stated in 18 CC BY 4.0 articles (list: figs/lit_gridded_gallery/SOURCES.md). Global products all span the Earth; markers stacked by up to ×1.6.

Grid spacing spans ten orders of magnitude, from 2.25 µm voxels to 100 km model cells; most grids are 100 to 10,000 cells across.

Laboratory: a sandstone core as a 4D grid

🧪 Sample & laboratory 🪨 Solid Earth 📈 Seismology

Cartwright-Taylor et al. (2022), Nature Communications 13, 6169, Fig. 2, doi:10.1038/s41467-022-33855-z. CC BY 4.0.

Each volume is 1,596 × 1,506 × 3,080 voxels of 7.91 µm, about 15 GB at 16 bits, repeated every 85 s while the rock fails.

Field: radar ice thickness, from survey lines to grids

📍 In-situ sensor 🖥️ Model & simulation 🧊 Cryosphere 🧊 Glaciology

Wang et al. (2026), Earth System Science Data 18, 4241–4262, Figs. 3–4, doi:10.5194/essd-18-4241-2026; the middle and right grids re-plot Frank and van Pelt (2024) and Farinotti et al. (2019). CC BY 4.0.

Lines 20 to 300 m apart become a 10 m grid; on the same four glaciers, two published grids differ by 21 to 72 m on average.

Satellite: soil moisture before and after gap filling

🛰️ Satellite & airborne 💧 Land water 💧 Hydrology & land-surface modeling

Preimesberger et al. (2025), Earth System Science Data 17, 4305–4329, Fig. 6, doi:10.5194/essd-17-4305-2025. CC BY 4.0.

On 1 March 2007, frozen ground (hatched) and dense vegetation leave much of the land without a retrieval; filled values match in situ stations about as well as retrievals do (median R = 0.72), but they are estimates.

Satellite: the local time each orbit samples drifts

🛰️ Satellite & airborne 🌊 Ocean 🌊 Oceanography

Embury et al. (2024), Scientific Data 11, 326, Fig. 1, doi:10.1038/s41597-024-03147-w. CC BY 4.0.

NOAA-14 drifted from 13:40 local time in 1995 to after 18:00 by 2002; the record adjusts every observation to 10:30 or 22:30 so the daily warming cycle does not alias into the trend.

Models: finer grids resolve lakes and eddies

🖥️ Model & simulation 🌤️ Atmosphere 🌊 Ocean 🌡️ Atmospheric & climate science 🌊 Oceanography

Left: Muñoz-Sabater et al. (2021), Earth System Science Data 13, 4349–4383, Fig. 4, doi:10.5194/essd-13-4349-2021. Right: Hohenegger et al. (2023), Geoscientific Model Development 16, 779–811, Fig. 17, doi:10.5194/gmd-16-779-2023. CC BY 4.0.

ERA5-Land at 9 km resolves lakes and valleys that ERA5 at 31 km averages away; in this North Atlantic run, small eddies and fronts need a grid spacing between 2.5 and 1 km.

Arrays that know their coordinates

🖥️ Model & simulation 🌤️ Atmosphere 🌡️ Atmospheric & climate science

  • NCEP/NCAR Reanalysis 1: air temperature at the lowest model level (sigma 0.995, about 40 m above the model’s ground), every 6 h, 2.5° grid, 2013–2014: 2,920 × 25 × 53 values
  • One value is a model state pulled toward observations (Kalnay et al. 1996, class B), at grid points about 280 × 190 km apart at Seattle, at 00/06/12/18 UTC
  • The file’s own metadata say level_desc: Surface and statistic: Individual Obs; the provider’s documentation says otherwise

Before using a grid value, say what it stands for: level, area, time, and how much of it is model.

Which cell is Seattle?

On a copy converted to −180…180°, sel(lon=237.7, method="nearest") returns −30°, in the Atlantic, with no error. A tolerance of half a grid step turns it into an error.

Keep one sample a day — and the tide invents a fortnight

0.59 m RMS error — keep each midnight reading

0.02 m RMS error — average the day first, then keep one value

The M2 tide (12.42-h period) lives above a daily series’ Nyquist frequency. Subsampled, it does not vanish — it folds into a 14.8-day oscillation at nearly full tidal amplitude.

Thirty times worse — and the artifact masquerades as a plausible fortnightly ocean signal.

Three ways to make a daily series

The daily mean — a humble 24-h average — already suppresses the tide; a proper anti-alias filter does slightly better. The midnight samples invent a half-meter oscillation that was never in the ocean.

One sensor, two samplings

📍 In-situ sensor 💧 Land water 💧 Hydrology & land-surface modeling · 🪨 Solid Earth 📈 Seismology

Data: USGS Water Services site 12213100 and USGS ComCat nc73821036, public domain; IU.COR.00 BHZ, LHZ via EarthScope FDSN (response removed), Global Seismograph Network doi:10.7914/SN/IU. Figure: figscripts/native_vs_distributed_series.py.

The daily mean (1,413 m³/s) is 11% below the instantaneous flood peak (1,594 m³/s); the 1 sample/s channel shows 24% less peak velocity than the 40 sample/s channel.

Native and distributed resolution

Kind Data Native As distributed Not in the distributed product
series Stream gauge (USGS) every 15 min daily mean (min and max at some gauges) the hour of the peak; at mean-only gauges, its size too
series Seismometer (FDSN) digitizer at a high rate 40 (BH) and 1 (LH) samples/s, anti-alias filtered all above each channel’s Nyquist frequency
series GNSS (EarthScope; Nevada Geodetic Lab) phase every 15 or 30 s 24-hour and 5-minute positions motion faster than 5 min; in daily positions, the hour of an offset
series Flux tower (FLUXNET2015) wind and gas at 10 to 20 Hz 30-minute fluxes, gap-filled turbulence within each half hour
grid Reanalysis (ERA5) hourly, 31 km model grid regular 0.25° grid nothing finer than 31 km
grid InSAR (Sentinel-1) 5 × 20 m pixels, every 6 or 12 days velocity and displacement series on a 100 m grid (European Ground Motion Service) detail finer than 100 m; the line-of-sight direction
grid Soil moisture (NASA SMAP radiometer) footprint about 40 km 36 km and 9 km grids nothing finer than about 40 km
grid Gravity (GRACE, JPL) 3° mascons, monthly 0.5° grid nothing finer than 3°

JPL’s 0.5° GRACE grid has 259,200 cells but rests on 4,551 independent mascons: check the native sampling before choosing a grid or counting samples.

Gaps: interpolation is a decision, not a default

Synthetic GNSS with planted truth (mlgeo_synth): a 150-day outage hides a 25 mm earthquake step — interpolation draws a confident straight ramp through it. Policy: fill gaps ≤ 10 days (error below the 2.4 mm noise), mask the rest.

Six ways to handle a gap

Choice Assumes Fails when Used in
Leave it missing, with a flag every later step reads the flag a mean over the observed cells treats the gaps as average satellite sea surface temperature, levels 2–3; HadCRUT4
Drop the affected rows gaps are unrelated to any value, measured or not (missing completely at random) the gap is caused by the value: floods, frozen soil notebook 2.4
Interpolate: linear in time, kriging or optimal interpolation in space the signal is smooth across the gap a step or a front hides in the gap; features are smoothed NOAA OISST; HadCRUT5 analysis
Statistical reconstruction: dominant spatial patterns, a smoother, a look-up of similar weather the gap resembles patterns seen elsewhere conditions in the gap are rare ESA CCI soil moisture; flux towers
Fill from a model or reanalysis the model is right where data are absent the model’s bias becomes data FLUXNET weather from ERA-Interim
Train an ML model training gaps look like the real ones gaps fall in conditions or places absent from training neural networks for sea surface temperature and sea level; boosted trees for flux towers; the GRACE gap

Filled values are typically at least half of a flux-tower record (Vekuri et al. 2023): keep a flag for each filled value, and its uncertainty.

Two cases where the filling choice changed the result

🗂️ Catalog & compiled product 🌤️ Atmosphere 🌡️ Atmospheric & climate science · 📍 In-situ sensor 🌱 Biosphere 🦠 Biogeosciences

Left: Cowtan & Way (2014), Quarterly Journal of the Royal Meteorological Society 140, 1935–1944, Fig. 1, doi:10.1002/qj.2297, CC BY 3.0. Right: Vekuri et al. (2023), Scientific Reports 13, 1720, Fig. 3, doi:10.1038/s41598-023-28827-2, CC BY 4.0.

Kriging the empty cells, mostly polar, raised the 1997–2012 warming trend from 0.064 (unfilled) to 0.108 °C per decade; at ten northern flux-tower sites, look-up filling biased the annual carbon balance toward emission by up to 42 g C m⁻² y⁻¹.

Testing a machine-learned gap filler

🛰️ Satellite & airborne 🌊 Ocean 🌊 Oceanography

  • Hide test data the way gaps really look: whole satellite tracks (panel d), real cloud masks, real gap lengths
  • Never score on data the model saw: on one sea surface temperature image, the network misfits its own input by 0.15 °C and hidden pixels by 0.55 °C
  • Compare with a tuned interpolator: 3.58 cm for the network against 3.60 cm for a tuned variational interpolator
  • Hold out places, not pixels: random cross-validation R² 0.53, spatial 0.14 (Ploton et al. 2020)
  • Score filled values on their own: soil moisture R 0.59 for filled values against 0.70 for observed ones

Barth et al. (2022), Geoscientific Model Development 15, 2183–2196, Fig. 8, doi:10.5194/gmd-15-2183-2022, CC BY 4.0.

Held out by place instead of by pixel, one biomass map’s R² fell from 0.53 to 0.14: test a gap filler on gaps shaped like the real ones, in places it has not seen, against a tuned interpolator.

The irregular stream: 25 wells, 40 years, no grid

Averaging raw heads jumps by meters whenever a well enters or leaves the record. Remove each well’s own level first, weight by measurement quality — and the true regional decline emerges: RMS 2.42 → 1.42 m.

Error bars for noise with memory

±0.019 mm/yr velocity uncertainty — resample individual days

±0.148 mm/yr velocity uncertainty — resample 100-day blocks

GNSS noise is time-correlated. Resampling single days destroys that memory: the true velocity sat 8.6σ outside the narrow bar — and 1.1σ inside the honest one.

The wider error bar is the correct one. The narrow bar was not conservative — it was wrong, and only the planted truth exposed it.

One discipline, four streams

Data situation The trap The principle Graded result
Hourly tide gauge → daily aliasing: high frequencies fold, disguised low-pass below the new Nyquist, then subsample 0.59 → 0.02 m RMS
Daily GNSS with outages confident fabrication across gaps fill what noise bounds, mask the rest, state the threshold 150-day gap hid a 25 mm step
Irregular multi-well network the average tracks the network, not the field anomalies first, weight by quality 2.42 → 1.42 m RMS
Trend in correlated noise error bars that ignore memory resample blocks, not samples 8.6σ → 1.1σ

Every resample is a claim about what happens between your samples. Make the claim explicitly — and grade it when you can.

Now run it yourself — open 2.6

  1. pixi run jupyter lab → 2.6_resampling.ipynb, section 3
  2. 3.1b The Nooksack record: count the readings, find the repeated hour, rebuild the USGS daily mean, measure the peak it loses
  3. 3.2b Gap fillers on known truth, with a filled flag; which wins on short gaps, which on the 150-day outage, and why?
  4. 3.2c Hide test data at random, then score on the real outage; let an agent write a filler and check it the same way
  5. Alias hunting (exercise 1): keep the noon sample instead of midnight; does the 14.8-day artifact move?

Wednesday: statistical considerations & spectral transforms (2.7–2.8) · HW1 and the Ch 1 quiz on Wednesday Oct 14