dependencies.md 3.07 KB

Project dependencies

Description

This project requires these following dependencies.

NetCDF4

  • NetCDF is C library to read and edit NetCDF files;
  • NetCDF4 is a Python wrapper for NetCDF, which requires the NetCDF library, used here to read NetCDF files.

-> Documentation is available here.

pycdf

  • SpacePy is a python package for space sciences;
  • pycdf is a SpacePy sub-package used to read and write CDF files.

-> Documentation is available here.

Sphinx

Sphinx is a documentation generator for Python projects.

-> Documentation is available here.

Installing environment and dependencies

Here we will install dependencies in Python environments.

Case 1: If you have NetCDF installed on your machine

You can use pip and virtualenv:

pip install virtualenv  # installing virtualenv
virtualenv -p python3 nc2cdf  # creating virtualenv
source nc2cdf/bin/activate  # (or ". nc2cdf/bin/activate.fish" on Fish shells) activating virtualenv
pip install -r install/pip_req_nc2cdf.txt  # installing dependencies

Then, each time you need to run one of the script in this project, activate the environment first:

source nc2cdf/bin/activate

And you can deactivate it with:

deactivate

Case 2: If you don't have NetCDF installed on your machine

The easier way is to use Anaconda, which is a tool to install compiled Python dependencies in environments.

First, install Anaconda3.

The installer may propose you to add Anaconda to your system path, but this will set the Anaconda Python interpreter as the default Python interpreter, which might be a problem. I recommend to add an alias which both add Anaconda to your path and source the environment. Edit your system startup file (usually .bashrc):

alias conda3="export PATH=$HOME/.anaconda3/bin:$PATH && source activate"

or on Fish shell:

alias conda3="set PATH $HOME/.anaconda3/bin/ $PATH; and source $HOME/.anaconda3/etc/fish/conf.d/conda.fish; and activate"

Note: this procedure will also allow you to manage several Anaconda versions (ie. 2 and 3) by using several aliases.

Now, create the environment (required only for the first time), supposing the Anaconda installation path is $HOME/.anaconda3/:

export PATH=$HOME/.anaconda3/bin:$PATH  # or "set PATH $HOME/.anaconda3/bin/ $PATH" on Fish shells
conda create -f install/conda_env_nc2cdf.yml

Then, each time you need to run one of the script in this project, activate the environment first:

conda3 nc2cdf

And you can deactivate it with:

deactivate

That's all!

You can now run all scripts in this project:

./create_granules.py

Build the documentation

To be completed