Skip to contents

Writes an ensemble data.table to CSV format compatible with PEST++.

Usage

write_ensemble(ensemble, file, format = "csv")

Arguments

ensemble

A data.table with realisation data.

file

Character. Output file path.

format

Character. Only "csv" is supported; any other value is an error. Note the asymmetry with read_ensemble(), which also reads PEST++ binary: writing that format is not implemented.

Value

Invisible NULL.

See also

Examples

ens <- data.table::data.table(
  real_name = sprintf("real_%02d", 1:5),
  k1 = runif(5, 0.1, 10),
  k2 = runif(5, 0.01, 1)
)
tf <- tempfile(fileext = ".csv")
on.exit(unlink(tf), add = TRUE)
write_ensemble(ens, tf)
file.exists(tf)
#> [1] TRUE