[R] Editing the variables attributes section in the netCDF header of netCDF files created using the package ncdf.
Ross Maidment
R.I.Maidment at pgr.reading.ac.uk
Wed Sep 7 23:25:11 CEST 2011
Hi,
I am using the package ncdf to create netCDF files and I want to mimic the the header of an exiting netCDF file created outside of R. Below is what the existing header looks like (part of it that is different):
netcdf ccd1984_05_08 {
dimensions:
lat = 1974 ;
lon = 1894 ;
time = UNLIMITED ; // (1 currently)
variables:
int time(time) ;
time:long_name = "time" ;
time:units = "days since 1984-05-01 0:0:0" ;
time:day_begins = "06:15" ;
double lat(lat) ;
lat:long_name = "latitude" ;
lat:standard_name = "latitude" ;
lat:units = "degrees_north" ;
lat:axis = "Y" ;
double lon(lon) ;
lon:long_name = "longitude" ;
lon:standard_name = "longitude" ;
lon:units = "degrees_east" ;
lon:axis = "X" ;
byte ccd(time, lat, lon) ;
ccd:Unit_duration = 7.5f ;
ccd:units = "Unit_duration mins" ;
ccd:long_name = "Cold Cloud Duration" ;
ccd:short_name = "ccd" ;
ccd:_FillValue = -1b ;
And here is my attempt when using the ncdf package:
netcdf ccd1983_04_08_r {
dimensions:
lon = 1894 ;
lat = 1974 ;
time = UNLIMITED ; // (1 currently)
variables:
double lon(lon) ;
lon:units = "" ;
double lat(lat) ;
lat:units = "" ;
double time(time) ;
time:units = "days since 1900-01-01" ;
byte ccd(time, lat, lon) ;
ccd:units = "" ;
ccd:missing_value = -99b ;
ccd:long_name = "Cold Cloud Duration" ;
I am unable to replicate the variables attributes that exist in the first example in the second example. Is there anyway to transfer across the header information or edit the ncdf package to do this?
Thanks in advance,
Ross (PhD Student)
More information about the R-help
mailing list