Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Removing the Seasonal Cycle: Daily Climatology vs. Harmonic Regression

Authors
Affiliations
University at Albany (SUNY)
Florida Institute of Technology
University at Albany (SUNY)
Texas A&M University
University at Albany (SUNY)
Duke University
University of Georgia
University at Albany (SUNY)

Overview

Before studying intraseasonal, interannual or other kinds of variability, we often remove the seasonal cycle to obtain anomalies, departures from the repeating annual pattern. This notebook compares two common approaches on daily 850-hPa zonal wind (u850u_{850}) from the NCEP–NCAR Reanalysis Kanamitsu et al., 2002Kalnay et al., 2018 and inspects the resulting spectra.

We will:

  1. Load daily u850u_{850} from the public Pythia Zarr store.

  2. Remove the seasonal cycle with daily climatology and harmonic regression.

  3. Compare the fitted seasonal cycles, anomaly time series, spatial patterns of disagreement, and time-mean maps.

  4. Resample to monthly means, compute monthly anomalies, and apply the FFT to see whether either method leaves residual seasonal power.

An anomaly is defined as

anomaly=observed value−seasonal climatology.\text{anomaly} = \text{observed value} - \text{seasonal climatology}.

Prerequisites

ConceptsImportanceNotes
Remove the seasonal cycle using harmonic regressionNecessaryHarmonic design matrix and least-squares fit
The Discrete Fourier TransformHelpfulFrequencies, periods, and Fourier coefficients
Fourier Power Spectrum and Spectral FilteringHelpfulPower spectrum and explained variance
  • Time to learn: 25 minutes


Imports

All packages used in the rest of the notebook are imported up front. s3fs is configured to read anonymously from the public Pythia bucket on the Jetstream2 S3 endpoint. The Zarr store is read lazily with Dask; heavy array work runs in parallel only when we call dask.persist or .compute().

Load NCEP–NCAR zonal wind

We use daily 850-hPa zonal wind from the NCEP–NCAR Reanalysis Kanamitsu et al., 2002Kalnay et al., 2018, stored as a preprocessed Zarr dataset on the Pythia Jetstream2 bucket. The array stays lazy until we compute specific results.

For harmonic regression each latitude band needs the full time series and longitude, so we rechunk to {time: -1, lat: 10, lon: -1}. Dask can then parallelize the least-squares fit over latitude blocks. In this tutorial we are only to be analysing the time period between "1980-01-01" and "2000-12-31".

Loading...

Remove the seasonal cycle

We subtract the seasonal cycle at every grid point using two methods.

Daily climatology averages all values for each calendar day (Jan 1, Jan 2, …) and subtracts that mean. Xarray applies this lazily over Dask chunks along time.

Harmonic regression fits a smooth annual cycle as a sum of sine and cosine harmonics; see Remove the seasonal cycle using harmonic regression for the theory and design matrix. For each grid point we model the time series u(t)u(t) as

u(t)≈a0+∑k=1N[aksin⁡(2πkt/T)+bkcos⁡(2πkt/T)],u(t) \approx a_0 + \sum_{k=1}^{N} \left[ a_k \sin(2\pi kt/T) + b_k \cos(2\pi kt/T) \right],

Compare the two methods

A fair comparison proceeds in four steps:

  1. Seasonal cycle — how smooth is each estimate of the repeating annual pattern?

  2. Anomalies — do the two anomaly time series track each other at a grid point and in the tropical mean?

  3. Difference field — where and when do the methods disagree most?

  4. Time-mean check — are anomalies near zero on average, as expected after removing the seasonal cycle?

We use the equatorial date line (0°N, 180°E) as a representative tropical grid point throughout. Lets first see how the anomalies fields look like for a particular date:

<Figure size 1400x400 with 4 Axes>
<Figure size 1000x400 with 1 Axes>

The two seasonal cycles have the same overall shape, but the daily climatology trace is jagged: each calendar day is averaged over only ~45 years, so sampling noise remains. Harmonic regression enforces a smooth annual curve and tends to sit between the day-to-day wiggles of the empirical climatology.

<Figure size 1200x400 with 2 Axes>
<Figure size 1200x600 with 2 Axes>
<Figure size 1400x400 with 4 Axes>

The time-mean anomaly maps should be close to zero everywhere (typically ∣uˉ′∣≪1| \bar{u}' | \ll 1 m/s). Values near zero confirm that the seasonal cycle has been removed by both methods. Any remaining structure is much smaller than the seasonal signal itself.

Fourier analysis of monthly anomalies

For spectral analysis we resample to monthly means, which suppresses day-to-day noise. We remove the seasonal cycle again using monthly climatology and harmonic regression (year_period=12), then compare the FFT spectra. If either daily method left residual seasonal power, it would appear as peaks near 12, 6, 4, or 3 months; a cleaner anomaly series shows less power at those periods.

<Figure size 1200x400 with 2 Axes>
Variance near annual harmonics (12, 6, 4, 3 mo): monthly clim = 5.10%, harmonic = 5.09%
/tmp/ipykernel_4441/15789573.py:11: RuntimeWarning: divide by zero encountered in divide
  periods = 1 / freqs
<Figure size 800x400 with 1 Axes>

Vertical dashed lines mark the annual cycle (12 months) and its harmonics. After removing the seasonal cycle, power at those periods should be small for both methods. Remaining peaks at longer periods reflect interannual and decadal variability; the two spectra should be similar if the daily methods agreed. Lower power in the harmonic curve near 12 months often indicates a cleaner removal of the annual cycle.


Summary

We compared daily climatology and harmonic regression for removing the seasonal cycle from 850-hPa zonal wind.

Both methods are suitable for tropical wind analysis when the record is long. Harmonic regression is preferable when a smooth seasonal cycle is desired or the record is short. Daily climatology is simpler and needs no choice of NN, but its day-to-day noise propagates into the anomalies.

What’s next?

The next notebook, Frequency Decomposition of Zonal Wind Variability Using the Fourier Transform, extends this idea: it partitions the total variance of u850u_{850} into annual, intraseasonal, interannual, background, and subseasonal bands and maps the spatial structure of each.

References
  1. Kanamitsu, M., Ebisuzaki, W., Woollen, J., Yang, S.-K., Hnilo, J. J., Fiorino, M., & Potter, G. L. (2002). Ncep–doe amip-ii reanalysis (r-2). Bulletin of the American Meteorological Society, 83(11), 1631–1644.
  2. Kalnay, E., Kanamitsu, M., Kistler, R., Collins, W., Deaven, D., Gandin, L., Iredell, M., Saha, S., White, G., Woollen, J., & others. (2018). The NCEP/NCAR 40-year reanalysis project. In Renewable energy (p. Vol1_146-Vol1_194). Routledge.