Learn R Programming

rbi (version 0.9.1)

netcdf_create_from_list: Create NetCDF File from R list

Description

Internal function that creates a NetCDF file given a list.

Usage

netcdf_create_from_list(filename, variables, time_dim, coord_dims, dim_factors,
  value_column = "value", guess_time = FALSE, guess_coord = FALSE,
  verbose)

Arguments

filename

a path to a NetCDF file to write the variable into, which will be overwritten if it already exists.

variables

a list

time_dim

the name of the time dimension, if one exists; default: "time"

coord_dims

the names of the coordinate dimension, if any; should be a named list of character vectors, they are matched to variables names

dim_factors

factors that dimensions have; this corresponds to the dims element of a libbi object

value_column

if any variables are data frames, which column contains the values (default: "value")

guess_time

whether to guess time dimension; this would be a numerical column in the data frame given which is not the value_column; only one such column must exist

guess_coord

whether to guess the coordinate dimension; this would be a column with varying value which is not the time or value column

verbose

if TRUE, will print variables as they are read

Value

A list of the time and coord dims, and factors in extra dimensions, if any

Details

The list of variables must follow the following rules. Each element of the list must itself be one of:

1) a data frame with a value_column column (see option 'value_column') and any number of other columns indicating one or more dimensions

2) a numeric vector of length one, with no dimensions

The name of the list elements itself is used to create the corresponding variable in the NetCDF file.