[R] problem loading ncdf library on MAC

Dan Kelley kelley.dan at gmail.com
Thu Aug 13 14:25:20 CEST 2009


Update: I could not get RNetCDF working because I couldn't install udunits
version 1 properly, and udunits2 is not the right version.

However, returning to the original post, I *did* get "ncdf" working.  Just
install it from source.  Then, you can do as e.g. below 

<pre>
library(ncdf)
jpeg("SSS.jpg", width=1000, height=500)
#ftp://ftp.nodc.noaa.gov/pub/data.nodc/woa/WOA05nc/annual
file <- open.ncdf("~/data/hydrographic/WOA05nc/S00an1.nc")
S <- get.var.ncdf(file,"s00an1")[,,1]
x <- get.var.ncdf(file, "lon")
y <- get.var.ncdf(file, "lat")
col <- hsv(h=seq(2/3, 0, length.out=16), 1, 1)
par(mar=rep(0.2, 4))
image(x, y, S, zlim=c(30,38), ylim=c(-90, 90),
      col=col, asp=1, axes=FALSE,
      xlab="",ylab="")
contour(x, y, S, levels=seq(30.5,38.5,1),
        drawlabels=FALSE, add=TRUE)
contour(x, y, S, levels=seq(30,38,1), add=TRUE, labcex=2)
abline(h = seq(-90,90,90), col="darkgray")
abline(v=seq(0, 360, 90), col="darkgray")
</pre>


-- 
View this message in context: http://www.nabble.com/problem-loading-ncdf-library-on-MAC-tp23195195p24953887.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list