Character. The name of the variable (or variables in checkDays) to retrieve. Use grepVar to know what variables are available in each service.
day
Date or character. In getRaster it defines the day when the forecast was produced. In getRasterDay it defines the day to be forecast.
run
Character. For example, the meteogalicia service executes the model at OOUTC and 12UTC. Therefore run can be '00' or '12'.
start
Date or character. First day of the time period to retrieve.
end
Date or character. Last day of the time period to retrieve.
frames
Numeric. It defines the number of hourly forecasts (frames) to retrieve. If frames = 'complete', the full set of frames is downloaded. For example, the meteogalicia service produces 96 hourly forecasts (frames) with run='00' and 84 frames with run='12'.
box
The bounding box, defined using longitude and latitude values. A Extent or an object that can be coerced to that class with extent: a 2x2 matrix (first row: xmin, xmax; second row: ymin, ymax), vector (length=4; order= xmin, xmax, ymin, ymax) or list (with at least two elements, with names 'x' and 'y').
resolution
Numeric. Resolution in kilometers of the raster. Valid choices are 4, 12, and 36. It is only used with service = 'meteogalicia'.
names
Character. Names of the layers of the resulting RasterBrick. If missing, a predefined vector is assigned the combination of day and hour.
remote
Logical. If TRUE (default) data is downloaded from the remote service. If FALSE the RasterBrick is produced with the files available in the local folder.
service
Character, which service to use, 'meteogalicia', 'gfs', 'nam' or 'rap'.
use00H
Logical. Only used when service is 'gfs', 'nam', or 'rap'. If FALSE (default), the first frame of each run or 00H "forecast" is not considered. This first frame is only produced for some variables. Therefore, with use00H = TRUE fewer frames that the number defined with frames could be obtained for some variables.)
dataDir
Character, path of the folder where files are stored (if remote = 'FALSE')
...
Additional arguments. Not used in getRaster.
Details
getRaster downloads data from the MeteoGalicia, NCDC (GFS, RAP, and NAM), or OpenMeteo servers using the NetCDF Subset Service. The result is returned as a RasterBrick object, with one or more NetCDF files stored in the temporary folder (as defined by tempdir()). Each frame or layer of the RasterBrick corresponds to a certain hour of the forecast.
getRasterDay uses getRaster to download the results corresponding to a certain day. If the day is in the future, the most recent forecast is downloaded with getRaster, and the corresponding frames are extracted. If the day is in the past, getRaster is used to download the corresponding frames of the forecast produced that day.
getRasterDays uses getRaster to download the results cast each day comprised between start and end using the 00UTC run. Then it subsets the first 24 frames of each result, and binds them together to produce a RasterBrick. Therefore, each frame of this RasterBrick is a forecast for an hour of the day when the forecast was cast.
checkDays explores a local folder looking for NetCDF files corresponding to a time sequence and a set of variables. It returns a Date vector comprising the days with files available for the requested variables. If remote = TRUE it only checks that start is after 2008-01-01 (first date of the archived forecasts of MeteoGalicia.)
Value
The getRaster* functions return a RasterBrick with a layer for each hour of the NWP forecast.
The time zone of the time index of this RasterBrick, stored in its z slot (accesible with getZ) is UTC.
MeteoGalicia, NAM, and RAP use the Lambert Conic Conformal projection. GFS files use longitude-latitude coordinates.
Author(s)
Oscar Perpiñán with contributions from Marcelo Almeida.