buildnetCDF: Collect Psi or Theta in a netCDF file

Description Usage Arguments Value Examples

Description

Collect Psi or Theta in a netCDF file

Usage

1
2
3
4
5
6
buildnetCDF(psi, filename = "/home/ecor/psi.nc",
  CRSdefault = "+ellps=WGS84 +proj=tmerc +lat_0=46.0 +lon_0=11 +k=1 +x_0=0 +y_0=0 +units=m +no_defs",
  time = 1:length(psi), depth = 1:nlayers(psi[[1]]), overwrite = TRUE,
  dimTime = "Time", dimDepth = "Depth", units_Time = "hour",
  units_Depth = "meter", units = "meter", name = "psi", longname = name,
  ...)

Arguments

psi

variable, a list of RasterBrick-class object

filename

string containing full name of the netCDF file

overwrite

logical value. Default is TRUE.

dimTime, dimDepth

string containing the name for time or (vartical) depth netCDF dimension respectively.

units_Time, units_Depth

string containing the units for time or (vartical) depth netCDF dimension respectively.

name, longname

string containing the name or the long name of psi variable.

...

further arguments.

CRSDefaul

string with CRS default (used if it is missing in psi)

Value

Function returns a netCF object containg the psi variable information.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data(PsiTheta)
filename="/home/ecor/psi.nc"

nc <- buildnetCDF(psi,filename=filename)

nc_close(nc)



psiz <- lapply(X=psi,FUN=function(x) {is.na(x)*0+1:nlayers(x)})
psit <- psiz
for (i in 1:length(psit)) {
 psit[[i]] <- psit[[i]]*0+i
}

ft="/home/ecor/psi_ft.nc"
fz="/home/ecor/psi_fz.nc"

ncz <- buildnetCDF(psiz,filename=fz)
nct <- buildnetCDF(psit,filename=ft)

nc_close(ncz)
nc_close(nct)

ecor/geotopsim documentation built on May 15, 2019, 10:05 p.m.