BuildProfile | R Documentation |
Takes the output of ReadGrib
or DODSGrab
and extracts data at a specific point, performing interpolation if required.
BuildProfile(model.data, lon, lat, spatial.average, points = 4)
model.data |
Data structure returned by |
lon |
Longitudes of points of interest. |
lat |
Latitudes of points of interest. |
spatial.average |
Whether to interpolate data using b-splines to obtain value at the requested point ( |
points |
How many points to include in the interpolation, will be ignored if |
It is much more efficient to download a large chunk of data and extract profile points from that as opposed to downloading individual small model chunks in the vicinity of each point of interest.
profile |
A list with as many elements as profile points, with fields: |
profile$profile.data |
A levels x variables x time matrix with data at a specific point |
profile$location |
The location for which the profile is generated |
profile$forecast.date |
What dates and times the profile contains |
profile$variables |
The variables the profile contains |
profile$levels |
The levels the profile contains |
The “outside of model domain” warning may occur if the profile point is very close to the prime meridian (in the case of a 0-360 longitude definition) or the antipode of the prime meridian (+/- 180 degrees longitude in the case of -180 to 180 degrees definition). For a full download of a global model (e. g. the GFS), this does not mean the point is actually outside of the model domain. For example, the 0.5 degree GFS has nodes from 0 to 359.5 degrees longitude; a profile point requested at 359.9 degrees longitude will cause this warning even though it is within the global GFS model domain.
Daniel C. Bowman danny.c.bowman@gmail.com
ReadGrib
, DODSGrab
#Get temperature profile in Chapel Hill, NC.
#First, define each location
lon <- -79.052094
lat <- 35.907562
#Get second to latest GFS 0.5 model, use analysis forecast
#(this ensures the data's fully up on NOMADS)
## Not run:
model.url <- CrawlModels(abbrev = "gfs_0p50", depth = 2)[2]
pred <- ParseModelPage(model.url)$pred[1]
## End(Not run)
#Get levels
pressure <- c(1, 2, 3, 5, 7,
10, 20, 30, 50, 70,
seq(100, 1000, by = 25))
levels <- paste(pressure, " mb", sep = "")
#Variables - temperature and height only
variables <- c("TMP", "HGT")
## Not run:
grib.info <- GribGrab(model.url, pred, levels, variables,
model.domain = c(-85, -75, 37, 32))
grib.data <- ReadGrib(grib.info[[1]]$file.name, levels, variables)
profile <- BuildProfile(grib.data, lon, lat, TRUE, points = 8)
plot(profile[[1]]$profile.data[,2, 1] - 272.15,
profile[[1]]$profile.data[,1, 1], xlab = "Temperature (C)",
ylab = "Height (m)", main = "Temperature Profile above Chapel Hill, NC")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.