Description Usage Arguments Value Author(s) Examples
View source: R/GetNetCDFAtCoords.R
Extract from a netcdf file the timeseries from the grid cells which are nearest to a set of requested coordinates. This function is useful if you want to analyse only a relatively small number of grid cells from a netcdf file and you do not necessarily need the entire spatial field.
1 2 3 4 5 6 7 8 9 | GetNetCDFAtCoords(
filename,
req.coords,
req.var,
time.var = "time",
lon.var = "longitude",
lat.var = "latitude",
verbose = FALSE
)
|
filename |
path to the netcdf file. |
req.coords |
matrix or dataframe of requested longitude (1st column) and latitude (2nd column) coordinates. |
req.var |
name of the timeseries variable to extract from the netcdf file. |
time.var |
name of the time variable in the netcdf file. |
lon.var |
name of the longitude variable in the netcdf file. |
lat.var |
name of the latitude variable in the netcdf file. |
verbose |
logical; if |
A data frame of n rows, where n is the product of the number of requested coordinates and the time steps in the netcdf file, and five columns with the requested longitude, requested latitude, index number of the requested coordinate as character vector, time step, and timeseries value for the requested variable at each time step.
Andrew Dolman with contributions from Thomas Muench
1 2 3 4 5 6 7 8 9 10 11 | filename <- system.file("extdata", "test_data.nc", package = "ncdftools")
req.coords = data.frame(lon = c(18, 13), lat = c(59, 52))
GetNetCDFAtCoords(filename, req.coords = req.coords, req.var = "t2m")
## print information on the processing step
## Not run:
GetNetCDFAtCoords(filename, req.coords = req.coords, req.var = "grid_index",
verbose = TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.