[Rnomads-user] ModelGrid function with Dods data

Bowman, Daniel haksaeng at live.unc.edu
Wed Jan 7 22:38:50 CET 2015


Hi Adam,


Yes, ModelGrid is the culprit.  First of all, GFS is in "Lat Lon" and the resolution is 0.5.  So your code should read:


GFS.modelgrid <- ModelGrid( GFS.Model.Data, grid.type = "latlon", resolution = c(0.5, 0.5),levels = c("surface","2_m_above_ground"), variables)


However, since you pulled multiple forecasts from DODS, the above won't work unless you separate out each forecast.  This is a problem I ran into recently but was too lazy to solve, but now you've given me a reason to put together an example.  I'll get it to you by the end of the day tomorrow.


Danny


Daniel C. Bowman
DoctGFS.modelgrid <- ModelGrid(model.data = GFS.Model.Data, grid.type = "cartesian", resolution = c(-140,40),levels = c("surface","2_m_above_ground"), variables, model.domain = NULL, cartesian.nodes = (list(x=0.5,y=0.5))oral Candidate in Geophysics
Mitchell 315
Department of Geological Sciences
The University of North Carolina at Chapel Hill
phone: 575-418-8555
email: daniel.bowman at unc.edu
web:http://geosci.unc.edu/page/daniel-c-bowman

________________________________
From: rnomads-user-bounces at lists.r-forge.r-project.org <rnomads-user-bounces at lists.r-forge.r-project.org> on behalf of Adam Simkowski <akssimkowski at sbcglobal.net>
Sent: Wednesday, January 7, 2015 4:12 PM
To: rnomads-user at lists.r-forge.r-project.org
Subject: [Rnomads-user] ModelGrid function with Dods data

Hi all,

I am attempting to build an array of GFS model data, but I am running into some trouble when it comes to defining my Cartesian nodes in the ModelGrib function.

I'll walk you through my code before that point... I pull the current day 0z GFS_hd run and then specify a given lat lon area along with certain variables to reduce the size of the data that I am reading in. From there, I run the DODSGrab function to pull in 36 hours worth of forecast data (gfs_hd) which works fine.

>From there, my troubles begin with the ModelGrid function. I believe I have all the arguments correct other than Cartesian.nodes, but I am skeptical on the resolution... not completely sure if I did that correctly. When it comes to the Cartesian.nodes function, I'm not exactly sure what to put in the argument. I understand that it has to be a list with an x and y element, but I can't find any literature on the gfs_hd grid in kilometers. Any thoughts on how to move forward here?

Thank you.


Code is listed below. I am running on a windows 7 machine so pulling Grib data is not an option for me, unfortunately.

#############################################3

  library("rNOMADS")
  library("RCurl")

  GFS.list <- GetDODSDates(abbrev="gfs_hd", archive=F, request.sleep=1) #returns list of available dates with GFS data in a numerical list


  current.GFS.url <- tail(GFS.list$url, 1)
  GFS.model.runs <- GetDODSModelRuns(current.GFS.url)

  GFS.0z <- (head(GFS.model.runs$model.run,1))

  #run when needed
  #GFS.info.variables <- GetDODSModelRunInfo(current.GFS.url, GFS.0z)

  lon <- c(480, 620) # USA Longitude
  lat <- c(240, 280) # USA Latitude

variables <- c("tmax2m","tmin2m", "weasdsfc", "ugrdmwl", "vgrdmwl")

GFS.Model.Data <- DODSGrab(current.GFS.url, GFS.0z, variables, time = c(0,36), lon, lat)

GFS.modelgrid <- ModelGrid(model.data = GFS.Model.Data, grid.type = "cartesian", resolution = c(-140,40),levels = c("surface","2_m_above_ground"), variables, model.domain = NULL, cartesian.nodes = (list(x=0.5,y=0.5)))

########################################################################

Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rnomads-user/attachments/20150107/6d5fb552/attachment.html>


More information about the Rnomads-user mailing list