Note
Pyleoclim requires the use of Python 3.9 or above
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.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:
conda list
To remove the environment:
conda remove --name pyleo --all
More information about managing conda environments can be found here.
Installing Pyleoclim
Once the pyleo environment is activated, you’ll want to first install Cartopy:
conda install cartopy
To avoid a recent (July 2023) conflict between Cartopy and SciPy v1.11, once may install Statsmodels from conda so that SciPy v1.10 will be installed:
conda install statsmodels
Then install Pyleoclim through Pypi, which contains the most stable version of Pyleoclim:
pip install pyleoclim
This will install the latest official release, which you can view here. To install the latest version, which contains the most up-to-date features, you can install directly from the GitHub source:
pip install git+https://github.com/LinkedEarth/Pyleoclim_util.git
This version may contain bugs not caught by our continuous integration test suite; if so, please report them via github issues 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 hundreds of times on timeseries longer than 1000 points), in which case we recommend activating the f2py feature to achieve a speedup of ~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 typemake
to compile the .f90 source code withgfortran
one may also edit the
Makefile
to useifort
as the compiler to achieve further acceleration; just comment out the line forgfortran
and use the line forifort
belowa
.so
file will be generated if the compilation is successfulcopy the
.so
file into the directoryPyleoclim_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.
Docker Container
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.