Skip to content

Latest commit

 

History

History

Presentation

Presentation

The goal of this repository is to give support materials for the meetings at IGE about tools: MC-Toolkit (MC stand for Mardi-Café, Modelisation&Climate,... who knows?), in additions of a Slack channel.

Recommended installation for xarray example

  1. Main packages descriptions:
  • xarray: to open netCDF files and do way more....
  • dask: for parallelization
  • jupyter: for using jupyter-notebook
  • matplotlib: backend for making plots
  • cartopy: replace basemap, backend for map projections
  • proplot: new plot package that I find really promissing (try to have lastest version because it is evolving fast)
  • xesmf: for regridding
  1. Install Miniconda: (if you don't already have an installation of Anaconda/Miniconda -> Miniconda is lighter and allows to only install the packages that you need)

If you are on a cluster, try to install it on a different path than the default one (usually it takes some spaces and it is not recommander to have it in your home), otherwise make the default installation and put yes anytime it ask something.

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh 
sh Miniconda3-latest-Linux-x86_64.sh 
source ~/.bashrc  

You should have a (base) in front of your line in your terminal, that correspond to the root environment.

  1. Add conda-forge and update your installation (optionnal but I recommend):
conda config --add channels conda-forge  
conda config --set channel_priority strict  
conda update -n base -c defaults conda  
  1. Create an xarray environment:

It is recommanded not to use the root (base) environment so that you keep a clean installation (see the note at the end of the page). If you already have an Anaconda/Miniconda it doesn't mater and just make a new environment for the examples of this repository.

Download the spec-file.txt and use this command to create a new xarray environment (you put any other name if you want):

conda create -n xarray --file spec-file.txt
conda activate xarray

You can finish here. Then launch Jupyter-Notebook in a terminal with: jupyter-notebook

  1. (bis) If you wish to make a manual installation with updated packages (without the spec-file.txt):

Install xESMF first with esmpy before by itself (see this issue, may be not the case anymore for future versions):

conda create -n xarray  
conda activate xarray  
conda install esmpy  
conda install xesmf dask  

Test the xesmf environment:

pip install pytest  
pytest -v --pyargs xesmf  

If it doesn't work I advice you to install with the spec-file.txt (3. above) or give up for this package (it is for regridding). You can use CDO or another tool for regridding.

Then install other packages (xarray, pandas, numpy already isntalled from previous packages):

conda install jupyter psutil netcdf4 proplot cartopy matplotlib 

Usefull commands for Anaconda/Miniconda:

conda list --explicit > spec-file.txt  
conda create --name myenv --file spec-file.txt  
conda remove --name myenv --all  
conda info --envs 
  • Update environment:
conda update -n base -c defaults conda
conda update --all