Radar Image Data Exploration

Eric Martin MBARI 2021

This assumes you've built the binaries in this directory, the goal of this notebook is to demonstrate the following:

  1. Processing a Radar PCAP file into three CSV files: (1) Radar image data (2) radar configuration messages, and (3) the AHRS data.
  2. Plotting a single scan of radar data.

Process the PCAP File

To date the project has been collecting the data through a raw packet capture tool, tshark. We have written C tools to go through and parse these files into CSV files of interest for broader accessibility. Some sample data is present in the repository.

Radar Settings Reports

We are pretty interested in the biggest day observed yet, 9/28/2021. Let's process that one. First let's process the radar data. The program, if built and installed should print out help with no inputs:

Let's make sure there are data in the file:

Yes, there are reports data for both channels on the radar, and many Frames of sonar data, covering 367K radar scan lines, which add up to 89 full revolutions of the radar for the entire file.

Next, let's convert the reports, and just print the header:

We can see that this isn't changing, which is good, at the time of this analysis, there is little change happening on the radar setting, and all of these values make sense (but range is 500.0meters, so something is a bit off). If we wanted to make a file for all the reports we simply redirecto the stdout to a file, as so:

AHRS Data Processing

Much like the reports data, we can generate csv files using the pcaptoahrs tool.

Radar Scan Line Processing

Our last pcap file process is to take the file, restructure the packets, and turn it into something we can parse in in a higher level language, like python:

That took a while, but now we have the file in CSV form, let's take a look at how large it ended up.

So in the end, from a 200MB file, we are generating another file that is 745MB. Let's see if we can parse the file with pandas, and then the fun can begin.

CSV Reading

Working with one scan

Let's find the first full revolution, scan_line set to 0.

Good! there are 2048 scans in one full revolution, we have something to look at.

Ok, let's see the result:

Polar Graphic Generation

The final step in creating a monochrome image is to reshape the array into a cartesian one. At the end of the day, we should have a square bound by the radius of the spokes, or $2*(1024)=2048$. Let's take a brute force attempt at this.

Here is the result

Adding in a yaw offset

Just a little sandbox area for me to sort out the best way to get a single yaw offset for the whole revolution.

Processing the whole file (VERY INEFFICIENTLY)

Let's turn this into and full script, here are the contents of wec_radar_movie.py file subject to change:

Now we have a set of images that we can turn into a movie. There are many ways to achieve this task, for now we will use ffmpeg.