Install Snowtools¶
The snowtools project is mainly designed for a Linux environment.
Please refer to the section corresponding to your case :
Snowtools install for users¶
If you are only a user of snowtools, you can install the package easily with pip in a virtual environment:
Download the source code:
git clone https://github.com/UMR-CNRM/snowtools.gitCreate a virtual environment :
python3 -m venv --system-site-packages <name_of_your_virtual_env>Enter in the virtual environment:
source <name_of_your_virtual_env>/bin/activateEnsure you are at the root of the snowtools repository and install the package (with optional dependencies plot) by running:
pip install .[plot]
Once you have finished working with snowtools, you can leave the virtual environment by typing
deactivate. You can come back to the environment later by calling againsource <name_of_your_virtual_env>/bin/activate.
Snowtools install for developers¶
Get the code¶
Make sure you have a github account and that you have a SSH key attached to your github account [1]. Do not hesitate to ask an access to the snowtools code and tickets repository (send a mail to crocus at meteo dot fr). You can then clone the git repository on your computer with:
git clone git@github.com:UMR-CNRM/snowtools.git
Warning
If you had a previous verison of snowtools installed as a developper, you first need to uninstall the previous version.
Installation¶
Choose a location where to store your virtual environments (e.g.
~/my_envs, if you do not have a dedicated folder, create it withmkdir ~/my_envs).Create a virtual environment :
python3 -m venv --system-site-packages ~/my_envs/snowtools_env.Enter in the virtual environment:
source ~/my_envs/snowtools_env/bin/activate.Install snowtools and all its dependencies available outside of Meteo-France in editable mode :
pip install .[all] -e
That’s all for snowtools.
Each time you will need snowtools, you will have to activate the python virtual environment with source ~/my_envs/snowtools_env/bin/activate. When you have finissed your work, you can leave the virtual environment by using the deactivate command.
Snowtools install for Meteo-France/CEN staff¶
Get the code¶
Make sure you have a github account and that you have a SSH key attached to your github account [1]. Do not hesitate to ask an access to the snowtools code and tickets repository (send a mail to crocus at meteo dot fr). You can then clone the git repository on your computer with:
git clone git@github.com:UMR-CNRM/snowtools.git
Special case of insallation on Meteo-France sxcen and HPC machines
On sxcen and HPC, we recommend you not to clone the repository directly but to synchronize with the code already present on your PC by using the put tool. To do so, run this command on your PC :
# For Belenos cenutils/put snowtools belenos # For SXCEN cenutils/put snowtools sxcen
Warning
If you had a previous verison of snowtools installed as a developper, you first need to uninstall the previous version.
Prerequisites on Meteo-France computers¶
On HPC you first have to set the correct python version and compiler to use by running :
module load python/3.12.12 gcc/15.2.0(module load python/3.10.12 gcc/15.2.0on taranis)On all Meteo-Frace machines, if you intend to deal with data stored on Meteo-France archive (hendrix), you will have to configure connecton creedentials as explained on page File transfers with Vortex at MF.
You have to configure pip to have an access to the internal repository (nexus) that allow to get internal packages such as
vortex-gco. To do so, add the following lines to~/.config/pip/pip.conf:
[global]
index = https://nexus-sidev.meteo.fr/repository/pypi-group/pypi
index-url = https://nexus-sidev.meteo.fr/repository/pypi-group/simple
extra-index-url = https://nexus.meteo.fr/pypi-vortex-releases/simple
Note that this is not required on HPC because the access to Nexus from HPC is currently blocked.
Installation¶
Choose a location where to store your virtual environments (e.g.
~/my_envs, if you do not have a dedicated folder, create it withmkdir ~/my_envs).Create a virtual environment :
python3 -m venv --system-site-packages ~/my_envs/snowtools_env.Enter in the virtual environment:
source ~/my_envs/snowtools_env/bin/activate.Use the script dedicated to installation of snowtools on Meteo-France machines :
python3 cenutils/install_snowtools.py -o allmf -e(This command will runpip installof snowtools, as an editable install and prepare necessary configuration for vortex).
That’s all for snowtools.
Each time you will need snowtools, you will have to activate the python virtual environment with source ~/my_envs/snowtools_env/bin/activate. When you have finissed your work, you can leave the virtual environment by using the deactivate command.
Additional optional dependencies and configuration¶
Optional dependecines of the snowtools package¶
By default, we recommend external users use the plot optional dependencies and developers have all optional dependencies by using the all optional dependency. However a finer granularity is available if needed :
sql: extraction from MF databasesplot: tools for plotting, including plotting tools of simulation outputsscores: CRPS score computationvortex: Tools to work with vortexallgather previous dependenciesdoc: Dependencies for documentation generation (in addition toalldependency), only available at Meteo-France for the moment.allmfgather previous dependencies and tools to get access to Meteo-France HPC simualtion outputs(vortex-gco) and doc, only available at Meteo-France.hpc: only used on Meteo-France HPC, to run simulations on these machines, do not try to install elsewhere.
Additional dependencies that have to be installed manually¶
GDAL is a dependency for some geopsatial processings. You first need to install gdal binaries (e.g. on Ubuntu, run sudo apt install libgdal libgdal-dev, already installed on Meteo-France machines). Then, you need to install the python binding manually to be consistently with your installed libgdal-dev version by running: pip install --no-cache gdal[numpy]=="$(gdal-config --version).*" (please make sure numpy, wheel and setuptools>=67 are installed beforehand).
Spatial interpolator for SAFRAN¶
On Meteo-France super-computers, a precompiled binary is provided in the CEN uenv environment.
On your PC at CEN, a pre-compiled binary is also provided on shared filesystems.
Otherwise (or if you want to use a custom version, e.g. for development) you will need to compile the
interpolbinaty and set the environment variableSNOWTOOLS_INTERPOLto point to the location of the interpol compiled binary. To do so, the procedure is detailed below.
To compile the interpol binary:
go into the
snowtools/interpolationfolderOn Meteo-France HPC only, load the necessary modules :
module purge
moudle load intel
module load intelmpi
On external PC only (outside of Meteo-France), you need to have a Fortran90 compiler, a MPI compiler, openmpi, netcdf-parallel and netcdff libraries with headers availables. On Ubuntu, it means installing the following packages :
build-essential libopenmpi-dev libnetcdf-mpi-dev libnetcdff-dev.Remove Makefile if defined with
rm Makefileand then link to the correct one depending on your situation:On Meteo-France HPC :
ln -s Makefile_belenos MakefileOn Meteo-France PC :
ln -s Makefile_pc_mf MakefileOn external PC :
ln -s Makefile_pc_nomf Makefile
You just have to run
make. That’s all. You now have aninterpolbinary in the current folder.
CRPS scores¶
CRPS score is now as an independent package available at https://github.com/UMR-CNRM/snowtools-crps
To install it along with snowtools, just install the optional dependency pip install snowtools[scores] or pip install .[all].
Note that you may need to upgrade pip to version above 23.0 to install scores dependency due to a bug in previous pip versions.