Download a species list and cross-reference with conservation status lists

Knowing what species have been observed in a local area is a regular task for ecosystem management. Here we show how to make a species list with {galah-python} and how to cross-reference this list with threatened and sensitive species lists. We then show how to visualise this information as a waffle chart using {pywaffle} & {matplotlib}.

Eukaryota
Summaries
Python
Authors

Amanda Buyan

Dax Kellie

Published

February 12, 2024

Author

Amanda Buyan
Dax Kellie

Date

12 February 2024

Knowing what species inhabit an area is important for conservation and ecosystem management. In particular, it can help us find out how many known species are in a given area, whether each species is common or rare, and whether any species are threatened or endangered.

In this post, we will use the galah-python, geopandas, matplotlib and pywaffle packages to show you how to download a list of species within the Yass Valley in 2023, cross-reference this list with state-wide conservation status lists, and visualise the number of threatened and sensitive species in the region.

Download a list of species

There are two ways to narrow a download query to return information for a specific region:

  • Using fields available in galah-python (downloaded from the ALA)
  • Using a shapefile

The method you choose depends on whether the region you wish to return species for is already within galah-python, or whether you require a list for a more specific area defined by a shapefile.

Cross-reference with threatened and sensitive species lists

Next we will compare our Yass valley species list with several state-wide conservation status lists of threatened and sensitive species. We can retrieve lists of threatened and sensitive species in one of two ways:

  • Use the lists available in the Atlas of Living Australia
  • Use your own list

Both use the same method of matching species names in our Yass Valley list to species names in official conservation status lists. However, there is a slightly different workflow between using galah-python and using an externally downloaded list. Choose from the options below to use either method.

Visualise species conservation status

One useful way to visualise the number of threatened and sensitive species in an area is using a waffle chart. Waffle charts are useful because they can show the total number of species (represented as individual square units) and proportions of different groups (represented by colours).

For example, we can visualse the number and proportion of species with different conservation status, along with a taxonomic breakdown of threatened/sensitive species 4.

Code
# add packages
import matplotlib 
import matplotlib.pyplot as plt
from pywaffle import Waffle 

# initialise figure
fig = plt.figure(figsize=(10,6))
fig.add_subplot(211) # Top Long Waffle Chart #211
fig.add_subplot(212) # Bottom Left Sensitive/Threatened # 223

# set the axes for separate plotting
ax1, ax2 = fig.axes

# # Modify existing axis and set aspect to equal
ax1.set_aspect(aspect="equal")
ax2.set_aspect(aspect="equal")

# make sure there are unique colours for each species
remaining_species = species_yass.shape[0] - (yass_sensitive.shape[0] + yass_threatened.shape[0])
all_species = [yass_sensitive.shape[0],yass_threatened.shape[0],remaining_species]

# add title over all plots
plt.suptitle("Species in Yass Valley in 2023",fontsize=20)

# add extra text
percentage = round(float(yass_sensitive.shape[0] + yass_threatened.shape[0]) / species_yass.shape[0], 4)*100
fig.text(0.56,0.44,"*1 square = 1 species",fontsize=12)
fig.text(0.56,0.22,"{}%".format(percentage),fontsize=56)
fig.text(0.56,0.18,"Threatened/Sensitive Species",fontsize=12)
fig.text(0.13,0.50,"Taxonomic Breakdown",fontsize=13)

# waffle chart
Waffle.make_waffle(
    ax=ax1,
    rows=15,
    values=all_species, 
    colors = ["#FFC547","#A12B58","#E1E1E1"],
    legend={
        'labels': ["Sensitive","Threatened","Remaining"],
        'loc': 'upper left',
        'bbox_to_anchor': (0.23, 1.2),
        'ncol': 3,
        'framealpha': 0,
        'fontsize': 10
    }
)

# separate into birds, mammals, reptiles, plants and other
birds = yass_sensitive[yass_sensitive["Class"] == "Aves"].shape[0] + yass_threatened[yass_threatened["Class"] == "Aves"].shape[0]
mammals = yass_sensitive[yass_sensitive["Class"] == "Mammalia"].shape[0] + yass_threatened[yass_threatened["Class"] == "Mammalia"].shape[0]
reptiles = yass_sensitive[yass_sensitive["Class"] == "Reptilia"].shape[0] + yass_threatened[yass_threatened["Class"] == "Reptilia"].shape[0]
plants = yass_sensitive[yass_sensitive["Kingdom"] == "Plantae"].shape[0] + yass_threatened[yass_threatened["Kingdom"] == "Plantae"].shape[0]
other = (yass_sensitive.shape[0] + yass_threatened.shape[0]) - (birds + mammals + reptiles + plants)

# get counts and add them to labels
group_count = [birds,mammals,reptiles,plants,other]

# make the labels with number of unique species in label
group_labels = ["Birds","Mammals","Reptiles","Plants","Other"]

# Make types breakdown waffle chart
Waffle.make_waffle(
    ax=ax2,
    rows=5,
    values=group_count, 
    colors = ["#68116A","#A72566","#CA3F51","#DE9568","#F2D0A6"],
    legend={
        'labels': group_labels,
        'loc': 'upper right',
        'bbox_to_anchor': (1.7, 1.02),
        'ncol': 1,
        'framealpha': 0,
        'fontsize': 10
    }
)

Final thoughts

We hope this post has helped you understand how to download a species list for a specific area and compare it to conservation lists. It’s also possible to compare species with other information like lists of migratory species or seasonal species.

For other Python posts, check out our beginner’s guide to map species observations or see how to map distributions of invasive species.

Expand for session info
-----
galah               0.8.2
geopandas           0.14.1
matplotlib          3.8.2
natsort             8.4.0
pandas              2.1.3
pywaffle            NA
session_info        1.0.0
-----
Python 3.12.0 (tags/v3.12.0:0fb18b0, Oct  2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]
Windows-10-10.0.19045-SP0
-----
Session information updated at 2024-02-16 12:28

Footnotes

  1. Each spatial layer has a two letter code, along with a number to identify it. The abbreviations are as follows: * cl = contextual layer (i.e. boundaries of LGAs, Indigenous Protected Areas, States/Territories etc.)
    * 10923 = number associated with the spatial layer in the atlas↩︎

  2. Check out this post for a better explanation of what CRS is and how it affects maps.↩︎

  3. These are the same two lists that you can access in galah-python, available from the Atlas of Living Australia. Keep in mind that if you use an external list, data cleaning may be required before matching species names.↩︎

  4. To create our colour palette, we used David Nichol’s website to help colours that are colour-blind friendly, the ColorHexa website create a gradient between 2 colours, and Coolors to adjust the colours & shades.↩︎