ISI-MIP / isimip-client

A thin client library to use the API of the ISIMIP repository using Python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

isimip-client

Latest release PyPI release Python Version License

A thin client library to use the API of the ISIMIP repository using Python.

Setup

The library is written in Python (> 3.6) uses only dependencies, which can be installed without administrator priviledges. The installation of Python (and its developing packages), however differs from operating system to operating system. Optional Git is needed if the application is installed directly from GitHub. The installation of Python 3 and Git for different plattforms is documented here.

The library can be installed via pip. Usually you want to create a virtual environment first, but this is optional:

# setup venv on Linux/macOS/Windows WSL
python3 -m venv env
source env/bin/activate

# setup venv on Windows cmd
python -m venv env
call env\Scripts\activate.bat

The library can conveniently installed using pip:

pip install isimip-client

Usage

The library is used in the following way:

from isimip_client.client import ISIMIPClient
client = ISIMIPClient()

# search the ISIMIP repository using a search string
response = client.datasets(query='gfdl-esm4 ssp370 pr')

# search the ISIMIP repository for a specific subtree
response = client.datasets(tree='ISIMIP3b/InputData/climate/atmosphere/global/daily/ssp370/gfdl-esm4/r1i1p1f1/w5e5/pr')

# search the ISIMIP repository using specifiers
response = client.datasets(simulation_round='ISIMIP3b',
                           product='InputData',
                           climate_forcing='gfdl-esm4',
                           climate_scenario='ssp370',
                           climate_variable='pr')

In order to use the dev version of the repository use:

client = ISIMIPClient(data_url='https://dev.isimip.org/api/v1', auth=(USER, PASS))

More examples can be found in the notebooks directory.

Jupyter notebooks

I you want to run the included jupyter notebooks, you can install the additional packages using:

pip install isimip-client[jupyter]

Then Jupyter lab can be started using:

jupyter lab

The example notebooks are in the notebooks directory.

About

A thin client library to use the API of the ISIMIP repository using Python.

License:MIT License


Languages

Language:Jupyter Notebook 79.0%Language:Python 21.0%