# Project dependencies ## Description This project requires these following dependencies. ### NetCDF4 - [NetCDF](https://www.unidata.ucar.edu/software/netcdf/) is C library to read and edit NetCDF files; - [NetCDF4](https://github.com/Unidata/netcdf4-python) is a Python wrapper for NetCDF, which requires the NetCDF library, used here to read NetCDF files. -> Documentation is available [here](http://unidata.github.io/netcdf4-python/). ### pycdf - [SpacePy](http://pythonhosted.org/SpacePy/index.html) is a python package for space sciences; - [pycdf](http://pythonhosted.org/SpacePy/pycdf.htm) is a SpacePy sub-package used to read and write CDF files. -> Documentation is available [here](http://pythonhosted.org/SpacePy/pycdf.htm). ### Sphinx Sphinx is a documentation generator for Python projects. -> Documentation is available [here](http://www.sphinx-doc.org/en/stable/). ## 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: ```bash 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: ```bash source nc2cdf/bin/activate ``` And you can deactivate it with: ```bash deactivate ``` ### Case 2: If you don't have NetCDF installed on your machine The easier way is to use [Anaconda](https://docs.continuum.io/), which is a tool to install compiled Python dependencies in environments. First, [install Anaconda3](https://docs.continuum.io/anaconda/install). 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`): ```bash alias conda3="export PATH=$HOME/.anaconda3/bin:$PATH && source activate" ``` or on Fish shell: ```bash 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/`: ```bash 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: ```bash conda3 nc2cdf ``` And you can deactivate it with: ```bash deactivate ``` ### That's all! You can now run all scripts in this project: ``` ./create_granules.py ``` ## Build the documentation To be completed