[R-sig-Geo] Plots from netcdf file

Thomas Szegvary t.szegvary at unibas.ch
Thu Jun 14 08:24:09 CEST 2007

I am using the RNetCDF package to extract data from netcdf files. I've got a
nc file (from an atmospheric model) with coordinates as the following:
[1] 67 46
> dim(lat)
[1] 67 46

I suppose the lon and lat values are given to grid points. If I get the
variables and plot(lon,lat) it shows me the grid points. But I am not able
to use filled.contour(lon,lat,z) for a variable z. z containts also the
coordinate array, 8 is an altitude layer and 121 represents the time

> dim(z)
[1]  67  46   8 121

I tried to extract a specific hour and layer, e.g. z100 <- z[,,5,100] and
tried to produce a contour plot. But I always have the following error

> filled.contour(lon,lat,z100)
Error in filled.contour(lon, lat, CO2.100) : 
        increasing 'x' and 'y' values expected

What can I do?

Thanks a lot


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

More information about the R-sig-Geo mailing list