stations2nc: Station data 2 netCDF export

Description Usage Arguments Value Author(s) References Examples

View source: R/stations2nc.R

Description

Export a loadeR grid to NetCDF

Usage

1
2
3
4
stations2nc(data, NetCDFOutFile = "out.nc4", missval = 1e+20,
  globalAttributes = NULL, varAttributes = NULL, prec = "float",
  compression = 4, shuffle = FALSE, standardName = NULL,
  verbose = FALSE)

Arguments

data

A grid data object coming from loadGridData or interpGrid or the function loadECOMS of package loadeR.ECOMS.

NetCDFOutFile

Name of the file created by the function. (default to "out.nc4")

missval

Missing value codification (default to 1e20)

globalAttributes

Optional. A list of global attributes included in the NetCDF file. Same format as varAttributes.

varAttributes

Optional. List of attributes to be included in the variable written in the NetCDF file. (NULL, default). It has the format list("name_of_attribute1" = attribute1, "name_of_attribute2" = attribute2 etc.

prec

Precision to write the attribute. If not specified, the written precision is the same as the variable whose attribute this is. This can be overridden by specifying this argument with a value of "short", "float", "double", or "text".

compression

If set to an integer between 1 (less compression) and 9 (highest compression), enables compression for the variable as it is written to the file. Turning compression on forces the output file to netcdf v4 format (the default), not compatible with older software that can only handle version 3 files.

shuffle

Logical. Turns on (TRUE) or off (FALSE, the default) the shuffle filter. According to netcdf documentation, turning the shuffle filter on can improve compression for integer variables. Turning the shuffle filter on forces the output file to netcdf v4 format (the default), not compatible with older software that can only handle version 3 files.

standardName

Standard name of the variable.

verbose

Optional. If set to TRUE, switches nc_create to verbose mode

Value

A NetCDF-4 file with the variable and attributes defined in the inputs.

Author(s)

S. Herrera, W. Franssen, J. Bedia and M. Iturbide

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
require(transformeR)
data("VALUE_Iberia_tas")
# Name of output file:
fileName <- "tas_VALUE_DJF_Iberia.nc4"
# Including a global attribute:
globalAttributeList <- list("institution" = "Santander MetGroup, http://www.meteo.unican.es/")
# Including two variable attributes:
varAttributeList <- list(var_attr1 = "one_attribute", var_attr2 = "another_attribute")
# Create file:
stations2nc(data = VALUE_Iberia_tas,
        NetCDFOutFile = fileName,
        missval = 1e20,
        prec = "float",
        globalAttributes = globalAttributeList,
        varAttributes = varAttributeList)

## End(Not run)

SantanderMetGroup/loadeR.2nc documentation built on Dec. 15, 2020, 10:11 a.m.