[R-sig-Geo] Coordinate/grid for ncdf data

Thomas Szegvary t.szegvary at unibas.ch
Wed Aug 8 15:12:47 CEST 2007


Hi!

I have a table with 3 columns, 2 for long/lat coordinates and 1 for values
(radon concentration). I have data for every week of the year
2006,distributed in 52 tables/files. I want to create a NetCDF file, which
is much easier to handle than extracting the values from 52 tables. I tried
the following for the first dataset (i.e first week):

#extracting coordinates and values from my tables (which have also other
information I don't need)
W01<-read.table("RN_weekly/KW01_RN.dat")
long<-W01$V1
lat<-W01$V2
RN01<-W01$V3

#defining dimensions for coordinates
dim1 <- dim.def.ncdf( "EW","degrees", as.double(long))
dim2 <- dim.def.ncdf( "SN","degrees", as.double(lat))

#defining variable for my values I want to have the time series
varz <- var.def.ncdf("Radon","Bq/m2/h1", list(dim1,dim2), -1, 
          longname="Radon flux rate")

#creating the netcdf file and filling the variable varz with the first
data-week from my time series
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 that
I need an array with two dimensions (coordinates...) for my values. But how
do I get this from my tables??

 *10573 are the pixels for my area

Thanks for any help!
Thomas


__

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-sig-Geo mailing list