New updates to the rNOMADS package and big changes in the GFS model

I rolled out a big update to the rNOMADS package in R about two weeks ago.  Now, the list of real time weather, ocean, and sea ice models available through rNOMADS updates automatically by scraping the NOMADS web site.  This way, changes in model inventories will be instantly reflected in rNOMADS without the need for a new version release.

Keep abreast of future updates to rNOMADS by subscribing to the mailing list here.  Feel free to ask for help or make comments on this list as well.

In other news, NOAA just updated the Global Forecast System to provide 0.25 x 0.25 degree output – doubling the resolution of the model!  Check out this crystal clear views of surface temperatures across the planet (source code below the image):

World temperature at 2 m above ground using the 0.25 x 0.25 degree output of the Global Forecast System model.

World temperature at 2 m above ground using the 0.25 x 0.25 degree output of the Global Forecast System model.

 


library(rNOMADS)
library(GEOmap)

#Get dates of model output
model.urls <- GetDODSDates(“gfs_0p25”)

#Find day of most recent model run
latest.model <- tail(model.urls$url, 1)

#Find most recent model run on that day
model.runs <- GetDODSModelRuns(latest.model)

#Get the most recent model (excluding analysis only)
latest.model.run <- tail(model.runs$model.run[which(grepl(“z$”, model.runs$model.run))], 1)

#Define model domain
time <- c(0,0) #Analysis model
lon <- c(0, 1439) #All longitude points
lat <- c(0, 720) #All latitude points
variables <- c(“tmp2m”) #Temperature 2 m above ground

#Get data from NOMADS real time server
tmp.data <- DODSGrab(latest.model, latest.model.run,
variables, time, lon, lat, display.url = FALSE)

#Reformat it
tmp.grid <- ModelGrid(tmp.data, c(0.25, 0.25))

#Define color scale
colormap <- rev(rainbow(500, start = 0 , end = 5/6))

#Plot it
image(x = tmp.grid$x, y = sort(tmp.grid$y), z = tmp.grid$z[1,1,,], col = colormap,
xlab = “Longitude”, ylab = “Latitude”,
main = paste(“World Temperature at Ground Level:”,
tmp.grid$fcst.date))

plotGEOmap(coastmap, border = “black”, add = TRUE,
MAPcol = NA)

Advertisements

10 thoughts on “New updates to the rNOMADS package and big changes in the GFS model

  1. Hi,

    I’m trying to test rNOMADS 2.1.3 on windows with your script of january (with RCurl 1.95-4.6 installed), but I’m getting an error when fetching data from the nomads website :

    The line :

    model.urls <- GetDODSDates("gfs_0p25")

    results in :

    * Hostname was NOT found in DNS cache
    * Trying 140.90.101.62…
    * connect to 140.90.101.62 port 9090 failed: Timed out
    * Failed to connect to nomads.ncep.noaa.gov port 9090: Timed out
    * Closing connection 0
    Error in GetDODSDates("gfs_0p25") :
    The specified URL does not exist! Make sure your model information is correct. It is also possible the NOMADS server is down.
    Details: Attempted to access http://nomads.ncep.noaa.gov:9090/dods/gfs_0p25/ but did not succeed..

    Any ideas what might have gone wrong ?

    Thanks,
    Felix

  2. I get an error right when first contacting the NOMADS site (see below)

    I’d say there might be a connection with one of Hadley’s packages.

    Further debugging shows that the error is thrown by the call

    xml2::xml_find_all(x, make_selector(css, xpath))

    BTW: Is there a reason why teh XML package is called first:

    doc library(rNOMADS)
    Loading required package: rvest
    Loading required package: xml2
    > library(GEOmap)
    >
    > model.urls sessionInfo()
    R version 3.2.0 (2015-04-16)
    Platform: x86_64-pc-linux-gnu (64-bit)
    Running under: Debian GNU/Linux stretch/sid

    locale:
    [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
    [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
    [7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
    [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

    attached base packages:
    [1] stats graphics grDevices utils datasets methods base

    other attached packages:
    [1] GEOmap_2.3-5 rNOMADS_2.1.3 rvest_0.2.0.9000 xml2_0.1.0 setwidth_1.0-3

    loaded via a namespace (and not attached):
    [1] Rcpp_0.11.5 lattice_0.20-31 XML_3.98-1.1 grid_3.2.0 magrittr_1.5
    [6] RPMG_2.1-7 spam_1.0-1 httr_0.6.1 sp_1.0-17 stringr_0.6.2
    [11] splancs_2.01-37 maps_2.3-9 fields_8.2-1
    >

  3. When I run “model.urls <- GetDODSDates("gfs_0p25")", I get below error:

    Error in UseMethod("xml_find_all") :
    no applicable method for 'xml_find_all' applied to an object of class "c('HTMLInternalDocument', 'HTMLInternalDocument', 'XMLInternalDocument', 'XMLAbstractDocument')"

    I literally installed R for the first time today. Really newb… Any ideas what might be causing this?

    Thanks

  4. urls.out <- CrawlModels(abbrev = "gfs_0p50", depth = 5)
    Error in open.connection(x, "rb") : Couldn't connect to server problem

  5. Hi,
    I work with R on Windows 10 :o(
    I am trying to use rNOMADS (which seem to be the perfect package for my project) but as others I don’t find a solution to avoid the following error :
    > model.urls <- GetDODSDates("gfs_0p25")
    Erreur dans UseMethod("xml_find_all") :
    pas de méthode pour 'xml_find_all' applicable pour un objet de classe "c('HTMLInternalDocument', 'HTMLInternalDocument', 'XMLInternalDocument', 'XMLAbstractDocument')"
    Could someone help me please ?

    • Hey, please contact me at danny.c.bowman[at]gmail.com and I’ll help you find out what the problem is. I just tested it on my Windows machine and it worked.
      -Danny (rNOMADS maintainer)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s