help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: plotting data from netcdf file


From: Ismael Diego Nunez-Riboni
Subject: Re: plotting data from netcdf file
Date: Tue, 15 May 2012 10:27:53 +0200

On 05/15/2012 09:36 AM, nuncio m wrote:
> HI all,
>       I have a netcdf file of 4 dimensions.  latitude, longitude, time
> and height.  How can i make a contour plot of my variable on any one of
> the height.
> I could read all the dimension variables properly. but when  contour
> command returns the following error
>
> contour(lon(1:end),lat(1:end),hgt1(:,:,1,17))
>
> error: __contour__: z argument must be a matrix
> error: called from:
> error:   /usr/share/octave/3.6.1/m/plot/private/__contour__.m at line
> 92, column 5
> error:   /usr/share/octave/3.6.1/m/plot/contour.m at line 61, column 19

The error message means that the 3rd argument of the function should be a 
matrix (i.e., a two dimensional tensor), right now, it seems it is a 4 
dimensional tensor. You have to use reshape, try something like this:

contour(lon(1:end),lat(1:end),reshape(hgt1(:,:,1,17), size(lon,1), size(lon,2))

It might be also that you need to traspose, i.e.,

contour(lon(1:end),lat(1:end),reshape(hgt1(:,:,1,17), size(lon,2), size(lon,1))

but in any case I do not understand why you use lon(1:end),lat(1:end) instead 
of simply lon,lat; are you sure these are also matrices? They look rather like 
vectors, otherwise you are forgetting there one dimension...

Cheers, Ismael.
-- 
Ismael Núñez-Riboni
Hamburg
Deutschland

--------
¿Quién dijo que todo está perdido? 
Yo vengo a ofrecer mi corazón...
Fito Páez

Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de


reply via email to

[Prev in Thread] Current Thread [Next in Thread]