diff --git a/IMOS/imosParameters.txt b/IMOS/imosParameters.txt index 755ed6383..1348b8106 100644 --- a/IMOS/imosParameters.txt +++ b/IMOS/imosParameters.txt @@ -50,7 +50,7 @@ DIR, 0, from_direction, DIR_MAG, 0, from_direction, degree, clockwise, magnetic north, E, 999999.0, 0.0, 360.0, float DIRECTION, 0, direction_of_the_profile, , , , , , , , char DIRT, 0, to_direction, degree, clockwise, true north, E, 999999.0, 0.0, 360.0, float -DIST_ALONG_BEAMS, 0, distance_from_sensor_along_beams, m, up, sensor, Z, 999999.0, -12000.0, 12000.0, float +DIST_ALONG_BEAMS, 0, distance_from_sensor_along_beams, m, , sensor, Z, 999999.0, -12000.0, 12000.0, float DOX1, 1, mole_concentration_of_dissolved_molecular_oxygen_in_sea_water, umol l-1, , , O, 999999.0, 0.0, 900000.0, float DOX2, 1, moles_of_oxygen_per_unit_mass_in_sea_water, umol kg-1, , , O, 999999.0, 0.0, 880000.0, float DOXS, 1, fractional_saturation_of_oxygen_in_sea_water, percent, , , O, 999999.0, , , float diff --git a/NetCDF/template/dist_along_beams_attributes.txt b/NetCDF/template/dist_along_beams_attributes.txt index 584d9ffed..60612b546 100644 --- a/NetCDF/template/dist_along_beams_attributes.txt +++ b/NetCDF/template/dist_along_beams_attributes.txt @@ -1,7 +1,7 @@ S, standard_name = [mat imosParameters('DIST_ALONG_BEAMS', 'standard_name')] S, long_name = distance_from_sensor_along_beams S, units = [mat imosParameters('DIST_ALONG_BEAMS', 'uom')] -S, axis = Z +S, axis = S, positive = [mat imosParameters('DIST_ALONG_BEAMS', 'positive')] S, reference_datum = [mat imosParameters('DIST_ALONG_BEAMS', 'reference_datum')] N, valid_min = [mat imosParameters('DIST_ALONG_BEAMS', 'valid_min')] diff --git a/Preprocessing/CTDDepthBinPP.m b/Preprocessing/CTDDepthBinPP.m index 84ccc5365..03c564a42 100644 --- a/Preprocessing/CTDDepthBinPP.m +++ b/Preprocessing/CTDDepthBinPP.m @@ -87,7 +87,10 @@ zend = zbin(2:end); z = (zstart + zend)/2; % depth of the actual centre of each bin - curSam.dimensions{iDepth}.data = z(:); + + curSam.dimensions{iDepth}.data = z(:); % update dimension and global attribute values + curSam.geospatial_vertical_min = min(z(:)); + curSam.geospatial_vertical_max = max(z(:)); [Z, ZSTART] = meshgrid(depth, zstart); [~, ZEND] = meshgrid(depth, zend); diff --git a/Preprocessing/adcpBinMappingPP.m b/Preprocessing/adcpBinMappingPP.m index f61687d0a..20d2fc542 100644 --- a/Preprocessing/adcpBinMappingPP.m +++ b/Preprocessing/adcpBinMappingPP.m @@ -148,9 +148,10 @@ % impacted parameter isBinMapApplied = false; for j=1:length(sample_data{k}.variables) - if any(sample_data{k}.variables{j}.dimensions == distAlongBeamsIdx) ... % only process variables that are function of DIST_ALONG_BEAMS + if any(sample_data{k}.variables{j}.dimensions == distAlongBeamsIdx) % only process variables that are function of DIST_ALONG_BEAMS - beamNumber = sample_data{k}.variables{j}.name(end); + % only process variables that are in beam coordinates + beamNumber = sample_data{k}.variables{j}.long_name(end); switch beamNumber case '1' nonMappedHeightAboveSensor = nonMappedHeightAboveSensorBeam1; @@ -187,23 +188,26 @@ % mappedData(i,iLastGoodBin) = interp1(nonMappedHeightAboveSensor(i,:), nonMappedData(i,:), mappedHeightAboveSensor(i,iLastGoodBin), 'spline'); end - binMappingComment = ['adcpBinMappingPP.m: data in beam coordinates originally referenced to DISTANCE_ALONG_BEAMS ' ... + binMappingComment = ['adcpBinMappingPP.m: data in beam coordinates originally referenced to DIST_ALONG_BEAMS ' ... 'has been vertically bin-mapped to HEIGHT_ABOVE_SENSOR using tilt information.']; - % we create the HEIGHT_ABOVE_SENSOR dimension if needed if ~heightAboveSensorIdx - sample_data{k}.dimensions{end+1} = sample_data{k}.dimensions{distAlongBeamsIdx}; - sample_data{k}.dimensions{end}.name = 'HEIGHT_ABOVE_SENSOR'; - sample_data{k}.dimensions{end}.long_name = 'height_above_sensor'; - sample_data{k}.dimensions{end}.axis = 'Z'; - sample_data{k}.dimensions{end}.positive = 'up'; - sample_data{k}.dimensions{end}.comment = ['Data has been vertically bin-mapped using tilt information so that the cells ' ... + % we create the HEIGHT_ABOVE_SENSOR dimension if needed + sample_data{k}.dimensions{end+1} = sample_data{k}.dimensions{distAlongBeamsIdx}; + + % attributes units, reference_datum, valid_min/max and _FillValue are the same as with DIST_ALONG_BEAMS, the rest differs + sample_data{k}.dimensions{end}.name = 'HEIGHT_ABOVE_SENSOR'; + sample_data{k}.dimensions{end}.long_name = 'height_above_sensor'; + sample_data{k}.dimensions{end}.standard_name = imosParameters('HEIGHT_ABOVE_SENSOR', 'standard_name'); + sample_data{k}.dimensions{end}.axis = 'Z'; + sample_data{k}.dimensions{end}.positive = imosParameters('HEIGHT_ABOVE_SENSOR', 'positive'); + sample_data{k}.dimensions{end}.comment = ['Data has been vertically bin-mapped using tilt information so that the cells ' ... 'have consistant heights above sensor in time.']; heightAboveSensorIdx = getVar(sample_data{k}.dimensions, 'HEIGHT_ABOVE_SENSOR'); end - % we re-assign the parameter to this dimension + % we re-assign the parameter to the HEIGHT_ABOVE_SENSOR dimension sample_data{k}.variables{j}.dimensions(sample_data{k}.variables{j}.dimensions == distAlongBeamsIdx) = heightAboveSensorIdx; sample_data{k}.variables{j}.data = mappedData; @@ -220,6 +224,29 @@ end if isBinMapApplied + % let's look for remaining variables assigned to DIST_ALONG_BEAMS, + % if none we can remove this dimension (RDI for example) + isDistAlongBeamsUsed = false; + for j=1:length(sample_data{k}.variables) + if any(sample_data{k}.variables{j}.dimensions == distAlongBeamsIdx) + isDistAlongBeamsUsed = true; + break; + end + end + if ~isDistAlongBeamsUsed + if length(sample_data{k}.dimensions) > distAlongBeamsIdx + for j=1:length(sample_data{k}.variables) + dimToUpdate = sample_data{k}.variables{j}.dimensions > distAlongBeamsIdx; + if any(dimToUpdate) + sample_data{k}.variables{j}.dimensions(dimToUpdate) = sample_data{k}.variables{j}.dimensions(dimToUpdate) - 1; + end + end + end + sample_data{k}.dimensions(distAlongBeamsIdx) = []; + + binMappingComment = [binMappingComment ' DIST_ALONG_BEAMS is not used by any variable left and has been removed.']; + end + history = sample_data{k}.history; if isempty(history) sample_data{k}.history = sprintf('%s - %s', datestr(now_utc, readProperty('exportNetCDF.dateFormat')), binMappingComment); diff --git a/Preprocessing/adcpNortekVelocityBeam2EnuPP.m b/Preprocessing/adcpNortekVelocityBeam2EnuPP.m index 936a43a94..c7d5f3cfc 100644 --- a/Preprocessing/adcpNortekVelocityBeam2EnuPP.m +++ b/Preprocessing/adcpNortekVelocityBeam2EnuPP.m @@ -171,6 +171,29 @@ end end + % let's look for remaining variables assigned to DIST_ALONG_BEAMS, + % if none we can remove this dimension + isDistAlongBeamsUsed = false; + for j=1:length(sample_data{k}.variables) + if any(sample_data{k}.variables{j}.dimensions == distAlongBeamsIdx) + isDistAlongBeamsUsed = true; + break; + end + end + if ~isDistAlongBeamsUsed + if length(sample_data{k}.dimensions) > distAlongBeamsIdx + for j=1:length(sample_data{k}.variables) + dimToUpdate = sample_data{k}.variables{j}.dimensions > distAlongBeamsIdx; + if any(dimToUpdate) + sample_data{k}.variables{j}.dimensions(dimToUpdate) = sample_data{k}.variables{j}.dimensions(dimToUpdate) - 1; + end + end + end + sample_data{k}.dimensions(distAlongBeamsIdx) = []; + + Beam2EnuComment = [Beam2EnuComment ' DIST_ALONG_BEAMS is not used by any variable left and has been removed.']; + end + if ~isfield(sample_data{k}, 'history') sample_data{k}.history = sprintf('%s - %s', datestr(now_utc, readProperty('exportNetCDF.dateFormat')), Beam2EnuComment); else diff --git a/Preprocessing/salinityPP.m b/Preprocessing/salinityPP.m index d204178d6..7399f3c8d 100644 --- a/Preprocessing/salinityPP.m +++ b/Preprocessing/salinityPP.m @@ -97,6 +97,9 @@ cndc = sam.variables{cndcIdx}.data; temp = sam.variables{tempIdx}.data; + + % pressure information used for Salinity computation is from the + % PRES or PRES_REL variables in priority if isPresVar if presRelIdx > 0 presRel = sam.variables{presRelIdx}.data; @@ -109,28 +112,36 @@ presName = 'PRES substracting a constant value 10.1325 dbar for nominal atmospheric pressure'; end else + % when no pressure variable exists, we use depth information either + % from the DEPTH variable or from the instrument_nominal_depth + % global attribute if depthIdx > 0 + % with depth data depth = sam.(depthType){depthIdx}.data; - if ~isempty(sam.geospatial_lat_min) && ~isempty(sam.geospatial_lat_max) - % compute depth with Gibbs-SeaWater toolbox - % relative_pressure ~= gsw_p_from_z(-depth, latitude) - if sam.geospatial_lat_min == sam.geospatial_lat_max - presRel = gsw_p_from_z(-depth, sam.geospatial_lat_min); - else - meanLat = sam.geospatial_lat_min + ... - (sam.geospatial_lat_max - sam.geospatial_lat_min)/2; - presRel = gsw_p_from_z(-depth, meanLat); - end - presName = 'DEPTH'; + presName = 'DEPTH'; + else + % with nominal depth information + depth = sam.instrument_nominal_depth*ones(size(temp)); + presName = 'instrument_nominal_depth'; + end + + % pressure information needed for Salinity computation is either + % retrieved from gsw_p_from_z when latitude is available or by + % simply assuming 1dbar ~= 1m + if ~isempty(sam.geospatial_lat_min) && ~isempty(sam.geospatial_lat_max) + % compute depth with Gibbs-SeaWater toolbox + % relative_pressure ~= gsw_p_from_z(-depth, latitude) + if sam.geospatial_lat_min == sam.geospatial_lat_max + presRel = gsw_p_from_z(-depth, sam.geospatial_lat_min); else - % without latitude information, we assume 1dbar ~= 1m - presRel = depth; - presName = 'DEPTH (assuming 1 m ~ 1 dbar)'; + meanLat = sam.geospatial_lat_min + ... + (sam.geospatial_lat_max - sam.geospatial_lat_min)/2; + presRel = gsw_p_from_z(-depth, meanLat); end - else - presRel = sam.instrument_nominal_depth*ones(size(temp)); - presName = 'instrument_nominal_depth (assuming 1 m ~ 1 dbar)'; + % without latitude information, we assume 1dbar ~= 1m + presRel = depth; + presName = [presName ' (assuming 1 m ~ 1 dbar)']; end end diff --git a/Util/fastSaveas.m b/Util/fastSaveas.m index 5d28025ba..df8901817 100644 --- a/Util/fastSaveas.m +++ b/Util/fastSaveas.m @@ -2,14 +2,23 @@ function fastSaveas( hFig, hPanel, fileDestination ) %FASTSAVEAS is a faster alternative to saveas. % It is used to save diagnostic plots when exporting netCDF files. -drawnow; - % preserve the color scheme set(hFig, 'InvertHardcopy', 'off'); +drawnow; + % force figure full screen -frame_h = get(handle(hFig), 'JavaFrame'); -set(frame_h, 'Maximized', 1); +try + warning('off', 'MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame'); + frame_h = get(handle(hFig), 'JavaFrame'); + set(frame_h, 'Maximized', 1); +catch + disp(['Warning : JavaFrame feature not supported. Figure is going full ' ... + 'screen using normalised units which does not give best results.']); + oldUnits = get(hFig, 'Units'); + set(hFig, 'Units', 'norm', 'Pos', [0, 0, 1, 1]); + set(hFig, 'Units', oldUnits); +end % screencapture creates an image of what is really displayed on % screen. diff --git a/imosToolbox.m b/imosToolbox.m index de2cacd5b..c81683d3f 100644 --- a/imosToolbox.m +++ b/imosToolbox.m @@ -73,7 +73,7 @@ function imosToolbox(auto, varargin) end % Set current toolbox version -toolboxVersion = ['2.5.17 - ' computer]; +toolboxVersion = ['2.5.18 - ' computer]; switch auto case 'auto', autoIMOSToolbox(toolboxVersion, varargin{:}); diff --git a/imosToolbox_Linux64.bin b/imosToolbox_Linux64.bin index 9ef711468..a756223ec 100755 Binary files a/imosToolbox_Linux64.bin and b/imosToolbox_Linux64.bin differ diff --git a/imosToolbox_Win32.exe b/imosToolbox_Win32.exe index f059c13dc..fad15ad1d 100644 Binary files a/imosToolbox_Win32.exe and b/imosToolbox_Win32.exe differ diff --git a/imosToolbox_Win64.exe b/imosToolbox_Win64.exe index fa2bb50b7..b75ffcbad 100644 Binary files a/imosToolbox_Win64.exe and b/imosToolbox_Win64.exe differ