Saturday, 8 November 2025

BirdNet-Pi Species Stats: post analysis graphing

 

I like graphs!

 

And I like the annual count-by-month bar graph in Species Stats

But I’m less keen on the hourly chart.

The issue I have with it, is that the animal kingdom does not run on a linear, 24 hour clock.

For example: If the BirdNet-Pi hourly graph shows a cluster around (say) 6pm, its not clear if this occurred over several days or months, and if it was light or dark at the time.

What I think is more important is whether the activity occurred during daylight or the hours of darkness.

So I set about generating my own graphs on LibreOffice Calc.

My first attempt to clarify daily activity involved dividing the day up into 6 segments:-

  • Night AM: from midnight to twilight

  • Twilight AM: from start of twilight to sunrise

  • Day AM: from sunrise to midday/noon

  • Day PM: from midday/noon to sunset

  • Twilight PM: from sunset to darkness (end of twilight)

  • Night PM: end of twilight to midnight

All call detection counts for a selected species were then classified by segment into a pie chart.

 

It looks like the coal tit makes most of its calls during the morning

 

Many smalls bird have the good sense to keep quiet at night, as shown on this ‘coal tit’ pie graph.

But some other species are active at night, especially if flying in migration flocks (calls known as NFC; nocturnal flight calls).

.



In this pie chart for redwing, well over half the calls detected are at night.

This gives me a better idea of bird behaviour, but I need to visualise how this picture changes during the year.

Data until 8th Nov only

Although this data does not include most of November and none of December, its clear that most of the night calls occur when the birds arrive in the UK in the autumn and leave in the spring.

 

But there is still something missing. The daily segments are not equal in magnitude/time;

At my location, the total twilight periods vary between about 10 to 16% of the day during the course of the year, while night time varies from about 15% to over 50%.

This may mean that (say) 10 detected calls during morning twilight are more significant than the same number during the rest of the morning, after sunrise.

So here is a graph using counts weighted by month and part of day


We very rarely see redwing in our garden, so much of this activity must be due to small flocks flying overhead.

How's it done

Initially I wrote a small Python program to generate a CSV file lookup table for 366 days of the year, with sunrise & sunset times. For twilight, I used the Nautical Twilight definition, which is determined by the sun when it is positioned 12 degrees below the horizon.

This lookup table was pasted into a LibreOffice Calc workbook.

The remaining operations & calculations were performed via Calc Basic (rather like VBA for Excel).

I didn’t need to plot this, I just like graphs!
 

The chart is based upon times for 2028. This is because it must contain 366 days, rather than only 365, otherwise the lookup would fail during leap years.

As the error in using a fixed calendar year is small, it doesn’t justify calculating a new lookup table for each new year.

Of more significance is probably cloud cover, as thick cloud may impact the twilight periods.

 

conclusions

I'm not sure how useful these graphs will be, but at the end of December I'll produce my first full set for all species that have clocked up at least (say) 100 counts.

Although this kind of analysis could be integrated within BirdNet-Pi, the existing analysis under Species Stats is already painfully slow, so I’m happy to export the data from the database, import the data to my LibreOffice Calc template, create these graphs, and then save the file by species name and date.

Exporting from BirdNet-Pi is pretty easy, for example:-

  • in BirdNet open Database Maintenance > Login > detections > select data
  • then Search: Com_Name = Redwing, Action: Select
  • now Export: save > CSV, > Export
  • finally; Logout

The csv file will be called: detections.csv and will have an annoying header which you will probably want to delete:-

 <a href="/scripts/adminer.php" target="_blank">Open in new page</a>


No comments:

Post a Comment