Skip to content
Snippets Groups Projects
Commit 75586e9a authored by jacques.grelet_ird.fr's avatar jacques.grelet_ird.fr
Browse files

use native NetCDF for Matlab >= R2008b

rename @netcdf directory to @netcdf_native (conflict with C Dunham NetCDF toolbox)

Remove FillValue_ attribute for <PARAM>_CALCOEFF_CONV, <PARAM>_LINCOEFF_CONV and SSPS_EXT_BOTTLE
parent 026a1a61
No related branches found
No related tags found
No related merge requests found
Showing
with 753 additions and 27 deletions
......@@ -13,7 +13,7 @@ result = elements(self);
% % -----------------------
% wks = whos('global');
% for i=1:length(wks)
% if strcmp(wks(i).class, 'us191.dynaload')
% if strcmp(wks(i).class, 'dynaload')
% var = wks(i).name;
% end
% end
......
......@@ -104,23 +104,23 @@ function self = dynaload(varargin)
% test constructor argument
% -------------------------
switch nargin
case 0 % can't create default object
[file, path, filterIndex] = uigetfile(...
{'*.csv','Ascii-file (*.csv)';...
'*.xls','Excel-file (*.xls)'}, 'Select file');
if ~any(file)
self.file = 'memory';
return
filterIndex = -1;
else
self.file = fullfile(path, file);
end
self.file = fullfile(path, file);
case 1
if strcmp(varargin{1}, 'memory')
self.file = 'memory';
return
end
if( isa(varargin{1}, 'char'))
filterIndex = -1;
elseif( isa(varargin{1}, 'char'))
file = which(varargin{1});
if isempty( file)
file = varargin{1};
......@@ -138,10 +138,10 @@ switch nargin
else
error('Wrong input argument');
end
otherwise
error('Wrong number of input arguments');
end
% init class properties
......
function save(self, varargin)
% us191.dynaload.save
% it's a wrapper on us191.dynaload.write method
% dynaload save
% it's a wrapper on dynaload.write method
%
% $Id$
......
function write(self, varargin)
% write dynaload memory structure to ASCII CSV file (Comma Separated Value)
% nc is a dynaload objet in memory load from xls file. for example:
% >> nc = us191.dynaload('test.xls');
% >> nc = dynaload('test.xls');
% >> nc
% us191.dynaload
% dynaload
%
% file: test.xls
%
% DIMENSIONS us191.hashtable
% VARIABLES us191.hashtable
% ATTRIBUTES us191.hashtable
% DIMENSIONS hashtable
% VARIABLES hashtable
% ATTRIBUTES hashtable
%
% >> s = nc.VARIABLES.SSTP
%
......
......@@ -8,6 +8,10 @@ function data = elements(hash)
% Copyright (c) 2004 Matthew Krauski (mkrauski@uci.edu), CNLM, UC Irvine
data(:,1) = hash.keys;
data(:,2) = hash.data;
if isempty( hash )
data = {};
else
data(:,1) = hash.keys;
data(:,2) = hash.data;
end
function out = size(self)
% get hashtable size
% Return the number of keys in hashtable
% --------------------------------------
out = numel(self.keys);
function display(self)
% display netcdf object
% diplay help in hypertext link
% -----------------------------
fprintf('<a href="matlab:help netcdf">netcdf</a>\n\n');
if self.mode ~= -1
fprintf('\tfile: ''%s''\n', self.file);
end
%fprintf('\tdynaload: ''%s''\n', self.dynaload);
fprintf('\tmode: ''%s''\n', self.mode);
if self.autonan
theAutonan = 'true';
else
theAutonan = 'false';
end
fprintf('\tautonan: %s\n', theAutonan);
if self.autoscale
theAutoscale = 'true';
else
theAutoscale = 'false';
end
fprintf('\tautoscale: %s\n\n', theAutoscale);
% call protected function hashtable.elements that return
% <nx2> cell array of key/value
% ------------------------------------------------------
result = elements(self);
% % get workspace variables
% % -----------------------
% wks = whos('global');
% for i=1:length(wks)
% if strcmp(wks(i).class, '.netcdf')
% var = wks(i).name;
% end
% end
% loop over key
% -------------
%nb = size(result);
for key = result'
fprintf('\t%-25s\t%2d [%-10s]\n', ...
key{1}, size(key{2}), class(key{2}));
end
fprintf('\n');
% diplay methods list in hypertext link
% -------------------------------------
disp('list of <a href="matlab:methods(''.netcdf'')">methods</a>');
end
\ No newline at end of file
function file = file(self)
file = self.file;
end
\ No newline at end of file
function value = get( self, prop )
% GET: Get profil properties from specified object
% $Id: get.m 121 2007-02-05 17:16:33Z jgrelet $
if nargin==1 % list properties if only object is given
disp('profil properties:')
fprintf(' file, mode, nc_id, autonan, autoscale');
return
end
if ~ischar(prop), error('GET: prop must be string.'), end
switch prop
case 'file'
value = self.file;
case 'mode'
value = self.mode;
case 'nc_id'
value = self.nc_id;
case 'autonan'
value = self.autonan;
case 'autoscale'
value = self.autoscale;
otherwise
error(['GET: ', prop,' is not a valid netcdf property.']);
end
\ No newline at end of file
function name = getConstantNames(self, xtype)
switch xtype
case 1 % NC_BYTE 1
name = 'byte';
case 2 % NC_CHAR 2
name = 'char';
case 3 % NC_SHORT 3
name = 'short';
case 4 % NC_INT, NC_LONG 4
name = 'int';
case 5 %NC_FLOAT 5
name = 'float';
case 6 % NC_DOUBLE 6
name = 'double';
otherwise
error( 'unhandled data type %d\n', xtype );
end
function mode = mode(self)
mode = self.mode;
end
\ No newline at end of file
function self = netcdf_native(varargin)
%
% file @netcdf_native/netcdf_native
arg = nargin;
if arg == 1 && isempty(varargin{1})
arg = 0;
end
theFile = ''; theDynaload = 'memory'; theMode = 'MEMORY';
switch arg
% with not arg, read netcdf file with uigetfile
% ---------------------------------------------
case 0
[theFileName, thePathName] = uigetfile(...
{'*.nc;*.cdf','NetCDF (*.nc,*.cdf)'}, 'Select file');
if any(theFileName)
theFile = fullfile(thePathName, theFileName);
theMode = 'NC_NOWRITE';
theDynaload = 'memory';
else
theFile = '';
end
% with one arg, read given netcdf filename
% ----------------------------------------
case 1
if( strcmp(varargin{1}, 'memory'))
theDynaload = 'memory';
theFile = 'memory';
theMode = 'MEMORY';
elseif( isa(varargin{1}, 'char'))
theFile = varargin{1};
if isempty(exist(theFile, 'file'))
error('netcdf: %s file don''t exist.\n', theFile );
end
[thePathName, theFileName, theFileExt] = fileparts(varargin{1});
switch theFileExt
case {'.nc', 'cdf'}
theMode = 'NC_NOWRITE';
% a revoir ...
theDynaload = 'memory';
case {'.csv', '.xls'}
theDynaload = varargin{1};
theMode = 'DYNALOAD';
otherwise
error('Wrong file type');
end
else
error('Wrong input argument');
end
% work on given netcdf filename with mode and dynaload dexcriptor
% file
% ---------------------------------------------------------------
case 2
% is the mode numeric.
if ischar(varargin{2})
% convert it in numeric value
switch (varargin{2})
case { 'NC_WRITE', 'NC_CLOBBER', 'NC_NOCLOBBER', 'NC_SHARE' };
theMode = varargin{2};
otherwise
error('Wrong mode to create netcdf file: %s', varargin{2});
end
else
% a modifier sur mode est numeric
theMode = varargin{2};
end
otherwise
error('Wrong number of input arguments');
end
d = dynaload( theDynaload );
self.file = theFile;
%self.dynaload = theDynaload;
self.mode = theMode;
self.nc_id = 0;
self.autonan = logical(1);
self.autoscale = logical(0);
% constants for netcdf data types
% -------------------------------
self.NC_BYTE = netcdf.getConstant('NC_BYTE'); % 1
self.NC_CHAR = netcdf.getConstant('NC_CHAR'); % 2
self.NC_SHORT = netcdf.getConstant('NC_SHORT'); % 3
self.NC_INT = netcdf.getConstant('NC_INT'); % 4
self.NC_LONG = netcdf.getConstant('NC_LONG'); % 4
self.NC_FLOAT = netcdf.getConstant('NC_FLOAT'); % 5
self.NC_DOUBLE = netcdf.getConstant('NC_DOUBLE'); % 6
self.NC_MEMORY = -1;
% constants for netcdf.open()
% ---------------------------
%self.NC_NOWRITE: Read-only access
self.NC_NOWRITE = netcdf.getConstant('NC_NOWRITE'); % 0
%self.NC_WRITE: Read-write access
self.NC_WRITE = netcdf.getConstant('NC_WRITE'); % 1
% constants for netcdf.create()
% -----------------------------
self.NC_CLOBBER = netcdf.getConstant('NC_CLOBBER'); % 0
%self.NC_NOCLOBBER: Prevent overwriting of existing file with the same name.
self.NC_NOCLOBBER = netcdf.getConstant('NC_NOCLOBBER'); % 4
%self.NC_SHARE: Allow synchronous file updates.
self.NC_SHARE = netcdf.getConstant('NC_SHARE'); % 2048
%self.NC_64BIT_OFFSET: Allow easier creation of files and variables which
% are larger than two gigabytes.
self.NC_64BIT_OFFSET = netcdf.getConstant('NC_64BIT_OFFSET'); % 512
self.NC_ERR = netcdf.getConstant('NC2_ERR'); % -1
self.NC_EBADDIM = netcdf.getConstant('NC_EBADDIM');
self.NC_EBADID = netcdf.getConstant('NC_EBADID');
self.NC_EBADNAME = netcdf.getConstant('NC_EBADNAME');
self.NC_EBADTYPE = netcdf.getConstant('NC_EBADTYPE');
self.NC_ECHAR = netcdf.getConstant('NC_ECHAR');
self.NC_EDIMSIZE = netcdf.getConstant('NC_EDIMSIZE');
self.NC_EEDGE = netcdf.getConstant('NC_EEDGE');
self.NC_EEXIST = netcdf.getConstant('NC_EEXIST');
self.NC_EGLOBAL = netcdf.getConstant('NC_EGLOBAL');
self.NC_EINDEFINE = netcdf.getConstant('NC_EINDEFINE');
self.NC_EINVAL = netcdf.getConstant('NC_EINVAL');
self.NC_EINVALCOORDS = netcdf.getConstant('NC_EINVALCOORDS');
self.NC_EMAXATTS = netcdf.getConstant('NC_EMAXATTS');
self.NC_EMAXDIMS = netcdf.getConstant('NC_EMAXDIMS');
self.NC_EMAXNAME = netcdf.getConstant('NC_EMAXNAME');
self.NC_EMAXVARS = netcdf.getConstant('NC_EMAXVARS');
self.NC_ENAMEINUSE = netcdf.getConstant('NC_ENAMEINUSE');
self.NC_ENFILE = netcdf.getConstant('NC_ENFILE');
self.NC_ENOMEM = netcdf.getConstant('NC_ENOMEM');
self.NC_ENORECVARS = netcdf.getConstant('NC_ENORECVARS');
self.NC_ENOTATT = netcdf.getConstant('NC_ENOTATT');
self.NC_ENOTINDEFINE = netcdf.getConstant('NC_ENOTINDEFINE');
self.NC_ENOTNC = netcdf.getConstant('NC_ENOTNC');
self.NC_ENOTVAR = netcdf.getConstant('NC_ENOTVAR');
self.NC_EPERM = netcdf.getConstant('NC_EPERM');
self.NC_ERANGE = netcdf.getConstant('NC_ERANGE');
self.NC_ESTRIDE = netcdf.getConstant('NC_ESTRIDE');
self.NC_ESTS = netcdf.getConstant('NC_ESTS');
self.NC_ETRUNC = netcdf.getConstant('NC_ETRUNC');
self.NC_EUNLIMIT = netcdf.getConstant('NC_EUNLIMIT');
self.NC_EUNLIMPOS = netcdf.getConstant('NC_EUNLIMPOS');
self.NC_EVARSIZE = netcdf.getConstant('NC_EVARSIZE');
self.NC_FATAL = netcdf.getConstant('NC_FATAL'); % 1
self.NC_FILL = netcdf.getConstant('NC_FILL'); % 0
self.NC_FILL_BYTE = netcdf.getConstant('NC_FILL_BYTE'); % -127
self.NC_FILL_CHAR = netcdf.getConstant('NC_FILL_CHAR'); % 0
self.NC_FILL_DOUBLE = netcdf.getConstant('NC_FILL_DOUBLE'); % 9.9692e+036
self.NC_FILL_FLOAT = netcdf.getConstant('NC_FILL_FLOAT'); % 9.9692e+036
self.NC_FILL_INT = netcdf.getConstant('NC_FILL_INT'); % -2.1475e+009
self.NC_FILL_SHORT = netcdf.getConstant('NC_FILL_SHORT'); % -32767
self.NC_FORMAT_64BIT = netcdf.getConstant('NC_FORMAT_64BIT'); % 2
self.NC_FORMAT_CLASSIC = netcdf.getConstant('NC_FORMAT_CLASSIC'); % 1
self.NC_GLOBAL = netcdf.getConstant('NC_GLOBAL'); % -1
self.NC_LOCK = netcdf.getConstant('NC_LOCK'); % 1024
self.NC_MAX_ATTRS = netcdf.getConstant('NC_MAX_ATTRS'); % 8192
self.NC_MAX_DIMS = netcdf.getConstant('NC_MAX_DIMS'); % 1024
self.NC_MAX_NAME = netcdf.getConstant('NC_MAX_NAME'); % 256
self.NC_MAX_VARS = netcdf.getConstant('NC_MAX_VARS'); % 8192
self.NC_MAX_VAR_DIMS = netcdf.getConstant('NC_MAX_VAR_DIMS'); % 1024
self.NC_NAT = netcdf.getConstant('NC_NAT'); % 0
self.NC_NOERR = netcdf.getConstant('NC_NOERR'); % 0
self.NC_NOFILL = netcdf.getConstant('NC_NOFILL'); % 256
self.NC_SIZEHINT_DEFAULT = netcdf.getConstant('NC_SIZEHINT_DEFAULT'); % 0
self.NC_UNLIMITED = netcdf.getConstant('NC_UNLIMITED'); % 0
self.NC_VERBOSE = netcdf.getConstant('NC_VERBOSE'); % 2
% bless class
% -----------
self = class(self, 'netcdf_native', d);
% call private function following mode state
% a revoir !!!!!!!!!!!!!!!
% ------------------------------------------
switch self.mode
case 'NC_NOWRITE' % NOWRITE mode
[self] = read(self, true);
case 'NC_WRITE' % READ/WRITE mode
self = put(self,'DIMENSIONS', hashtable);
self = put(self,'VARIABLES', hashtable);
self = put(self,'ATTRIBUTES', hashtable);
case 'NC_NOCLOBBER' % NOCLOBBER mode
case 'NC_CLOBBER' % NOCLOBBER mode
self = put(self,'DIMENSIONS', hashtable);
self = put(self,'VARIABLES', hashtable);
self = put(self,'ATTRIBUTES', hashtable);
% case self.NC_SHARE % SHARE mode
% % not implemeted
case 'NC_64BIT_OFFSET'
% %
case 'DYNALOAD'
% %
case 'MEMORY'
self = put(self,'DIMENSIONS', hashtable);
self = put(self,'VARIABLES', hashtable);
self = put(self,'ATTRIBUTES', hashtable);
otherwise
error('Wrong mode argument');
end
function self = read(self, varargin)
%
%varargin{1} ........... waitbar (boolean)
%
% $Id$
% no waitbar per default
% ----------------------
wbool = false;
% check varargin
% --------------
if nargin > 1
if varargin{1}
wbool = true;
end
end
% check file validity
% -------------------
self.nc_id = netcdf.open(self.file, self.mode);
if self.nc_id == -1
error(['netcdf:netcdf', ...
'The specified data file ''%s'' does not exist\n' ...
'or is not in the directory which is on the MATLAB path'],...
self.file);
end
% update waitbar title with Tex mode disable
% ------------------------------------------
if wbool
%set(0,'DefaulttextInterpreter','none')
wb = waitbar(0, ['Loading file. Please wait...']);
hchild = get(wb,'children');
htitle = get(hchild,'title');
set(htitle,'Interpreter','None');
end
% create a temporary hashtable use to store data read in file
% -----------------------------------------------------------
hash = hashtable;
% returns the number of dimensions, variables, global attributes and
% eventually unlimited dimension in a netCDF file.
% ------------------------------------------------------------------
[n_dims, nvars, ngatts, unlimdimid] = netcdf.inq(self.nc_id);
% get dimensions and store to netcdf hashtable
% --------------------------------------------
for dimid = 0:n_dims-1
% initialize empty structure
% --------------------------
s = [];
% Get name and length of id dimension
% -------------------------------------
[dimname, dimlen] = netcdf.inqDim(self.nc_id, dimid);
% Get dimid (dimension id) from name
% normalement pas besoin, a verifier....
% ----------------------------------
%dimid = netcdf.inqDimId(self.nc_id, dimname);
% fill dimension structure with name and boolean for unlimdimid
% -------------------------------------------------------------
s.dimlen = dimlen;
if(dimid == unlimdimid)
s.unlimited = true;
else
s.unlimited = false;
end
% put dimension name and length to temporary hashtable
% ----------------------------------------------------
hash = put(hash, dimname, s);
end
% put dimensions hashtable to netcdf hashtable
% --------------------------------------------
self = put(self, 'DIMENSIONS', hash);
% clear temporary hashtable for next use
% --------------------------------------
hash = clear(hash);
% bug (TODO), on ne peut pas utiliser hash = hash.clear !!!!
% 09/03/2009: ce n'est pas un bug, voir subsref de hashtable
% get variables and store to netcdf hashtable
% -------------------------------------------
for id = 0:nvars-1
% moves the waitbar cursor
% ------------------------
if wbool
waitbar( id/nvars, wb);
end
% initialize empty structure
% --------------------------
s = [];
% return information about variable
% ---------------------------------
[varName, xtype, dimids, natts] = netcdf.inqVar(self.nc_id, id);
% fill structure s with variable attribute names and values
% ---------------------------------------------------------
for attid = 0:natts-1
% get attribute name
% ------------------
attName = netcdf.inqAttName(self.nc_id, id, attid);
% if attribute name is '_FillValue', transforme to 'FillValue,
% because Matlab dosn't handle member name begining with '_'
% ------------------------------------------------------------
if strcmp(attName, '_FillValue')
s.('FillValue_') = netcdf.getAtt(self.nc_id, id, attName);
else
% otherwise, dynamically fill attribute member of structure s
% with it's value
% -----------------------------------------------------------
s.(attName) = netcdf.getAtt(self.nc_id, id, attName);
end
end % end for loop over variable attributes
% add internal type__ member from xtype 2->char, 6->double
% --------------------------------------------------------
s.type__ = getConstantNames(self, xtype);
% fill temporary structure s with value
% -------------------------------------
s.data__ = netcdf.getVar(self.nc_id, id);
% If a NetCDF variable has valid scale_factor and add_offset
% attributes, then the data is scaled accordingly.
% ----------------------------------------------------------
if self.autoscale
if isfield(s, 'scale_factor') && isfield(s, 'add_offset')
s.data__ = s.data__ * s.scale_factor + s.add_offset;
end
end
% replace FillValue_ by NaN only for numeric variable
% autonan mode is set to true by default
% ---------------------------------------------------
if self.autonan && isfield(s, 'FillValue_')
switch(xtype)
case self.NC_CHAR
% For now, do nothing.
case { self.NC_DOUBLE, self.NC_FLOAT, self.NC_LONG,...
self.NC_SHORT, self.NC_BYTE }
% sometimes, FillValue could be a char a badformed netcdf
% files
% --------------------------------------------------------
if isnumeric(s.('FillValue_'))
s.data__(s.data__ == s.('FillValue_')) = NaN;
else
s.data__(s.data__ == str2double(s.('FillValue_'))) = NaN;
% verrue, pour les fichiers Roscop netcdf mal forms
% --------------------------------------------------
if str2double(s.('FillValue_')) > 1e35
s.data__(s.data__ >= 1e35) = NaN;
end
end
otherwise
error( 'unhandled datatype %d\n', xtype );
end
end
% if var is char and as vertical alignment, transpose it
% ------------------------------------------------------
% if xtype == self.NC_CHAR && (size(s.data__, 1) ~= 1)
% s.data__ = s.data__';
% end
% add internal dimension__ member
% Because MATLAB uses FORTRAN-style ordering, however, the order of
% the dimension IDs is reversed relative to what would be obtained
% from the C API
% ----------------------------
if length(dimids) > 1
s.data__ = permute(s.data__, fliplr(1:length(dimids)));
dimids = fliplr(dimids);
end
for dimid = 1:numel(dimids)
dimname = netcdf.inqDim(self.nc_id, dimids(dimid));
% we need to reverse dimid
% a verifier imperativement avec plusieurs dimensions
% ---------------------------------------
s.dimension__{dimid} = dimname;
end
% put variable name and value to temporary hashtable
% --------------------------------------------------
hash = put(hash, varName, s);
end
% put variable temporary hash to netcdf hashtable
% -----------------------------------------------
self = put(self, 'VARIABLES', hash);
% clear temporary hashtable for next use
% --------------------------------------
hash = clear(hash);
% get gloabal attributes and store to netcdf hashtable
% -----------------------------------------------------
for id = 0:ngatts-1
% initialize empty structure
% --------------------------
s = [];
% Get the name of the global attribute associated with the
% variable.
% --------------------------------------------------------
gattName = netcdf.inqAttName(self.nc_id, ...
self.NC_GLOBAL, id);
% Get value of global attribute.
% ------------------------------
attVal = netcdf.getAtt(self.nc_id, ...
self.NC_GLOBAL, gattName);
% fill global attribute structure
% -------------------------------
s.key__ = gattName;
s.data__ = attVal;
% put attribute name and value to temporary hashtable
% ---------------------------------------------------
hash = put(hash, gattName, s);
end
% put attribute temporary hash to netcdf hashtable
% ------------------------------------------------
self = put(self, 'ATTRIBUTES', hash);
% Close waitbar
% -------------
if wbool
close(wb)
end
% close netcdf file
% -----------------
netcdf.close(self.nc_id)
end % end of read function
\ No newline at end of file
function save(self, varargin)
% netcdf.save
% it's a wrapper on netcdf write method
%
% $Id$
write(self, varargin);
function self = set( self, varargin )
% modifier set pour modifier plusieurs propriete
% (voir doc Programing Matlab, page 8-41)
if nargin == 3
prop = varargin{1};
value = varargin{2};
switch prop
case 'file'
self.file = value;
case 'mode'
self.mode = value;
case 'nc_id'
self.nc_id = value;
case 'autonan'
self.autonan = value;
case 'autoscale'
self.autoscale = value;
otherwise
error('Unrecognized property name ''%s''.', prop);
end
end
\ No newline at end of file
function self = subsasgn(self, s, val)
% Subscripted assignment for object Hashtable
% -------------------------------------------
% see help for subsasgn
% ---------------------
switch (length(s))
case 3
switch s(3).type
case '.'
h = get(self.dynaload, s(1).subs);
t = get(h, s(2).subs);
t.(s(3).subs) = val;
h = put(h, s(2).subs, t);
self = put(self, s(1).subs, h);
otherwise
error('Invalid type.')
end
case 2
switch s(1).type
case '.'
if isstruct(val)
h = get(self.dynaload, s(1).subs);
h = put(h, s(2).subs, val);
self = put(self, s(1).subs, h);
else
error('value must be a structure');
end
otherwise
error('Invalid type.')
end
case 1
switch s.type
case '()'
if (length(s.subs) ~= 1)
error('Only single indexing is supported.');
end
self = put(self, s.subs{1}, val);
case '.'
switch s.subs
case {'autonan', 'autoscale' }
builtin('subsasgn', self, s, val);
otherwise
self = put(self, s.subs, val);
end
otherwise
error('Invalid type.')
end
end
function val = subsref(self, s)
% overloading subscripted reference for objects
% Dot Notation vs. Function Notation
%
% MATLAB classes support both function and dot notation syntax for calling methods.
% For example, if write is a method of the class of object nc, then calling
% write with function notation would be:
%
% nc = write(nc, 'mode');
%
% The equivalent method call using dot notation is:
%
% nc = nc.write('mode')
%
% However, in certain cases, the results for dot notation can differ with respect
% to how MATLAB dispatching works:
%
% If there is an overloaded subsref, it is invoked whenever using dot-notation.
% That is, the statement is first tested to see if it is subscripted assignment.
%
% If there is no overloaded subsref, then setColor must be a method of X.
% An ordinary function or a class constructor is never called using this notation.
%
% $Id: subsref.m 411 2009-07-23 16:26:40Z jgrelet $
% see help from substruct and subsref
% -----------------------------------
switch s(1).type
case '.'
switch s(1).subs
case {'write', 'save'}
builtin('subsref', self, s);
case {'autonan','autoscale'}
val = builtin('subsref', self, s);
otherwise
% call dynaload subsref
% ---------------------
val = subsref(self.dynaload, s);
end
end
......@@ -3,7 +3,7 @@
%
%
$DIMENSIONS$
#;key__;value;unlimited;#
#;key__;dimlen;unlimited;#
#;char;integer;logical;#
#;DAYD;;0;#
#;DAYD_EXT;;0;#
......@@ -36,18 +36,18 @@ $VARIABLES$
#;CNDC_CAL;'DAYD';float;CONDUCTIVITY CALIBRATED;sea_water_electrical_conductivity;S/meter;;0;7;%6.3f;99999;;;0.001;Conductivity calibrated using linearization coefficient;;DAYD;#
#;CNDC_FREQ;'DAYD';float;SENSOR CONDUCTIVITY FREQUENCY;;hz;;0;20000;%9.3f;99999;;;0.001;Sensor conductivity frequency measured by TSG;;DAYD;#
#;CNDC_CALCOEF;'NCOEF_CAL';double;CONDUCTIVITY CALIBRATION COEFFICIENTS;;;;;;;99999;;;;Calibration coefficients are real value, date is in julian day from REFERENCE_DATE_TIME;;;#
#;CNDC_CALCOEF_CONV;'NCOEF_CAL','STRING8';char;CONDUCTIVITY CALIBRATION COEFFICIENTS CONVENTION;;;;;;;NaN;;;;Calibration coefficient convention is an enumeration of coefficients name, ex: 'date','a','b','c','d','f0';;;#
#;CNDC_CALCOEF_CONV;'NCOEF_CAL','STRING8';char;CONDUCTIVITY CALIBRATION COEFFICIENTS CONVENTION;;;;;;;;;;;Calibration coefficient convention is an enumeration of coefficients name, ex: 'date','a','b','c','d','f0';;;#
#;CNDC_LINCOEF;'NCOEF_LIN';double;CONDUCTIVITY LINEAR DRIFT CORRECTION COEFFICIENTS;;;;;;;99999;;;;Calibration coefficients are real value, date is in julian day from REFERENCE_DATE_TIME;;;#
#;CNDC_LINCOEF_CONV;'NCOEF_LIN','STRING8';char;CONDUCTIVITY LINEAR DRIFT CORRECTION COEFFICIENTS CONVENTION;;;;;;;NaN;;;;Calibration coefficient convention is an enumeration of coefficients name, ex: 'date','offset','slope';;;#
#;CNDC_LINCOEF_CONV;'NCOEF_LIN','STRING8';char;CONDUCTIVITY LINEAR DRIFT CORRECTION COEFFICIENTS CONVENTION;;;;;;;;;;;Calibration coefficient convention is an enumeration of coefficients name, ex: 'date','offset','slope';;;#
#;SSJT;'DAYD';float;WATER JACKET TEMPERATURE;;degree_Celsius;;-1.5;38;%6.3f;99999;;;0.001;Temperature within TSG or (Water Jacket Temperature). Warning, this is not ocean SST temperature. Is is used for salinity computation. The reduction applied is the same as for conductivity. Temperature is ITS-90;;DAYD;#
#;SSJT_QC;'DAYD';byte;WATER JACKET TEMPERATURE QUALITY FLAG;;;;0;9;%1d;;;;;Quality flag applied on water jacket temperature values;0;DAYD;#
#;SSJT_STD;'DAYD';float;WATER JACKET TEMPERATURE STANDARD DEVIATION;;degree_Celsius;;-1.5;38;%6.3f;99999;;;0.001;Water jacket temperature standard deviation for data wich have been reduced (with a mean or median);;DAYD;#
#;SSJT_CAL;'DAYD';float;WATER JACKET TEMPERATURE CALIBRATED;;degree_Celsius;;-1.5;38;%6.3f;99999;;;0.001;Water jacket temperature calibrated using linearization coefficients;;DAYD;#
#;SSJT_FREQ;'DAYD';float;WATER JACKET SENSOR TEMPERATURE FREQUENCY;;hz;;0;20000;%9.3f;99999;;;0.001;Frequency of water jacket temperature sensor ;;DAYD;#
#;SSJT_CALCOEF;'NCOEF_CAL';double;TEMPERATURE CALIBRATION COEFFICIENTS;;;;;;;99999;;;;Calibration coefficients are real value, date is in julian day from REFERENCE_DATE_TIME;;;#
#;SSJT_CALCOEF_CONV;'NCOEF_CAL','STRING8';char;TEMPERATURE CALIBRATION COEFFICIENTS CONVENTION;;;;;;;NaN;;;;Calibration coefficient convention is an enumeration of coefficients name, ex: 'date','a','b','c','d','f0';;;#
#;SSJT_CALCOEF_CONV;'NCOEF_CAL','STRING8';char;TEMPERATURE CALIBRATION COEFFICIENTS CONVENTION;;;;;;;;;;;Calibration coefficient convention is an enumeration of coefficients name, ex: 'date','a','b','c','d','f0';;;#
#;SSJT_LINCOEF;'NCOEF_LIN';double;TEMPERATURE LINEAR DRIFT CORRECTION COEFFICIENTS;;;;;;;99999;;;;Calibration coefficients are real value, date is in julian day from REFERENCE_DATE_TIME;;;#
#;SSJT_LINCOEF_CONV;'NCOEF_LIN','STRING8';char;TEMPERATURE LINEAR DRIFT CORRECTION COEFFICIENTS CONVENTION;;;;;;;NaN;;;;Calibration coefficient convention is an enumeration of coefficients name, ex: 'date','offset','slope';;;#
#;SSJT_LINCOEF_CONV;'NCOEF_LIN','STRING8';char;TEMPERATURE LINEAR DRIFT CORRECTION COEFFICIENTS CONVENTION;;;;;;;;;;;Calibration coefficient convention is an enumeration of coefficients name, ex: 'date','offset','slope';;;#
#;SSJT_ADJUSTED;'DAYD';float;WATER JACKET TEMPERATURE ADJUSTED;;degree_Celsius;;-1.5;38;%6.3f;99999;;;0.001;Adjusted water jacket temperature with external data (ARGO,CTD,XBT,...);;DAYD;#
#;SSJT_ADJUSTED_ERROR;'DAYD';float;ERROR ON ADJUSTED WATER JACKET TEMPERATURE;;degree_Celsius;;-1.5;38;%6.3f;99999;;;0.001;Error on adjusted water jacket temperature with external data (ARGO,CTD, XBT,);;DAYD;#
#;SSJT_ADJUSTED_QC;'DAYD';byte;WATER JACKET TEMPERATURE QUALITY FLAG;;;;0;9;%1d;;;;;Quality flag applied on adjusted water jacket temperature values;0;DAYD;#
......@@ -74,9 +74,9 @@ $VARIABLES$
#;SSTP_DEPH_MIN;'N1';float;MINIMUM DEPTH OF WATER INTAKE FOR TEMPERATURE MEASUREMENT;;meter;;0;100;%6.3f;99999;;;;;;;#
#;SSTP_DEPH_MAX;'N1';float;MAXIMUM DEPTH OF WATER INTAKE FOR TEMPERATURE MEASUREMENT;;meter;;0;100;%6.3f;99999;;;;;;;#
#;SSTP_CALCOEF;'NCOEF_CAL';double;TEMPERATURE CALIBRATION COEFFICIENTS;;;;;;;99999;;;;Calibration coefficients are real value, date is in julian day from REFERENCE_DATE_TIME;;;#
#;SSTP_CALCOEF_CONV;'NCOEF_CAL','STRING8';char;TEMPERATURE CALIBRATION COEFFICIENTS CONVENTION;;;;;;;NaN;;;;Calibration coefficient convention is an enumeration of coefficients name, ex: 'date','a','b','c','d','f0';;;#
#;SSTP_CALCOEF_CONV;'NCOEF_CAL','STRING8';char;TEMPERATURE CALIBRATION COEFFICIENTS CONVENTION;;;;;;;;;;;Calibration coefficient convention is an enumeration of coefficients name, ex: 'date','a','b','c','d','f0';;;#
#;SSTP_LINCOEF;'NCOEF_LIN';double;TEMPERATURE LINEAR DRIFT CORRECTION COEFFICIENTS;;;;;;;99999;;;;Calibration coefficients are real value, date is in julian day from REFERENCE_DATE_TIME;;;#
#;SSTP_LINCOEF_CONV;'NCOEF_LIN','STRING8';char;TEMPERATURE LINEAR DRIFT CORRECTION COEFFICIENTS CONVENTION;;;;;;;NaN;;;;Calibration coefficient convention is an enumeration of coefficients name, ex: 'date','offset','slope';;;#
#;SSTP_LINCOEF_CONV;'NCOEF_LIN','STRING8';char;TEMPERATURE LINEAR DRIFT CORRECTION COEFFICIENTS CONVENTION;;;;;;;;;;;Calibration coefficient convention is an enumeration of coefficients name, ex: 'date','offset','slope';;;#
#;SSTP_EXT;'DAYD_EXT';float;SEA SURFACE TEMPERATURE FROM EXTERNAL DATA;sea_surface_temperature;degree_Celsius;;-1.5;38;%6.3f;99999;;;0.001;Sea Surface Temperature (SST) from external data instrument (ARGO,CTD, XBT);;DAYD_EXT;#
#;SSTP_EXT_QC;'DAYD_EXT';byte;SEA SURFACE TEMPERATURE FROM EXTERNAL DATA QUALITY FLAG;;;;0;9;%1d;;;;;Quality flag applied on external sea surface temperature data values;0;DAYD_EXT;#
#;SSTP_EXT_TYPE;'DAYD_EXT','STRING4';char;TYPE OF EXTERNAL SEA SURFACE TEMPERATURE DATA ORIGIN;;;;;;;;;;;ARGO,CTD,XBT,...;;DAYD_EXT;#
......@@ -84,7 +84,7 @@ $VARIABLES$
#;SSPS_EXT_QC;'DAYD_EXT';byte;SEA SURFACE SALINITY FROM EXTERNAL DATA QUALITY FLAG;;;;0;9;%1d;;;;;Quality flag applied on external sea surface salinity data values;0;DAYD_EXT;#
#;SSPS_EXT_TYPE;'DAYD_EXT','STRING4';char;TYPE OF EXTERNAL SEA SURFACE SALINITY DATA ORIGIN;;;;;;;;;;;WS (Water Sample),ARGO,CTD,XBT,...;;DAYD_EXT;#
#;SSPS_EXT_ANALDATE;'DAYD_EXT','STRING14';char;DATE OF WATER SAMPLE SURFACE SALINITY ANALYSIS;;;yyyymmddhhmmss;;;;;;;;Date of sea surface salinity water sample analysis;;DAYD_EXT;#
#;SSPS_EXT_BOTTLE;'DAYD_EXT','STRING4';char;SEA SURFACE SALINITY BOTTLE NUMBER;;;;;;;NaN;;;;Number of sea surface salinity water sample;;DAYD_EXT;#
#;SSPS_EXT_BOTTLE;'DAYD_EXT','STRING4';char;SEA SURFACE SALINITY BOTTLE NUMBER;;;;;;;;;;;Number of sea surface salinity water sample;;DAYD_EXT;#
%
$ATTRIBUTES$
#;key__;name;conventions;uicontrolType;string;value;length;height;horizontalAlignment;comment;#
......
% tsgqc_netcdf.m
% convert Excel file to csv
d = dynaload('tsgqc_netcdf.xls')
write( d, 'tsgqc_netcdf.csv')
\ No newline at end of file
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment