analysis

analysis

The computational chunks of the KNMI statistics scripts, one function per R chunk.

Every function returns a dict with the variable names of the corresponding R save() call. Random draws are taken from an RRandom stream (kuststatistiek.rrandom) in the same order as in R; the caller is responsible for calling the chunks in R’s order.

Functions

Name Description
bootstrap_seas5 Bootstrap of the omni and directional GW estimates from SEAS5 data.
combine_other_station
draw_seas5_blocks_only Consume the random draws of seas5_blocks() for a station that is not computed.
fit_meas_fixed_shape Chunk ‘OMNI GW tail estimates from measurements with shape parameter from SEAS5-DCSM5 data’.
fit_seas5_tails
meas_bootstrap Loop of the measurement bootstraps (meas1: pure=True with theta0bs; meas2: theta00bs, model error).
meas_bootstrap_years Year resampling of chunk ‘Bootstrap uncertainty estimation without model error’
model_error_draws theta00bs <- theta0bs + modelstd*rep(rnorm(nb), each= lp);
r_loess_predict_inside predict.loess with surface = ‘interpolate’: NA outside the range of the data.
seas5_blocks Blocks = 6-month SEAS5 runs, separated by date jumps; blocks <- sample(1:nblock, nb*m, TRUE).
smooth_directionality Chunk ‘Smooth the directionality’ (contents of _stats_multi_meas3.RData).

bootstrap_seas5

analysis.bootstrap_seas5(
    values,
    dirs,
    blockno,
    blocks,
    var,
    bins,
    caseId=None,
    dir_threshold=None,
    modelerror=None,
    rng=None,
    keep_quantiles=True,
)

Bootstrap of the omni and directional GW estimates from SEAS5 data.

modelerror None: chunk ‘Bootstrap … WITHOUT model error’ (shape estimated) modelerror dict(theta00bs, theta00dirbs): chunk ‘WITH model error’ (wind: shapes fixed at the perturbed values, stress scaled by exp(rnorm(1)*scalestd) drawn from rng per sample) dir_threshold: sample fraction for the directional fits (wind: mthresh, wl: kthresh)

combine_other_station

analysis.combine_other_station(
    own_stats_multi,
    omniref_stats_multi,
    omniref_meas2,
    dirref_stats_multi,
    dirref_meas2,
    shift,
    var,
    bins,
    station,
)

draw_seas5_blocks_only

analysis.draw_seas5_blocks_only(n_blocks, rng, nb)

Consume the random draws of seas5_blocks() for a station that is not computed.

fit_meas_fixed_shape

analysis.fit_meas_fixed_shape(
    stats_multi,
    wlm,
    wlmm,
    winddir,
    var,
    bins,
    caseId=None,
)

Chunk ‘OMNI GW tail estimates from measurements with shape parameter from SEAS5-DCSM5 data’.

Returns (meas0, esmeasGW): meas0 with the variables of _stats_multi_meas0.RData.

fit_seas5_tails

analysis.fit_seas5_tails(values, dirs, var, bins, caseId=None)

meas_bootstrap

analysis.meas_bootstrap(
    bootdata,
    theta_omni,
    theta_dir,
    var,
    bins,
    caseId=None,
    pure=False,
)

Loop of the measurement bootstraps (meas1: pure=True with theta0bs; meas2: theta00bs, model error).

Returns qmbs, Qmbs, Q0mbs, Qmsd, Q0msd, qmsd (and qmpurebs, thetampurebs if pure=True).

meas_bootstrap_years

analysis.meas_bootstrap_years(wlm, dtm, wlmm, dtmm, winddir, rng, nb)

Year resampling of chunk ‘Bootstrap uncertainty estimation without model error’ (contents of _meas_wl_bootdata.RData).

model_error_draws

analysis.model_error_draws(theta0bs, theta0dirbs, var, rng)

theta00bs <- theta0bs + modelstdrep(rnorm(nb), each= lp); theta00dirbs <- pmin(1, theta0dirbs + modelstdrnorm(lcats*nb)); dim(.) <- c(lcats, nb)

r_loess_predict_inside

analysis.r_loess_predict_inside(m, newx, xfit)

predict.loess with surface = ‘interpolate’: NA outside the range of the data.

seas5_blocks

analysis.seas5_blocks(dt, rng, nb)

Blocks = 6-month SEAS5 runs, separated by date jumps; blocks <- sample(1:nblock, nb*m, TRUE).

smooth_directionality

analysis.smooth_directionality(stats_multi, meas2, var, bins)

Chunk ‘Smooth the directionality’ (contents of _stats_multi_meas3.RData).