Install

pip install pygbif

Registry/datasets


In [1]:
from pygbif import registry
registry.dataset_metrics(uuid='3f8a1297-3259-4700-91fc-acc4170b27ce')


Out[1]:
{u'colCoveragePct': 76,
 u'colMatchingCount': 22483,
 u'countByConstituent': {},
 u'countByIssue': {u'BACKBONE_MATCH_NONE': 1338,
  u'VERNACULAR_NAME_INVALID': 7852},
 u'countByKingdom': {u'PLANTAE': 8949},
 u'countByOrigin': {u'PROPARTE': 10, u'SOURCE': 29260},
 u'countByRank': {u'CLASS': 1,
  u'FAMILY': 172,
  u'GENUS': 1251,
  u'ORDER': 55,
  u'SECTION': 326,
  u'SERIES': 40,
  u'SPECIES': 6071,
  u'SUBCLASS': 6,
  u'SUBFAMILY': 150,
  u'SUBGENUS': 101,
  u'SUBSECTION': 56,
  u'SUBSPECIES': 737,
  u'SUBTRIBE': 61,
  u'SUPERORDER': 12,
  u'TRIBE': 328,
  u'VARIETY': 871},
 u'countExtRecordsByExtension': {u'DESCRIPTION': 10213,
  u'DISTRIBUTION': 29143,
  u'IDENTIFIER': 0,
  u'MULTIMEDIA': 0,
  u'REFERENCE': 0,
  u'SPECIES_PROFILE': 0,
  u'TYPES_AND_SPECIMEN': 0,
  u'VERNACULAR_NAME': 32290},
 u'countNamesByLanguage': {u'ENGLISH': 20989, u'FRENCH': 11301},
 u'created': u'2016-07-27T20:34:07.015+0000',
 u'datasetKey': u'3f8a1297-3259-4700-91fc-acc4170b27ce',
 u'distinctNamesCount': 29254,
 u'downloaded': u'2016-07-27T20:34:07.013+0000',
 u'key': 55067,
 u'nubCoveragePct': 95,
 u'nubMatchingCount': 27932,
 u'otherCount': {},
 u'synonymsCount': 19032,
 u'usagesCount': 29270}

Taxonomic names


In [2]:
from pygbif import species
species.name_suggest(q='Puma concolor', limit = 1)


Out[2]:
{'data': [{u'canonicalName': u'Puma concolor',
   u'class': u'Mammalia',
   u'classKey': 359,
   u'family': u'Felidae',
   u'familyKey': 9703,
   u'genus': u'Puma',
   u'genusKey': 2435098,
   u'key': 2435099,
   u'kingdom': u'Animalia',
   u'kingdomKey': 1,
   u'nubKey': 2435099,
   u'order': u'Carnivora',
   u'orderKey': 732,
   u'parent': u'Puma',
   u'parentKey': 2435098,
   u'phylum': u'Chordata',
   u'phylumKey': 44,
   u'rank': u'SPECIES',
   u'scientificName': u'Puma concolor (Linnaeus, 1771)',
   u'species': u'Puma concolor',
   u'speciesKey': 2435099,
   u'status': u'ACCEPTED',
   u'synonym': False}],
 'hierarchy': [{u'1': u'Animalia',
   u'2435098': u'Puma',
   u'359': u'Mammalia',
   u'44': u'Chordata',
   u'732': u'Carnivora',
   u'9703': u'Felidae'}]}

Occurrence data

Search


In [3]:
from pygbif import occurrences
res = occurrences.search(taxonKey = 3329049, limit = 10)
[ x['phylum'] for x in res['results'] ]


Out[3]:
[u'Basidiomycota',
 u'Basidiomycota',
 u'Basidiomycota',
 u'Basidiomycota',
 u'Basidiomycota',
 u'Basidiomycota',
 u'Basidiomycota',
 u'Basidiomycota',
 u'Basidiomycota',
 u'Basidiomycota']

Fetch specific occurrences


In [5]:
occurrences.get(key = 1258202889)


Out[5]:
{u'basisOfRecord': u'PRESERVED_SPECIMEN',
 u'bibliographicCitation': u'http://www.tropicos.org/Specimen/100889255',
 u'catalogNumber': u'100889255',
 u'class': u'Magnoliopsida',
 u'classKey': 220,
 u'collectionCode': u'MO',
 u'collectionID': u'http://biocol.org/urn:lsid:biocol.org:col:15859',
 u'continent': u'NORTH_AMERICA',
 u'country': u'Panama',
 u'countryCode': u'PA',
 u'county': u'La Pintada',
 u'crawlId': 18,
 u'datasetKey': u'7bd65a7a-f762-11e1-a439-00145eb45e9a',
 u'datasetName': u'Tropicos',
 u'day': 11,
 u'decimalLatitude': 8.68,
 u'decimalLongitude': -80.60056,
 u'elevation': 753.0,
 u'eventDate': u'2016-01-11T00:00:00.000+0000',
 u'extensions': {},
 u'facts': [],
 u'family': u'Juglandaceae',
 u'familyKey': 2499,
 u'fieldNumber': u'9',
 u'gbifID': u'1258202889',
 u'genericName': u'Alfaroa',
 u'genus': u'Alfaroa',
 u'genusKey': 7310533,
 u'geodeticDatum': u'WGS84',
 u'identifier': u'urn:catalog:MO:Tropicos:100889255',
 u'identifiers': [],
 u'individualCount': 3,
 u'institutionCode': u'MO',
 u'issues': [u'COORDINATE_ROUNDED', u'GEODETIC_DATUM_ASSUMED_WGS84'],
 u'key': 1258202889,
 u'kingdom': u'Plantae',
 u'kingdomKey': 6,
 u'lastCrawled': u'2016-06-06T11:13:54.020+0000',
 u'lastInterpreted': u'2016-08-04T03:07:30.466+0000',
 u'lastParsed': u'2016-03-21T14:33:34.346+0000',
 u'license': u'http://creativecommons.org/licenses/by/4.0/legalcode',
 u'locality': u'Corregimiento del Harino. Parque Nacional General de Divisi\xf3n Omar Torrijos Herrera (PNGDOTH) el Cop\xe9, camino hacia La Rica, aproximadamente a 1.5 Km. al NO de la caba\xf1a de visitantes del parque. Parcela Los corazones 1 (PP-Corazones-1).',
 u'month': 1,
 u'nomenclaturalCode': u'ICNafp',
 u'nomenclaturalStatus': u'No opinion',
 u'occurrenceID': u'urn:catalog:MO:Tropicos:100889255',
 u'order': u'Fagales',
 u'orderKey': 1354,
 u'ownerInstitutionCode': u'MOBOT',
 u'phylum': u'Tracheophyta',
 u'phylumKey': 7707728,
 u'protocol': u'DWC_ARCHIVE',
 u'publishingCountry': u'US',
 u'publishingOrgKey': u'90fd6680-349f-11d8-aa2d-b8a03c50a862',
 u'recordNumber': u'Flores Jim\xe9nez 3724',
 u'recordedBy': u'Rodolfo Flores|M. Madrid|Y. Pe\xf1a|L. De Gracia V.|R. Berenguer|J. Rodr\xedguez|J. Vargas|A. Gonzalez C.|C. L\xf3pez V.|R. Vergara E.|H. Moreno',
 u'relations': [],
 u'rightsHolder': u'Missouri Botanical Garden',
 u'scientificName': u'Alfaroa Standl.',
 u'stateProvince': u'Cocl\xe9',
 u'taxonID': u'40009683',
 u'taxonKey': 7310533,
 u'taxonRank': u'GENUS',
 u'type': u'PhysicalObject',
 u'year': 2016}

Occurrence counts API


In [6]:
occurrences.count(isGeoreferenced = True)


Out[6]:
546341356