R: Download model data from the NOMADS server using the...
DODSGrab
R Documentation
Download model data from the NOMADS server using the GrADS-DODS system.
Description
This function interfaces with the NOMADS server to download weather, ocean, and sea ice data.
The available models can be viewed by calling NOMADSRealTimeList and NOMADSArchiveList.
The data arrives in ascii format, so this function can be used to retrieve data on any operating system.
#An example for the Global Forecast System 0.5 degree model
#Make a world temperature map for the latest model run
## Not run:
#Figure out which model is most recent
model.urls <- GetDODSDates("gfs_0p50")
latest.model <- tail(model.urls$url, 1)
model.runs <- GetDODSModelRuns(latest.model)
latest.model.run <- tail(model.runs$model.run, 1)
#Download worldwide temperature data at 2 m
variable <- "tmp2m"
time <- c(0, 0) #Analysis run, index starts at 0
lon <- c(0, 719) #All 720 longitude points
lat <- c(0, 360) #All 361 latitude points
model.data <- DODSGrab(latest.model, latest.model.run,
variable, time, lon, lat)
#Make it into a nice array and plot it
model.grid <- ModelGrid(model.data, c(0.5, 0.5))
image(model.grid$z[1,1,,])
## End(Not run)