[R-sig-Geo] merge netcdf files with Raster (or other) package?
Matthias Demuzere
Matthias.demuzere at ees.kuleuven.be
Tue Dec 6 05:49:41 CET 2011
Hi all,
I have some large netcdf files that present 4 quadrants (that neatly fit
together) of a large domain (eg. NW, NE, SE, SW).
Let's assume for example that all the files contain the following
variables with dimensions:
float A(lat, lon) ;
A:units = "unitless" ;
A:long_name = "none" ;
float B(pft, lat, lon) ;
B:units = "unitless" ;
B:long_name = "nonet" ;
float C(time, pft, lat, lon) ;
C:units = "unitless" ;
C:long_name = "none" ;
float D(layers) ;
D:long_name = "thickness" ;
D:units = "m" ;
So as you can see, 4 variables (A, B, C and D) which all have different
dimensions (lat,lon), (pft,lat,lon), (time,pft,lat,lon) and (layers).
But these variables are the same over all 4 quadrants.
Now my question is whether there is an easy way to merge these 4
quadrants into 1 file, and write it out as a netcdf file again, with the
same metadata as the original files.
I have tried with the raster package (merge function), but it seems you
can only read 1 variable at the time (when reading .nc file with
raster())? Furthermore, raster() seems unable to deal with 1D variables
(as eg. D)?
The reason I would like to get it working with raster is that I like the
fact is handles large datasets really well.
So if anyone could point me in the right direction how to deal with this
properly, that would be great!
Kind regards,
Matthias
--
-------------------------------------------------------------
FWO Post-doctoral Research Fellow
School of Geography and Environmental Science
Monash University
Melbourne, Victoria
Australia
Matthias.Demuzere at monash.edu
Department of Earth& Environmental Sciences
Physical and Regional Geography Research Group
Regional climate studies
Celestijnenlaan 200E
3001 Heverlee (Leuven)
BELGIUM
Tel: + 32 16 326424
Fax: + 32 16 322980
matthias.demuzere at ees.kuleuven.be
http://geo.kuleuven.be/aow/
www.kuleuven.be/geography
More information about the R-sig-Geo
mailing list