weather synthesis · step 2

3DBC: rank correction and shuffling

3DBC takes three daily series for one location: observations for , model output for the same period, and model output for . The first two determine a target ordering for the third. The future values are then permuted within each calendar-day group; their numerical values are unchanged.

The worked example is , chain , . All values are read from the pipeline artifacts by build_data.py.

scroll

Inputs and output

The three inputs are the observed reference for , the same years from a climate model chain, and that chain’s future window, . The output is a reordering of the third series. Within each calendar-day group, the output contains exactly the same values as the model-future input.

3DBC is three-dimensional bias correction, from Mehrotra & Sharma (2019), where the three dimensions are variables, time and space. In the paper the method has two halves: quantile mapping for the marginals, then rank correction and shuffling for the dependence. This pipeline runs the second half. Its input is MET’s EQM product, which is the quantile-mapping stage.

Group by calendar day

The implementation processes each calendar date separately. All thirty values form one group, the thirty values of the next date form another, and so on across groups. Values from different dates are never compared.

29 February is excluded. The reference window contains of them and the future window , so the group would not be square. Those future rows pass through uncorrected and the next stage drops them.

Values in one calendar-day group

For the group holds observed values, one per year, and the same count for the model-historical and model-future series. Year k of each window occupies row k, which is how the kernel pairs them. The remaining steps operate inside this table and repeat times.

Values by year

Each dot represents one year, with height encoding the value. The outlined future value remains marked as it is assigned to a new year in the later frames.

Convert values to ranks

Each vector is replaced by its ranks, 1 to , with tied values sharing an averaged rank. Units are discarded; only the ordering within the group is carried forward.

Ties occur in every group in this example. WeatherFormatter stores temperature at a quantum of  , which is coarse enough that of groups contain at least one tie. The implementation uses a stable mergesort, giving tied values a reproducible order during the final assignment.

Transform ranks to normal scores

Rank r becomes a probability p = r / (n + 1), and p becomes a normal score through the inverse normal CDF. This is the plotting position the paper uses: its Table 1 assigns the maximum of thirty values p = 30/31, as here.

Without ties the three series would share one set of thirty probabilities and differ only in which year holds which score. Averaged tied ranks break that: for the three vectors hold , and distinct values out of , so their score sets differ slightly. The ordering, not the score values, is what the method uses.

Normal scores in year order

Each series contains the normal scores for thirty consecutive occurrences of , ordered by year.

Lag-1 autocorrelation

Each score is plotted against the next year’s score. The fitted slope is the lag-1 autocorrelation: ρobs = , ρcur = , ρfut = .

The lag is between years within one date — 1991 to 1992 — and not between adjacent days. The paper flags this too: the AR term is computed for the same calendar day across years, and is not an AR model of the daily series.

Adjust the observed autocorrelation

The correction transfers the model’s change in persistence rather than its level. Written additively that would be ρnew = ρfut − ρcur + ρobs, which can leave the valid range near ±1 because correlations are not additive. The subtraction is therefore performed in Fisher’s z space and transformed back, giving equation (1) of the paper:

a = (1 + ρfut) / (1 + ρcur) · (1 + ρobs)
b = (1 − ρfut) / (1 − ρcur) · (1 − ρobs)
ρnew = (a − b) / (a + b)

The chain moves from to , so the observed becomes . The result is clipped to ±0.9999. The construction is from Bárdossy & Pegram (2012).

Two identities characterize the operator. If ρcur = ρobs, the result is ρfut. If ρcur = ρfut, the result is ρobs. build_data.py checks both against the production function over random pairs; the largest deviation is .

Build the target score sequence

The implementation applies the inverse AR(1) recurrence parameterized by ρobs to the observed score sequence, then applies the forward recurrence with ρnew. The resulting sequence, zfc, supplies the target ranks for the shuffle.

Equations (2) and (3) are filters rather than estimators, so on a group of thirty values neither recurrence reaches its target exactly. Across the Oslo groups the whitened sequence retains a median sample lag-1 of rather than zero, reaching ; and the sample lag-1 of zfc differs from ρnew by a median of , reaching . The paper's worked example shows the same behaviour: removing rO = −0.38 leaves −0.01, and applying rN = 0.205 yields 0.208.

Mehrotra & Sharma state that shuffling corrected values across years makes current-climate simulations identical to the observations and makes future simulations resemble the observed record when projected changes are not significant. That statement describes the published method. This pipeline applies only its rank-correction and shuffling stage to MET’s existing EQM values; it does not establish identity between its current-climate model input and the observations.

Permute the future values

The thirty future values and the thirty target scores are each sorted, then paired in order: the smallest value goes to the slot with the smallest target score. The operation changes the assignment of values to years, without changing the values in the group.

Each value moves horizontally to a different year; its height, which is its value, does not change. In this group of slots hold a different year’s value afterwards.

Permutation verification

Both rows hold the same thirty values across the same run of years. Sorting either row gives the same result. build_data.py asserts this for every group, not only this one: of verified as permutations, mirroring the equivalent test in tests/test_bias_correction.py.

  • mean →
  • min
  • max
  • sorted arrays identical

Thirty-year output

groups × variables completes the thirty-year series. The next stage consumes it: for each future day it now has a daily target whose rank is consistent with the reference hourly template it will be morphed onto.

Each calendar date’s thirty-year distribution is preserved. The overall thirty-year mean is therefore identical to the last decimal — either way, and the same for each seasonal climatology. Individual years are not preserved: consecutive dates are permuted independently, so the values making up any single output year are drawn from across the whole model window.

For Oslo, annual means move by up to and monthly means by up to , with all years affected. Year 2057 in the output is not the chain’s year 2057, and the product should not be used for year-by-year comparison against a model run.

Dependence structure and limitations

3DBC runs after the marginals have been corrected, so it is a rank-based tool for dependence structure rather than a second bias correction.

The kernel operates on one location, one variable and one calendar day. In the published method the shuffle is repeated M × S times independently, and dependence across variables and locations is expected to follow because each series derives its target ordering from the same sequence of observed years. That reasoning is exact for the current climate, where the target is the observed ordering. For a future window the target is zfc, whose AR retuning and tie-breaking are computed per series, so the alignment between series is only approximate.

The table measures the outcome for this configuration. Cross-variable dependence moves toward the observed value in of pairs. Spatial dependence does not: in of location pairs the corrected output is slightly further from the observed correlation than the model input was. Oslo–Bergen is observed 0.765, model input 0.701, corrected 0.692.

The chain already carries spatial coherence, since it simulates the locations together. The shuffle replaces that coherence with one derived from the observed record, and in this configuration the replacement is not an improvement. This is one chain, one variable, four locations and one statistic; it is enough to withhold the claim that spatial dependence is restored, and not enough to characterise the method in general.

Two further limits hold regardless. The target reflects observed dependence adjusted by the model’s change in lag-1 correlation, not a projection of change in the full dependence structure. And the statistic is a correlation across thirty years of one calendar date, which does not make any individual future day carry a physically coherent temperature and humidity pair; the pipeline therefore does not derive vapour-pressure deficit from those two daily columns.

Published method and KSS configuration

KSS applies 3DBC with a different grouping configuration.

This pipeline runs the second half of the method. Its input is MET’s EQM product (DailyTimeSeries/…/eqm/…), which is the quantile-mapping stage, so the shuffle is applied once to marginals MET/NVE had already adjusted.

KSS shuffles within a single year because its future period runs 2021–2100 and per-calendar-day grouping would re-impose the observed trend eighty times. The future windows here are the thirty-year ones the paper assumes — it specifies that a thirty-year series gives thirty observations per day — so this implementation groups on the calendar day, as published.

KSS reports that its adaptation may modify seasonal marginals and that the autocorrelation adjustment has limited effect. In this implementation, the per-date distribution is preserved exactly and the Fisher-space change is applied directly to the AR(1) recurrence. The sample autocorrelation of the resulting 30-value target sequence, and of the shuffled values, is not guaranteed to equal ρnew.

One provision of the paper is unused, by us and by its authors: drawing the shuffling dates randomly from a longer observed record and repeating with different seeds, to obtain an ensemble of bias-corrected realisations. With a single fixed draw the corrected future is one reordering.