Pyleoclim requires the use of Python 3.9 or above
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.10 via command line:
conda create -n pyleo python=3.10
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:
To remove the environment:
conda remove --name pyleo --all
More information about managing conda environments can be found here.
Make sure that the pyleo environment is activated.
First install Cartopy:
conda install -c conda-forge cartopy=0.21
(note: under Python 3.10, cartopy>=0.21 will be installed by default, so specifying this version is unnecessary). 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
conda install -c conda-forge xarray dask netCDF4 bottleneck
You will also need climlab:
conda install climlab
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.
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
maketo compile the .f90 source code with
one may also edit the
ifortas the compiler to achieve further acceleration; just comment out the line for
gfortranand use the line for
.sofile will be generated if the compilation is successful
.sofile into the directory
Pyleoclim_util/pyleoclim/utilswhere 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.
Docker containers with various versions of Pyleoclim are available on quay.io.
To pull an image:
docker pull quay.io/linkedearth/pyleoclim:latest
To run the image:
docker run -it -p 8888:8888 quay.io/linkedearth/pyleoclim:latest
The container will start a Jupyter server automatically. You need to copy the link to the server (localhost) into your web browser on your machine (the command -p 8888:8888 opens the communication port between your machine and the container). You can then create notebook and upload notebook and data using the Jupyter interface. Remember that the container will not save any of your work if you close it. So make sure you donwload your work before closing the container.