Skip to content

ISI-MIP/isimip-utils

Repository files navigation

ISIMIP utils

Python Version License CI status Latest release DOI

ISIMIP offers a framework for consistently projecting the impacts of climate change across affected sectors and spatial scales. An international network of climate-impact modellers contribute to a comprehensive and consistent picture of the world under different climate-change scenarios.

This package contains various utility methods for use in custom scripts as well as in different ISIMIP tools:

The different methods are described are documented at https://utils.isimip.org.

Setup

Using the package requires a running Python 3 on your system. The installation for different systems is covered here.

Unless you already use an environment manager (e.g. conda or uv), it is highly recommended to use a virtual environment, which can be created using:

python3 -m venv env
source env/bin/activate  # needs to be invoked in every new terminal session

The package itself can be installed via pip:

pip install isimip-utils

For a development setup, the repo should be cloned and installed in editable mode:

git clone git@github.com:ISI-MIP/isimip-utils
pip install -e isimip-utils

Usage

Once installed, the modules can be used like any other Python library, e.g. in order to create a ISIMIP compliant NetCDF file, you can use:

from isimip_utils.xarray import init_dataset, write_dataset

time = np.arrange(0, 365, dtype=np.float64)
var = np.ones((365, 360, 720), dtype=np.float32)

attrs={
    'global': {
        'contact': 'mail@example.com'
    },
    'var': {
        'standard_name': 'var',
        'long_name': 'Variable',
        'units': '1',
    }
}

# create an xarray.Dataset
ds = init_dataset(time=time, var=var, attrs=attrs)

# write the dataset as NetCDF file
write_dataset(ds, 'output.nc')

Please also note our examples page and the API reference.

About

Common functionality for custom scripts and ISIMIP tools

Resources

License

Stars

Watchers

Forks

Contributors

Languages