Learn R Programming

rNOMADS (version 2.5.3)

DODSGrab: 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.

Usage

DODSGrab(model.url, model.run, variables, time, lon, lat,
    levels = NULL, ensembles = NULL, display.url = TRUE, 
    verbose = FALSE, request.sleep = 1)

Value

model.data

A structure with a series of elements containing data extracted from GrADS-DODS system.

Arguments

model.url

A model URL for a specific date, probably from GetDODSDates.

model.run

A specific model run to get, probably from GetDODSModelRuns.

variables

A list of the data types to get.

time

A two component vector denoting which time indices to get.

lon

A two component vector denoting which longitude indices to get.

lat

A two component vector denoting which latitude indices to get.

levels

A two component vector denoting which levels to get, if applicable.

ensembles

A two component vector denoting which ensemble runs to get, if applicable.

display.url

If TRUE, print out the URL for the data request.

verbose

If TRUE, give a very detailed description of the download. Default FALSE.

request.sleep

If multiple requests are to be sent to the server, pause by this many seconds between them. This is courteous and also helps prevent timeouts.

Author

Daniel C. Bowman danny.c.bowman@gmail.com

References

https://nomads.ncep.noaa.gov/

See Also

GetDODSDates, GetDODSModelRuns, GetDODSModelRunInfo

Examples

Run this code

#An example for the Global Forecast System 0.5 degree model
#Make a world temperature map for the latest model run

if (FALSE) {
#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,,])
}

Run the code above in your browser using DataLab