G5NR Data Access Guide: Difference between revisions

Pchakrab (talk | contribs)
m Pchakrab moved page Data access guide to G5NR Data Access Guide: More verbose title.
Free clients: Added a small example for R
Line 220: Line 220:


====== pygrads ======
====== pygrads ======
===== R =====
This example requires the [http://cran.r-project.org/web/packages/ncdf4/index.html ncdf4] and [http://cran.r-project.org/web/packages/rworldmap/index.html rworldmap] packages.
<nowiki>
> library(ncdf4)
> library(rworldmap)
Loading required package: sp
### Welcome to rworldmap ###
For a short introduction type : vignette('rworldmap')
> im <- 720
> jm <- 361
> lm <- 72
> nc <- nc_open("http://opendap.nccs.nasa.gov:9090/dods/OSSE/GEOS-5.12/BETA9/0.5000_deg/inst/inst01hr_3d_T_Cv")
< t <- ncvar_get(nc,"t",start=c(1,1,1,37),count=c(im,jm,lm,1))
> str(t)
num [1:720, 1:361, 1:72] 218 218 218 218 218 ...
> summary(t)
  Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
  179.7  220.9  241.7  243.4  265.3  316.7
> mapGriddedData(t[1:im,1:jm,71])
</nowiki>


===== NCL =====
===== NCL =====