Skip to main content

OpenGHG - a cloud platform for greenhouse gas data analysis

Project description

OpenGHG logo

OpenGHG - a cloud platform for greenhouse gas data analysis and collaboration

License OpenGHG tests

OpenGHG is a project based on the prototype HUGS platform which aims to be a platform for collaboration and analysis of greenhouse gas (GHG) data.

The platform will be built on open-source technologies and will allow researchers to collaborate on large datasets by harnessing the power and scalability of the cloud.

For more information please see our documentation.

Install locally

To run OpenGHG locally you'll need Python 3.8 or later on Linux or MacOS, we don't currently support Windows.

You can install OpenGHG using pip or conda, though conda allows the complete functionality to be accessed at once.

Using pip

To use pip, first create a virtual environment

python -m venv openghg_env

Then activate the environment

source openghg_env/bin/activate

It's best to make sure you have the most up to date versions of the packages that pip will use behind the scenes when installing OpenGHG.

pip install --upgrade pip wheel setuptools

Then we can install OpenGHG itself

pip install openghg

Each time you use OpenGHG please make sure to activate the environment using the source step above.

NOTE: Some functionality is not completely accessible when OpenGHG is installed with pip. This only affects some map regridding functionality. See the Additional Functionality section below for more information.

Using conda

To get OpenGHG installed using conda we'll first create a new environment

conda create --name openghg_env

Then activate the environment

conda activate openghg_env

Then install OpenGHG and its dependencies from our conda channel and conda-forge.

conda install --channel conda-forge --channel openghg openghg

Note: the xesmf library is already incorporated into the conda install from vx.x onwards and so does not need to be installed separately.

Create the configuration file

OpenGHG stores object store and user data in a configuration file in the user's home directory at ~/.config/openghg/openghg.conf. As this sets the path of the object store, the user must create this file in one of two ways

Command line

Using the openghg command line tool

openghg --quickstart

OpenGHG configuration
---------------------

Enter path for object store (default /home/gareth/openghg_store):
INFO:openghg.util:Creating config at /home/gareth/.config/openghg/openghg.conf

INFO:openghg.util:Configuration written to /home/gareth/.config/openghg/openghg.conf

Python

Using the create_config function from the openghg.util submodule.

from openghg.util import create_config

create_config()

OpenGHG configuration
---------------------

Enter path for object store (default /home/gareth/openghg_store):
INFO:openghg.util:Creating config at /home/gareth/.config/openghg/openghg.conf

INFO:openghg.util:Configuration written to /home/gareth/.config/openghg/openghg.conf

You will be prompted to enter the path to the object store, leaving the prompt empty tells OpenGHG to use the default path in the user's home directory at ~/openghg_store.

Additional functionality

Some optional functionality is available within OpenGHG to allow for multi-dimensional regridding of map data (openghg.tranform sub-module). This makes use of the xesmf package. This Python library is built upon underlying FORTRAN and C libraries (ESMF) which cannot be installed directly within a Python virtual environment.

To use this functionality these libraries must be installed separately. One suggestion for how to do this is as follows.

If still within the created virtual environment, exit this using

deactivate

We will need to create a conda environment to contain just the additional C and FORTRAN libraries necessary for the xesmf module (and dependencies) to run. This can be done by installing the esmf package using conda

conda create --name openghg_add esmf -c conda-forge

Then activate the Python virtual environment in the same way as above:

source openghg_env/bin/activate

Run the following lines to link the Python virtual environment to the installed dependencies, doing so by installing the esmpy Python wrapper (a dependency of xesmf):

ESMFVERSION='v'$(conda list -n openghg_add esmf | tail -n1 | awk '{print $2}')
$ export ESMFMKFILE="$(conda env list | grep openghg_add | awk '{print $2}')/lib/esmf.mk"
$ pip install "git+https://github.com/esmf-org/esmf.git@${ESMFVERSION}#subdirectory=src/addon/ESMPy/"

Note: The pip install command above for esmf module may produce an AttributeError. At present (19/07/2022) an error of this type is expected and may not mean the xesmf module cannot be installed. This error will be fixed if PR #49 is merged.

Now the dependencies have all been installed, the xesmf library can be installed within the virtual environment

pip install xesmf

Developers

If you'd like to contribute to OpenGHG please see the contributing section of our documentation. If you'd like to take a look at the source and run the tests follow the steps below.

Clone

git clone https://github.com/openghg/openghg.git

Install dependencies

We recommend you create a virtual environment first

python -m venv openghg_env

Then activate the environment

source openghg_env/bin/activate

Then install the dependencies

cd openghg
pip install --upgrade pip wheel setuptools
pip install -r requirements.txt -r requirements-dev.txt

Next you can install OpenGHG in editable mode using the -e flag. This installs the package from the local path and means any changes you make to the code will be immediately available when using the package.

pip install -e .

OpenGHG should now be installed in your virtual environment.

See above for additional steps to install the xesmf library as required.

Run the tests

To run the tests

pytest -v tests/

NOTE: Some of the tests require the udunits2 library to be installed.

The udunits package is not pip installable so we've added a separate flag to specifically run these tests. If you're on Debian / Ubuntu you can do

sudo apt-get install libudunits2-0

Running CF Checker tests

You can then run the cfchecks marked tests using

pytest -v --run-cfchecks tests/

Running ICOS tests

Some of our tests retrieve data from the ICOS Carbon Portal and so to avoid load on the ICOS severs these should not be run frequently. They should only be run when working on this functionality or before a release. These tests are marked icos with pytest.mark.

pytest -v --run-icos tests/

If all the tests pass then you're good to go. If they don't please open an issue and let us know some details about your setup.

Documentation

For further documentation and tutorials please visit our documentation.

Community

If you'd like further help or would like to talk to one of the developers of this project, please join our Gitter at gitter.im/openghg/lobby.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openghg-0.10.1.tar.gz (311.6 kB view details)

Uploaded Source

Built Distribution

openghg-0.10.1-py3-none-any.whl (355.5 kB view details)

Uploaded Python 3

File details

Details for the file openghg-0.10.1.tar.gz.

File metadata

  • Download URL: openghg-0.10.1.tar.gz
  • Upload date:
  • Size: 311.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.10

File hashes

Hashes for openghg-0.10.1.tar.gz
Algorithm Hash digest
SHA256 18e8bd04fe17150db39856670f6fd9c6fb114625a2df7dba1099694b00a0a228
MD5 9d9e89350ec12e7f481731c0f678aded
BLAKE2b-256 6c1ce9ef9f0a1850761c640011b5ebe6b682082ebee32d2dda0eebc7f87f5141

See more details on using hashes here.

File details

Details for the file openghg-0.10.1-py3-none-any.whl.

File metadata

  • Download URL: openghg-0.10.1-py3-none-any.whl
  • Upload date:
  • Size: 355.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.10

File hashes

Hashes for openghg-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 626171bc1678dc06a66ace2de89e9f53dfa42b8d6a3c9b5225e602417638844f
MD5 87e92a80c176a9f9832550c85f99dcf8
BLAKE2b-256 8ebc47bb2c420e2980ef062cacd60cdea02b67b79060417992e02e4cdfdc44b3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page