Skip to content

Commit

Permalink
Rename eBird database entries for versioning.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 550567137
  • Loading branch information
Bart van Merriënboer authored and copybara-github committed Jul 24, 2023
1 parent ae6721e commit 4be50b7
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 54 deletions.
10 changes: 7 additions & 3 deletions chirp/data/bird_taxonomy/bird_taxonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,17 @@ class BirdTaxonomy(tfds.core.GeneratorBasedBuilder):
'chirp.audio_utils.slice_peaked_audio.'
),
data_processing_query=fsu.QuerySequence([
fsu.filter_in_class_list('species_code', 'global_seabirds'),
fsu.filter_in_class_list(
'species_code', 'ebird2021_global_seabirds'
),
fsu.scrub_all_but_class_list(
'bg_species_codes', 'global_seabirds'
'bg_species_codes', 'ebird2021_global_seabirds'
),
]),
metadata_processing_query=fsu.QuerySequence([
fsu.filter_in_class_list('species_code', 'global_seabirds'),
fsu.filter_in_class_list(
'species_code', 'ebird2021_global_seabirds'
),
]),
),
]
Expand Down
90 changes: 45 additions & 45 deletions chirp/taxonomy/taxonomy_database.json
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@
],
"namespace": "audioset"
},
"bird_families": {
"ebird2021_families": {
"classes": [
"acanthisittidae",
"acanthizidae",
Expand Down Expand Up @@ -1053,9 +1053,9 @@
"zeledoniidae",
"zosteropidae"
],
"namespace": "bird_families"
"namespace": "ebird2021_families"
},
"bird_families_2022": {
"ebird2022_families": {
"classes": [
"acanthisittidae",
"acanthizidae",
Expand Down Expand Up @@ -1307,9 +1307,9 @@
"zeledoniidae",
"zosteropidae"
],
"namespace": "bird_families_2022"
"namespace": "ebird2022_families"
},
"bird_genera": {
"ebird2021_genera": {
"classes": [
"abeillia",
"abroscopus",
Expand Down Expand Up @@ -3706,9 +3706,9 @@
"zosterops",
"zosterornis"
],
"namespace": "bird_genera"
"namespace": "ebird2021_genera"
},
"bird_genera_2022": {
"ebird2022_genera": {
"classes": [
"abeillia",
"abroscopus",
Expand Down Expand Up @@ -6109,9 +6109,9 @@
"zosterops",
"zosterornis"
],
"namespace": "bird_genera_2022"
"namespace": "ebird2022_genera"
},
"bird_orders": {
"ebird2021_orders": {
"classes": [
"accipitriformes",
"anseriformes",
Expand Down Expand Up @@ -6155,9 +6155,9 @@
"tinamiformes",
"trogoniformes"
],
"namespace": "bird_orders"
"namespace": "ebird2021_orders"
},
"bird_orders_2022": {
"ebird2022_orders": {
"classes": [
"accipitriformes",
"anseriformes",
Expand Down Expand Up @@ -6201,7 +6201,7 @@
"tinamiformes",
"trogoniformes"
],
"namespace": "bird_orders_2022"
"namespace": "ebird2022_orders"
},
"birdclef2019_colombia": {
"classes": [
Expand Down Expand Up @@ -11233,7 +11233,7 @@
],
"namespace": "ebird2021"
},
"clements": {
"ebird2021_clements": {
"classes": [
"abeillia abeillei",
"abroscopus albogularis",
Expand Down Expand Up @@ -27989,9 +27989,9 @@
"zosterornis striatus",
"zosterornis whiteheadi"
],
"namespace": "clements"
"namespace": "ebird2021_clements"
},
"clements_2022": {
"ebird2022_clements": {
"classes": [
"abeillia abeillei",
"abroscopus albogularis",
Expand Down Expand Up @@ -44854,7 +44854,7 @@
"zosterornis striatus",
"zosterornis whiteheadi"
],
"namespace": "clements_2022"
"namespace": "ebird2022_clements"
},
"coffee_farms": {
"classes": [
Expand Down Expand Up @@ -108169,7 +108169,7 @@
],
"namespace": "audioset"
},
"global_seabirds": {
"ebird2021_global_seabirds": {
"classes": [
"adepen1",
"angpet1",
Expand Down Expand Up @@ -120339,14 +120339,14 @@
"alcidae",
"scolopacidae"
],
"namespace": "bird_families"
"namespace": "ebird2021_families"
},
"seabird_orders": {
"classes": [
"sphenisciformes",
"procellariiformes"
],
"namespace": "bird_orders"
"namespace": "ebird2021_orders"
},
"sierra_nevadas": {
"classes": [
Expand Down Expand Up @@ -180283,7 +180283,7 @@
"zothaw": "accipitridae"
},
"source_namespace": "ebird2021_species",
"target_namespace": "bird_families"
"target_namespace": "ebird2021_families"
},
"ebird2021_species_to_genus": {
"mapped_pairs": {
Expand Down Expand Up @@ -191113,7 +191113,7 @@
"zothaw": "buteo"
},
"source_namespace": "ebird2021_species",
"target_namespace": "bird_genera"
"target_namespace": "ebird2021_genera"
},
"ebird2021_species_to_order": {
"mapped_pairs": {
Expand Down Expand Up @@ -201943,7 +201943,7 @@
"zothaw": "accipitriformes"
},
"source_namespace": "ebird2021_species",
"target_namespace": "bird_orders"
"target_namespace": "ebird2021_orders"
},
"ebird2021_to_family": {
"mapped_pairs": {
Expand Down Expand Up @@ -218689,7 +218689,7 @@
"zothaw": "accipitridae"
},
"source_namespace": "ebird2021",
"target_namespace": "bird_families"
"target_namespace": "ebird2021_families"
},
"ebird2021_to_genus": {
"mapped_pairs": {
Expand Down Expand Up @@ -235344,7 +235344,7 @@
"zothaw": "buteo"
},
"source_namespace": "ebird2021",
"target_namespace": "bird_genera"
"target_namespace": "ebird2021_genera"
},
"ebird2021_to_order": {
"mapped_pairs": {
Expand Down Expand Up @@ -252101,7 +252101,7 @@
"zothaw": "accipitriformes"
},
"source_namespace": "ebird2021",
"target_namespace": "bird_orders"
"target_namespace": "ebird2021_orders"
},
"ebird2021_to_species": {
"mapped_pairs": {
Expand Down Expand Up @@ -270480,7 +270480,7 @@
"source_namespace": "ebird2022_issf",
"target_namespace": "ebird2022_species"
},
"ebird2022_species_to_family_2022": {
"ebird2022_species_to_family": {
"mapped_pairs": {
"aakspa1": "passeridae",
"abbbab1": "pellorneidae",
Expand Down Expand Up @@ -281390,9 +281390,9 @@
"zothaw": "accipitridae"
},
"source_namespace": "ebird2022_species",
"target_namespace": "bird_families_2022"
"target_namespace": "ebird2022_families"
},
"ebird2022_species_to_genus_2022": {
"ebird2022_species_to_genus": {
"mapped_pairs": {
"aakspa1": "passer",
"abbbab1": "malacocincla",
Expand Down Expand Up @@ -292302,9 +292302,9 @@
"zothaw": "buteo"
},
"source_namespace": "ebird2022_species",
"target_namespace": "bird_genera_2022"
"target_namespace": "ebird2022_genera"
},
"ebird2022_species_to_order_2022": {
"ebird2022_species_to_order": {
"mapped_pairs": {
"aakspa1": "passeriformes",
"abbbab1": "passeriformes",
Expand Down Expand Up @@ -303214,9 +303214,9 @@
"zothaw": "accipitriformes"
},
"source_namespace": "ebird2022_species",
"target_namespace": "bird_orders_2022"
"target_namespace": "ebird2022_orders"
},
"ebird2022_to_family_2022": {
"ebird2022_to_family": {
"mapped_pairs": {
"aakspa1": "passeridae",
"abbbab1": "pellorneidae",
Expand Down Expand Up @@ -320067,9 +320067,9 @@
"zothaw": "accipitridae"
},
"source_namespace": "ebird2022",
"target_namespace": "bird_families_2022"
"target_namespace": "ebird2022_families"
},
"ebird2022_to_genus_2022": {
"ebird2022_to_genus": {
"mapped_pairs": {
"aakspa1": "passer",
"abbbab1": "malacocincla",
Expand Down Expand Up @@ -336825,9 +336825,9 @@
"zothaw": "buteo"
},
"source_namespace": "ebird2022",
"target_namespace": "bird_genera_2022"
"target_namespace": "ebird2022_genera"
},
"ebird2022_to_order_2022": {
"ebird2022_to_order": {
"mapped_pairs": {
"aakspa1": "passeriformes",
"abbbab1": "passeriformes",
Expand Down Expand Up @@ -353689,7 +353689,7 @@
"zothaw": "accipitriformes"
},
"source_namespace": "ebird2022",
"target_namespace": "bird_orders_2022"
"target_namespace": "ebird2022_orders"
},
"ebird2022_to_species": {
"mapped_pairs": {
Expand Down Expand Up @@ -391806,7 +391806,7 @@
"/t/dd00140"
]
},
"bird_families": {
"ebird2021_families": {
"classes": [
"acanthisittidae",
"acanthizidae",
Expand Down Expand Up @@ -392059,7 +392059,7 @@
"zosteropidae"
]
},
"bird_families_2022": {
"ebird2022_families": {
"classes": [
"acanthisittidae",
"acanthizidae",
Expand Down Expand Up @@ -392312,7 +392312,7 @@
"zosteropidae"
]
},
"bird_genera": {
"ebird2021_genera": {
"classes": [
"abeillia",
"abroscopus",
Expand Down Expand Up @@ -394710,7 +394710,7 @@
"zosterornis"
]
},
"bird_genera_2022": {
"ebird2022_genera": {
"classes": [
"abeillia",
"abroscopus",
Expand Down Expand Up @@ -397112,7 +397112,7 @@
"zosterornis"
]
},
"bird_orders": {
"ebird2021_orders": {
"classes": [
"accipitriformes",
"anseriformes",
Expand Down Expand Up @@ -397157,7 +397157,7 @@
"trogoniformes"
]
},
"bird_orders_2022": {
"ebird2022_orders": {
"classes": [
"accipitriformes",
"anseriformes",
Expand Down Expand Up @@ -399640,7 +399640,7 @@
"Zosterops virens"
]
},
"clements": {
"ebird2021_clements": {
"classes": [
"abeillia abeillei",
"abroscopus albogularis",
Expand Down Expand Up @@ -416397,7 +416397,7 @@
"zosterornis whiteheadi"
]
},
"clements_2022": {
"ebird2022_clements": {
"classes": [
"abeillia abeillei",
"abroscopus albogularis",
Expand Down
12 changes: 6 additions & 6 deletions chirp/tests/namespace_db_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def test_load_namespace_db(self):
db = namespace_db.load_db()
for namespace_name in [
'ebird2021',
'bird_genera',
'bird_families',
'bird_orders',
'ebird2021_genera',
'ebird2021_families',
'ebird2021_orders',
]:
self.assertIn(namespace_name, db.namespaces)
# Also check that each namespace is represented as a ClassList.
Expand All @@ -45,17 +45,17 @@ def test_load_namespace_db(self):

genus_mapping = db.mappings['ebird2021_to_genus']
caples_genera = caples_list.apply_namespace_mapping(genus_mapping)
self.assertEqual(caples_genera.namespace, 'bird_genera')
self.assertEqual(caples_genera.namespace, 'ebird2021_genera')
self.assertLen(caples_genera.classes, 62)

family_mapping = db.mappings['ebird2021_to_family']
caples_families = caples_list.apply_namespace_mapping(family_mapping)
self.assertEqual(caples_families.namespace, 'bird_families')
self.assertEqual(caples_families.namespace, 'ebird2021_families')
self.assertLen(caples_families.classes, 30)

order_mapping = db.mappings['ebird2021_to_order']
caples_orders = caples_list.apply_namespace_mapping(order_mapping)
self.assertEqual(caples_orders.namespace, 'bird_orders')
self.assertEqual(caples_orders.namespace, 'ebird2021_orders')
self.assertLen(caples_orders.classes, 11)

def test_class_maps(self):
Expand Down

0 comments on commit 4be50b7

Please sign in to comment.