[R] Creating netcdf from table
Thomas Szegvary
t.szegvary at unibas.ch
Wed Aug 8 10:26:02 CEST 2007
Hi!
I have a table with 3 columns, 2 for long/lat coordinates and 1 for values
(radon concentration). I have Tables for every week of the year 2006, always
same coordinates but other values, i.e. time series. Now I want to create a
NetCDF file for, which is much easier to handle than 52 tables. I tried the
following for the first dataset (i.e first week):
W01<-read.table("RN_weekly/KW01_RN.dat")
long<-W01$V1
lat<-W01$V2
RN01<-W01$V3
dim1 <- dim.def.ncdf( "EW","degrees", as.double(long))
dim2 <- dim.def.ncdf( "SN","degrees", as.double(lat))
varz <- var.def.ncdf("Radon","Bq/m2/h1", list(dim1,dim2), -1,
longname="Radon flux rate")
nc.rn <- create.ncdf("rn_weekly.nc",varz)
put.var.ncdf(nc.rn,varz,RN01)
close.ncdf(nc.rn)
The problem now is that the last step (put.var.ncdf) doesn't work, because
it says I am trying to "error: you asked to write 111788329 values, but the
passed data array only has 10573 entries!". So I think the problem is I need
an array with two dimensions (coordinates...) for my values. But do I get
this from my tables??
Thanks for any help!
Thomas
My problem now is that
__
Thomas Szegvary
Institute of Environmental Geosciences
Department of Geosciences
University of Basel
Bernoullistrasse 30
CH - 4056 Basel
Tel. 41-61-267 04 82
Fax. 41-61-267 04 79
Email: t.szegvary at unibas.ch
www.radon.unibas.ch
www.unibas.ch/environment
More information about the R-help
mailing list