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

corrige un bug sur l'ecriture des variables netcdf a 2 dimensions, a completer proprement

desactive zoom out et pan off
parent 255b1247
No related branches found
No related tags found
No related merge requests found
......@@ -89,6 +89,9 @@ for i=1:ncv.size
switch type
case 'char'
theStruct.(member) = value;
case 'cell'
%c = textscan(value,'%s','delimiter',',');
theStruct.(member) = value;
case {'integer','double'}
theStruct.(member) = str2double(value);
otherwise
......
......@@ -2,11 +2,11 @@
% $Id$
%
id;code;dimension;long_name;standard_name;units;conventions;valid_min;valid_max;format;FillValue;epic_code;axis;resolution;comment;
integer;char;char;char;char;char;char;integer;integer;char;double;integer;char;double;char;
integer;char;cell;char;char;char;char;integer;integer;char;double;integer;char;double;char;
1;REFERENCE_DATE_TIME;STRING14;;;;yyyymmddhhmmss;;;;;;;;Reference date for julian days origin;
2;DATE;DAYD,STRING14;DATE OF MAIN INSTRUMENT MEASUREMENT;;;yyyymmddhhmmss;;;;;;;;This is the original data describing the date, it must not be lost;
3;DATE_WS;DAYD,STRING14;DATE OF WATER SAMPLE;;;yyyymmddhhmmss;;;;;;;;This is the original data describing the date, it must not be lost;
4;DATE_EXT;DAYD,STRING14;DATE OF EACH EXTERNAL DATA MEASUREMENT;;;yyyymmddhhmmss;;;;;;;;This is the original data describing the date, it must not be lost;
3;DATE_WS;DAYD','STRING14;DATE OF WATER SAMPLE;;;yyyymmddhhmmss;;;;;;;;This is the original data describing the date, it must not be lost;
4;DATE_EXT;DAYD','STRING14;DATE OF EACH EXTERNAL DATA MEASUREMENT;;;yyyymmddhhmmss;;;;;;;;This is the original data describing the date, it must not be lost;
5;DAYD;DAYD;DECIMAL JULIAN DAY (UTC) OF EACH MEASUREMENT;time;days since 1950/01/01 00:00:00;Relative julian days with decimal part (as parts of the day);0.0;36600.0;%9.5lf;9999999.;601;t;;Julian day of the measurement;
6;DAYD_WS;DAYD_WS;DECIMAL JULIAN DAY (UTC) OF EACH WATER SAMPLE;time;days since 1950/01/01 00:00:00;Relative julian days with decimal part (as parts of the day);0.0;36600.0;%9.5lf;9999999.;601;t;;Julian day of the measurement;
7;DAYD_EXT;DAYD_EXT;DECIMAL JULIAN DAY (UTC) OF EXTERNAL DATA MEASUREMENT;time;Days since 1950/01/01 00:00:00;Relative julian days with decimal part (as parts of the day);0.0;36600.0;%9.5lf;9999999.;601;t;;Julian day of the measurement;
......
......@@ -54,7 +54,7 @@ nca_keys = keys(nca);
% Get GF3 variables list codes from class tsg_nc with file 'tsg_ncvar.csv'
% -----------------------------------------------------------------------
ncv = tsg_nc('tsg_ncvar.csv');
ncv = tsg_nc('tsg_test.csv');
ncv_keys = keys(ncv);
ncv_fieldNames = get_fieldnames(ncv);
......@@ -88,23 +88,31 @@ waitbar(1/50,wb,['Writing file: ' filename ' Please wait...']);
%% Create NetCDF global attributes
% -------------------------------
for i=1:numel(nca_keys)
nc.(nca_keys{i}) = tsg.(nca_keys{i});
global_att = nca_keys{i};
nc.(global_att) = tsg.(global_att);
end
% Create NetCDF variables and attributes
% --------------------------------------
for i=1:numel(ncv_keys)
for j=1:numel(ncv_fieldNames)
fn = ncv_fieldNames{j};
variable = ncv_keys{i};
fieldName = ncv_fieldNames{j};
value = get(ncv, variable, fieldName);
% define dimension
if strcmp(fn,'dimension')
nc{ncv_keys{i}} = ncfloat(get(ncv, ncv_keys{i}, fn));
% define variable atributes
elseif ~isempty(get(ncv, ncv_keys{i}, fn))
if ischar(get(ncv, ncv_keys{i}, fn))
nc{ncv_keys{i}}.(fn) = ncchar(get(ncv, ncv_keys{i}, fn));
% ----------------
if strcmp(fieldName,'dimension')
s = ['nc{''' variable '''} = {''' value '''}'];
eval(s);
% define variable attributes
% --------------------------
elseif ~isempty(value)
if ischar(value)
nc{variable}.(fieldName) = ncchar(value);
else
nc{ncv_keys{i}}.(fn) = ncfloat(get(ncv, ncv_keys{i}, fn));
nc{variable}.(fieldName) = ncfloat(value);
end
end
end
......@@ -116,7 +124,12 @@ end
% Write global attributes
% -----------------------
for i=1:numel(nca_keys)
nc.(nca_keys{i}) = tsg.(nca_keys{i});
% get netcdf global attribute name
% --------------------------------
global_attr = nca_keys{i};
nc.(global_attr) = tsg.(global_attr);
end
% Convert Matlab julian days (datenum) to 1950 reference
......@@ -129,22 +142,28 @@ end
% Write measurements (variables)
% -------------------------------
for i=1:numel(ncv_keys)
% get netcdf variable name
% ------------------------
variable = ncv_keys{i};
% display waitbar
waitbar( i/numel(ncv_keys), wb, ['writing ' ncv_keys{i} ' variable']);
% ---------------
waitbar( i/numel(ncv_keys), wb, ['writing ' variable ' variable']);
% DATE as two dimension
% don't work under windows
% nc{ncv_keys{i}}(:) = tsg.(ncv_keys{i});
if strmatch('DATE',ncv_keys(i))
nc{ncv_keys{i}}(:,:) = tsg.(ncv_keys{i});
% nc{variable}(:) = tsg.(variable);
if strmatch('DATE', variable)
nc{variable}(:,:) = tsg.(variable);
else
% other one dimension
% under Linux, when you write an with empty matrix to an unlimited
% variable dimension, nc was corrupted to double object
% works well on windows
if ~isempty(tsg.(ncv_keys{i}))
%ncv_keys{i}
%nc{ncv_keys{i}}(1:length(tsg.(ncv_keys{i}))) = tsg.(ncv_keys{i});
nc{ncv_keys{i}}(:) = tsg.(ncv_keys{i});
if ~isempty(tsg.(variable))
%nc{variable}(1:length(tsg.(variable))) = tsg.(variable);
nc{variable}(:) = tsg.(variable);
end
end
end
......
......@@ -28,7 +28,10 @@ function tsgqc_GUI
%% Initialization tasks
% ********************
clc
% Clear Command Window display, giving up a "clean screen."
% ---------------------------------------------------------
clc;
% Find program directory.
% functions (icons) should be store at a lower level
......@@ -564,7 +567,7 @@ tsg_initialisation(hMainFig, hQcCmenu)
% returns the plot to its initial zoom setting
% --------------------------------------------
zoom out;
%zoom out;
% turns interactive zooming off
% -----------------------------
......@@ -607,7 +610,7 @@ tsg_initialisation(hMainFig, hQcCmenu)
% reset to original figure
% ------------------------
zoom out;
%zoom out;
end
......@@ -1280,8 +1283,12 @@ tsg_initialisation(hMainFig, hQcCmenu)
rmpath( [DEFAULT_PATH_FILE filesep 'tsg_util'] );
rmpath( [DEFAULT_PATH_FILE filesep 'tsg_data'] );
rmpath( [DEFAULT_PATH_FILE filesep 'tsg_io'] );
% Refresh file system caches
% --------------------------
rehash;
end
end
end % end of tsgqc_GUI
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