importRaster | R Documentation |
A function to import the first layer of a generic raster file.
importRaster(
file = file.choose(),
k = 1,
kz = 1,
dx = 0,
dy = 0,
destaggering = FALSE,
variable = NULL,
verbose = FALSE
)
file |
character. Path to the raster file. |
k |
numeric. Factor applied to x and y coordinates (default = 1). For example, it can be used to convert the grid coordinates from km to m (k = 1000). |
kz |
numeric. Factor applied to the variable values (default = 1). |
dx |
numeric. Constant to shift x coordinates (default = 0). |
dy |
numeric. Constant to shift y coordinates (default = 0). |
destaggering |
Use |
variable |
character. The name of the variable to be imported. |
verbose |
logical. If |
This function is based on the terra package and it can import any format managed by it as NetCDF.
Destaggering applies a shift equal to half grid size in both horizontal directions. It is useful for importing data from the SPRAY air quality dispoersion model and it is not applied by default.
An optional summary output can be printed out by setting the verbose
parameter
to TRUE
.
A data.frame with x, y and z columns for the grid cells coordiantes and the variable value.
importADSOBIN()
, importSurferGrd()
## Not run:
# Import binary (netcdf) file and convert coordinates from km to m,
# without destaggering. Variable name is "NOx".
mydata <- importRaster(
file = "/path_to_file/filename.nc",
variable = "NOx",
k = 1000,
destaggering = FALSE
)
# Import binary (netcdf) file and convert coordinates from km to m,
# with shift of 100 m in both directions:
mydata <- importRaster(
file = "/path_to_file/filename.nc",
variable = "pm10",
k = 1000,
dx = 100,
dy = 100
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.