octave-maintainers
[Top][All Lists]
Advanced

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

Re: octcdf questions


From: Joan Pau Beltran
Subject: Re: octcdf questions
Date: Wed, 29 May 2013 12:42:06 +0200

Hi Alexander,

Thank you for your response, now it is clear to me how autonan and autoscale work.
Probably a comment in the documentation's example would help here.
BTW which are the actual names: ncautonan and ncautoscale or autonan and autoscale?
The later are undefined in my version of octave with ocatve-octcdf.

Regarding the other failure, I realized it only happens to me with variables with several dimensions (e.g matrices).
This probably points out to a misuse. Let me reword my example (forgetting autonan and autoscale issue):

nc = netcdf('myncfile.nc','c');
nc('dim1') = 3;
nc('dim2') = 2;
nc{'var1'} = ncdouble('dim1');
nc{'var2'} = ncdouble('dim1', 'dim2');
nc{'var1'}(:)   = rand(3,1); % this works.
nc{'var1'}(1:3) = rand(3,1); % this works, too.
nc{'var2'}(:)   = rand(3,2); % this works.
nc{'var2'}(1:6) = rand(3,2); % this fails: octcdf: unknown index specification: type <unknown_type>
nc{'var2'}(:,:)     = rand(3,2); % this works.
nc{'var2'}(1:3,1:2) = rand(3,2); % this works, too.

So does it mean that I should explicitly indicate the slice along EACH DIMENSION? Another possibility is to use either a single magic colon, or a magic colon for each dimension. Will the last option work with variables with record dimensions?

Thanks again!

2013/5/28 Alexander Barth <address@hidden>
Hi Joan

For autonan and autoscale you should do something like this:

What is strange is that both assignments work for me using octcdf 1.1.6 and octave 3.6.2

nv(:) = 1:5; % to use the autonan and autoscale
nv(1:5) = 1:5;

or in this form:

nc{'var1'}(1:5) = 1:5; % without autonan and autoscale

What does happen when you try "nv(1:5) = 1:5;" ?
Can you run nctest?

Joan Pau Beltran

reply via email to

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