Try extracting the unique  coordinates as vectors, 

e.g. 

x <- sort(unique(lon))
y <- sort(unique(lat))
filled.contour(x, y, z100)

The sensibility of that depends on the numeric uniqueness of your
coordinates, if length(x) and length(y) are not now equal to** the
corresponding dim(z100) then that won't work. 

** (or 1 more than given corners vs. centres)


Other plotting functions, such as spplot and its lattice friends, expect
a data.frame with all the coordinates for each pixel explicit, and you
can specify a plot by formula. The standard "gridded" data functions in
R: image, contour, and filled.contour expect a list with x/y vector and z 
matrix, or each of those as separate arguments. sp's plotting functions
build on these 2 foundations. 

BTW1, image etc. will handle non-linear "grids" because of the way they
use rect at the lower graphics level. This may be important from an sp
perspective as NetCDF data sometimes come in gridded form, but with
non-linear latitudes (since they are really using Mercator projection)
and require special handling. 

BTW2, you can probably also read your file with a custom compile version
of rgdal (which I have on Windows, thanks to Roger Bivand's help!). 

I'm very interested in finding about uses of NetCDF files and the various 
ways in which it is done (it's actually part of my job now), so please
feel free to contact me directly - I'd love to find out more about your
dataset and interests. 

Cheers, Mike.

==============Original message text===============
On Thu, 14 Jun 2007 16:24:09 +1000 "Thomas Szegvary" wrote:

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:
>dim(lon)
[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
(hours). 

> 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
message:

> 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



__

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@unibas.ch
www.radon.unibas.ch
www.unibas.ch/environment

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

===========End of original message text===========



If it wasn't backed-up, then it wasn't important. ~ Anon sysadmin

Mike Sumner (Phd. Candidate)
http://www.antcrc.utas.edu.au/~mdsumner/ http://www.zoo.utas.edu.au/awru/  IASOS/AWRU
University of Tasmania
Private Bag 80
Hobart Tasmania 7001
AUSTRALIA
Email: mdsumner@utas.edu.au 
Phone: 03 6226 1752 (W)
       0408599921   (M)
Fax:   03 6226 2745


