diff --git a/@netcdf_native/write.m b/@netcdf_native/write.m index 70829ae565c186561e2a74dad84511327a82bdc4..53fd7efdd32ec5614082fd9b45d667876d385267 100644 --- a/@netcdf_native/write.m +++ b/@netcdf_native/write.m @@ -388,7 +388,7 @@ for i=1:numel(ncv_keys) % If a NetCDF variable has valid _FillValue attributes, then % the data is filled accordingly. % ---------------------------------------------------------- - if self.autonan && isfield(s, 'FillValue_') + if self.autonan && isfield(s, 'FillValue_') && ~isempty(s.FillValue_) value(isnan(value)) = s.FillValue_; end @@ -404,6 +404,11 @@ for i=1:numel(ncv_keys) 'Cannot write netcdf file\n%s.', exception.message); %#ok<CTPCT> end + + % synchronize netcdf file to disk + % ------------------------------- + netcdf.sync(self.nc_id); + end % end for ncv variables loop % Close waitbar diff --git a/tsg_util/castByteQC.m b/tsg_util/castByteQC.m index 2389d32b9055fe47cb4fbf80199a7ee57cf0b985..a08ce7d8f13c9e5bc7618982f65ac99feef3e339 100644 --- a/tsg_util/castByteQC.m +++ b/tsg_util/castByteQC.m @@ -8,6 +8,6 @@ function [tabOut] = castByteQC( code, tabIn ) % $Id$ - tabOut = int8(code) * int8( ones(size(tabIn) )); + tabOut = uint8(code) * uint8( ones(size(tabIn) )); end diff --git a/tsg_util/updateTsgStruct.m b/tsg_util/updateTsgStruct.m index 10297bf3eb0b3c75df83bb32c581b0f26614d180..6dbb73efc17cb720c63c9825e572c3ff5b928a2a 100644 --- a/tsg_util/updateTsgStruct.m +++ b/tsg_util/updateTsgStruct.m @@ -20,8 +20,8 @@ shipVelocity( hMainFig ); % ------------------------------------- tsg = getappdata( hMainFig, 'tsg_data'); -nPARA = 2; -PARA = ['SSPS'; 'SSJT']; +nPARA = 3; +PARA = ['SSPS'; 'SSJT'; 'SSTP']; % Get NO_CONTROL and INTERPOLATED_VALUE codes % a modifier !!!!!!!!!!!!! @@ -72,6 +72,7 @@ tsg.DATE_END = [date(1:8) date(10:15)]; for i = 1: nPARA para1 = PARA(i,:); + if ~isempty( tsg.(para1) ) && isempty( tsg.([para1 '_QC']) ) % If QC variables are emptied, fill them with NO_CONTROL code value @@ -79,8 +80,20 @@ for i = 1: nPARA tsg.([para1 '_QC']) = castByteQC( NO_CONTROL, tsg.DAYD ); end + + if ~isempty( tsg.(para1) ) && isempty( tsg.([para1 '_ADJUSTED_QC']) ) + + % If QC variables are emptied, fill them with NO_CONTROL code value + % ----------------------------------------------------------------- + tsg.([para1 '_ADJUSTED_QC']) = castByteQC( NO_CONTROL, tsg.DAYD ); + + end end +% initialize POSITION_QC +% ---------------------- +tsg.('POSITION_ADJUSTED_QC') = castByteQC( NO_CONTROL, tsg.DAYD ); + % Empty variables filled with NaN % ------------------------------- names = fieldnames( tsg );