Get started with the CoFFee toolbox to explore your multibeam sonar raw data

Get started with the CoFFee toolbox to explore your multibeam sonar raw data

This LinkedIn article is a modified version of this CoFFee tutorial on GitHub. Find other tutorials and more on the CoFFee wiki.

--

If you have multibeam sonar raw data in Kongsberg format (*.all or *.kmall) or Teledyne-Reson or Norbit (*.s7k) and a MATLAB license, you can start exploring and processing your data today with the free open-source MATLAB toolbox CoFFee.

This is a quick "Hello World" tutorial on how to use CoFFee to convert a raw data file to access the bathymetry and backscatter data in it.

1. Download and install CoFFee

See dependencies, install, and use information on the CoFFee home page for details, but in short:

  • Make sure you have MATLAB installed. CoFFee is currently built with version R2020b, but it may work on other versions. Some CoFFee functions may need additional MATLAB toolboxes : Signal Processing Toolbox, Mapping Toolbox, Statistics and Machine Learning Toolbox, Parallel Computing Toolbox.
  • Next, clone or download the CoFFee repository. See the green "Code" button at the top-right of the CoFFee home page for information.
  • Finally, start MATLAB and, at the prompt, inform MATLAB where it can find the CoFFee toolbox. This is achieved by adding to the MATLAB path the location on your computer of your freshly downloaded CoFFee. Use the following commands, with the appropriate location to your copy of CoFFee:

coffeeFolder = 'C:\my\path\to\CoFFee';
addpath(genpath(coffeeFolder));
        

2. Convert raw data to the CoFFee format

Start with informing a folder of compatible raw data files. For this tutorial, I am using a short set of Kongsberg *.all files, acquired by Deakin University in 2014 off Warrnambool (Victoria, Australia) with a Kongsberg EM2040 C mounted on RV Yolla. You can download this test data here.

dataFolder = 'D:\data\test_data';        

You can use the CoFFee function CFF_list_raw_files_in_dir to select files from a folder of raw data. This function takes for input a folder, and a range of options are possible to fine-tune our selection of files. With the following command, we simply get the first '.all' file in the folder:

rawFile = CFF_list_raw_files_in_dir(dataFolder, 'filesType', '.all', 'nFilesWanted', 1);        

You can use the MATLAB command print to verify which file you selected, or use the CoFFee function CFF_print_raw_files, which is specially designed for list of raw files in CoFFee:

CFF_print_raw_files_list(rawFile);        

Convert the raw data file with CoFFee function CFF_convert_raw_files. Here we are only interested in seafloor data (bathymetry and backscatter data) so use the 'seafloor' option for the 'conversionType' parameter to ignore any water-column data.

fData = CFF_convert_raw_files(rawFile,'conversionType','seafloor');        

See this wiki page for more information on the function CFF_convert_raw_files and its options.

See this wiki page for information on converting more than one file at a time.

3. Access and display data

The converted output fData is a MATLAB structure array. Bathymetry and backscatter data are some of its fields, stored as 2D beams-per-ping arrays. For simplicity, you may save them as new variables with:

bathymetry = -fData.X8_BP_DepthZ; % in m
backscatter = fData.X8_BP_ReflectivityBS; % in dB        

Notes:

  • Depths are positive by default, so we just invert the sign for display.
  • The level of backscatter data in dB is the level as recorded in the raw data files. No radiometric corrections were applied to this output.
  • See this wiki page for more information on the fData format.

Data is now ready to be displayed. Here is some example MATLAB code to do so:

figure; 

ax(1) = subplot(211); %sub-plot for bathymetry
imagesc(bathymetry); 
grid on; colorbar; colormap(ax(1),'jet');
xlabel('ping number'); ylabel('beam number'); title('bathymetry (m)');

ax(2) = subplot(212); % sub-plot for backscatter
imagesc(backscatter); 
caxis([prctile(backscatter(:),10) prctile(backscatter(:),90)]); % enhance contrast
grid on; colorbar; colormap(ax(2),'gray');
xlabel('ping number'); ylabel('beam number'); title('backscatter (dB)')

rawFileName = CFF_file_name(char(rawFile)); 
sgtitle(rawFileName ,'Interpreter','none');        

Below is a screenshot of the output you should obtain:

4. Conclusion

CoFFee is a MATLAB toolbox to explore and process multibeam sonar raw data. You may use it under the (very permissive) terms of the MIT license to explore your raw data and/or build your own processing pipelines, or software. This short article may have already given you ideas on what you can do with it, but to continue learning about other capabilities of CoFFee, see the tutorials in the CoFFee wiki, or the next articles in this series.



Doug Newcomb

Semi - Retired Cartographer

3 个月

Will it work with Octave as well as MatLab?

回复
Robert Runya, Ph.D

Marine Scientist | Researcher | Consultant | Project manager| Mentor ~ Spatial Ecology, Marine Spatial Planning, Conservation biology, MPAs & pro-Nature Based Solutions

3 个月
Irena Hana Hariyanto

Geomatics Engineering | Ocean Mapping

3 个月

It's interesting, I'd try to read the water column data someday. Appreciate it

回复
Manish Devana

Building Ocean Tech at Aquatic Labs | Oceanography, MRV for Ocean Carbon, Marine Sensing Technology

3 个月

This is so cool! And kudos for making it open source!

要查看或添加评论,请登录

社区洞察

其他会员也浏览了