Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 2ae87fc1 authored by Anthony's avatar Anthony
Browse files

Add run.def for HydroLakes and Environment file

parent 36a5f672
#!/bin/bash
#
#########################################
#
# Script to build and maintain en environment to run
# the python code in this directory. We verify that
# all needed packages are available.
# This is based on the anaconda python system : https://www.anaconda.com/distribution/
#
# Usage : source Environment
#
#########################################
#
# Functions
#
function hasanaconda (){
ipsl="ipsl camelot climserv ciclad"
idris="idris jean-zay"
case $(hostname -d) in
climserv*|private.ipsl.fr|ipsl.polytechnique.fr)
echo "IPSL"
eval "$1='ipsl'"
;;
idris*|jean-zay*)
echo "IDRIS"
eval "$1='idris'"
;;
*)
echo "unknown machine : $(hostname -d)"
eval "$1='unknown'"
esac
}
function checkenv (){
rm -f checkenv.py
cat <<EOF > checkenv.py
from osgeo import ogr
import netCDF4
import configparser
import numba
import pyproj
print ("OK")
EOF
python checkenv.py > /dev/null
if [ $? -gt 0 ] ; then
echo "Environment not OK. Some packages must be missing."
echo "This was tested with the checkenv.py code."
else
rm -f checkenv.py
fi
}
#
# Main
#
loc=''
hasanaconda loc
if [ loc != "unknown" ] ; then
#
# Make sure the right version of Python
#
case $loc in
"ipsl")
#module unload python
#module load python/3.6-anaconda50
#
# Test if the MPI environment is installed.
#
if [ ! -e ${HOME}/.conda/envs/GEOM ] ; then
#
# Create the MPI environment as it does not exist.
#
conda create -y -n GEOM -c conda-forge python=3.7.* cython GDAL pyproj rasterio configparser netcdf4 numba shapely pip
source activate GEOM
pip install argparse
else
source activate GEOM
fi
;;
"idris")
module load python/3.7.3
if [[ -L ${HOME}/.conda && -d ${HOME}/.conda ]] ; then
if [ ! -e ${WORK}/.conda/envs/GEOM ] ; then
conda create -y -n GEOM -c conda-forge python=3.7.* cython GDAL pyproj rasterio configparser netcdf4 numba shapely pip
conda activate GEOM
pip install argparse
else
conda activate GEOM
fi
else
echo "Make sure \$HOME/.conda is a link to your \$WORK/.conda"
fi
;;
*)
echo "Environment for $loc is not foreseen yet"
exit
;;
esac
fi
#
# Verify we can load all the needed modules.
#
checkenv
[OverAll]
#
EarthRadius = 6370000.
#
# If Debug = True, there will not have overlap calculation (everything = 1)
# Quicker because it s the heavier step, allow to check if everything works
#
Debug = False
# [DEF] input_type : geogrid, hydro
#
input_type = hydro
dinput = /bdd/ORCHIDEE_Forcing/Routing/Hydro4ORCH/MERIT_Global.nc
# output file direction
doutput = ./MERIT_frac_lakes.nc
# Shapefile direction
shpdir = /homedata/aschrapffer/TODEMTOOLS/HydroLAKES_polys_v10_shp/HydroLAKES_polys_v10.shp
# Name of the output variable
varnamefrac = lake_frac
varnameid = lake_id
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment