transfer_raster_RData: Transfer values from a Raster* object to an RData file

View source: R/transfer_raster_RData.R

transfer_raster_RDataR Documentation

Transfer values from a Raster* object to an RData file

Description

Get the values of a Raster*, storage them into an array and finally save the array in an RData which allows for compatibility with multiple R functions as well as great portability.

Usage

transfer_raster_RData(
  inputFile,
  outputPath,
  transferOneFile = TRUE,
  vmode = c("integer", "single", "double")
)

Arguments

inputFile

character with full path name of input file.

outputPath

character with full path name (where the RData file will be saved). No need to provide extension .RData.

transferOneFile

logical, default TRUE indicates that one file will be transferred. FALSE indicates that more than one file will be transferred. See Details.

vmode

a character specifying the type of virtual storage mode vmode needed. Only integer, single and double are allowed.

Details

Prior to embark the user in a transfer that may not be successful due to the lack of RAM, this function provides an estimate of the amount of bytes to be used in the transfer process. The estimate is obtained by multiplying the number of rows by the number of columns by the number of layers of the Raster* object to transfer by the amount of bites used by vmode (32-bit float for integer or single and 64-bit float for double). A question is displayed in the console requesting whether the process should continue. Should the user decide not to continue with the importation transfer_raster_RData returns the message "Did not transfer anything".

When transferOneFile=FALSE, it is assumed that the system has enough RAM to support full files transfer -no question is asked in the console. This option is useful when this function is used within a for loop.

Value

At the designated path (outputPath) the user will find an RData file.

See Also

vmode

Examples


inputFile = system.file("extdata", "master.tif", package = "geoTS")
outputPath = paste0(system.file("extdata", package = "geoTS"), "/master")
transfer_raster_RData(inputFile = inputFile, outputPath = outputPath, 
                      vmode = "single")



geoTS documentation built on Nov. 18, 2022, 1:08 a.m.