-
Notifications
You must be signed in to change notification settings - Fork 8
5.6. Stack water‐column data
This is a tutorial on how to use CoFFee to stack water-column data in range, depth or fan. Replace the paths appropriately.
Water-column data for more than 1 ping has three dimensions (pings, beams, samples), which is difficult to visualize. Stacking is the process of reducing this dimensionality to only 2 dimensions, which induces some ambiguity but is easier to visualize.
- Stacking in range reduces the dimensionality to a Range-by-Ping array.
- Stacking in depth reduces the dimensionality to a Depth-by-Ping array.
- Stacking in fan reduces the dimensionality to an Across-distance-by-Depth array (that is, wedge display).
In CoFFee, you can use CFF_stack_WCD
to operate these three stacking operations.
Note that vertical echo-integration is also effectively a stacking process (that is, displaying the data as an Easting-by-Northing array) but is not operated by this function, nor covered in this tutorial.
Start from a clean slate:
clear all
close all
restoredefaultpath();
clc
Set location of CoFFee code root folder and add to path:
coffeeFolder = 'C:\Users\Schimel_Alexandre\Code\MATLAB\CoFFee';
addpath(genpath(coffeeFolder));
Select a raw data file with water-column data and convert it. For Kongsberg data acquired in file pairs (i.e. *.all and *.wcd, or *.kmall and *.kmwcd), ensure the pair of files are in the same folder.
dataFolder = 'C:\Users\Schimel_Alexandre\Data\MBES\Kongsberg all\EM2040C\Deakin_2014_EM2040c_Kelp-Pilot-Study\300kHz';
rawFile = CFF_list_raw_files_in_dir(dataFolder, 'filesType', '.all/.wcd', 'nFilesWanted', 1);
rawFileName = CFF_file_name(char(CFF_onerawfileonly(rawFile)));
fData = CFF_convert_raw_files(rawFile,'conversionType','WCD',...
'forceReconvert',1);
To use CFF_stack_WCD
, it is necessary to first process the navigation and georeference the bottom detect:
fData = CFF_compute_ping_navigation_v2(fData,'comms','multilines');
fData = CFF_georeference_bottom_detect(fData,'comms','multilines');
To use CFF_stack_WCD
, first create a structure defining the desired parameters. For example, to stack in range only the pings 20 to 120, create a structure params
as:
params = struct();
params.stackMode = 'range'; % this is the default mode so this could be omitted
params.iPingLims = [20,120]; % to specify all pings use [1,inf] (or do not specify this parameter at all)
Other parameters are available, such as specifying the range of beam numbers and sample numbers with iBeamLims
and iSampleLims
, respectively.
Then you can call CFF_stack_WCD
, specifying params
as parameters:
[rangeStack,rangeStackX,rangeStackY] = CFF_stack_WCD(fData,params,'comms','multilines');
The function returned the stack array and the vectors for the axes. With this new information, we can display the stack in range:
figure;
imagesc(rangeStackX,rangeStackY,rangeStack);
grid on; colorbar; colormap jet
xlabel('ping #'); ylabel('range from sonar (m)');
titleStr = sprintf('%s water-column (dB)\npings %i-%i (stacked in %s)',rawFileName,params.iPingLims(1),params.iPingLims(2),params.stackMode);
title(titleStr,'Interpreter','none');
![water-column data stacked in range](https://private-user-images.githubusercontent.com/8197102/318054781-f398b550-82b2-4d03-99b5-7bebe687bb0d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTA3OTIsIm5iZiI6MTczOTM1MDQ5MiwicGF0aCI6Ii84MTk3MTAyLzMxODA1NDc4MS1mMzk4YjU1MC04MmIyLTRkMDMtOTliNS03YmViZTY4N2JiMGQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTJUMDg1NDUyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MmQ4ZjEyYzI5NDQzYjFiNjhmYTFkZDdkMzZkY2IwYjU0MDdiYTdhMjBmYWQwYzg1MTkwMzY3MGRkNGQ2ZWFmYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.C_OkHouoHoKYxO-SWyQCJnGFZJW7FRXWlN1IWG8cMZw)
For stacking in depth, set stackMode
to 'depth'
. You can also specify a desired depth resolution with resDepthStackY
:
params = struct();
params.stackMode = 'depth';
params.iPingLims = [20,120];
params.resDepthStackY = 0.01; % in m
[depthStack,depthStackX,depthStackY] = CFF_stack_WCD(fData,params,'comms','multilines');
With this new information, we can display the stack in depth:
figure;
imagesc(depthStackX,depthStackY,depthStack,'AlphaData',~isnan(depthStack));
grid on; colorbar; colormap jet
xlabel('ping #'); ylabel('depth below sonar (m)');
titleStr = sprintf('%s water-column (dB)\npings %i-%i (stacked in %s)',rawFileName,params.iPingLims(1),params.iPingLims(2),params.stackMode);
title(titleStr,'Interpreter','none');
![water-column data stacked in depth](https://private-user-images.githubusercontent.com/8197102/318056953-83824b3f-e18e-4fa2-b046-c6df5a505980.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTA3OTIsIm5iZiI6MTczOTM1MDQ5MiwicGF0aCI6Ii84MTk3MTAyLzMxODA1Njk1My04MzgyNGIzZi1lMThlLTRmYTItYjA0Ni1jNmRmNWE1MDU5ODAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTJUMDg1NDUyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Njg1MzRhMzI2NTk5YzhlMTI0ODEzNGY2YzU3MWY3YTE4NzE1MTQ0NWFjYzk4MmE5ODQyOWI5NzQ5NDMxOTFhYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.tldiYjsM4lg2R2SV0pMZhSCBCh9UuPdZPfgMBoW69E8)
For stacking in fan, set stackMode
to 'fan'
. You can also specify a desired resolution with resFanStack
:
params = struct();
params.stackMode = 'fan';
params.iPingLims = [20,120];
params.resFanStack = 0.05; % in m
[fanStack,fanStackX,fanStackY] = CFF_stack_WCD(fData,params,'comms','multilines');
With this new information, we can display the stack in fan:
figure;
imagesc(fanStackX,fanStackY,fanStack,'AlphaData',~isnan(fanStack));
grid on; colorbar; axis equal; colormap jet
xlabel('across distance (m)'); ylabel('depth below sonar (m)');
titleStr = sprintf('%s water-column (dB)\npings %i-%i (stacked in %s)',rawFileName,params.iPingLims(1),params.iPingLims(2),params.stackMode);
title(titleStr,'Interpreter','none');
![water-column data stacked in fan](https://private-user-images.githubusercontent.com/8197102/318072648-32d44664-84c8-47fb-a812-20de18686daa.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTA3OTIsIm5iZiI6MTczOTM1MDQ5MiwicGF0aCI6Ii84MTk3MTAyLzMxODA3MjY0OC0zMmQ0NDY2NC04NGM4LTQ3ZmItYTgxMi0yMGRlMTg2ODZkYWEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTJUMDg1NDUyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NzIzZGM1NWI5NTRiMzM0ZDU1YTdhNmFiN2FiNjZhMWY5MjgzOTI3ZmQ5YzExNThlNzc3ZDVkOTQyZDUyZjMxMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.jZwE8-cyl1AwVpA3b2HHhUS9MiQ0GTZLVf2y3SeXHCA)
The complete list of parameters available to CFF_stack_WCD
is as follows:
Parameter | Description |
---|---|
'stackMode' |
String code for the mode of stacking. Possible values are 'range' (default), 'depth' , or 'fan' . When stackMode is set to 'depth' , the resolution in the Y-dimension (depths) is equal to twice the inter-sample distance (see the param field resDepthStackY to modify this default behaviour). When stackMode is set to 'fan' , the resolution in both the X-dimension (across-track distance) and Y-dimension (depth) is equal to the distance between two beams at the max depth (see the param field resFanStack to modify this default behaviour). |
'dataField' |
Name of the fData field to use as the (memmaped file) WCD data to stack. Default is 'WC_SBP_SampleAmplitudes' . |
'angleDegLims' |
Two-values vector of beam angles (in degrees) to which the stacking is to be limited. Default is [-inf,inf] to conserve all beam angles. |
'minStackY' |
Starting value for the stack's Y-dimension, aka minimum range (for range-stacking) or minimum depth (for depth-stacking and fan-stacking). Must be 0 (default, i.e. stacking starts at sonar face) or positive. |
'maxStackY' |
End value for the stack's Y-dimension. Must be 0 (default) or positive. The value 0 (default) is a special code to indicate stacking is to go as far as the deepest bottom-detect in the data. Use the value inf to stack as far as data goes. |
'resDepthStackY' |
Desired depth resolution when depth-stacking. Must be 0 (default) or positive. The value 0 (default) is a special code to indicate the default resolution (see previously for default value). This parameter is ignored in other stacking modes. |
'resFanStack' |
Desired resolution in depth and across-track distance when fan-stacking. Must be 0 (default) or positive. The value 0 (default) is a special code to indicate the default resolution (see previously for default value). This parameter is ignored in other stacking modes. |
'iPingLims' |
Two-values vector of the indices of pings to which the stacking is to be limited. Default is [1,inf] to conserve all pings. If requested values are outside the range available in the data, the function will automatically adjust them. |
'iBeamLims' |
Two-values vector of the indices of beams to which the stacking is to be limited. Default is [1,inf] to conserve all beams. Note that this parameter does not over-ride the parameter angleDegLims . Instead, both parameters are taken into account to limit beam contributions to the stack. |
'iSampleLims' |
Two-values vector of the indices of samples to which the stacking is to be limited. Default is [1,inf] to conserve all samples. Note that this parameter does not over-ride the parameters minStackY and maxStackY . Instead, all three parameters are taken into account to limit sample contributions to the stack. |
Valid as of 17 December 2024 (CoFFee 2.0.0-alpha.22). Contact the authors if something is inaccurate or does not work.