ebv_add_data {ebvcube} | R Documentation |
Add data to your EBV netCDF
Description
Add data to your EBV netCDF from GeoTiffs or in-memory arrays.
First, create a new EBV netCDF using ebv_create()
.
Usage
ebv_add_data(
filepath_nc,
datacubepath = NULL,
entity = NULL,
timestep = 1,
data,
band = 1,
scenario = NULL,
metric = NULL,
ignore_RAM = FALSE,
verbose = TRUE
)
Arguments
filepath_nc |
Character. Path to the self-created netCDF file. |
datacubepath |
Character. Optional. Default: NULL. Path to the datacube
(use |
entity |
Character or Integer. Default is NULL. If the structure is 3D,
the entity argument is set to NULL. Else, a character string or single
integer value must indicate the entity of the 4D structure of the EBV
netCDFs. The character string can be obtained using
|
timestep |
Integer or character. Default: 1. Define to which timestep or timesteps the data should be added. If several timesteps are given they have to be in a continuous and in order. Meaning c(4,5,6) is right but c(2,5,6) is wrong. Alternatively you can provide a date or list of dates in ISO format, such as '2015-01-01' (also in order). |
data |
Character or matrix or array. If character: Path to the GeoTiff file containing the data. Ending needs to be *.tif. If matrix or array: in-memory object holding the data. |
band |
Integer. Default: 1. Define which band(s) to read from GeoTiff. Can be several. Don't have to be in order as the timesteps definition requires. |
scenario |
Character or integer. Optional. Default: NULL. Define the
scenario you want to access. If the EBV netCDF has no scenarios, leave the
default value (NULL). You can use an integer value defining the scenario or
give the name of the scenario as a character string. To check the available
scenarios and their name or number (integer), use
|
metric |
Character or integer. Optional. Define the metric you want to
access. You can use an integer value defining the metric or give the name
of the scenario as a character string. To check the available metrics and
their name or number (integer), use |
ignore_RAM |
Logical. Default: FALSE. Checks if there is enough space in your memory to read the data. Can be switched off (set to TRUE). Ignore this argument when you give an array or a matrix for 'data' (it will do nothing). |
verbose |
Logical. Default: TRUE. Turn off additional prints by setting it to FALSE. |
Value
Adds data to the EBV netCDF. Check your results using
ebv_read()
and/or ebv_analyse()
and/or
ebv_map()
and/or ebv_trend()
.
Note
If the data exceeds your memory the RAM check will throw an error. No block-processing or other method implemented so far. Move to a machine with more capacities if needed.
Examples
#set path to EBV netCDF
file <- system.file(file.path("extdata","test.nc"), package="ebvcube")
#get all datacubepaths of EBV netCDF
datacubepaths <- ebv_datacubepaths(file, verbose=FALSE)
#set path to GeoTiff with data
tif <- system.file(file.path("extdata","entity1.tif"), package="ebvcube")
# add data to the timestep 1, 2 and 3 using the first three bands of the GeoTiff
## Not run:
#use datacubepath argument and define timestep by integer
ebv_add_data(filepath_nc = file, datacubepath = datacubepaths[1,1],
entity = 1, timestep = 1:3, data = tif, band = 1:3)
#use metric argument and define timestep by ISO-format
ebv_add_data(filepath_nc = file, entity = 1,
timestep = paste0(as.character(seq(1900,1920,10)), '-01-01'),
metric = 1, data = tif, band = 1:3, verbose = FALSE)
## End(Not run)