Technical Articles and Newsletters

Analyzing Bird Flight Patterns with MATLAB

By Richard Budgey, Central Science Laboratory

In April 2007, a Boeing 757 that had just taken off from Manchester Airport was forced to land when a crow was sucked into one of its engines. The previous fall, an RAF Tornado crashed following another collision with a bird.

Bird strikes are a common threat to aircraft safety. One of the most effective ways to prevent them is to know the likely position of birds in any given location throughout the day.

The Birdstrike Avoidance Team at the Central Science Laboratory (part of the U.K. Department for Environment, Food and Rural Affairs) conducts studies to assist with this effort. My colleagues and I process radar data and create input files for the geographic information system software that we use to visualize bird flight patterns. After analyzing and interpreting the data, we report our findings to airports or military bases.

Previously, the data processing and filtering involved a complex series of manual steps and disparate tools, including Visual Basic and Microsoft Excel. This error-prone approach was so time-consuming that it often took us an entire day to process 24 hours' worth of radar data.

This article describes how we developed a MATLAB® application that completes the same job in about 30 minutes.

Acquiring Radar Data

Radar systems have been detecting birds since World War II, but it is only in the past few years that mobile units specifically tuned to detect birds have become available. These units are equipped with software that substantially reduces the amount of processing required. (In the past, researchers had to sit in the radar hut with an acetate and a felt tip pen and plot the path of the birds by hand.)

Figure 1. A mobile radar unit designed for bird detection.

These mobile units, which have a range of up to 11 kilometers, are typically placed on estuaries near airports or military training grounds.

Processing and Preparing the Data

The mobile units generate a Microsoft Access database table in which each row represents a bird echo. The columns include data such as a tracking identifier, the x and y coordinates of the bird, and its radar reflectivity (a metric that helps us determine the size of the bird). Every two-second sweep of the radar creates a new database row for each bird in range. Typically, anywhere from zero to one hundred or more birds are detected in each sweep.

A major technical challenge for our team lies in converting the data in this Access database into a format that is readable by ArcGIS, the software that we use to visualize bird movement on maps. To convert the data, we must first remove noise and correct instances in which the system merged the echoes from two birds into a singe echo. Using the time stamp, tracking identifier, and coordinates, we then calculate the speed, direction, and time of day of each bird flight and store it in a shapefile, a file formatted to be read by ArcGIS.

The Old Approach: Too Many Files, Tools, and Steps

Our original method for creating the ArcGIS shapefile involved numerous tools, intermediate data files, and manual steps. We would begin by creating a Visual Basic program to read the data in the Access database and do some pre-processing. The results from that step were then exported to Excel for further processing. We would then manually export a text file from Excel, which we would import into another application, ArcView, to create the shapefile.

One hour of radar data can contain over 500,000 records. To keep things manageable and avoid exceeding the number of rows allowed by the Excel spreadsheet, we had to break down each day's data into one-hour chunks, which multiplied all the steps and intermediate files by 24. For periods of particularly high bird activity, we had to further break the data down into five-minute chunks.

In addition, we had to work around some strange anomalies. For example, if a record fell at midnight, Access would drop the trailing seconds and record only the hour, but our Excel macros would fail when the trailing seconds were missing. Despite its shortcomings, we were reluctant to change the process. It took us about six months to develop, and a single modification often involved several disparate tools.

All in all, our old approach was tedious, prone to human error, difficult to update, and required too much time to complete. 

The Switch to MATLAB

We decided to implement the process in MATLAB and to automate as many steps as possible. Other researchers at CSL had been using MATLAB for statistical analysis and other tasks.

As a biologist, I had no prior programming experience with MATLAB. Most of my experience was in Visual Basic. I attended a two-day training course, “MATLAB Fundamentals and Programming Techniques,” which helped me understand the basics of programming in MATLAB. While Visual Basic may be easier to learn for someone without formal programming training, I found that once I was past the first step, performing complex tasks was much quicker and easier using MATLAB than it had been using Visual Basic.

Implementing the MATLAB Application

Our first MATLAB project had a straightforward goal: We would use an Access database as input and produce an ArcGIS shapefile as output, but would replace all the manual intermediate steps with a single MATLAB application.

The first step in the new process is to access the database table from within the MATLAB environment using Database Toolbox. We then pre-process or filter the data with an algorithm developed in MATLAB. In this step we eliminate noise from the data, such as echoes that we can be reasonably certain are not birds. The algorithm also corrects instances in which the radar unit reports as a single bird what is actually two birds flying close together.

The radar unit provides coordinates of each bird echo relative to itself. Using MATLAB, we convert these coordinates into coordinates on the U.K. national grid. We can then link a radar echo to a specific location on a map.

Figure 2. Individual bird echoes captured near the Spurn Bird Observatory.

We use Mapping Toolbox to convert that array of coordinates into a format required for an ArcGIS shapefile. At the same time, we use MATLAB to calculate the speed and direction of each bird.

Figure 3. Lines representing flight paths of individual birds.

The result is a series of lines, each representing the flight path of a single bird, which are written to a shapefile. We can then explore this data visually using ArcGIS or conduct further statistical analysis.

Figure 4. Flight paths superimposed on a map of the region. Click on image to see enlarged view.

Extending and Deploying the Application

Inaccuracies in the radar can produce echoes that result in a jagged or wobbly representation of a bird’s flight path. We have used MATLAB and Curve Fitting Toolbox to produce a more realistic path by finding a line of best fit through the radar echoes. Curve fitting can sometimes give us a much better idea of the bird’s actual path. Adding this functionality was straightforward with MATLAB. It would have been exceptionally difficult with Excel and Visual Basic.

We created a graphical user interface in MATLAB that researchers can use to set up and perform data analysis. To simplify deployment, we used MATLAB Compiler to create a standalone application that can be run by any ornithologist at CSL, even if they do not have MATLAB installed. This approach ensures consistency across the team’s results that we lacked with our previous system. Before, to update the system I would distribute an Excel file that contained a series of macros. If anyone on the team edited that file themselves, all my hard work was lost. Now that the program is compiled, consistency is ensured because the code can't be modified.

Analysis Results in 30 Minutes

The MATLAB application analyzes 24 hours of radar data—a task that used to take a researcher all day to complete—in about half an hour. This increase in speed has directly benefited our research. The more data we can examine visually, the more likely we are to gain insights into flight patterns. And because it so much easier now to process the data, our team can explore areas and ideas that we did not have time to pursue before. The increased ability to try new approaches extends to changes in the algorithms that we use: we are more likely to improve our process because making a single change to the MATLAB application is easier than changing the two or three different applications that we used before.

The MATLAB application increases the productivity of the researchers on our team. Because the processing is completed in one step, much less work is required to get the same results, and mistakes that resulted from having to keep track of dozens of intermediate data files have been eliminated.

Conservation and Real-Time Applications

While reducing the risk of bird strikes is a primary goal of our research, it is by no means the only one. A better understanding of bird behavior is also vital to CSL’s environmental management and conservation efforts. Our research helps engineers position windfarms to minimize the potential hazard to rare or endangered bird species. With our system, we can track individual birds, assess the environmental impact of a proposed windfarm, and reduce the chances of threatened species flying into wind turbines.

Published 2007

View Articles for Related Capabilities

View Articles for Related Industries