Functions to read gridded meteorological data from the disk.

readmeteorologygrid(files, format = "netCDF", varmapping = NULL,
                    dates = NULL, bbox = NULL, offset = 0, verbose = FALSE)
readmeteorologypixels(files, format = "netCDF", varmapping = NULL,
                      dates = NULL, bbox = NULL, offset = 0, verbose = FALSE)
readmeteorologygridpoints(files, format = "netCDF", varmapping = NULL,
                      dates = NULL, bbox = NULL, offset = 0, 
                      relativehumidity = FALSE, verbose = FALSE)

Arguments

files

Character vector with the file names to be read.

format

Format of meteorological data. Currently, the only accepted format is "netCDF".

varmapping

Named character vector specifying a mapping of variables in the NetCDF into variables used in meteoland (e.g. c(MinTemperature = "tmn") specifies a map of variable 'tmn' to MinTemperature).

dates

A character or Date vector to specify subset of dates to be read.

bbox

Boundary box (2 x 2 matrix) specifying the minimum and maximum coordinates of a study area.

offset

A buffer to include NetCDF cells that are at a certain distance around the boundary box.

relativehumidity

A logical flag to indicate estimation of relative humidity from specific humidity if possible.

verbose

A logical flag to output process information in the console.

Details

Function readmeteorologygrid reads one or several files containing the meteorology over a grid for a set of days. Function readmeteorologypixels reads one or several file containing the meteorology over a grid for a set of days and filters those pixels with missing data. If more than one file is specificated, the functions read all of them and then try to merge the data into a single meteorology object (see function mergegrids).

Function readmeteorologygridpoints is similar to the preceding ones, but is meant to extract specific grid pixels and return them as spatial points. If more than one file is specificated, the function reads all of them and then tries to merge the data into a single meteorology object (see function mergepoints).

The functions are primarily meant to read NetCDF written by package meteoland, but also to import data written by other software. In this case, a mapping can be supplied to map variable names in the netCDF to variables used in meteoland. Rotated grids should not be read using functions readmeteorologygrid or readmeteorologypixels.

Value

Author

Miquel De Cáceres Ainsa, CREAF