param_convert: converts byte data to absolte values or vise versa...

View source: R/param_convert.r

param_convertR Documentation

converts byte data to absolte values or vise versa (param_unconvert)

Description

converts byte data as stored in '.gz'-files to absolte values (param_convert) or vise versa (param_unconvert) using the parameter_definitions-dataset. param_convert is used by readbin, param_unconvert is used by writebin.

Usage

param_convert(x,param)

param_unconvert(x,param)

Arguments

x

vector, matrix or raster-object holding byte-data that that should be converted to absolute values (param_convert) or vise versa (param_unconvert).

param

Character string indicating parameter of the dataset to be treated. See parameter_definitions for available parameters.

Author(s)

Robert K. Bauer

See Also

param_unconvert, readbin

Examples

library('fields')
path <- system.file("test_files", package="oceanmap")
gz.file <- Sys.glob(paste0(path,'/*.gz'))[1] # load sample-'.gz'-files
param <- name_split(gz.file)$parameter
print(param)

## converted data, according to param information
m <- readbin(gz.file, Raster=FALSE) 
image.plot(m)

## byte data ("unconverted") according to param information, as stored in ".gz"files
bin <- param_unconvert(m,param) 
image.plot(bin)

## reconverting byte data, according to param information
conv <- param_convert(bin,param) 
image.plot(conv)


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