# OpenClimate-pyclient

[](https://openclimate-pyclient.readthedocs.io/en/latest/?badge=latest)
[](https://pypi.org/project/openclimate)
[](https://github.com/python/black)
[](https://opensource.org/licenses/Apache-2.0)
[](https://mybinder.org/v2/gh/Open-Earth-Foundation/OpenClimate-pyclient/HEAD?urlpath=lab/tree/docs/notebooks/)
[](https://github.com/Open-Earth-Foundation/OpenClimate-pyclient/issues)
OpenClimate Python Client is a Python 3.8+ package for the [OpenClimate API](https://github.com/Open-Earth-Foundation/OpenClimate/blob/develop/api/API.md). The goal of this package is to make emissions data and pledges more accessible.
# Installation
```
pip install openclimate
```
# Usage
Import and create a `Client()` object
```python
from openclimate import Client
client = Client()
```
## Retrieving data
### Emissions
Retrieve all emissions data for a single actor. Here I am retrieving emissions data for Canada
```python
df = client.emissions(actor_id='CA')
```
Retrieve all emissions data for a list of actors. Here I am retrieving emission data for the United States, Canada, and Great Britain.
```python
df = client.emissions(actor_id=['US','CA','GB'])
```
Return the different datasets available for a particular actor:
```python
df = client.emissions_datasets(actor_id='US')
```
Only select data for a particular dataset
```python
df = client.emissions_datasets(actor_id='US', datasource_id='GCB2022:national_fossil_emissions:v1.0')
```
### Targets
Retrieve emissions targets for a particule actor
```python
df = client.targets(actor_id='US')
```
### Population
Retrieve population data.
```python
df = client.population(actor_id=['US','CA','GB'])
```
### GDP
Retrieve GDP data.
```python
df = client.gdp(actor_id=['US','CA','GB'])
```
## Searching for codes
use the following to list the actor_ids for countries:
```python
df = client.country_codes()
```
search for actor codes:
```python
df = client.search(query='Minnesota')
```
get all the parts of an actor. Here I am returning the actor_id for each US state.
```python
df = client.parts(actor_id='US',part_type='adm1')
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Open-Earth-Foundation/OpenClimate-pyclient",
"name": "openclimate",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "GHG,emissions,climate data",
"author": "Luke Gloege",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/be/4e/661f05d6eed742ab6cb7d1cf7a42240cc14ea7ede6abdca207e82afd5bc0/openclimate-0.1.5.tar.gz",
"platform": "unix",
"description": "# OpenClimate-pyclient\n\n\n[](https://openclimate-pyclient.readthedocs.io/en/latest/?badge=latest)\n[](https://pypi.org/project/openclimate)\n[](https://github.com/python/black)\n[](https://opensource.org/licenses/Apache-2.0)\n[](https://mybinder.org/v2/gh/Open-Earth-Foundation/OpenClimate-pyclient/HEAD?urlpath=lab/tree/docs/notebooks/)\n[](https://github.com/Open-Earth-Foundation/OpenClimate-pyclient/issues)\n\nOpenClimate Python Client is a Python 3.8+ package for the [OpenClimate API](https://github.com/Open-Earth-Foundation/OpenClimate/blob/develop/api/API.md). The goal of this package is to make emissions data and pledges more accessible.\n\n# Installation\n```\npip install openclimate\n```\n\n# Usage\nImport and create a `Client()` object\n```python\nfrom openclimate import Client\nclient = Client()\n```\n\n## Retrieving data\n\n### Emissions\nRetrieve all emissions data for a single actor. Here I am retrieving emissions data for Canada\n```python\ndf = client.emissions(actor_id='CA')\n```\n\nRetrieve all emissions data for a list of actors. Here I am retrieving emission data for the United States, Canada, and Great Britain.\n```python\ndf = client.emissions(actor_id=['US','CA','GB'])\n```\n\nReturn the different datasets available for a particular actor:\n```python\ndf = client.emissions_datasets(actor_id='US')\n```\n\nOnly select data for a particular dataset\n```python\ndf = client.emissions_datasets(actor_id='US', datasource_id='GCB2022:national_fossil_emissions:v1.0')\n```\n\n### Targets\nRetrieve emissions targets for a particule actor\n```python\ndf = client.targets(actor_id='US')\n```\n\n### Population\nRetrieve population data.\n```python\ndf = client.population(actor_id=['US','CA','GB'])\n```\n\n### GDP\nRetrieve GDP data.\n```python\ndf = client.gdp(actor_id=['US','CA','GB'])\n```\n\n## Searching for codes\nuse the following to list the actor_ids for countries:\n```python\ndf = client.country_codes()\n```\n\nsearch for actor codes:\n```python\ndf = client.search(query='Minnesota')\n```\n\nget all the parts of an actor. Here I am returning the actor_id for each US state.\n```python\ndf = client.parts(actor_id='US',part_type='adm1')\n```\n",
"bugtrack_url": null,
"license": "Apache",
"summary": "Python client for OpenClimate API",
"version": "0.1.5",
"split_keywords": [
"ghg",
"emissions",
"climate data"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9df2f09de9c28fd0e4c656e5ababf84be0876290a62892062753eea85f7984c1",
"md5": "ab997bffa02d67af0725808bac06dff9",
"sha256": "226f4671ac07b2772a560900ea4ae34a3937d85200f9e093bc8e118e6ef101fa"
},
"downloads": -1,
"filename": "openclimate-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ab997bffa02d67af0725808bac06dff9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 18250,
"upload_time": "2023-04-16T18:06:02",
"upload_time_iso_8601": "2023-04-16T18:06:02.088050Z",
"url": "https://files.pythonhosted.org/packages/9d/f2/f09de9c28fd0e4c656e5ababf84be0876290a62892062753eea85f7984c1/openclimate-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "be4e661f05d6eed742ab6cb7d1cf7a42240cc14ea7ede6abdca207e82afd5bc0",
"md5": "f180cb7944125518240dcd1cb5fe2679",
"sha256": "cee9d4140da99815421786a736d0ed31b464cb1268caf4b4ad98c8912b9d765b"
},
"downloads": -1,
"filename": "openclimate-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "f180cb7944125518240dcd1cb5fe2679",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 17682,
"upload_time": "2023-04-16T18:06:08",
"upload_time_iso_8601": "2023-04-16T18:06:08.127990Z",
"url": "https://files.pythonhosted.org/packages/be/4e/661f05d6eed742ab6cb7d1cf7a42240cc14ea7ede6abdca207e82afd5bc0/openclimate-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-16 18:06:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Open-Earth-Foundation",
"github_project": "OpenClimate-pyclient",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "openclimate"
}