RAnEn::writeNcVar can write a variable to a new NetCDF file if the file does not exist. If the fist exists, RAnEn::writeNcVar tries to append the variable to the existing file.

writeNcVar(variable_name, variable_data, dim_names, nc_file, verbose = F)

Arguments

variable_name

The name of the variable

variable_data

The data for the variable. It can be a vector, a matrix, or an array.

dim_names

The dimension names associated with the variable.

nc_file

The complete NetCDF file path

verbose

Whether to be verbose

Details

This is a more general function than RAnEn::writeNetCDF because RAnEn::writeNetCDF only takes a Forecasts or an Observations. But RAnEn::writeNcVar takes any numeric arrays (including vectors, matrices, and arrays) and write them to an NetCDF file. This can be helpful when you are saving AnEn results from RAnEn::generateAnalogs.