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.

If this 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. So what is more important is whether the activity occurred during daylight or the hours of darkness.

My first attempt to clarify this 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

  • Night PM: end of twilight to midnight

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

 

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

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

But some others are active at night, especially if flying in migration flocks

.



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

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


Now its clear that most of the night calls occur when the birds arrive in the autumn and leave in the spring.

 

But there is still something missing. The daily segments are not equal in 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.

Hows it done

Initially I created a small Python program to create a CSV file lookup table of 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 12 degrees below the horizon.

This lookup table was pasted into a LibreOffice Calc workbook.

All further 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 will effectively shorten the twilight periods.

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 and create these graphs in my LibreOffice Calc template, then save the file by species and date.

Example: in BirdNet open Database Maintenance > Login > detections > select data

Then Search: Com_Name = Redwing, Action: Select

Now Export: save > CSV, > Export

Finally; Logout


No comments:

Post a Comment