Install watershed-workflow on a fresh Ubuntu 20.04 LTS

1 minute read

Published:

Notes:

Set up Python environment

note: Again, it’s assumed miniconda has been installed. If not, see the ‘how to install ATS instruction’ here: zhilihydro.github.io/posts/2022/04/blog-post-1/

  • Install libmamba to make conda faster.
conda update -n base conda
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
  • Create a new environment called watershed_workflow.
conda create -n watershed_workflow -c conda-forge -c defaults python=3 numpy matplotlib scipy pandas geopandas ipython ipykernel jupyterlab nb_conda_kernels meshpy fiona rasterio shapely=1.8.4 cartopy pyepsg descartes pyproj requests sortedcontainers attrs pytest netcdf4 h5py tqdm libarchive
conda activate watershed_workflow
  • Check if successfully set up:
python -c 'import numpy, matplotlib, scipy, rasterio, fiona, shapely, cartopy, meshpy.triangle; print("SUCCESS")'

Download SEACAS

cd
git clone https://github.com/sandialabs/seacas.git

Install Exodus (a part of SEACAS)

(See sandialabs.github.io/seacas-docs/sphinx/html/ for SEACAS and Exodus details)

cd seacas && export ACCESS=`pwd`
MPI=YES ./install-tpl.sh
mkdir build
cd build
../cmake-exodus
make && make install

note: Replace ../cmake-exodus with ../cmake-config if try to install full SEACAS

  • Test if Exodus successfully installed:
export PYTHONPATH=${ACCESS}/lib; python -c 'import exodus; print("SUCCESS")'

Download and install watershed-workflow

cd
git clone https://github.com/environmental-modeling-workflows/watershed-workflow.git
cd watershed-workflow
python -m pip install -e .
  • Edit .bashrc to export PYTHONPATH:
cd
vi .bashrc

Append the following line to .bashrc:

export PYTHONPATH="$HOME/watershed-workflow/bin:$HOME/seacas/lib"

Now restart terminal, or:

source .bashrc
  • (optional) Test if watershed-workflow successfully installed:
cd watershed-workflow
pytest watershed_workflow/test