ebv_write {ebvcube} | R Documentation |
Write the extracted data on your disk as a GeoTiff
Description
After you extracted data from the EBV netCDF and worked with it this function gives you the possibility to write it to disk as a GeoTiff.
Usage
ebv_write(
data,
outputpath,
epsg = 4326,
extent = c(-180, 180, -90, 90),
type = "FLT8S",
overwrite = FALSE,
verbose = TRUE
)
Arguments
data |
Your data object. May be SpatRaster, array, DelayedMatrix or list
of DelayedMatrix (see return values of |
outputpath |
Character. Set the path where you want to write the data to disk as a GeoTiff. Ending needs to be *.tif. |
epsg |
Integer. Default: 4326 (WGS84). Defines the coordinate reference system via the corresponding epsg code. |
extent |
Numeric. Default: c(-180,180,-90,90). Defines the extent of the data: c(xmin, xmax, ymin, ymax). |
type |
Character. Default is FLT8S Indicate the datatype of the GeoTiff file. Possible values: INT1S, INT2S, INT2U, INT4S, INT4U, FLT4S, FLT8S. |
overwrite |
Locigal. Default: FALSE. Set to TRUE to overwrite the outputfile defined by 'outputpath'. |
verbose |
Logical. Default: TRUE. Turn off additional prints by setting it to FALSE. |
Value
Returns the outputpath.
Note
If the nodata value of your data is not detected correctly, this could be due to the wrong choice of the datatype (type argument).
Examples
#set path to EBV netCDF
file <- system.file(file.path("extdata","martins_comcom_subset.nc"), package="ebvcube")
#get all datacubepaths of EBV netCDF
datacubes <- ebv_datacubepaths(file, verbose=FALSE)
## Not run:
#read data
data <- ebv_read(filepath = file, datacubepath = datacubes[1,1], timestep = 1, entity = 1)
# HERE YOU CAN WORK WITH YOUR DATA
#write data to disk as GeoTiff
out <- file.path(system.file(package='ebvcube'),"extdata","write_data.tif")
ebv_write(data = data, outputpath = out, overwrite = TRUE)
#read a subset
data_bb <- ebv_read_bb(filepath = file, datacubepath = datacubes[1,1],
entity = 1, timestep = 1:3, bb = c(-26, 64, 30, 38))
#write subset to disk as GeoTiff
ebv_write(data = data_bb, outputpath = out, extent = c(-26, 64, 30, 38), overwrite = TRUE)
## End(Not run)