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

Thomas Szegvary t.szegvary at unibas.ch
Thu Aug 9 08:22:01 CEST 2007


I use ncdf V1.6 on Windows XP Sp2, I hava attached the sample file (tab
delim) which contains 2 columns for coordinates long/lat and 10 columns for
weekly averages of radon. Sp would be the best solution to produce map I
guess, but for time series analysis I think netcdf would perform better. 

Thanks,thoams


 
-----Ursprüngliche Nachricht-----
Von: Michael Sumner [mailto:mdsumner at utas.edu.au] 
Gesendet: Donnerstag, 9. August 2007 01:49
An: 'Thomas Szegvary'; r-sig-geo at stat.math.ethz.ch
Betreff: RE: [R-sig-Geo] Coordinate/grid for ncdf data

Hi, can you provide an example file?

I'd recommend avoiding NetCDF for various reasons, why don't you simply add
each value column from the separate files to a new column in a
SpatialGridDataFrame?

That would be the recommend sp way to proceed here. If you really need to
create a NetCDF file, please let us know more about your OS and the
package/s and versions you are using (ncdf I presume?) - however such
questions should include the ncdf(?) package author at least.  

Cheers, Mike. 

-----Original Message-----
From: r-sig-geo-bounces at stat.math.ethz.ch
[mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of Thomas Szegvary
Sent: Wednesday, 8 August 2007 11:13 PM
To: r-sig-geo at stat.math.ethz.ch
Subject: [R-sig-Geo] Coordinate/grid for ncdf data

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

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sample_rn.txt
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20070809/97647e70/attachment.txt>


More information about the R-sig-Geo mailing list