View source: R/conversion_functions.R
raster2ncdf | R Documentation |
This function converts a RasterLayer
, RasterStack
or a list
of these classes to a netCDF
file, and exports it to a pre-defined output path.
raster2ncdf( rast_in, path_out, name, unit, is_ncdf4 = FALSE, prec = "float", missing_value = 32000, time = NULL, origin = "1901-01-01", longname = NULL, title = NULL, author = NULL, institute = NULL, source = NULL, description = NULL, axis_names = c("lon", "lat", "time") )
rast_in |
an input |
path_out |
|
name |
|
unit |
|
is_ncdf4 |
|
prec |
|
missing_value |
missing value |
time |
|
origin |
|
longname |
|
title |
|
author |
|
institute |
|
source |
|
description |
|
Inputs can represent a single map (RasterLayer
), a stacked map (e.g., with multiple variables; RasterStack
),
a time-series (list
of maps) or a time-series of stacked maps.
For each variable, a name
must be provided, so the length of the name
argument must be equal to the number of stacked layers in the input.
In case a time-series is used (e.g., input raster is a list
), one shall provide a time
argument, either as a numeric
vector or as a character
vector.
In the latter option, the character
input will be converted to numeric
representing the number of days since a user defined origin
. Both the time
and origin
arguments should be of format %Y-%m-%d
.
For spatio-temporal data, a list of RasterLayer
/RasterStack
objects is expected. Each list item stands for a point in time, and
each RasterLayer
stands for the spatial dimensions and data of a variable. If multiple variable are required, a RasterStack
can be used, so
each layer stands for a variable.
The user must provide the following attributes: name
, unit
, prec
, and missing_value
. Other optional attributes include longname
(for each variable),
or the global variables title
, author
, institute
, source
, and description
.
## Not run: PUT EXAMPLE HERE ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.