rstream
rstream
R’s random number stream, split up per station.
In the R scripts all random numbers come from one stream (set.seed), drawn chunk after chunk and, within a chunk, station after station. The numbers a station gets therefore depend on all stations before it. The functions below replay only the random draws of an R run, for the full station list of that run, and keep for every station and chunk a copy of the stream at the point where R starts drawing for that station. A notebook can then compute any selection of stations, in any order, with exactly the random numbers of the R run. This only reads the data (no fits).
Each function takes the seed of the R script and starts from set.seed itself, so a notebook cell that calls it can be re-run on its own. (An RRandom stream is accepted too; it is then continued and advanced.)
Every lookup streams[station][step] returns a new copy of the stored stream, so the stored position never moves: re-running a notebook cell (e.g. after an interruption) gives the same random numbers again.
Functions
| Name | Description |
|---|---|
| others_random_streams | statistics-wl10others, from set.seed (only chunk eimeas draws random numbers). |
| texel_random_streams | statistics-wl10-omni-texeln, from set.seed: runif(Nm) (eimeas), rnorm(nb) (shape), sample(yrm, nb*n_years) |
| wind_random_streams | statistics-wind10, from set.seed: first the draws of chunk proc-meas2 (runif(Nm) for each measuring |
| wl_random_streams | statistics-wl10, from set.seed. |
others_random_streams
rstream.others_random_streams(seed, stations, input_path)statistics-wl10others, from set.seed (only chunk eimeas draws random numbers). Returns {station: {“eimeas”: stream}}.
texel_random_streams
rstream.texel_random_streams(seed, Nm, n_years, nb)statistics-wl10-omni-texeln, from set.seed: runif(Nm) (eimeas), rnorm(nb) (shape), sample(yrm, nbn_years) plus rnorm(1) per sample (bootstrap with model error), sample(yrm, nbn_years) (bootstrap of the scale). Returns {“eimeas”, “shape”, “bootstrap”, “scale_bootstrap”: stream}.
wind_random_streams
rstream.wind_random_streams(seed, stations, nb, input_path, meas_N=())statistics-wind10, from set.seed: first the draws of chunk proc-meas2 (runif(Nm) for each measuring station, Nm in meas_N), then the bootstrap chunks. Returns {station: {“bootstrap1”: stream, “bootstrap2”: stream}}.
wl_random_streams
rstream.wl_random_streams(seed, stations, nb, input_path)statistics-wl10, from set.seed. Returns {station: {“eimeas”, “bootstrap”, “meas_bootstrap”, “model_error”: stream}}.