help_ts2netcdf: Create netCDF from zoo time series object.

Description Usage Arguments Value Author(s) Examples

Description

Create netCDF from zoo time series object.

Usage

1
help_ts2netcdf(ts, unit, var.name, latitude, longitude, name.nc)

Arguments

ts

zoo time series object, named.

Value

NULL, saves netCDF file containing all variables of zoo time series in working directory

Author(s)

Johannes Brenner johannes.brenner@ufz.de

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(zoo)

# dummy time series
date <- seq(as.Date("2010-01-01"),as.Date("2016-01-01"),1)
ts_data <- cbind(rnorm(length(date)), rnorm(length(date)))
colnames(ts_data) <- c("A","B")

ts_date  <- zoo(ts_data, date)
ts_POSIX <- zoo(ts_data, as.POSIXct(date))
ts_chron <- zoo(ts_data, as.chron(date))

# dummy lat, lon matrix
lat = as.matrix(40, ncol=1); dimnames(lat) = list("x","y")
lon = as.matrix(5 , ncol=1); dimnames(lon) = list("x","y")

help_ts2netcdf(ts = ts_date, unit = c("UNIT varA","UNIT varB"),
               latitude = lat, longitude = lon, name.nc="test_date")

help_ts2netcdf(ts = ts_POSIX, unit = c("UNIT varA","UNIT varB"),
               latitude = lat, longitude = lon, name.nc="test_POSIX")

help_ts2netcdf(ts = ts_chron, unit = c("UNIT varA","UNIT varB"),
               latitude = lat, longitude = lon, name.nc="test_chron")

JBrenn/Helper4me documentation built on May 7, 2019, 6:49 a.m.