  Sara,

  Why don't you try packages ncdf, ncdf4, or even the famous raster?


________________________________
 From: sara martino <saramartino@yahoo.com>
To: "r-sig-geo@r-project.org" <r-sig-geo@r-project.org> 
Sent: Tuesday, December 4, 2012 5:12 PM
Subject: Re: [R-sig-Geo] Problem with RNetCDF and ubuntu

Nobody uses RNetCDF on Ubuntu? Is there another place i could try to ask?
thanks again
sara



________________________________

A: "r-sig-geo@r-project.org" <r-sig-geo@r-project.org> 
Inviato: Venerdė 30 Novembre 2012 18:57
Oggetto: [R-sig-Geo] Problem with RNetCDF and ubuntu

Hi,
hope someone can help me with this...
I have istalled the RNetCD on my Ubuntu machine using:


sudo apt-get install libudunits2-0 libudunits2-dev
sudo apt-get install libnetcdf4 libnetcdf-dev 

Then in R :
install.packages("RNetCDF",configure.args="--with-netcdf-include=/usr/include")


everything seemed to work fine untill i tryed to create some ncf files, I have tryed the following code:

##  Create a new NetCDF dataset and define two dimensions
nx=100
ny=4

nc <- create.nc("foo.nc")
dim.def.nc(nc, "x", nx)
dim.def.nc(nc, "y", ny)
dim.def.nc(nc, "time", unlim=TRUE)
dim.def.nc(nc, "max_string_length", 32)
##  Create three variables, one as coordinate variable
var.def.nc(nc, "time", "NC_INT", "time")
var.def.nc(nc, "x", "NC_INT", "x")
var.def.nc(nc, "y", "NC_INT", "y")
var.def.nc(nc, "temperature", "NC_DOUBLE", c("x","y", "time"))
##  Define variable values
mytime <- c(1:2)
myx <- 1:nx
myy <- 1:ny
mytemperature <- matrix(runif(nx*ny),nx, ny)
##  Put the data with indicated start/count
var.put.nc(nc, "time", mytime)
var.put.nc(nc, "x", myx)
var.put.nc(nc, "y", myy)
var.put.nc(nc, "temperature", mytemperature, c(1,1, 1), c(nx,ny, 1))
close.nc(nc)

This runs fine but if i change ny to (for example 40) and i run the same code then i get the following error:

> nc <- create.nc("foo.nc")
> dim.def.nc(nc, "x", nx)
> dim.def.nc(nc, "y", ny)
> dim.def.nc(nc, "time", unlim=TRUE)
> dim.def.nc(nc, "max_string_length", 32)
> ##  Create three variables, one as coordinate variable
> var.def.nc(nc, "time", "NC_INT", "time")
> var.def.nc(nc, "x", "NC_INT", "x")
> var.def.nc(nc, "y", "NC_INT", "y")
> var.def.nc(nc, "temperature", "NC_DOUBLE", c("x","y", "time"))
> ##  Define variable values
> mytime <- c(1:2)
> myx <- 1:nx
> myy <- 1:ny
> mytemperature <- matrix(runif(nx*ny),nx, ny)
> ##  Put the data with indicated start/count
> var.put.nc(nc, "time", mytime)
Error: Protocol error



I have asked some colleagues using windows to try the same code and it runs fine for them. Does anyone has an idea of what could be the problem??
thanks a lot
sara
    [[alternative HTML version deleted]]


_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
    [[alternative HTML version deleted]]


_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
	[[alternative HTML version deleted]]

