Note

Pyleoclim requires the use of Python 3.8 or 3.9.

Installing Pyleoclim

We recommend the use of Anaconda or Miniconda, with Pyleoclim setup in its own conda environment. Some default packages shipping with the full Anaconda distribution are known to cause conflicts with the required Pyleoclim packages, so we recommend Miniconda, especially for beginners.

Installing Anaconda or Miniconda

To install Anaconda or Miniconda on your platform, follow the instructions from this page.

Click here for a quick tutorial on MacOs and Linux systems.

Creating a new conda environment

To create a new environment using Python 3.9 via command line:

conda create -n pyleo python=3.9

To view a list of available environment:

conda env list

To activate your new environment:

conda activate pyleo

To view the list of packages in your environment:

conda list

To remove the environment:

conda remove --name pyleo --all

More information about managing conda environments can be found here.

Installing Pyleoclim

Make sure that the pyleo environment is activated.

First install Cartopy:

conda install -c conda-forge cartopy

Then install Pyleoclim through Pypi, which contains the most stable version of Pyleoclim:

pip install pyleoclim

To install the development version, which contains the most up-to-date features:

pip install git+https://github.com/LinkedEarth/Pyleoclim_util.git@Development

If you would like to use Jupyter Notebooks or Spyder for code development, install these packages in your environment:

conda install spyder
conda install jupyter

Building from source for the f2py feature of WWZ

The default version of WWZ that comes with the installation steps mentioned above is relying on Numba. It is fast enough for lightweight spectral & wavelet analysis tasks, in which case we recommend using the default installation.

However, it could be slow for heavy use (e.g. performing it for hundreds of times on timeseries with length longer than 1000 points), in which case we recommend activating the f2py feature to achieve an acceleration of around 50%.

To do that, a Fortran compiler (e.g. gfortran or ifort) is required on your local machine, and the related Fortran source code should be compiled locally following the steps below:

  • download the source code, either via git clone or just download the .zip file from the Github repo

  • go to the directory Pyleoclim_util/pyleoclim/f2py, and then type make to compile the .f90 source code with gfortran

  • one may also edit the Makefile to use ifort as the compiler to achieve further acceleration; just comment out the line for gfortran and use the line for ifort below

  • a .so file will be generated if the compilation is successful

  • copy the .so file into the directory Pyleoclim_util/pyleoclim/utils where Pyleoclim is installed on your machine. To find out the location, one may import the package in Python and “print” it:

import pyleoclim as pyleo
print(pyleo)

Again, unless you are planning to make heavy use of the WWZ functionality, we recommend using the default installation.