writebin: Saves geographic data as byte file (".gz")

View source: R/writebin.r

writebinR Documentation

Saves geographic data as byte file ('.gz')

Description

Saves geographic data as byte file, in gzip compressed format ('.gz'). ATTENTION!! Only 2D (one layer) can be stored!

Usage

writebin(satdata,filename,folder,param)

Arguments

satdata

one layer-raster-object or matrix holding spatial data.

param

character string indicating the parameter name for the dataset treatment. See parameter_definitions for available parameters.

filename

character string naming the '.gz'-file to be created.

folder

character string indicating the target directory.

Author(s)

Robert K. Bauer

See Also

readbin, regions, crop, raster2matrix, param_unconvert

Examples

## Example for selecting wrong area definition when saving files
path <- system.file("test_files", package="oceanmap")
gz.files <- Sys.glob(paste0(path,'/*.gz')) # load sample-'.gz'-files
v(gz.files[1])

fname <- name_split(gz.files[1])
param <- fname$parameter
gz <- readbin(gz.files[1])
dim(gz)
v(gz.files[1])

### reset region name
fname$area <- 'med9'
fname <- name_join(fname)
# writebin(gz,fname,folder=path,param=param)
# v(fname)
# system(paste('rm', fname))

### multi layer raster file
gz2 <- stack(gz,gz)
# writebin(gz2,rep(gz.files[1],2),folder=path,param) # error message since multi layer
# writebin(gz,gz.files[1],folder=path,param) # single layer raster file
# v(gz.files[1])

oceanmap documentation built on Nov. 10, 2023, 5:08 p.m.

Related to writebin in oceanmap...