Hi,

I have never needed this functionality myself. However patches are
certainly welcome.  If you really need this, have a look at line 246
of file ov-netcdf.cc. You would need to add a special case for ncdim:

  else if (args(0).class_name() == "ncdim") {
// do something
  }

and add the line 'dispatch('var','ncvar','ncdim');' to PKG_ADD.

Alex

On Tue, May 4, 2010 at 7:04 AM,  <n...@itimes.com> wrote:
> Hi Alex.
>
> The code given below gives the output (in matlab) as "longitude temp". That 
> is, "longitude" and "temp" are the variables which depend on the dimension 
> "longitude".
> Could you please make necessary correction to the code below so that I can 
> get similar output in octave as well.
>
>
> latitude = -90:1:90;
> longitude = -179:1:180;
> temp = 35;
>
> nc = netcdf('example.nc','c');
>
> nc('longitude') = 360;
>
> nc('latitude') = 181;
>
> nc{'longitude'} = ncdouble('longitude');
> nc{'longitude'}(:) = longitude;
> nc{'longitude'}.units = 'degree West';
> nc{'latitude'} = ncdouble('latitude');
> nc{'latitude'}(:) = latitude;
> nc{'latitude'}.units = 'degree North';
>
>
> nc{'temp'} = ncdouble('longitude','latitude');
>
> nc{'temp'}(:) = temp;
> nc{'temp'}.units = 'degree Celsius';
> nc{'temp'}.valid_range = [-10 40];
>
> r = nc('longitude');
> v = var(r);
> for i = 1:length(v)
>  disp(name(v{i}));
> end
>
> close(nc);
>
>
> Thanks,
> Nands
>
>
> ----- Original Message -----
> From: Alexander Barth <barth.alexan...@gmail.com>
> To: n...@itimes.com
> Cc: octave-dev <octave-dev@lists.sourceforge.net>
> Sent: Sat, 1 May 2010 13:43:50 +0530 (IST)
> Subject: Re: [OctDev] alternative to 'var' in Octcdf
>
> On Wed, Apr 21, 2010 at 8:27 AM,  <n...@itimes.com> wrote:
>> Hi all.
>>
>> There is a function 'var' in matlab's netcdf such that var(self) returns the 
>> list of variables that contribute  to self, a composite "ncvar" object.
>> Is there any such function in Octcdf or is there any alternate way from 
>> which I can get the same functionality as 'var'.
>
>
> There is the function var in octcdf. If it does not do what you want
> (compared to matlab's netcdf toolbox), can you show it with an
> example?
>
> Alex
>

------------------------------------------------------------------------------

_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to