{galah} 101 - Beginner’s guide

Dr Dax Kellie, Dr Amanda Buyan
@daxkellie

ALA4R

ALA4R still had problems


  • No function naming convention
  • Confusing syntax
  • Inconsistent behaviour



  • abbreviations: aus()
  • snake case: ala_fields()
  • single words: occurrences(), images()
  • contractions: fieldguide()

ALA4R still had problems


  • No function naming convention
  • Confusing syntax
  • Inconsistent behaviour



  • unclear function names: ala_list(), ala_lists(), specieslist()
  • abbreviated argument names: wkt, fq, qa
  • Required solr queries: "taxon_name:\"Alaba vibex\""

ALA4R still had problems


  • No function naming convention
  • Confusing syntax
  • Inconsistent behaviour



  • Functions return either:
    • a data.frame
    • a list
    • a PDF

tidyverse

The tidyverse brought a set of recognised standards and syntax

galah

galah


  • Query the ALA (and other national GBIF nodes)
  • Use tidy syntax that was structured but flexible

galah


Lookup Narrow a query Run a query
show_all() galah_identify() atlas_counts()
search_all() galah_filter() atlas_occurrences()
galah_select() atlas_species()
galah_group_by() atlas_media()
galah_geolocate()

Build a query

library(galah)

galah_call() |>
  galah_identify("Eolophus roseicapilla") |> # galahs
  galah_filter(year >= 2019,
               stateProvince == "New South Wales") |>
  galah_group_by(year, dataResourceName) |>
  atlas_counts()
# A tibble: 21 × 3
   dataResourceName year  count
   <chr>            <chr> <int>
 1 eBird Australia  2022  20858
 2 eBird Australia  2021  18006
 3 eBird Australia  2020  17114
 4 eBird Australia  2019  13561
 5 eBird Australia  2023   4999
 6 NSW BioNet Atlas 2020   2296
 7 NSW BioNet Atlas 2019   2031
 8 NSW BioNet Atlas 2021    793
 9 NSW BioNet Atlas 2022    648
10 NSW BioNet Atlas 2023     35
# ℹ 11 more rows

galah for Python

Why Python?


PYPL website: https://pypl.github.io/PYPL.html CC-BY 3.0


galah for Python


Lookup Narrow a query Run a query
galah.show_all() taxa= galah.atlas_counts()
galah.search_all() filters= galah.atlas_occurrences()
select= galah.atlas_species()
group_by= galah.atlas_media()
geolocate=

Note: {galah} for Python narrows queries with arguments inside atlas_ functions

Build a query

import galah

galah.atlas_counts(
  taxa = "Eolophus roseicapilla",
  filters=["year>=2019","stateProvince==New South Wales"],
  group_by=["year", "dataResourceName"]
)
    year                                   dataResourceName  count
0   2019                                    eBird Australia  13561
1   2020                                    eBird Australia  17114
2   2021                                    eBird Australia  18006
3   2022                                    eBird Australia  20858
4   2023                                    eBird Australia   4999
5   2019                                   NSW BioNet Atlas   2031
6   2020                                   NSW BioNet Atlas   2296
7   2021                                   NSW BioNet Atlas    793
8   2022                                   NSW BioNet Atlas    648
9   2023                                   NSW BioNet Atlas     35
10  2019                              iNaturalist Australia    233
11  2020                              iNaturalist Australia    455
12  2021                              iNaturalist Australia    521
13  2022                              iNaturalist Australia    537
14  2023                              iNaturalist Australia    303
15  2019                        Earth Guardians Weekly Feed    134
16  2020                        Earth Guardians Weekly Feed    104
17  2021                        Earth Guardians Weekly Feed     51
18  2022                        Earth Guardians Weekly Feed     40
19  2023                        Earth Guardians Weekly Feed     11
20  2019                        BirdLife Australia, Birdata    235
21  2019                                         NatureMapr      8
22  2020                                         NatureMapr      9
23  2021                                         NatureMapr     18
24  2022                                         NatureMapr     17
25  2020                                 Wildlife Watch NSC      5
26  2021                                 Wildlife Watch NSC      5
27  2022                                 Wildlife Watch NSC      5
28  2023                                 Wildlife Watch NSC      3
29  2019                                       Tempe birdos      5
30  2020                                       Tempe birdos      5
31  2021                                       Tempe birdos      1
32  2022                                       Tempe birdos      2
33  2022  Australian National Wildlife Collection provid...      8
34  2019                           WCPS Bird Survey Project      4
35  2020                           WCPS Bird Survey Project      3
36  2019                       Victorian Biodiversity Atlas      2
37  2020                       Victorian Biodiversity Atlas      3
38  2021                       Victorian Biodiversity Atlas      1
39  2019                  ALA species sightings and OzAtlas      2
40  2020                  ALA species sightings and OzAtlas      1
41  2021                  ALA species sightings and OzAtlas      1
42  2019                                         Gaia Guide      1

Learn how to use galah for R and Python


  • Install & load {galah}
  • See or search for information
  • Build a query (counts, occurrences)
  • Make a map of observations

Install and load {galah}

Install and load {galah}

install.packages("galah") # install
library(galah)            # load


We can already run a simple query!

atlas_counts()
# A tibble: 1 × 1
      count
      <int>
1 125563160
pip install galah-python
import galah


galah.galah_config(data_profile="None")
galah.atlas_counts()
   totalRecords
0     125563160

Build a query
Download record counts and occurrence records of Peron’s tree frog since 2018 in New South Wales by FrogID

Photo | Indiaianson CC BY NC
Litoria peronii

Photo | Jeannie CC BY NC
Litoria peronii

See or search for information

show_all() & search_all()

Use these functions to find information or metadata to filter your queries

Check scientific name for Peron’s tree frog

search_taxa("litoria peronii")
# A tibble: 1 × 15
  search_term     scientific_name scientific_name_autho…¹ taxon_concept_id rank 
  <chr>           <chr>           <chr>                   <chr>            <chr>
1 litoria peronii Litoria peronii (Tschudi, 1838)         https://biodive… spec…
# ℹ abbreviated name: ¹​scientific_name_authorship
# ℹ 10 more variables: match_type <chr>, kingdom <chr>, phylum <chr>,
#   class <chr>, order <chr>, family <chr>, genus <chr>, species <chr>,
#   vernacular_name <chr>, issues <chr>


Incorrect search term

search_taxa("incorrect taxa")
# A tibble: 1 × 2
  search_term    issues 
  <chr>          <chr>  
1 incorrect taxa noIssue


Search for multiple taxa

search_taxa("litoria peronii", "Crinia signifera", "Rhinella marina")
# A tibble: 3 × 15
  search_term      scientific_name scientific_name_auth…¹ taxon_concept_id rank 
  <chr>            <chr>           <chr>                  <chr>            <chr>
1 litoria peronii  Litoria peronii (Tschudi, 1838)        https://biodive… spec…
2 Crinia signifera Crinia signife… Girard, 1853           https://biodive… spec…
3 Rhinella marina  Rhinella marina (Linnaeus, 1758)       https://biodive… spec…
# ℹ abbreviated name: ¹​scientific_name_authorship
# ℹ 10 more variables: match_type <chr>, kingdom <chr>, phylum <chr>,
#   class <chr>, order <chr>, family <chr>, genus <chr>, species <chr>,
#   vernacular_name <chr>, issues <chr>
galah.search_taxa("litoria peronii")
    scientificName scientificNameAuthorship                                     taxonConceptID     rank   kingdom    phylum  order   family    genus          species     vernacularName   issues
0  Litoria peronii          (Tschudi, 1838)  https://biodiversity.org.au/afd/taxa/c584f24b-...  species  Animalia  Chordata  Anura  Hylidae  Litoria  Litoria peronii  Peron's Tree Frog  noIssue





galah.search_taxa("incorrect taxa")
Empty DataFrame
Columns: []
Index: []



galah.search_taxa(taxa=["litoria peronii", "Crinia signifera", "Rhinella marina"])
     scientificName scientificNameAuthorship                                     taxonConceptID     rank   kingdom    phylum  order          family     genus           species     vernacularName   issues
0   Litoria peronii          (Tschudi, 1838)  https://biodiversity.org.au/afd/taxa/c584f24b-...  species  Animalia  Chordata  Anura         Hylidae   Litoria   Litoria peronii  Peron's Tree Frog  noIssue
1  Crinia signifera             Girard, 1853  https://biodiversity.org.au/afd/taxa/88a99f63-...  species  Animalia  Chordata  Anura  Myobatrachidae    Crinia  Crinia signifera     Common Froglet  noIssue
2   Rhinella marina         (Linnaeus, 1758)  https://biodiversity.org.au/afd/taxa/e79179f8-...  species  Animalia  Chordata  Anura       Bufonidae  Rhinella   Rhinella marina          Cane Toad  noIssue

Download record counts of Peron’s tree frog (Litoria peronii)

galah_call() |>
  galah_identify("litoria peronii") |>
  atlas_counts()
# A tibble: 1 × 1
  count
  <int>
1 83881
galah.atlas_counts(
  taxa="litoria peronii"
)
   totalRecords
0         83881

Download record counts of Peron’s tree frog (Litoria peronii) since 2018

To see a list of all possible fields, use show_all()

show_all(fields)
# A tibble: 626 × 4
   id                  description                                   type  link 
   <chr>               <chr>                                         <chr> <chr>
 1 _nest_parent_       <NA>                                          fiel… <NA> 
 2 _nest_path_         <NA>                                          fiel… <NA> 
 3 _root_              <NA>                                          fiel… <NA> 
 4 abcdTypeStatus      ABCD field in use by herbaria                 fiel… <NA> 
 5 acceptedNameUsage   http://rs.tdwg.org/dwc/terms/acceptedNameUsa… fiel… <NA> 
 6 acceptedNameUsageID http://rs.tdwg.org/dwc/terms/acceptedNameUsa… fiel… <NA> 
 7 accessRights        <NA>                                          fiel… <NA> 
 8 annotationsDoi      <NA>                                          fiel… <NA> 
 9 annotationsUid      <NA>                                          fiel… <NA> 
10 assertionUserId     User ID of the person who has made an assert… fiel… <NA> 
# ℹ 616 more rows
galah.show_all(fields=True)
                    id                                     description   type link
0        _nest_parent_                                             NaN  field  NaN
1          _nest_path_                                             NaN  field  NaN
2               _root_                                             NaN  field  NaN
3       abcdTypeStatus                   ABCD field in use by herbaria  field  NaN
4    acceptedNameUsage  http://rs.tdwg.org/dwc/terms/acceptedNameUsage  field  NaN
..                 ...                                             ...    ...  ...
749  multimediaLicence                              Media filter field  media     
750             images                              Media filter field  media     
751             videos                              Media filter field  media     
752             sounds                              Media filter field  media     
753                qid                Reference to pre-generated query  other     

[754 rows x 4 columns]

Download record counts of Peron’s tree frog (Litoria peronii) since 2018

Search for valid field names with “year” in title or description

search_all(fields, "year")
# A tibble: 9 × 4
  id                  description                                    type  link 
  <chr>               <chr>                                          <chr> <chr>
1 year                The year in which an occurrence was observed.… fiel… <NA> 
2 raw_year            <NA>                                           fiel… <NA> 
3 endDayOfYear        http://rs.tdwg.org/dwc/terms/endDayOfYear      fiel… <NA> 
4 startDayOfYear      http://rs.tdwg.org/dwc/terms/startDayOfYear    fiel… <NA> 
5 datePrecision       The precision of the date information for the… fiel… <NA> 
6 occurrenceYear      Year ranges for a search. Calculated based on… fiel… <NA> 
7 raw_endDayOfYear    <NA>                                           fiel… <NA> 
8 raw_startDayOfYear  <NA>                                           fiel… <NA> 
9 namePublishedInYear http://rs.tdwg.org/dwc/terms/namePublishedInY… fiel… <NA> 
galah.search_all(fields="year",column_name="id")
           id                                        description   type                                               link
592      year  The year in which an occurrence was observed. ...  field  https://github.com/AtlasOfLivingAustralia/ala-...
512  raw_year                                                NaN  field                                                NaN

Download record counts of Peron’s tree frog (Litoria peronii) since 2018

Add year to your query as a filter

galah_call() |>
  galah_identify("litoria peronii") |>
  galah_filter(year >= 2018) |>
  atlas_counts()
# A tibble: 1 × 1
  count
  <int>
1 57475
galah.atlas_counts(
  taxa="litoria peronii",
  filters="year>=2018"
)
   totalRecords
0         57475

Download record counts of Peron’s tree frog (Litoria peronii) since 2018 in New South Wales

Search for valid fields that contain “australian states” in title or description

search_all(fields, "australian states")
# A tibble: 2 × 4
  id     description                                                 type  link 
  <chr>  <chr>                                                       <chr> <chr>
1 cl2013 ASGS Australian States and Territories Australian Statisti… laye… http…
2 cl22   Australian States and Territories Australian States and Te… laye… http…
galah.search_all(fields="Australian States")
         id                                        description    type link
692    cl22  Australian States and Territories Australian S...  layers     
668  cl2013  ASGS Australian States and Territories Austral...  layers     

Download record counts of Peron’s tree frog (Litoria peronii) since 2018 in New South Wales

See and search for values within field cl22 to see whether it contains “New South Wales”

search_all(fields, "cl22") |>
  show_values()
# A tibble: 11 × 2
   field category                    
   <chr> <chr>                       
 1 cl22  New South Wales             
 2 cl22  Victoria                    
 3 cl22  Queensland                  
 4 cl22  South Australia             
 5 cl22  Western Australia           
 6 cl22  Northern Territory          
 7 cl22  Tasmania                    
 8 cl22  Australian Capital Territory
 9 cl22  Unknown1                    
10 cl22  Coral Sea Islands           
11 cl22  Ashmore and Cartier Islands 


search_all(fields, "cl22") |>
  search_values("new south wales")
# A tibble: 1 × 2
  field category       
  <chr> <chr>          
1 cl22  New South Wales
galah.show_values(field="cl22")
   field                      category
0   cl22               New South Wales
1   cl22                      Victoria
2   cl22                    Queensland
3   cl22               South Australia
4   cl22             Western Australia
5   cl22            Northern Territory
6   cl22                      Tasmania
7   cl22  Australian Capital Territory
8   cl22                      Unknown1
9   cl22             Coral Sea Islands
10  cl22   Ashmore and Cartier Islands


galah.search_values(field="cl22",value="new south wales")
  field         category
0  cl22  New South Wales

Download record counts of Peron’s tree frog (Litoria peronii) since 2018 in New South Wales

Add state/territory to your query as a filter

galah_call() |>
  galah_identify("litoria peronii") |>
  galah_filter(year >= 2018,
               cl22 == "New South Wales") |>
  atlas_counts()
# A tibble: 1 × 1
  count
  <int>
1 48907
galah.atlas_counts(
  taxa="litoria peronii",
  filters=["year>=2018","cl22=New South Wales"]
)
   totalRecords
0         48907

Download record counts of Peron’s tree frog (Litoria peronii) since 2018 in New South Wales by FrogID

Search for fields that contain “dataresource”. Then see and search for values within field

search_all(fields, "dataresource")
# A tibble: 4 × 4
  id                   description                                   type  link 
  <chr>                <chr>                                         <chr> <chr>
1 dataResourceUid      A list (concatenated and separated) of prepa… fiel… <NA> 
2 dataResourceName     The data resource that supplies the record. … fiel… <NA> 
3 raw_dataResourceUid  <NA>                                          fiel… <NA> 
4 raw_dataResourceName <NA>                                          fiel… <NA> 


search_all(fields, "dataResourceName") |>
  show_values()
# A tibble: 962 × 2
   field            category                      
   <chr>            <chr>                         
 1 dataResourceName eBird Australia               
 2 dataResourceName NSW BioNet Atlas              
 3 dataResourceName BirdLife Australia, Birdata   
 4 dataResourceName Victorian Biodiversity Atlas  
 5 dataResourceName iNaturalist Australia         
 6 dataResourceName New South Wales Bird Atlassers
 7 dataResourceName First Bird Atlas              
 8 dataResourceName SA Flora                      
 9 dataResourceName SA Fauna                      
10 dataResourceName Garden Bird Surveys           
# ℹ 952 more rows


search_all(fields, "dataResourceName") |>
  search_values("frogid")
# A tibble: 1 × 2
  field            category
  <chr>            <chr>   
1 dataResourceName FrogID  
galah.search_all(fields="dataResource",column_name="id")
                       id                                        description   type link
143       dataResourceUid  A list (concatenated and separated) of prepara...  field  NaN
142      dataResourceName  The data resource that supplies the record. Th...  field  NaN
406   raw_dataResourceUid                                                NaN  field  NaN
405  raw_dataResourceName                                                NaN  field  NaN

# galah.show_values(field="dataResourceName")

# galah.search_values(field="dataResourceName",value="frogid")

Download record counts of Peron’s tree frog (Litoria peronii) since 2018 in New South Wales by FrogID

galah_call() |>
  galah_identify("litoria peronii") |>
  galah_filter(year >= 2018,
               cl22 == "New South Wales",
               dataResourceName == "FrogID") |>
  atlas_counts()
# A tibble: 1 × 1
  count
  <int>
1 27647
galah.atlas_counts(
  taxa="litoria peronii",
  filters=["year>=2018",
           "cl22=New South Wales",
           "dataResourceName=FrogID"]
)
   totalRecords
0         27647

Group counts by fields

Group counts by data resource

galah_call() |>
  galah_identify("litoria peronii") |>
  galah_filter(year >= 2018,
               cl22 == "New South Wales") |>
  galah_group_by(dataResourceName) |>
  atlas_counts()
# A tibble: 11 × 2
   dataResourceName                     count
   <chr>                                <int>
 1 FrogID                               27647
 2 NSW BioNet Atlas                     19639
 3 iNaturalist Australia                 1348
 4 Earth Guardians Weekly Feed            145
 5 NatureMapr                              98
 6 ALA species sightings and OzAtlas       16
 7 Australian Museum provider for OZCAM     4
 8 FrogWatch SA                             4
 9 BowerBird                                3
10 Melbourne Water Frog Census              2
11 Victorian Biodiversity Atlas             1
galah.atlas_counts(
  taxa="litoria peronii",
  filters=["year>=2018",
           "cl22=New South Wales"],
  group_by="dataResourceName",
  expand=False
)
                        dataResourceName  count
0                                 FrogID  27647
1                       NSW BioNet Atlas  19639
2                  iNaturalist Australia   1348
3            Earth Guardians Weekly Feed    145
4                             NatureMapr     98
5      ALA species sightings and OzAtlas     16
6   Australian Museum provider for OZCAM      4
7                           FrogWatch SA      4
8                              BowerBird      3
9            Melbourne Water Frog Census      2
10          Victorian Biodiversity Atlas      1

Group counts by state/territory and year

galah_call() |>
  galah_identify("litoria peronii") |>
  galah_filter(year >= 2018,
               dataResourceName == "FrogID") |>
  galah_group_by(cl22, year) |>
  atlas_counts()
# A tibble: 21 × 3
   year  cl22                         count
   <chr> <chr>                        <int>
 1 2020  New South Wales              12459
 2 2020  Victoria                      1131
 3 2020  Queensland                    1038
 4 2020  Australian Capital Territory   116
 5 2020  South Australia                 77
 6 2021  New South Wales               6473
 7 2021  Queensland                     876
 8 2021  Victoria                       666
 9 2021  South Australia                 57
10 2021  Australian Capital Territory    28
# ℹ 11 more rows
galah.atlas_counts(
  taxa="litoria peronii",
  filters=["year>=2018",
           "dataResourceName=FrogID"],
  group_by=["cl22","year"]
)
                            cl22  year  count
0                New South Wales  2018   4266
1                     Queensland  2018    365
2                       Victoria  2018    326
3                South Australia  2018     62
4   Australian Capital Territory  2018     35
5                New South Wales  2019   4449
6                       Victoria  2019    377
7                     Queensland  2019    369
8                South Australia  2019     70
9   Australian Capital Territory  2019     16
10                      Tasmania  2019      3
11               New South Wales  2020  12459
12                      Victoria  2020   1131
13                    Queensland  2020   1038
14  Australian Capital Territory  2020    116
15               South Australia  2020     77
16               New South Wales  2021   6473
17                    Queensland  2021    876
18                      Victoria  2021    666
19               South Australia  2021     57
20  Australian Capital Territory  2021     28

Download occurrences

Download record counts of Peron’s tree frog (Litoria peronii) since 2018 in New South Wales by FrogID

galah_call() |>
  galah_identify("litoria peronii") |>
  galah_filter(year >= 2018,
               cl22 == "New South Wales",
               dataResourceName == "FrogID") |>
  atlas_counts()
# A tibble: 1 × 1
  count
  <int>
1 27647
galah.atlas_counts(
  taxa="litoria peronii",
  filters=["year>=2018",
           "cl22=New South Wales",
           "dataResourceName=FrogID"]
)
   totalRecords
0         27647

Download record occurrences of Peron’s tree frog (Litoria peronii) since 2018 in New South Wales by FrogID

galah_config(email = "your-email-here") # registered ALA email
galah_call() |>
  galah_identify("litoria peronii") |>
  galah_filter(year >= 2018,
               cl22 == "New South Wales",
               dataResourceName == "FrogID") |>
  atlas_occurrences()
# A tibble: 27,647 × 8
   decimalLatitude decimalLongitude eventDate           scientificName 
             <dbl>            <dbl> <dttm>              <chr>          
 1           -37.2             149. 2020-12-27 00:00:00 Litoria peronii
 2           -37.1             150. 2020-12-14 00:00:00 Litoria peronii
 3           -37.1             150. 2018-01-06 00:00:00 Litoria peronii
 4           -37.1             150. 2018-01-06 00:00:00 Litoria peronii
 5           -37.1             150. 2020-12-13 00:00:00 Litoria peronii
 6           -37.1             150. 2019-10-30 00:00:00 Litoria peronii
 7           -37.1             150. 2019-10-31 00:00:00 Litoria peronii
 8           -37.1             150. 2019-01-07 00:00:00 Litoria peronii
 9           -37.1             150. 2019-11-25 00:00:00 Litoria peronii
10           -37.1             150. 2018-12-29 00:00:00 Litoria peronii
# ℹ 27,637 more rows
# ℹ 4 more variables: taxonConceptID <chr>, recordID <chr>,
#   dataResourceName <chr>, occurrenceStatus <chr>
galah.galah_config(email="your-email-here")
galah.atlas_occurrences(
  taxa="litoria peronii",
  filters=["year>=2018",
           "cl22=New South Wales",
           "dataResourceName=FrogID"]
)
       decimalLatitude  decimalLongitude             eventDate   scientificName                                     taxonConceptID                              recordID dataResourceName occurrenceStatus
0           -37.246800        149.375000  2020-12-27T00:00:00Z  Litoria peronii  https://biodiversity.org.au/afd/taxa/c584f24b-...  a5cd2fcd-5225-4d19-977c-b16ca5e8f1dd           FrogID          PRESENT
1           -37.089036        149.699526  2020-12-14T00:00:00Z  Litoria peronii  https://biodiversity.org.au/afd/taxa/c584f24b-...  eebde5ef-cac4-4897-af00-cb2e39a0684f           FrogID          PRESENT
2           -37.077693        149.874402  2018-01-06T00:00:00Z  Litoria peronii  https://biodiversity.org.au/afd/taxa/c584f24b-...  35340478-97c1-48a4-a463-991fe3a8daa0           FrogID          PRESENT
3           -37.077241        149.874787  2018-01-06T00:00:00Z  Litoria peronii  https://biodiversity.org.au/afd/taxa/c584f24b-...  a7abc9f3-362f-469e-9076-5b55a2447b69           FrogID          PRESENT
4           -37.070746        149.896011  2020-12-13T00:00:00Z  Litoria peronii  https://biodiversity.org.au/afd/taxa/c584f24b-...  1cc9dda8-f2d4-4f55-acf6-11c93b26da9e           FrogID          PRESENT
...                ...               ...                   ...              ...                                                ...                                   ...              ...              ...
27642       -28.207514        153.442592  2018-11-15T00:00:00Z  Litoria peronii  https://biodiversity.org.au/afd/taxa/c584f24b-...  b094fed1-5bff-4df8-b556-cabd693c533a           FrogID          PRESENT
27643       -28.207472        153.442497  2018-11-15T00:00:00Z  Litoria peronii  https://biodiversity.org.au/afd/taxa/c584f24b-...  5cc24fbd-8c6b-4a76-9b28-fec76ee08f37           FrogID          PRESENT
27644       -28.207442        153.442328  2020-02-07T00:00:00Z  Litoria peronii  https://biodiversity.org.au/afd/taxa/c584f24b-...  61aa50a1-4c79-4fc3-b3ab-93538faa37b1           FrogID          PRESENT
27645       -28.207108        153.443021  2021-02-19T00:00:00Z  Litoria peronii  https://biodiversity.org.au/afd/taxa/c584f24b-...  0324b8d1-77b0-4bf3-9ec2-6ad9efff18f2           FrogID          PRESENT
27646       -28.186157        153.445556  2018-11-16T00:00:00Z  Litoria peronii  https://biodiversity.org.au/afd/taxa/c584f24b-...  bcf83a54-a900-4265-960a-9436356a7107           FrogID          PRESENT

[27647 rows x 8 columns]



Register your email by creating an ALA account

Download record occurrences of Peron’s tree frog (Litoria peronii) since 2018 in New South Wales by FrogID

Only select certain fields

galah_config(email = "your-email-here") # registered ALA email
galah_call() |>
  galah_identify("litoria peronii") |>
  galah_filter(year >= 2018,
               cl22 == "New South Wales",
               dataResourceName == "FrogID") |>
  galah_select(scientificName, decimalLongitude, decimalLatitude) |>
  atlas_occurrences()
# A tibble: 27,647 × 3
   scientificName  decimalLongitude decimalLatitude
   <chr>                      <dbl>           <dbl>
 1 Litoria peronii             151.           -33.1
 2 Litoria peronii             148.           -29.1
 3 Litoria peronii             150.           -34.5
 4 Litoria peronii             150.           -30.4
 5 Litoria peronii             150.           -30.3
 6 Litoria peronii             147.           -36.1
 7 Litoria peronii             151.           -33.1
 8 Litoria peronii             151.           -33.8
 9 Litoria peronii             152.           -31.2
10 Litoria peronii             151.           -33.9
# ℹ 27,637 more rows
galah.galah_config(email="your-email-here")
galah.atlas_occurrences(
  taxa="litoria peronii",
  filters=["year>=2018",
           "cl22=New South Wales",
           "dataResourceName=FrogID"],
  fields=["scientificName","decimalLongitude","decimalLatitude"]
)
        scientificName  decimalLongitude  decimalLatitude
0      Litoria peronii        151.262517       -33.147551
1      Litoria peronii        147.918000       -29.113300
2      Litoria peronii        150.360484       -34.469104
3      Litoria peronii        149.782270       -30.372720
4      Litoria peronii        149.750621       -30.338791
...                ...               ...              ...
27642  Litoria peronii        149.682467       -32.401231
27643  Litoria peronii        150.307065       -35.635308
27644  Litoria peronii        149.647894       -34.330005
27645  Litoria peronii        149.677576       -30.347631
27646  Litoria peronii        151.184877       -33.675905

[27647 rows x 3 columns]

Note: You only need to run galah_config() once per session

Make a map

Make a map

Load packages

library(dplyr)
library(ggplot2)
library(sf)      # for handling spatial objects
library(ozmaps)  # excellent australia maps

Download frog data

# Download data
frogs <- galah_call() |>
  galah_identify("litoria peronii") |>
  galah_filter(year >= 2018,
               cl22 == "New South Wales",
               dataResourceName == "FrogID") |>
  galah_select(scientificName, decimalLongitude, decimalLatitude) |>
  atlas_occurrences()
frogs
# A tibble: 27,647 × 3
   scientificName  decimalLongitude decimalLatitude
   <chr>                      <dbl>           <dbl>
 1 Litoria peronii             151.           -33.1
 2 Litoria peronii             148.           -29.1
 3 Litoria peronii             150.           -34.5
 4 Litoria peronii             150.           -30.4
 5 Litoria peronii             150.           -30.3
 6 Litoria peronii             147.           -36.1
 7 Litoria peronii             151.           -33.1
 8 Litoria peronii             151.           -33.8
 9 Litoria peronii             152.           -31.2
10 Litoria peronii             151.           -33.9
# ℹ 27,637 more rows

ozmap_states() contains AUS state/territory boundaries

# See what's in `ozmap_states`
ozmaps::ozmap_states
Simple feature collection with 9 features and 1 field
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 105.5507 ymin: -43.63203 xmax: 167.9969 ymax: -9.229287
Geodetic CRS:  GDA94
# A tibble: 9 × 2
  NAME                                                                  geometry
* <chr>                                                       <MULTIPOLYGON [°]>
1 New South Wales              (((150.7016 -35.12286, 150.6611 -35.11782, 150.6…
2 Victoria                     (((146.6196 -38.70196, 146.6721 -38.70259, 146.6…
3 Queensland                   (((148.8473 -20.3457, 148.8722 -20.37575, 148.85…
4 South Australia              (((137.3481 -34.48242, 137.3749 -34.46885, 137.3…
5 Western Australia            (((126.3868 -14.01168, 126.3625 -13.98264, 126.3…
6 Tasmania                     (((147.8397 -40.29844, 147.8902 -40.30258, 147.8…
7 Northern Territory           (((136.3669 -13.84237, 136.3339 -13.83922, 136.3…
8 Australian Capital Territory (((149.2317 -35.222, 149.2346 -35.24047, 149.271…
9 Other Territories            (((167.9333 -29.05421, 167.9188 -29.0344, 167.93…

Filter to NSW boundary

# Get map of New South Wales
nsw <- ozmaps::ozmap_states |>
  filter(NAME == "New South Wales")
nsw
Simple feature collection with 1 feature and 1 field
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 140.9993 ymin: -37.50503 xmax: 153.6299 ymax: -28.15703
Geodetic CRS:  GDA94
# A tibble: 1 × 2
  NAME                                                                  geometry
* <chr>                                                       <MULTIPOLYGON [°]>
1 New South Wales (((150.7016 -35.12286, 150.6611 -35.11782, 150.6373 -35.14688…

Make sure map is in correct spatial projection (ALA records are in WGS84)

nsw <- nsw |>
  sf::st_transform(crs = st_crs("WGS84")) 
nsw
Simple feature collection with 1 feature and 1 field
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 140.9993 ymin: -37.50502 xmax: 153.6299 ymax: -28.15702
Geodetic CRS:  WGS 84
# A tibble: 1 × 2
  NAME                                                                  geometry
* <chr>                                                       <MULTIPOLYGON [°]>
1 New South Wales (((150.7016 -35.12285, 150.6611 -35.11781, 150.6373 -35.14687…
# see map
ggplot() + geom_sf(data = nsw, fill = "white")

Make map

# Map frog observations
ggplot() +
  geom_sf(data = nsw,
          fill = "white",
          colour = "grey70") +
  geom_point(data = frogs,
             aes(x = decimalLongitude,
                 y = decimalLatitude),
             colour = "#6fab3f",
             alpha = 0.5) + 
  theme_void()

Load libraries

import galah
from matplotlib import pyplot as plt
import geopandas as gpd

Get Peron’s tree frog occurrences

frogs = galah.atlas_occurrences(
  taxa="litoria peronii",
  filters=["year>=2018",
           "cl22=New South Wales",
           "dataResourceName=FrogID"],
  fields=["scientificName","decimalLongitude","decimalLatitude"]
)
frogs
        scientificName  decimalLongitude  decimalLatitude
0      Litoria peronii        151.262517       -33.147551
1      Litoria peronii        147.918000       -29.113300
2      Litoria peronii        150.360484       -34.469104
3      Litoria peronii        149.782270       -30.372720
4      Litoria peronii        149.750621       -30.338791
...                ...               ...              ...
27642  Litoria peronii        149.682467       -32.401231
27643  Litoria peronii        150.307065       -35.635308
27644  Litoria peronii        149.647894       -34.330005
27645  Litoria peronii        149.677576       -30.347631
27646  Litoria peronii        151.184877       -33.675905

[27647 rows x 3 columns]

Get Australian state and territory boundaries (link to shapefile).
Select New South Wales

states = gpd.read_file("STE_2021_AUST_GDA94.shp")
print(states.crs)
EPSG:4283
states
  STE_CODE21                    STE_NAME21 CHG_FLAG21  CHG_LBL21 AUS_CODE21         AUS_NAME21    AREASQKM21                                       LOCI_URI21                                           geometry
0          1               New South Wales          0  No change        AUS          Australia  8.007977e+05  http://linked.data.gov.au/dataset/asgsed3/STE/1  MULTIPOLYGON (((159.06230 -31.50887, 159.06217...
1          2                      Victoria          0  No change        AUS          Australia  2.274962e+05  http://linked.data.gov.au/dataset/asgsed3/STE/2  MULTIPOLYGON (((146.29286 -39.15779, 146.29341...
2          3                    Queensland          0  No change        AUS          Australia  1.730171e+06  http://linked.data.gov.au/dataset/asgsed3/STE/3  MULTIPOLYGON (((142.53139 -10.68302, 142.53071...
3          4               South Australia          0  No change        AUS          Australia  9.842314e+05  http://linked.data.gov.au/dataset/asgsed3/STE/4  MULTIPOLYGON (((140.66024 -38.06257, 140.66005...
4          5             Western Australia          0  No change        AUS          Australia  2.526632e+06  http://linked.data.gov.au/dataset/asgsed3/STE/5  MULTIPOLYGON (((117.86952 -35.19109, 117.86960...
5          6                      Tasmania          0  No change        AUS          Australia  6.801754e+04  http://linked.data.gov.au/dataset/asgsed3/STE/6  MULTIPOLYGON (((144.60439 -41.01002, 144.60442...
6          7            Northern Territory          0  No change        AUS          Australia  1.348134e+06  http://linked.data.gov.au/dataset/asgsed3/STE/7  MULTIPOLYGON (((133.02817 -10.90841, 133.02981...
7          8  Australian Capital Territory          0  No change        AUS          Australia  2.358133e+03  http://linked.data.gov.au/dataset/asgsed3/STE/8  POLYGON ((149.06238 -35.15911, 149.09134 -35.1...
8          9             Other Territories          0  No change        AUS          Australia  2.557420e+02  http://linked.data.gov.au/dataset/asgsed3/STE/9  MULTIPOLYGON (((167.94747 -29.12758, 167.94748...
9          Z             Outside Australia          1        New        ZZZ  Outside Australia           NaN  http://linked.data.gov.au/dataset/asgsed3/STE/Z                                               None

Plot New South Wales

states = states.to_crs(4326)
states[states["STE_NAME21"] == "New South Wales"].plot(edgecolor = "#5A5A5A", linewidth = 0.5, facecolor = "white", figsize = (24,10))

Add occurrence records to the map

ax = states[states["STE_NAME21"] == "New South Wales"].plot(edgecolor = "#5A5A5A", linewidth = 0.5, facecolor = "white", figsize = (24,10))
plt.scatter(frogs['decimalLongitude'],frogs['decimalLatitude'], c = "#6fab3f", alpha = 0.5)

Help & other resources

Help & other resources


For code references & help getting started:


Quick code reference:


To learn to how to use data for analyses and dataviz:

Thank you

Dax Kellie
Data Analyst (galah-R)
Science & Decision Support | ALA
: dax.kellie@csiro.au
: @daxkellie
: @daxkellie

Amanda Buyan
Data Analyst (galah-python)
Science & Decision Support | ALA
: amanda.buyan@csiro.au
: @acbuyan

galah development team
Martin Westgate, Shandiya Balasubramaniam
Matilda Stevenson, Caitlin Ramsey
Peggy Newman
These slides were made using Quarto