sl.grid.writeCDO: Write Grid for CDO

Description Usage Arguments Details Note Author(s) See Also Examples

View source: R/sl.grid.writeCDO.R

Description

Write a spheRlab grid to a file that is readable by the Climate Data Operators (CDO). Currently only ascii output is implemented.

Usage

1
sl.grid.writeCDO(grid, ofile = "~/sl.grid.CDO", netcdf = FALSE, write.precision = Inf, overwrite = FALSE, verbose = TRUE)

Arguments

grid

a spheRlab grid list as returned by sl.grid.readFESOM.

ofile

a character specifying the path and file name of the output file.

netcdf

NOT YET IMPLEMENTED - a logical value indicating whether or not to write directly to NetCDF instead of writing to ascii with subsequent conversion using CDO.

write.precision

a scalar giving the number of digits after which coordinates are truncated (rounded).

overwrite

a logical value indicating whether or not to overwrite an already existing file.

verbose

a logical value indicating whether or not print statements shall report on the function progess.

Details

This is a special function that is typically used when converting FESOM grid information to a CDO-readable format, see the example below.

Note

Currently only ascii output is implemented. However, it would be much faster to write directly to NetCDF instead of writing to ascii with subsequent conversion using CDO. This is particularly the case for very large FESOM grids.

Author(s)

Helge Goessling

See Also

sl.grid.readFESOM, sl.grid.addinfo

Examples

1
2
3
4
5
6
7
8
## Not run: 
grid = sl.grid.readFESOM(griddir="PATH-TO-YOUR-FESOM-GRID",rot=TRUE,rot.invert=TRUE,rot.abg=c(50,15,-90))
ofile = "~/sl.grid.CDO"
sl.grid.writeCDO(grid,ofile=ofile)
system(paste0("cdo -f nc const,0,",ofile," ",ofile,".nc"))
sl.grid.addinfo(grid,ncdf.file.in=paste0(ofile,".nc"))

## End(Not run)

helgegoessling/spheRlab documentation built on Sept. 29, 2017, 6:36 a.m.