#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)
if (FALSE) {
model.url <- CrawlModels(abbrev = "gfs_0p50", depth = 2)[2]
pred <- ParseModelPage(model.url)$pred[1]
}
#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")
if (FALSE) {
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")
}
Run the code above in your browser using DataLab