OpenGHG is a platform for collaboration and analysis of greenhouse gas (GHG) data, inspired by the HUGS platform. It allows researchers to analyze and collaborate on large datasets using the scalability of the cloud.
For more information, please visit our documentation.
OpenGHG supports Python 3.10 and later on Linux or MacOS. To install the package, you can use either uv (recommended for its environment management abilities) or conda.
uv simplifies environment creation and dependency management, making it easy to manage your setup. To install OpenGHG using uv:
-
Install
uv:The
uvtool from Astral streamlines Python management, virtual environments, and package installation. Follow the recommended steps from the officialuvdocs:- Install from link
uv(Recommended "robust, Python-independent"):
- macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
- Install from pip (Alternative "requires existing Python + pip"):
pip install uv
- Install from link
-
Create and activate an environment for OpenGHG:
uv venv openghg-env
Additionally, a specific python version can be specified while creating the environment as follows.
uv venv openghg-env --python 3.11
To activate:
source openghg-env/bin/activate -
Install OpenGHG:
uv pip install openghg
This installs OpenGHG and its core dependencies.
To get OpenGHG installed using conda, follow these steps:
-
Create and activate a
condaenvironment:conda create --name openghg_env conda activate openghg_env
-
Install OpenGHG and its dependencies using the
conda-forgeandopenghgchannels:conda install --channel conda-forge --channel openghg openghg
Note: The optional xesmf library is pre-installed when using conda. No additional steps are required for regridding functionality.
Once OpenGHG is installed, you need to configure the object store and user data. OpenGHG stores its configuration file by default at:
~/.config/openghg/openghg.conf.
openghg --quickstartfrom openghg.util import create_config
create_config()When prompted, you can specify the path to the object store. Leave the field blank to use the default directory at ~/openghg_store.
If you'd like to contribute to OpenGHG, here are the steps to set up a development environment. You can use either uv or conda.
-
Clone the repository:
git clone https://github.com/openghg/openghg.git cd openghg -
Create and activate an environment for OpenGHG:
uv venv
A python environment with name can also be created, as showed in non-developer instance previously. Additionally, a specific python version can be specified while creating the environment as follows.
uv venv --python 3.11
Note: If the virtual environment is not named, the .venv folder is created at the directory level, and using commands like "uv add" or "uv pip install" will automatically detect the environment and install the packages.
To activate:
source .venv/bin/activate -
Install development dependencies and the package in editable mode:
uv sync --all-extras
This ensures that the local repository is installed in editable mode, meaning changes to the source code are immediately reflected. It will also ensure that all the dev and documentation dependencies are installed in the environment.
For more details, please refer to the UV Documentation (sync).
-
Clone the repository:
git clone https://github.com/openghg/openghg.git cd openghg -
Create and activate a
condaenvironment:conda create --name openghg-dev python=3.12 conda activate openghg-dev
-
Install development dependencies:
pip install --upgrade pip wheel setuptools pip install -e ".[dev]"
OpenGHG uses pytest for testing. After setting up the development environment, you can run tests as follows:
pytest -v tests/-
CF Checker Tests: Install the
udunits2library for certain tests:sudo apt-get install libudunits2-0 pytest -v --run-cfchecks tests/
-
ICOS Tests: These tests access the ICOS Carbon Portal and should be run sparingly:
pytest -v --run-icos tests/
If you encounter issues, please open a GitHub issue.
OpenGHG's optional functionality includes the xesmf module for map regridding.
Note that xesmf is not installed by default with the core OpenGHG package.
- When using
uv, install it explicitly, for example:uv add xesmf
- For conda install of xesmf
conda install -c conda-forge xesmf
For further details, refer to our documentation.
We encourage contributions and are happy to assist where needed. Raise issues and pull requests in our repository.
For further information, check out our documentation.
