Skip to contents

This function will create all NetCDF files used to export results from the TnetRUI package. It's possible to put data in the created NetCDF files using TNETutils_appendNetCDF()

Usage

TNETutils_createNetCDF(
  path_createdNetCDF,
  variable,
  units = "",
  longname = variable,
  NetCDF_base = NULL,
  ID_dim = NULL,
  ID_name = NULL,
  time_dim = NULL,
  chunksize = NULL
)

Arguments

path_createdNetCDF

path where the NetCDF file will be created

variable

vector of variable to create in the NetCDF

units

vector of units of the variable (can be 1 element or the number of elements in the variable parameter)

longname

vector of more explicit names for the variables

NetCDF_base

NetCDF file where the dimensions will be copied for the new NetCDF

ID_dim

vector of values to use as the dimention ID

ID_name

name of the dimension with the IDs (by defaults it's "gid")

time_dim

vector to values to put in the time dimension (as to be in POSIXct format)

chunksize

Use a chunksize for the variables ? (see ncdf4::ncvar_def() function)

Value

A nc_file

Examples

netcdf_file <- TNETutils_createNetCDF(path/to/export,
                                      variable = c('Runoff','QlatSout'),
                                      units = 'm3/s',
                                      NetCDF_base = 'path/to/ncdf.nc')
#> Error in R_nc4_open: No such file or directory
#> Error in nc_open(NetCDF_base): Error in nc_open trying to open file path/to/ncdf.nc (return_on_error= FALSE )