############## How to install ############## .. role:: bash(code) :language: bash Before installing pycif, some libraries and python packages are needed. The list below is not necessary comprehensive and may depend on the OS and machine you use. For easy installation, it is recommended to use conda (see below for details). To help new users testing the CIF, a docker image has been designed, with all requirements properly installed. .. contents:: Contents :local: ********************* Requirements ********************* Please see :doc:`here ` for details on the CIF docker image. the following libraries and packages must be installed on your server: - python >=3.6: pycif is designed for python 3.6 or above; compatibility with python 2.7 has been lost and is not maintained anymore; - git: can be installed following instructions from `git-scm.com `__ - geographical and binary tools: pycif is based on the following geographical and binary libraries: - `GEOS `__ - `GDAL `__ - `PROJ `__ - `hdf5 `__ - `netCDF4 `__ - basic libraries and tools (most likely already installed on most systems): - `GCC `__ - `freetype `__ - `libpng `__ - `OpenBLAS `__ - `psutils `__ - `py-yaml `__ or python-yaml (depending on the distribution) - `linux-headers `__ - ethtool The following python packages must be installed before getting pycif: - `numpy `__ - `scipy `__ - `pandas `__ - `xarray `__ - `matplotlib `__ - `pyproj `__ - `setuptools `__ - `cython `__ - `shapely `__ - `psutil `__ - `netCDF4 `__ - `cftime `__ - `PyYAML `__ - `dateutil `__ - `tz `__ - `Pillow `__ - `future `__ - `cfgrib `__ **************************** Using conda for requirements **************************** `conda `__ enables an easy handling of package installations and virtual environments. If you are using conda, please find below some instructions to install required packages: .. code-block:: bash # Packages installed in Conda base environment conda activate base conda install --yes numpy scipy matplotlib h5py netcdf4 gdal conda install --yes -c conda-forge pyhdf # Make a pyCIF environment conda deactivate conda create --clone base --name cif conda activate cif # Install remaining packages for pyCIF conda install --yes -c conda-forge openblas pyyaml pandas xarray cython shapely psutil pillow future cfgrib # Check if the packages are installed conda list "(gdal|openblas|pyyaml|pandas|xarray|cython|shapely|psutil|pillow|future|cfgrib)" You can also find :doc:`here ` a conda virtual environment file to automatically create a virtual environment. Copy the content of the link in a text file and use the command: .. code-block:: bash conda create --name --file Don't forget to activate your environment before installing pyCIF below: .. code-block:: bash conda activate cif **************** Getting the code **************** The main server hosting the CIF is: `git.nilu.no/VERIFY/CIF `__. Anyone can clone sources and start using them. At the top right of the git-page there’s a blue button with the word “Clone”. If you click on that, you’ll see two options, one is “Clone with SSH”, the other “Clone with HTTPS”. Both options give you an address which you can use in a git command: .. code-block:: bash git clone GIT/ADDRESS /where/you/want/the/sources Please be aware that the SSH address works only for users registered at the NILU server. Contributors to the CIF can ask for a login by sending a mail at `help@community-inversion.eu `__ For other users, please use the HTTPS address. To get updates from the master version of the CIF, use the following colomn: .. code-block:: bash git pull origin master For further git commands: `try.github.io `__ **************** Installing pycif **************** Installation as fixed third-party module ---------------------------------------- Installation on the system ========================== pyCIF is a python module that can be installed to your python environment. You can install the CIF as a third-party package. It will add it to the list of available packages exactly like when using :bash:`conda` or :bash:`pip`: .. code-block:: bash cd /where/you/have/the/sources python setup.py install Please be aware that the command will try to modify some system files, hence requiring super-user authorization. If you have admin rights on your server, you may use the :bash:`sudo` prefix. Installation on the user environment ==================================== Python also offers the possibility of installing thrid-party packages on the user environment only, which do not requires admin rights: .. code-block:: bash cd /where/you/have/the/sources python setup.py install --user Installation with Anaconda ========================== If you are using Anaconda to manage your Python environment, the installation of pyCIF works similarly to the installation on the general system, without the need of super-user permission: .. code-block:: bash conda activate my_conda_environment cd /where/you/have/the/sources python setup.py install Installation with debugging features ------------------------------------ Despite all our efforts to have a distributed version of pycif as stable and robust as possible, thus if you plan to do any modification (to fix bugs, implement your own plugins, understand the code better by printing intermediate states, etc.), use the following command (valid for super-users and users with Anaconda environments): .. code-block:: bash cd /where/you/have/the/sources python setup.py develop or (as a user stand-alone python installation): .. code-block:: bash cd /where/you/have/the/sources python setup.py develop --user Thus, any modification you do on the code will be directly accessible to python scripts using pycif. ************************* Contributing to pycif ************************* pycif is a research participative project. Any bug-fixes, plugin developments or general contribution to the present documentation are very welcome. Guidelines for some typical developments are given :doc:`here `. In any case, contributions should follow as closely as possible `PEP8 `__ standards. When doing developments, it is recommended to create a new branch to the git structure. To do so, please follow the steps: .. code-block:: bash cd /where/you/have/the/sources git checkout -b [name_of_your_new_branch] This create a new local branch from the master. You can then commit your modifications to this branch. Once you are satisfied by your new version, you can push it to the main server: .. code-block:: bash git push origin [name_of_your_new_branch] Please note that this last step requires a login to the NILU server. If you don't have one yet, you can send a mail to `help@community-inversion.eu `__ To propagate your changes to the master branch, you need to submit a merge request to the git server. Please visit `this page `__ to merge your branch.