octave-maintainers
[Top][All Lists]
Advanced

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

octcdf questions


From: Joan Pau Beltran
Subject: octcdf questions
Date: Tue, 28 May 2013 10:18:09 +0200

Hi everyone,

Yesterday I subimitted a bug (39084) but I realized that it might not be a bug but an unsupported feature. Basically, using a preset range as a subscript for a netcdf variable, either on reading or writing, fails with error: unknown index specification type: <unknown type>. Is this feature supported? It seems it should be, because this is the syntax used with variables with record dimensions.

Here I reproduce the example in the bug sumbit:

% Writing:
nc = netcdf('myncfile.nc','c');
nc('dim1') = 5;
nc{'var1'} = ncvar('dim1');
nc{'var1'} = ncautonan(nc{'var1'}, 1); % This produces a warning: var1 already exists
nc{'var1'} = ncautoscale(nc{'var1'}, 1);
% This produces a warning: var1 already exists
nc{'var1'}(:) = 1:5;   % this works!
nc{'var1'}(1:5) = 1:5; % this fails!
close(nc);
% Reading:
nc = netcdf('myncfile.nc', 'r')
var1_data = nc{'var1'}(:)   % this works!
var1_data = nc{'var1'}(1:5) % this fails!
% should we close nc here, too?

In the example above I also added comments about ncautonan an ncautoscale. From the documentation, it is not clear if the return value should be reassigned to a variable to preserve the changes or not. This keeps the changes but produce the warning:

nc{'var1'} = ncvar('dim1');
nc{'var1'} = ncautonan(nc{'var1'}, 1);   % This produces a warning: var1 already exists
nc{'var1'} = ncautoscale(nc{'var1'}, 1); % This produces a warning: var1 already exists


While this does not produce the warning but does not keep the changes (autonan and autoscale keep disabled):

nc{'var1'} = ncvar('dim1');
ncautonan(nc{'var1'}, 1);   % Autonan does not keep enabled for nc{'var1'}
ncautoscale(nc{'var1'}, 1); %
Autoscale does not keep enabled for nc{'var1'}

How should we call these functions?

I did all tests in Ubuntu 13.04 (x86-64) with octave and octave-octcdf from the official repositories.

Thank you!
--
Joan Pau Beltran

reply via email to

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