diff --git a/bin/hru-delin_all-steps.sh b/bin/hru-delin_all-steps.sh index 91234342d60fa7eeb1b276c87ae3c587fc0da179..533f03e16fa15be71074a05b9630d7a92ccbaa17 100755 --- a/bin/hru-delin_all-steps.sh +++ b/bin/hru-delin_all-steps.sh @@ -1,7 +1,23 @@ #!/bin/bash +############################################################################ +# +# MODULE: hru-delin_all-steps.sh +# AUTHOR(S): Julien Veyssier +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# + + + # very simple, we just call all steps scripts with same arguments we got here hru-delin_step1.sh "$@" hru-delin_step2.sh "$@" hru-delin_step3.sh "$@" -hru-delin_step4.sh "$@" \ No newline at end of file +hru-delin_step4.sh "$@" diff --git a/bin/hru-delin_step1.sh b/bin/hru-delin_step1.sh index 8f8ff82d86be4a9217599def327d92539575fcf7..adb882958893cb0c76481f97b3c8d5762a73778c 100755 --- a/bin/hru-delin_step1.sh +++ b/bin/hru-delin_step1.sh @@ -1,4 +1,19 @@ #!/bin/bash +############################################################################ +# +# MODULE: hru-delin_step1.sh +# AUTHOR(S): Julien Veyssier +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# + + # HRU-DELIN # first step : hru-delin_init @@ -105,11 +120,20 @@ fi # clean work environment # ---------------------- +# test id dir output exist + + clean_files=`grep "files\s*:" $CONFIGFILE | cut -d ':' -f2 | sed -e 's/\s*$//' | sed -e 's/^\s*//'` + if [ -z "$clean_files" ]; then clean_files=`grep "files\s*=" $CONFIGFILE | cut -d '=' -f2 | sed -e 's/\s*$//' | sed -e 's/^\s*//'` fi +if [ -z "$clean_files" ]; then + echo "------------> ERROR : Output FILE Directory not provided !" + exit 1 +fi echo "clean files $clean_files" + # is the path absolute? if [[ "$clean_files" = /* ]]; then rm -rf $clean_files @@ -120,10 +144,23 @@ else mkdir $CONFIGFILEPATH/$clean_files fi +# test if mkdir works +if [ $? -ne 0 ] ; then + echo "------------> ERROR : Impossible to create Output directory !" + exit 1 +fi + + clean_results=`grep "results\s*:" $CONFIGFILE | cut -d ':' -f2 | sed -e 's/\s*$//' | sed -e 's/^\s*//'` if [ -z "$clean_results" ]; then clean_results=`grep "results\s*=" $CONFIGFILE | cut -d '=' -f2 | sed -e 's/\s*$//' | sed -e 's/^\s*//'` fi + +if [ -z "$clean_results" ]; then + echo "------------> ERROR : Output RESULTS Directory not provided !" + exit 1 +fi + echo "clean results $clean_results" # is the path absolute? if [[ "$clean_results" = /* ]]; then diff --git a/bin/hru-delin_step2.sh b/bin/hru-delin_step2.sh index 43aa709be4bd3c5b694339b81bc22f75521e2ab9..c798bdbbaf97d6019233d01715213aa85e33f6b4 100755 --- a/bin/hru-delin_step2.sh +++ b/bin/hru-delin_step2.sh @@ -1,4 +1,18 @@ #!/bin/bash +############################################################################ +# +# MODULE: hru-delin_step2.sh +# AUTHOR(S): Julien Veyssier +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# + # HRU-DELIN # 2nd step : hru-delin_basins @@ -107,6 +121,12 @@ clean_files=`grep "files\s*:" $CONFIGFILE | cut -d ':' -f2 | sed -e 's/\s*$//' | if [ -z "$clean_files" ]; then clean_files=`grep "files\s*=" $CONFIGFILE | cut -d '=' -f2 | sed -e 's/\s*$//' | sed -e 's/^\s*//'` fi + +if [ -z "$clean_files" ]; then + echo "------------> ERROR : Output FILE Directory not provided !" + exit 1 +fi + # is the path absolute? if [[ "$clean_files" = /* ]]; then rm -f $clean_files/step2* $clean_files/step3* @@ -118,6 +138,12 @@ clean_results=`grep "results\s*:" $CONFIGFILE | cut -d ':' -f2 | sed -e 's/\s*$/ if [ -z "$clean_results" ]; then clean_results=`grep "results\s*=" $CONFIGFILE | cut -d '=' -f2 | sed -e 's/\s*$//' | sed -e 's/^\s*//'` fi + +if [ -z "$clean_results" ]; then + echo "------------> ERROR : Output RESULTS Directory not provided !" + exit 1 +fi + # is the path absolute? if [[ "$clean_results" = /* ]]; then rm -rf $clean_results @@ -127,6 +153,12 @@ else mkdir $CONFIGFILEPATH/$clean_results fi +# test if mkdir works +if [ $? -ne 0 ] ; then + echo "------------> ERROR : Impossible to create Output directory !" + exit 1 +fi + # ----------------------------------- # exec second step of HRU-DELIN batch # ----------------------------------- diff --git a/bin/hru-delin_step3.sh b/bin/hru-delin_step3.sh index dba439a6de2d7007d8bd4da23e804db0beeb3370..06cbaba85c70c531d2d6b7caa68f1dc8f55f829c 100755 --- a/bin/hru-delin_step3.sh +++ b/bin/hru-delin_step3.sh @@ -1,4 +1,17 @@ #!/bin/bash +############################################################################ +# +# MODULE: hru-delin_step3.sh +# AUTHOR(S): Julien Veyssier +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# # HRU-DELIN # 3rd step : hru-delin_hrugen @@ -108,6 +121,12 @@ clean_files=`grep "files\s*:" $CONFIGFILE | cut -d ':' -f2 | sed -e 's/\s*$//' | if [ -z "$clean_files" ]; then clean_files=`grep "files\s*=" $CONFIGFILE | cut -d '=' -f2 | sed -e 's/\s*$//' | sed -e 's/^\s*//'` fi + +if [ -z "$clean_files" ]; then + echo "------------> ERROR : Output FILE Directory not provided !" + exit 1 +fi + # is the path absolute? if [[ "$clean_files" = /* ]]; then rm -f $clean_files/step3* @@ -118,6 +137,12 @@ clean_results=`grep "results\s*:" $CONFIGFILE | cut -d ':' -f2 | sed -e 's/\s*$/ if [ -z "$clean_results" ]; then clean_results=`grep "results\s*=" $CONFIGFILE | cut -d '=' -f2 | sed -e 's/\s*$//' | sed -e 's/^\s*//'` fi + +if [ -z "$clean_results" ]; then + echo "------------> ERROR : Output RESULTS Directory not provided !" + exit 1 +fi + # is the path absolute? if [[ "$clean_results" = /* ]]; then rm -rf $clean_results @@ -127,6 +152,12 @@ else mkdir $CONFIGFILEPATH/$clean_results fi +# test if mkdir works +if [ $? -ne 0 ] ; then + echo "------------> ERROR : Impossible to create Output directory !" + exit 1 +fi + # ----------------------------------- # exec third step of HRU-DELIN batch # ----------------------------------- diff --git a/bin/hru-delin_step4.sh b/bin/hru-delin_step4.sh index 541c70f6699bbb6a2c47a5ebf7b03d2ec5004e36..1d79a43df80b633d91b6efb4135e2adbc553b41a 100755 --- a/bin/hru-delin_step4.sh +++ b/bin/hru-delin_step4.sh @@ -1,4 +1,18 @@ #!/bin/bash +############################################################################ +# +# MODULE: hru-delin_step4.sh +# AUTHOR(S): Julien Veyssier +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# + # HRU-DELIN # 4th step : hru-delin_parms_J2000 @@ -109,6 +123,12 @@ clean_results=`grep "results\s*:" $CONFIGFILE | cut -d ':' -f2 | sed -e 's/\s*$/ if [ -z "$clean_results" ]; then clean_results=`grep "results\s*=" $CONFIGFILE | cut -d '=' -f2 | sed -e 's/\s*$//' | sed -e 's/^\s*//'` fi + +if [ -z "$clean_results" ]; then + echo "------------> ERROR : Output RESULTS Directory not provided !" + exit 1 +fi + # is the path absolute? if [[ "$clean_results" = /* ]]; then rm -rf $clean_results @@ -118,6 +138,13 @@ else mkdir $CONFIGFILEPATH/$clean_results fi +# test if mkdir works +if [ $? -ne 0 ] ; then + echo "------------> ERROR : Impossible to create Output directory !" + exit 1 +fi + + rm -f topologie_* tmp/topologie_* # ----------------------------------- diff --git a/bin/tools.sh b/bin/tools.sh index 490856f51c81cfb0b642fdeb9648c2d098c15886..23e4b21920f8da19583822af25883fd90cdc4bf1 100644 --- a/bin/tools.sh +++ b/bin/tools.sh @@ -1,4 +1,17 @@ #!/bin/bash +############################################################################ +# +# MODULE: tools.sh +# AUTHOR(S): Julien Veyssier +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# buildGrassEnv() { envPath=$1 @@ -48,4 +61,4 @@ t-b resol: 1 " > $gisdbase/$location/$mapset/WIND cp $gisdbase/$location/$mapset/WIND $gisdbase/$location/$mapset/DEFAULT_WIND -} \ No newline at end of file +} diff --git a/modules/awk.py b/modules/awk.py index 9a4de97cb52eaadd07d68eaade3d28b23f767234..7df5a55a59df4aa9854a7bc2973c10278324dd87 100644 --- a/modules/awk.py +++ b/modules/awk.py @@ -1,3 +1,18 @@ +############################################################################ +# +# MODULE: awk.py +# AUTHOR(S): Julien Veyssier +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# + + # coding: utf-8 # this file contains the converted old awk scripts which were not portable (to windows) diff --git a/modules/circleKill.py b/modules/circleKill.py index 14c4ac22d1ad237ec1cffb04727c87198cb1ce2b..90894f5793fb44398458d6bb8a609310bcf47147 100755 --- a/modules/circleKill.py +++ b/modules/circleKill.py @@ -1,5 +1,22 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- + +############################################################################ +# +# MODULE: circleKill.py +# AUTHOR(S): Julien Veyssier +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# + + + import sys try: import dbf @@ -105,4 +122,4 @@ if __name__ == '__main__': outPath = sys.argv[2] circleKill(inPath, outPath) else: - sys.exit('Please provide two arguments: INPUT_PATH OUTPUT_PATH_PREFIX') \ No newline at end of file + sys.exit('Please provide two arguments: INPUT_PATH OUTPUT_PATH_PREFIX') diff --git a/modules/grassUtils.py b/modules/grassUtils.py index fecbf70407219472c8a1442f437942ababb07a45..2313bd7964251a68977fab25df55c86d9c4f2a3b 100644 --- a/modules/grassUtils.py +++ b/modules/grassUtils.py @@ -1,4 +1,21 @@ # coding: utf-8 +############################################################################ +# +# MODULE: grassUtils.py +# AUTHOR(S): Julien Veyssier +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# + + + + import os, sys, shutil try: # Python 3 diff --git a/modules/hrudelin_1_init.py b/modules/hrudelin_1_init.py index fca6143cb8749c1bf2445aec2d809374dcff72d8..845eaab769175b7dca7fa7d508e08b9df4f53744 100755 --- a/modules/hrudelin_1_init.py +++ b/modules/hrudelin_1_init.py @@ -1,18 +1,27 @@ # coding: utf-8 -''' - MODULE: hru-delin_init - AUTHOR(S): adapted from GRASS-HRU (ILMS) - JENA University - by IRSTEA - Christine Barachet +############################################################################ +# +# MODULE: hrudelin_1_init.py +# AUTHOR(S): adapted from GRASS-HRU (ILMS) - JENA University +# by IRSTEA - Christine Barachet, +# Julien Veyssier +# PURPOSE: Prepare files for the next steps of HRU Delineation +# shapefile : selected gauges +# rasters : bounded DEM and others (geology, soils, landuse) +# DEM, slope and aspect with values of reclassification +# calculates oriented flows and subbasins +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# - PURPOSE: Prepare files for the next steps of HRU Delineation - shapefile : selected gauges - rasters : bounded DEM and others (geology, soils, landuse) - DEM, slope and aspect with values of reclassification - calculates oriented flows and subbasins -''' # to keep python2 compatibility from __future__ import print_function @@ -61,13 +70,37 @@ def get_polygon_bounds(shape, xmin_slect, ymax_slect, xmax_slect, ymin_slect): max(ymin_slect, ymin) ) +def isfloat(value): + try: + float(value) + return True + except ValueError: + return False + +def isint(value): + try: + int(value) + return True + except ValueError: + return False + + def get_coords(parms, xmin_slect, ymax_slect, xmax_slect, ymin_slect): + + if not isfloat(parms.get('surface', 'west')) or isfloat(parms.get('surface', 'north')) or isfloat(parms.get('surface', 'east')) or isfloat(parms.get('surface', 'south')): + sys.exit('------------> ERROR : coordinates for surface selection is not valid') + xmin_slect = max(xmin_slect, float(parms.get('surface', 'west'))) ymax_slect = min(ymax_slect, float(parms.get('surface', 'north'))) xmax_slect = min(xmax_slect, float(parms.get('surface', 'east'))) ymin_slect = max(ymin_slect, float(parms.get('surface', 'south'))) + print("hello",xmin_slect) return xmin_slect, ymax_slect, xmax_slect, ymin_slect + + + + try: # Python 3 from subprocess import DEVNULL @@ -75,12 +108,20 @@ except ImportError: #DEVNULL = open('cbtrace_step1', 'wb') DEVNULL = open(os.devnull, 'wb') + + + + ''' MAIN ''' def main(parms_file): print('---------- HRU-delin Step 1 started ---------------------------------------------') + + + + configFileDir = os.path.dirname(parms_file) # create main env buildGrassEnv(os.path.join(configFileDir, 'grass_db'), 'hru-delin') @@ -89,26 +130,81 @@ def main(parms_file): parms = ConfigParser.ConfigParser(allow_no_value=True) parms.read(parms_file) directory = parms.get('dir_in', 'dir') - # manage absolute and relative paths + + + #Â Test parameters from configuration file + ## test if directory is valid + + if not os.path.isdir(directory): + sys.exit('------------> ERROR : In Directoy is not valid') + + ## manage absolute and relative paths if not os.path.isabs(directory): directory = os.path.join(configFileDir, directory) + directory_out = parms.get('dir_out', 'files') if not os.path.isabs(directory_out): directory_out = os.path.join(configFileDir, directory_out) + ##Â Test if dem exist + dem = os.path.join(directory, str(parms.get('files_in', 'dem'))) + if not os.path.isfile(dem): + sys.exit('------------> ERROR : Input Dem not found') + + ##Â Test if gauges exist + gauges = os.path.join(directory, str(parms.get('files_in', 'gauges'))) + if not os.path.isfile(gauges): + sys.exit('------------> ERROR : Input Gauges not found') + + ##Â Test if gauges is point or multipoint + ds=ogr.Open(gauges) + layer=ds.GetLayer() + layer_defn=layer.GetLayerDefn() + if ogr.GeometryTypeToName(layer_defn.GetGeomType()) != 'Point': + sys.exit('------------> ERROR : Input Gauges is not Point Geometry (multi Point not allowed)') + + ## if hgeon, landuse and soil provided, test if exist + for data in parms.items('data'): + data = os.path.join(directory, data[1]) + if not os.path.isfile(data): + print(data) + sys.exit('------------> ERROR : Input data not found' ) + + ## if irrig_rast provided, test if is valid + if str(parms.get('irrigation', 'irrig_rast')) != '': + irr_rast_test = os.path.join(directory, str(parms.get('irrigation', 'irrig_rast'))) + if not os.path.isfile(irr_rast_test): + sys.exit('------------> ERROR : Irrigation raster not found' ) + + ## if rules_auto_dem is yes, test if step_dem valid + if (parms.get('reclass_dem', 'rules_auto_dem')) == 'yes': + if not isint(parms.get('reclass_dem', 'step_dem')): + sys.exit('------------> ERROR : Step dem value not provided or is not integer' ) + ## test if basin min size is valid + if not isint(parms.get('basin_min_size', 'size')): + sys.exit('------------> ERROR : Basin min size value not provided or is not integer' ) + + # Initializing the variables for cutting up of layers xmin_slect = ymin_slect = 0.0 ymax_slect = xmax_slect = 9999999999.9 - dem = os.path.join(directory, str(parms.get('files_in', 'dem'))) + + dem_name = os.path.basename(parms.get('files_in', 'dem')).split('.')[0] selection = (parms.get('surface', 'selection')) xmin_slect, ymax_slect, xmax_slect, ymin_slect = get_raster_bounds(dem, xmin_slect, ymax_slect, xmax_slect, ymin_slect) + ## test if selection is valid + + if selection == 'total': pass elif selection == 'polygon': + polygon_test = os.path.join(directory, str(parms.get('surface', 'polygon'))) + if not os.path.isfile(polygon_test): + sys.exit('------------> ERROR : Polygon layer for surface selection not found') xmin_slect, ymax_slect, xmax_slect, ymin_slect = get_polygon_bounds(os.path.join(directory, parms.get('surface', 'polygon')), xmin_slect, ymax_slect, xmax_slect, ymin_slect) elif selection == 'coords': xmin_slect, ymax_slect, xmax_slect, ymin_slect = get_coords(parms, xmin_slect, ymax_slect, xmax_slect, ymin_slect) @@ -174,15 +270,20 @@ def main(parms_file): # DEM dem_rcl = 'dem_rcl' + + if (parms.get('reclass_dem', 'rules_auto_dem')) == 'yes': pRecode = grass_feed_command('r.recode', input=dem_filled, output=dem_rcl, rules='-', quiet=True) + step_reclass = int(parms.get('reclass_dem', 'step_dem')) + alti_min = float(grass_parse_command('r.info', flags='r', map=dem_filled, stdout=DEVNULL, stderr=DEVNULL)['min']) alti_max = float(grass_parse_command('r.info', flags='r', map=dem_filled, stdout=DEVNULL, stderr=DEVNULL)['max']) # just a copy, still do the pipe recl_dem_file = os.path.join(directory_out, 'reclass_rules_dem') + with open(recl_dem_file, 'w') as dem_rules: new_max = math.floor(alti_max / step_reclass) * step_reclass + step_reclass if alti_min < 0: @@ -208,7 +309,9 @@ def main(parms_file): if not os.path.isfile(recl_dem_file): sys.exit('------------> File reclass_rules_dem is missing') # r.recode does a better job with grass7, values close to interval limits are now correctly reclassified + grass_run_command('r.recode', input=dem_filled, output=dem_rcl, rules=recl_dem_file, stdout=DEVNULL, stderr=DEVNULL) + # Save the rules to directory_out recl_dem_name = os.path.basename(recl_dem_file) shutil.copyfile(recl_dem_file, os.path.join(directory_out, recl_dem_name)) @@ -219,6 +322,7 @@ def main(parms_file): if (parms.get('reclass_slope', 'rules_auto_slope')) == 'yes': pRecode = grass_feed_command('r.recode', input=dem_slope, output=slp_rcl, rules='-', quiet=True) recl_slope_file = os.path.join(directory_out, 'reclass_rules_slope') + default_recl_slope_file = os.path.join(DATA_PATH, 'reclass_default_rules_slope') slp_min = float(grass_parse_command('r.info', flags='r', map=dem_slope, stdout=DEVNULL, stderr=DEVNULL)['min']) diff --git a/modules/hrudelin_2_basins.py b/modules/hrudelin_2_basins.py index b30986efae4b8024d4e07fc9c69017a141ece9c5..bcff6c7f7f9090fe27ae1d6a81180d92c7baf586 100755 --- a/modules/hrudelin_2_basins.py +++ b/modules/hrudelin_2_basins.py @@ -1,15 +1,27 @@ # coding: utf-8 -""" - MODULE: hru-delin_basins - AUTHOR(S): adapted from GRASS-HRU (ILMS) - JENA University - by IRSTEA - Christine Barachet - PURPOSE: 1. Relocates the gauges on the reaches - 2. Calculates watersheds at the gauges +############################################################################ +# +# MODULE: hru-delin_basins.py +# AUTHOR(S): adapted from GRASS-HRU (ILMS) - JENA University +# by IRSTEA - Christine Barachet, +# Julien Veyssier +# PURPOSE: 1. Relocates the gauges on the reaches +# 2. Calculates watersheds at the gauges +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# + + -""" # to keep python2 compatibility from __future__ import print_function @@ -40,6 +52,15 @@ try: except ImportError: DEVNULL = open(os.devnull, 'wb') + +def isint(value): + try: + int(value) + return True + except ValueError: + return False + + def write_log(msg, buff, start, end, best_x, best_y): horiz_shift = best_x - start - end vertic_shift = best_y - start - end + 1 @@ -79,6 +100,10 @@ def snapping_gauges_to_reaches(parms, directory_out): dist_ok_2 = 0 else: nb_trials = 2 + if not isint(parms.get('auto_relocation', 'surface_tolerance_2')): + sys.exit('------------> ERROR : Surface_tolerance_2 is not integer' ) + if not isint(parms.get('auto_relocation', 'distance_tolerance_2')): + sys.exit('------------> ERROR : Distance_tolerance_2 is not integer' ) surface_ok_2 = int(parms.get('auto_relocation', 'surface_tolerance_2')) dist_ok_2 = int(parms.get('auto_relocation', 'distance_tolerance_2' )) @@ -126,9 +151,20 @@ def snapping_gauges_to_reaches(parms, directory_out): for y in range(0, (max_dist * 2 + 1)): for x in range(0, (max_dist * 2 + 1)): euclid_dist[y, x] = int(math.sqrt((y - max_dist)**2 + (x - max_dist)**2)) - + # Gauges loop for gauge in reloc_lyr: + geom = gauge.GetGeometryRef() + gauge_x, gauge_y = geom.GetX(), geom.GetY() + Xreste = gauge_x % hres + Yreste = gauge_y % abs(vres) + new_gauge_x = (gauge_x - Xreste) + 1 + new_gauge_y = (gauge_y - Yreste) - 1 + print("end********") + + for gauge in reloc_lyr: + if not gauge.IsFieldSet(col_name): + sys.exit('------------> ERROR : col_name not found' ) gauge_code = gauge.GetField(col_name) # Get the drained surface of the gauge gauge_area = gauge.GetField(col_area) @@ -167,11 +203,14 @@ def snapping_gauges_to_reaches(parms, directory_out): dist_max = max(dist_ok_1, dist_ok_2) pix_x = max(int(((new_gauge_x - georef[0]) / hres) - (dist_max)), 0) + pix_y = max(int(((georef[3] - new_gauge_y) / abs(vres)) - (dist_max)), 0) # and don't access beyond the accum raster bounds nb_cols = min((dist_max * 2) + 1, acc_rast_cols - pix_x) - nb_rows = min((dist_max * 2) + 1, acc_rast_rows - pix_y) + + nb_rows = (min((dist_max * 2) + 1, acc_rast_rows - pix_y)) + zone = accum_bd.ReadAsArray(pix_x, pix_y, nb_cols, nb_rows).astype(int) # in the end, this is just to ensure that we won't look at relocating the gaug outside the raster boudaries # isn't that right? @@ -421,6 +460,9 @@ def processReach(params): def main(parms_file, nbProc, generator=False): print('---------- HRU-delin Step 2 started ---------------------------------------------') + + + # TODO remove dirty global variables global logf, gauge_code, gauge_area, reloc_lyr, col_name @@ -444,10 +486,36 @@ def main(parms_file, nbProc, generator=False): print(' =========> ERROR ') sys.exit(' =========> CHECK col_name PARAMETER') + # test parameters from configuration file + # if auto_relocation == yes, test int value for surface_tolerance_1 and distance_tolerance_1 + if (parms.get('auto_relocation', 'to_do')) == 'yes': + + if not isint(parms.get('auto_relocation', 'surface_tolerance_1')): + sys.exit('------------> ERROR : Surface_tolerance_1 value not provided or is not integer' ) + if not isint(parms.get('auto_relocation', 'distance_tolerance_1')): + sys.exit('------------> ERROR : Distance_tolerance_1 value not provided or is not integer' ) + + + ## test if basin min size is valid + if not isint(parms.get('basin_min_size', 'size')): + sys.exit('------------> ERROR : Basin min size value not provided or is not integer' ) + + + + # Get the shape of gauges gauges_file = parms.get('auto_relocation', 'relocated_gauges') if gauges_file == '': gauges_file = os.path.join(directory_out, 'gauges_selected.shp') + else: + if ogr.Open(gauges_file) is None: + sys.exit('------------> ERROR : Relocated Gauges file not found') + + + + + + gauges_in = ogr.Open(gauges_file) gauges_lyr = gauges_in.GetLayer() @@ -459,7 +527,7 @@ def main(parms_file, nbProc, generator=False): driver.DeleteDataSource(gauges_reloc_file) reloc_shp = driver.CreateDataSource(gauges_reloc_file) reloc_lyr = reloc_shp.CopyLayer(gauges_lyr, gauges_reloc_name) - + # Relocation of the gauges if (parms.get('auto_relocation', 'to_do')) == 'yes': print('---------- HRU-delin Step 2 : Relocation of the gauges') @@ -768,4 +836,4 @@ if __name__ == '__main__': else: from .grassUtils import buildGrassEnv, buildGrassLocation, exportRasters, importRastersInEnv,\ grass_run_command, grass_parse_command, grass_feed_command, grass_read_command - from .progressColors import * \ No newline at end of file + from .progressColors import * diff --git a/modules/hrudelin_3_hrugen.py b/modules/hrudelin_3_hrugen.py index 07f73f8ebb185bf1110ead8c7e686a509ffbc812..f4a09d38f8a1b9f7e0cd2625bef8e95f5443b7c1 100755 --- a/modules/hrudelin_3_hrugen.py +++ b/modules/hrudelin_3_hrugen.py @@ -1,16 +1,28 @@ # coding: utf-8 -''' - MODULE: hru-delin_basins - AUTHOR(S): adapted from GRASS-HRU (ILMS) - JENA University - by IRSTEA - Christine Barachet +############################################################################ +# +# MODULE: hrudelin_3_hrugen.py +# AUTHOR(S): adapted from GRASS-HRU (ILMS) - JENA University +# by IRSTEA - Christine Barachet, +# Julien Veyssier +# +# PURPOSE: overlay of all selected layers +# construction of HRUs +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# + - PURPOSE: overlay of all selected layers - construction of HRUs -''' # to keep python2 compatibility from __future__ import print_function @@ -32,6 +44,15 @@ import pandas as pd import multiprocessing from multiprocessing import Pool, cpu_count + +def isint(value): + try: + int(value) + return True + except ValueError: + return False + + def reclass(map_in, map_out, size): p = grass_pipe_command('r.stats', flags='lnNc', input=map_in) pReclass = grass_feed_command('r.reclass', overwrite=True, input=map_in, output=map_out, rules='-') @@ -394,6 +415,20 @@ def main(parms_file, nbProc, generator=False): if not os.path.isabs(directory_out): directory_out = os.path.join(configFileDir, directory_out) + # test if surface is valid + if not isint(parms.get('hrus_min_surface', 'surface')): + sys.exit('------------> ERROR : Hrus min surface not provided or is not integer' ) + + ## if hgeon, landuse and soil provided, test if exist + directory = parms.get('dir_in', 'dir') + for data in parms.items('data'): + data = os.path.join(directory, data[1]) + if not os.path.isfile(data): + print(data) + sys.exit('------------> ERROR : Input data not found' ) + + + min_area = int(parms.get('hrus_min_surface', 'surface')) # get rid of mask anyway @@ -693,4 +728,4 @@ if __name__ == '__main__': else: from .grassUtils import buildGrassEnv, buildGrassLocation, exportRasters, importRastersInEnv, exportRastersFromEnv,\ grass_run_command, grass_parse_command, grass_feed_command, grass_pipe_command, grass_read_command - from .progressColors import * \ No newline at end of file + from .progressColors import * diff --git a/modules/hrudelin_parms_J2000.py b/modules/hrudelin_parms_J2000.py index dd1ab705ee0fd347219d50160fcdcaca06d0a7d4..2a605e05f7b4e0e0c68446e04c8b89a458129872 100755 --- a/modules/hrudelin_parms_J2000.py +++ b/modules/hrudelin_parms_J2000.py @@ -1,16 +1,29 @@ # coding: utf-8 -''' - MODULE: hru-delin_parms_J2000 - AUTHOR(S): adapted from GRASS-HRU (ILMS) - JENA University - IRSTEA - Christine Barachet +############################################################################ +# +# MODULE: hru-delin_parms_J2000.py +# AUTHOR(S): adapted from GRASS-HRU (ILMS) - JENA University +# by IRSTEA - Christine Barachet, +# Julien Veyssier +# +# PURPOSE: calculates the topology +# generates parameters files for J2000 +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# + + - PURPOSE: calculates the topology - generates parameters files for J2000 -''' # to keep python2 compatibility from __future__ import print_function @@ -210,6 +223,26 @@ def main(parms_file, nbProc, generator=False): os.mkdir(tmpPath) parms.read(parms_file) directory_out = parms.get('dir_out', 'files') + + if not os.path.isdir(directory_out): + sys.exit('------------> ERROR : In Directoy is not valid') + + + ## if hgeon, landuse and soil provided, test if exist + directory = parms.get('dir_in', 'dir') + for data in parms.items('data'): + data = os.path.join(directory, data[1]) + if not os.path.isfile(data): + print(data) + sys.exit('------------> ERROR : Input data not found' ) + + ## if irrig_rast provided, test if is valid + if str(parms.get('irrigation', 'irrig_rast')) != '': + irr_rast_test = os.path.join(directory, str(parms.get('irrigation', 'irrig_rast'))) + if not os.path.isfile(irr_rast_test): + sys.exit('------------> ERROR : Irrigation raster not found' ) + + # manage absolute and relative paths if not os.path.isabs(directory_out): directory_out = os.path.join(configFileDir, directory_out) @@ -865,4 +898,4 @@ else: from .progressColors import * from .circleKill import circleKill from .reach import buildReachPar - from .awk import * \ No newline at end of file + from .awk import * diff --git a/modules/progressColors.py b/modules/progressColors.py index 1c3cca73afde02e135110d88e70c709f176bb3c1..6b66d9ff4b39961495f0e8537c35c1c43ec4cd46 100644 --- a/modules/progressColors.py +++ b/modules/progressColors.py @@ -1,3 +1,24 @@ + + +############################################################################ +# +# MODULE: progressColors.py +# AUTHOR(S): Julien Veyssier +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# + + + + + + COLOR_GREEN='\x1b[32m' COLOR_YELLOW='\x1b[33m' COLOR_CYAN='\x1b[36m' @@ -30,4 +51,4 @@ def pad(s, nb): def padLeft(s, nb): while len(s) < nb: s = ' ' + s - return s \ No newline at end of file + return s diff --git a/modules/reach.py b/modules/reach.py index 09480a8d2c9a274f70a9e1567d58cef83c137137..05b5f5259011fb7096b83d7f2299e444e0c9515f 100755 --- a/modules/reach.py +++ b/modules/reach.py @@ -1,5 +1,24 @@ # coding: utf-8 + +############################################################################ +# +# MODULE: reach.py +# AUTHOR(S): Julien Veyssier +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# + + + + + import sys, os, shutil import time #import grass.script as grass diff --git a/modules/utils.py b/modules/utils.py index 745af2974a20930d7063195bf07ced9961d81f52..e9ece5e733bcc9682e8b7c8d56f08e2c502bce95 100644 --- a/modules/utils.py +++ b/modules/utils.py @@ -1,8 +1,27 @@ # coding: utf-8 + + +############################################################################ +# +# MODULE: utils.py +# AUTHOR(S): Julien Veyssier +# +# +# COPYRIGHT: (C) 2020 UR RIVERLY - INRAE +# +# This program is free software under the GNU General Public +# License (>=v2). Read the file LICENSE that comes with +# HRU-DELIN for details. +# +############################################################################# + + + + import pandas as pd def myJoin(f1Path, f2Path, resultPath): df1 = pd.read_table(f1Path, delim_whitespace=True) df2 = pd.read_table(f2Path, delim_whitespace=True) merge = pd.merge(df1, df2) - merge.to_csv(resultPath, header=True, index=False, sep=' ') \ No newline at end of file + merge.to_csv(resultPath, header=True, index=False, sep=' ') diff --git a/tests/bad_basin_size_config.cfg b/tests/bad_basin_size_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..c1d0d5b030f8b615c816f80b74fb5c546b0b4a06 --- /dev/null +++ b/tests/bad_basin_size_config.cfg @@ -0,0 +1,113 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size= + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name=COL +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_col_name_config.cfg b/tests/bad_col_name_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..1d5cff01bbdbddb45b951a64bb1abe942412a8a6 --- /dev/null +++ b/tests/bad_col_name_config.cfg @@ -0,0 +1,112 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1=1 +distance_tolerance_1=10 +# second rule +surface_tolerance_2=1 +distance_tolerance_2=10 + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit=1 + +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name=NON_EXISTENT +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_coords_config.cfg b/tests/bad_coords_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..fc402e7f6301e4396fc383df246836ac1591ac3d --- /dev/null +++ b/tests/bad_coords_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:coords +polygon: +west:10 +north:10 +east:10 +south:a + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_data_config.cfg b/tests/bad_data_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..6d628d6ada089b7506e95600e8c60d7d425de885 --- /dev/null +++ b/tests/bad_data_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:NON_EXISTENT.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:coords +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_dem_config.cfg b/tests/bad_dem_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..fa13273ae40293810359f7629128175905662d20 --- /dev/null +++ b/tests/bad_dem_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:NON_EXISTENT.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:coords +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_distance_tolerance_1_config.cfg b/tests/bad_distance_tolerance_1_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..7f10d5591ba05c0f1f99df472d013e72d17b6a95 --- /dev/null +++ b/tests/bad_distance_tolerance_1_config.cfg @@ -0,0 +1,112 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1=1 +distance_tolerance_1=a +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name=COL +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_distance_tolerance_2_config.cfg b/tests/bad_distance_tolerance_2_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..8b83ee92ad5936c288a0bc9d4239ce5ebf638bd5 --- /dev/null +++ b/tests/bad_distance_tolerance_2_config.cfg @@ -0,0 +1,112 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1=1 +distance_tolerance_1=10 +# second rule +surface_tolerance_2=1 +distance_tolerance_2=a + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name=COL +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_gauge_area_col_name_config.cfg b/tests/bad_gauge_area_col_name_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..2a36a08bafcf90ef92351f61455b3d53310b7095 --- /dev/null +++ b/tests/bad_gauge_area_col_name_config.cfg @@ -0,0 +1,112 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1=1 +distance_tolerance_1=10 +# second rule +surface_tolerance_2=1 +distance_tolerance_2=10 + +# drained surface +gauge_area_col_name= + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name=COL +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_gauge_area_col_unit_config.cfg b/tests/bad_gauge_area_col_unit_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..c1cf712b5e342c2c0a4bf6eaf4b294c76e7fbdf5 --- /dev/null +++ b/tests/bad_gauge_area_col_unit_config.cfg @@ -0,0 +1,112 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1=1 +distance_tolerance_1=10 +# second rule +surface_tolerance_2=1 +distance_tolerance_2=10 + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name=COL +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_gauges_config.cfg b/tests/bad_gauges_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..ab8817302af16021f1b7c68b3cdf58aa85692393 --- /dev/null +++ b/tests/bad_gauges_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:NON_EXISTENT.tif + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:coords +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_hrus_min_surface_config.cfg b/tests/bad_hrus_min_surface_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..c4c5ce92c007dd41f4390679efcb0f14449e3ffe --- /dev/null +++ b/tests/bad_hrus_min_surface_config.cfg @@ -0,0 +1,112 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1=1 +distance_tolerance_1=10 +# second rule +surface_tolerance_2=1 +distance_tolerance_2=10 + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit=1 + +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name=COL +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface=a + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_input_dir_config.cfg b/tests/bad_input_dir_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..cf22193165e26fda40e31d18bc98e44e8bbb88fc --- /dev/null +++ b/tests/bad_input_dir_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir: +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:coords +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_irrigation_config.cfg b/tests/bad_irrigation_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..0b7a31f0a5eda642e430c24e6632d3513e546fba --- /dev/null +++ b/tests/bad_irrigation_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast:NON_EXISTENT.tif + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:coords +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_output_files_config.cfg b/tests/bad_output_files_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..789e068b312fea3805563eccb92d85527fabeb4b --- /dev/null +++ b/tests/bad_output_files_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/NON_EXISTENT_DIRECTORY/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:coords +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_output_results_config.cfg b/tests/bad_output_results_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..2abe9bb053108ac46af5c2972bf82adbfa3d9a97 --- /dev/null +++ b/tests/bad_output_results_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/NON_EXISTENT_DIRECTORY/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:coords +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_polygon_config.cfg b/tests/bad_polygon_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..7f168fdd80490ce37b07eb88c33e4f18791f004e --- /dev/null +++ b/tests/bad_polygon_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:polygon +polygon:NON_EXISTENT.shp +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_reclass_aspect_rules_config.cfg b/tests/bad_reclass_aspect_rules_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..351d7a436056991b543b7f687186cf8e259fe8d7 --- /dev/null +++ b/tests/bad_reclass_aspect_rules_config.cfg @@ -0,0 +1,113 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:no + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_reclass_dem_rules_config.cfg b/tests/bad_reclass_dem_rules_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..326c59b19df1c38d65a1ca4794921238fc0ae8b0 --- /dev/null +++ b/tests/bad_reclass_dem_rules_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:no + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_reclass_slope_rules_config.cfg b/tests/bad_reclass_slope_rules_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..314d0dc7c2390ada508125f2feda7b295a093a7b --- /dev/null +++ b/tests/bad_reclass_slope_rules_config.cfg @@ -0,0 +1,113 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:no + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_relocated_gauges_config.cfg b/tests/bad_relocated_gauges_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..e56dd4eda6138339093897f5202834147cc9646c --- /dev/null +++ b/tests/bad_relocated_gauges_config.cfg @@ -0,0 +1,112 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +relocated_gauges:NON_EXISTENT.shp + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name=COL +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_step_dem_rules_config.cfg b/tests/bad_step_dem_rules_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..5d3f4214c89201abf511e2ae834b8e0c91ae7727 --- /dev/null +++ b/tests/bad_step_dem_rules_config.cfg @@ -0,0 +1,113 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem: + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_surface_tolerance_1_config.cfg b/tests/bad_surface_tolerance_1_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..5025349be80f42b3f83790d379b0cb404ea4c1fc --- /dev/null +++ b/tests/bad_surface_tolerance_1_config.cfg @@ -0,0 +1,112 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1=a +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name=COL +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/bad_surface_tolerance_2_config.cfg b/tests/bad_surface_tolerance_2_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..eaad91845961ba9d41f64a8e9095f9f0f0c8db92 --- /dev/null +++ b/tests/bad_surface_tolerance_2_config.cfg @@ -0,0 +1,112 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1=1 +distance_tolerance_1=10 +# second rule +surface_tolerance_2=a +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name=COL +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/empty_output_files_config.cfg b/tests/empty_output_files_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..9e875c565fdfabb34fe2430938566795c7b7a1b0 --- /dev/null +++ b/tests/empty_output_files_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files: +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:coords +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/empty_output_results_config.cfg b/tests/empty_output_results_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..4aa6bcc45fb7282406c48807befd8090513257a2 --- /dev/null +++ b/tests/empty_output_results_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results: +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:coords +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/hru_config.cfg b/tests/hru_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..6dfe0d6c5afc4d506f147800fb8d74cccaedb7f5 --- /dev/null +++ b/tests/hru_config.cfg @@ -0,0 +1,113 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/inputdata/Tille.cfg b/tests/inputdata/Tille.cfg new file mode 100644 index 0000000000000000000000000000000000000000..36027b080346881d5d3baf369e1cfe2ed4eb5f12 --- /dev/null +++ b/tests/inputdata/Tille.cfg @@ -0,0 +1,113 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/donnees_exemple/tests_maillage_Tille +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/donnees_exemple/tests_maillage_Tille/OUT_FILE +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/donnees_exemple/tests_maillage_Tille/OUT_RESULT +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem: + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size= + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/inputdata/bv_tille.dbf b/tests/inputdata/bv_tille.dbf new file mode 100755 index 0000000000000000000000000000000000000000..f34a4ec17db6a942f43f7fd62236df8d80e98a3b Binary files /dev/null and b/tests/inputdata/bv_tille.dbf differ diff --git a/tests/inputdata/bv_tille.prj b/tests/inputdata/bv_tille.prj new file mode 100755 index 0000000000000000000000000000000000000000..5adb2a9108a4bd847464a2c506a40c8d199faa69 --- /dev/null +++ b/tests/inputdata/bv_tille.prj @@ -0,0 +1 @@ +PROJCS["RGF93_Lambert_93",GEOGCS["GCS_RGF93",DATUM["D_RGF_1993",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["standard_parallel_1",49],PARAMETER["standard_parallel_2",44],PARAMETER["latitude_of_origin",46.5],PARAMETER["central_meridian",3],PARAMETER["false_easting",700000],PARAMETER["false_northing",6600000],UNIT["Meter",1]] \ No newline at end of file diff --git a/tests/inputdata/bv_tille.qpj b/tests/inputdata/bv_tille.qpj new file mode 100755 index 0000000000000000000000000000000000000000..52a60bf44d9f6d1ad3e986837ac8859cf97d222f --- /dev/null +++ b/tests/inputdata/bv_tille.qpj @@ -0,0 +1 @@ +PROJCS["RGF93 / Lambert-93",GEOGCS["RGF93",DATUM["Reseau_Geodesique_Francais_1993",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6171"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4171"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["standard_parallel_1",49],PARAMETER["standard_parallel_2",44],PARAMETER["latitude_of_origin",46.5],PARAMETER["central_meridian",3],PARAMETER["false_easting",700000],PARAMETER["false_northing",6600000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],AUTHORITY["EPSG","2154"]] diff --git a/tests/inputdata/bv_tille.shp b/tests/inputdata/bv_tille.shp new file mode 100755 index 0000000000000000000000000000000000000000..1dee52aee43906883a546f5619dbf76410671f8d Binary files /dev/null and b/tests/inputdata/bv_tille.shp differ diff --git a/tests/inputdata/bv_tille.shx b/tests/inputdata/bv_tille.shx new file mode 100755 index 0000000000000000000000000000000000000000..fbf97733f470c9d288e830a0574a4935ef27b145 Binary files /dev/null and b/tests/inputdata/bv_tille.shx differ diff --git a/tests/inputdata/hgeo_tille.tif b/tests/inputdata/hgeo_tille.tif new file mode 100755 index 0000000000000000000000000000000000000000..a628c3cecd7515e36c9a585fa8e954df3fbbde53 Binary files /dev/null and b/tests/inputdata/hgeo_tille.tif differ diff --git a/tests/inputdata/hgeo_tille.tif.aux.xml b/tests/inputdata/hgeo_tille.tif.aux.xml new file mode 100755 index 0000000000000000000000000000000000000000..c52d9588d15d2ec16aa1f18dd383813427c9b3ef --- /dev/null +++ b/tests/inputdata/hgeo_tille.tif.aux.xml @@ -0,0 +1,21 @@ +<PAMDataset> + <PAMRasterBand band="1"> + <Histograms> + <HistItem> + <HistMin>0.9965000000000001</HistMin> + <HistMax>8.003500000000001</HistMax> + <BucketCount>1000</BucketCount> + <IncludeOutOfRange>0</IncludeOutOfRange> + <Approximate>0</Approximate> + <HistCounts>195|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|10085|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|3</HistCounts> + </HistItem> + </Histograms> + <Metadata> + <MDI key="STATISTICS_MAXIMUM">8</MDI> + <MDI key="STATISTICS_MEAN">6.8865117183702</MDI> + <MDI key="STATISTICS_MINIMUM">1</MDI> + <MDI key="STATISTICS_STDDEV">0.81859165967775</MDI> + <MDI key="STATISTICS_VALID_PERCENT">100</MDI> + </Metadata> + </PAMRasterBand> +</PAMDataset> diff --git a/tests/inputdata/landuse_tille.tif b/tests/inputdata/landuse_tille.tif new file mode 100755 index 0000000000000000000000000000000000000000..180815be4335f5a665d6821edaa97308ddefb38d Binary files /dev/null and b/tests/inputdata/landuse_tille.tif differ diff --git a/tests/inputdata/landuse_tille.tif.aux.xml b/tests/inputdata/landuse_tille.tif.aux.xml new file mode 100755 index 0000000000000000000000000000000000000000..c76276424e6c83e898f4753dcfc56c9efeb26bc8 --- /dev/null +++ b/tests/inputdata/landuse_tille.tif.aux.xml @@ -0,0 +1,21 @@ +<PAMDataset> + <PAMRasterBand band="1"> + <Histograms> + <HistItem> + <HistMin>0.998</HistMin> + <HistMax>5.002</HistMax> + <BucketCount>1000</BucketCount> + <IncludeOutOfRange>0</IncludeOutOfRange> + <Approximate>0</Approximate> + <HistCounts>4|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|5019|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|109|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|4075|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|49</HistCounts> + </HistItem> + </Histograms> + <Metadata> + <MDI key="STATISTICS_MAXIMUM">5</MDI> + <MDI key="STATISTICS_MEAN">2.9077355229041</MDI> + <MDI key="STATISTICS_MINIMUM">1</MDI> + <MDI key="STATISTICS_STDDEV">0.9984433723229</MDI> + <MDI key="STATISTICS_VALID_PERCENT">100</MDI> + </Metadata> + </PAMRasterBand> +</PAMDataset> diff --git a/tests/inputdata/mnt_tille.tif b/tests/inputdata/mnt_tille.tif new file mode 100755 index 0000000000000000000000000000000000000000..bd1d499903c3a1c6cf2a127ab11d6eec09ec6d27 Binary files /dev/null and b/tests/inputdata/mnt_tille.tif differ diff --git a/tests/inputdata/mnt_tille.tif.aux.xml b/tests/inputdata/mnt_tille.tif.aux.xml new file mode 100755 index 0000000000000000000000000000000000000000..27701757379aab27eaea3166612c2e84b905800e --- /dev/null +++ b/tests/inputdata/mnt_tille.tif.aux.xml @@ -0,0 +1,21 @@ +<PAMDataset> + <PAMRasterBand band="1"> + <Histograms> + <HistItem> + <HistMin>253.1301449813843</HistMin> + <HistMax>539.1158724746704</HistMax> + <BucketCount>1000</BucketCount> + <IncludeOutOfRange>0</IncludeOutOfRange> + <Approximate>0</Approximate> + <HistCounts>1|0|0|0|0|0|0|0|0|0|0|0|1|0|0|1|0|2|0|1|3|0|1|6|8|4|7|8|8|9|7|14|4|7|19|7|9|14|7|6|6|11|12|14|8|11|8|8|9|15|10|20|15|13|13|23|14|13|22|15|8|22|31|11|16|31|22|13|19|41|23|9|25|30|19|18|54|24|20|42|17|22|22|34|22|19|29|13|22|18|38|13|17|34|18|14|20|16|16|14|13|19|11|13|13|15|14|17|24|18|15|23|23|20|25|15|14|23|23|18|21|15|14|16|18|20|20|18|25|20|19|22|19|22|20|20|17|20|18|27|11|13|24|22|22|23|19|21|21|31|16|25|11|30|17|12|18|21|18|24|23|16|18|31|24|26|19|33|18|24|31|25|37|21|28|24|18|36|21|24|25|28|24|26|36|26|22|22|35|22|22|23|20|24|24|27|35|32|16|18|24|20|22|16|21|25|24|25|26|27|18|28|37|31|22|19|35|20|24|22|22|25|18|40|20|20|33|33|30|34|26|29|26|32|20|20|29|30|22|25|25|24|21|24|39|24|30|23|36|30|21|25|23|26|25|26|29|28|35|27|27|32|28|25|23|26|32|33|42|25|27|26|31|48|20|27|37|30|25|33|31|36|34|36|31|38|26|29|38|43|27|38|32|42|40|32|34|25|29|50|32|48|32|42|29|32|30|43|46|38|47|33|58|30|31|35|36|52|44|32|31|33|38|33|53|43|33|42|41|43|41|40|45|51|39|50|47|39|42|35|37|33|31|39|43|52|40|57|44|47|45|40|41|42|44|32|49|40|55|41|43|38|50|42|36|38|61|44|51|57|44|51|48|46|49|45|55|61|47|45|53|68|53|59|61|70|62|68|54|55|49|58|59|60|53|62|46|68|71|69|66|69|60|51|63|66|57|71|68|63|66|55|63|60|50|71|67|76|74|64|77|69|72|67|63|50|75|60|60|79|68|67|73|83|88|73|83|63|55|81|83|76|82|85|94|78|80|79|84|80|88|77|83|69|104|83|73|102|83|87|80|99|79|94|96|95|79|103|103|82|69|97|97|84|85|108|88|90|104|97|109|88|102|99|85|104|111|89|93|106|98|103|109|93|100|93|131|114|102|124|102|100|99|125|92|95|112|92|93|105|125|94|108|137|98|104|120|134|115|111|134|114|118|121|134|117|105|147|104|121|118|130|123|103|146|141|106|121|127|103|103|116|120|100|131|139|105|117|135|122|117|103|129|115|111|133|108|103|127|128|116|111|130|118|124|117|138|115|128|147|114|120|141|143|135|119|139|108|123|152|129|120|116|128|118|120|141|142|114|141|147|123|110|145|115|130|129|155|145|127|130|117|130|135|157|148|119|163|110|121|122|129|113|124|146|139|121|121|171|122|115|142|126|113|126|148|126|134|133|114|139|128|146|118|140|150|138|125|137|152|121|125|169|142|158|128|185|140|140|145|136|126|129|144|140|141|141|157|106|144|161|121|122|159|116|141|145|167|131|147|166|147|129|128|177|125|113|176|130|127|138|163|151|121|188|150|130|121|150|144|139|160|133|128|157|184|148|127|187|142|128|147|161|130|133|178|163|145|156|188|132|144|186|135|147|132|187|151|146|200|134|129|148|197|149|137|166|131|140|119|157|135|123|206|153|140|133|171|128|138|173|127|109|122|159|121|116|162|104|124|114|138|97|98|149|118|123|117|133|100|103|137|99|92|87|125|83|100|111|102|83|78|124|77|81|124|82|86|88|91|83|83|120|77|75|98|110|85|85|107|94|78|70|120|70|71|110|85|71|80|98|78|69|80|56|65|52|76|68|61|73|61|53|57|62|43|53|70|52|50|56|73|40|47|68|33|35|34|58|40|33|43|30|30|41|37|29|25|45|26|37|32|42|35|21|45|32|32|21|37|26|27|30|27|18|20|27|27|24|29|20|10|22|30|18|20|22|23|22|21|31|18|12|18|11|14|20|21|23|15|16|9|14|10|28|19|15|25|19|14|12|24|12|15|22|20|21|16|11|16|13|21|21|15|22|19|15|8|16|6|8|17|16|9|11|20|11|6|12|9|8|9|7|10|9|9|10|4|13|7|7|3|8|10|3|7|1|6|5|5|7|3|4|2|2|2|4|4|4|2|2|1|0|2|6|1|1|1|0|0|2|0|3|1|0|2|2|2|2|2|0|0|0|0|0|0|1|0|1|0|0|0|1|0|1|0|0|0|1|1|0|0|0|0|0|1|0|1|0|1</HistCounts> + </HistItem> + </Histograms> + <Metadata> + <MDI key="STATISTICS_MAXIMUM">538.97302246094</MDI> + <MDI key="STATISTICS_MEAN">414.88370197617</MDI> + <MDI key="STATISTICS_MINIMUM">253.27299499512</MDI> + <MDI key="STATISTICS_STDDEV">53.267620020209</MDI> + <MDI key="STATISTICS_VALID_PERCENT">100</MDI> + </Metadata> + </PAMRasterBand> +</PAMDataset> diff --git a/tests/inputdata/multipoint_stations_tille.cpg b/tests/inputdata/multipoint_stations_tille.cpg new file mode 100644 index 0000000000000000000000000000000000000000..3ad133c048f2189041151425a73485649e6c32c0 --- /dev/null +++ b/tests/inputdata/multipoint_stations_tille.cpg @@ -0,0 +1 @@ +UTF-8 \ No newline at end of file diff --git a/tests/inputdata/multipoint_stations_tille.dbf b/tests/inputdata/multipoint_stations_tille.dbf new file mode 100644 index 0000000000000000000000000000000000000000..8745e73ef7961a784f3241942b6010229daa14d7 Binary files /dev/null and b/tests/inputdata/multipoint_stations_tille.dbf differ diff --git a/tests/inputdata/multipoint_stations_tille.prj b/tests/inputdata/multipoint_stations_tille.prj new file mode 100644 index 0000000000000000000000000000000000000000..f904335fe5023555790abfa69e50304e1cf3fa1f --- /dev/null +++ b/tests/inputdata/multipoint_stations_tille.prj @@ -0,0 +1 @@ +PROJCS["RGF93_Lambert_93",GEOGCS["GCS_RGF93_geographiques_dms",DATUM["D_RGF_1993",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",700000.0],PARAMETER["False_Northing",6600000.0],PARAMETER["Central_Meridian",3.0],PARAMETER["Standard_Parallel_1",44.0],PARAMETER["Standard_Parallel_2",49.0],PARAMETER["Latitude_Of_Origin",46.5],UNIT["Meter",1.0]] \ No newline at end of file diff --git a/tests/inputdata/multipoint_stations_tille.shp b/tests/inputdata/multipoint_stations_tille.shp new file mode 100644 index 0000000000000000000000000000000000000000..7a9f17a0ca44e4389ace91a1941f9f388a4bcb70 Binary files /dev/null and b/tests/inputdata/multipoint_stations_tille.shp differ diff --git a/tests/inputdata/multipoint_stations_tille.shx b/tests/inputdata/multipoint_stations_tille.shx new file mode 100644 index 0000000000000000000000000000000000000000..cae162080b070a0f02e7fc1021e09eef95a22f04 Binary files /dev/null and b/tests/inputdata/multipoint_stations_tille.shx differ diff --git a/tests/inputdata/soil_tille.tif b/tests/inputdata/soil_tille.tif new file mode 100755 index 0000000000000000000000000000000000000000..b42cfaf77f240a6e4b5ccfa2cbc94a6635c6d53d Binary files /dev/null and b/tests/inputdata/soil_tille.tif differ diff --git a/tests/inputdata/soil_tille.tif.aux.xml b/tests/inputdata/soil_tille.tif.aux.xml new file mode 100755 index 0000000000000000000000000000000000000000..f2687fe9d070926828081223e188786148f5b52d --- /dev/null +++ b/tests/inputdata/soil_tille.tif.aux.xml @@ -0,0 +1,21 @@ +<PAMDataset> + <PAMRasterBand band="1"> + <Histograms> + <HistItem> + <HistMin>0.999</HistMin> + <HistMax>3.001</HistMax> + <BucketCount>1000</BucketCount> + <IncludeOutOfRange>0</IncludeOutOfRange> + <Approximate>0</Approximate> + <HistCounts>7229|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|3419</HistCounts> + </HistItem> + </Histograms> + <Metadata> + <MDI key="STATISTICS_MAXIMUM">3</MDI> + <MDI key="STATISTICS_MEAN">1.6421863260706</MDI> + <MDI key="STATISTICS_MINIMUM">1</MDI> + <MDI key="STATISTICS_STDDEV">0.93379300423015</MDI> + <MDI key="STATISTICS_VALID_PERCENT">100</MDI> + </Metadata> + </PAMRasterBand> +</PAMDataset> diff --git a/tests/inputdata/stations_tille.dbf b/tests/inputdata/stations_tille.dbf new file mode 100644 index 0000000000000000000000000000000000000000..8745e73ef7961a784f3241942b6010229daa14d7 Binary files /dev/null and b/tests/inputdata/stations_tille.dbf differ diff --git a/tests/inputdata/stations_tille.prj b/tests/inputdata/stations_tille.prj new file mode 100644 index 0000000000000000000000000000000000000000..f904335fe5023555790abfa69e50304e1cf3fa1f --- /dev/null +++ b/tests/inputdata/stations_tille.prj @@ -0,0 +1 @@ +PROJCS["RGF93_Lambert_93",GEOGCS["GCS_RGF93_geographiques_dms",DATUM["D_RGF_1993",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",700000.0],PARAMETER["False_Northing",6600000.0],PARAMETER["Central_Meridian",3.0],PARAMETER["Standard_Parallel_1",44.0],PARAMETER["Standard_Parallel_2",49.0],PARAMETER["Latitude_Of_Origin",46.5],UNIT["Meter",1.0]] \ No newline at end of file diff --git a/tests/inputdata/stations_tille.shp b/tests/inputdata/stations_tille.shp new file mode 100644 index 0000000000000000000000000000000000000000..e2f056dd076eee6e742788749be007e707ed01ec Binary files /dev/null and b/tests/inputdata/stations_tille.shp differ diff --git a/tests/inputdata/stations_tille.shx b/tests/inputdata/stations_tille.shx new file mode 100644 index 0000000000000000000000000000000000000000..c94228bdd8230751bb743385713c979995c81886 Binary files /dev/null and b/tests/inputdata/stations_tille.shx differ diff --git a/tests/multipoint_gauges_config.cfg b/tests/multipoint_gauges_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..049723b6571ab1adeba2ed1d57302d7f43c27f42 --- /dev/null +++ b/tests/multipoint_gauges_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:multipoint_stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:coords +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/no_col_name_config.cfg b/tests/no_col_name_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..3d4b4f58ba63dc7802560889b039bb62031fcf91 --- /dev/null +++ b/tests/no_col_name_config.cfg @@ -0,0 +1,112 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/no_dem_config.cfg b/tests/no_dem_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..6051d01b0df3e24031e8f14264824cb21b971c46 --- /dev/null +++ b/tests/no_dem_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem: +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:coords +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/no_gauges_config.cfg b/tests/no_gauges_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..36f633c3ed883cb76646183f964d50fe1e1d2275 --- /dev/null +++ b/tests/no_gauges_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges: + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:coords +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/no_polygon_config.cfg b/tests/no_polygon_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..1691ed8fd18af9ea8e81b625064525f087c73a6c --- /dev/null +++ b/tests/no_polygon_config.cfg @@ -0,0 +1,115 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:polygon +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes + +[step_dem] +step_auto_dem:yes + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/running_tests.sh b/tests/running_tests.sh new file mode 100755 index 0000000000000000000000000000000000000000..5d603233a0602dd4a5b5d012a03e9ceb18d9e1c6 --- /dev/null +++ b/tests/running_tests.sh @@ -0,0 +1,625 @@ +#!/bin/bash + + +MYPATH=`readlink -f $0` +MYDIR=`dirname $MYPATH` + + +NBSEP=$(echo "$MYDIR"|grep -o '/'|wc -l) +DIRPATH=$(echo "$MYDIR"|cut -d/ -f1-$NBSEP) + + + + +succeed=0 +failed=0 +count=0 + +echo "**** test hru-delin_step1.sh ****" +# test input directory +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./bad_input_dir_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test input directory ----- ok" + let succeed++ +else + echo "test input directory ------------ FAILED" + let failed++ +fi + +##Â test input dem +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./no_dem_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if dem exist ----- ok" + let succeed++ +else + echo "test if dem exist ------------ FAILED" + let failed++ +fi + +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./bad_dem_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if dem is valid ----- ok" + let succeed++ +else + echo "test if dem is valid ------------ FAILED" + let failed++ +fi + + +##Â test gauges +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./no_gauges_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if Gauges exist ----- ok" + let succeed++ +else + echo "test if Gauges exist ------------ FAILED" + let failed++ +fi + +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./bad_gauges_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if Gauges is valid ----- ok" + let succeed++ +else + echo "test if Gauges is valid ------------ FAILED" + let failed++ +fi + +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./multipoint_gauges_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if Gauges is point geometry ----- ok" + let succeed++ +else + echo "test if Gauges is point geometry ------------ FAILED" + let failed++ +fi + + + + +##Â test data is valid +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./bad_data_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if data exist ----- ok" + let succeed++ +else + echo "test if data exist ------------ FAILED" + let failed++ +fi + +##Â test output FILE and RESULTS Directory +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./empty_output_files_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Directory is provided ----- ok" + let succeed++ +else + echo "test if output FILE Directory is provided ------------ FAILED" + let failed++ +fi + + +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./empty_output_results_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Results is provided ----- ok" + let succeed++ +else + echo "test if output FILE Results is provided ------------ FAILED" + let failed++ +fi + +##Â test output FILE and RESULTS Directory is valid +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./bad_output_files_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Directory is valid ----- ok" + let succeed++ +else + echo "test if output FILE Directory is valid ------------ FAILED" + let failed++ +fi + + +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./bad_output_results_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Results is valid ----- ok" + let succeed++ +else + echo "test if output FILE Results is valid ------------ FAILED" + let failed++ +fi + + + + +##Â test irrigation raster if provided +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./bad_irrigation_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if Irrigation is provided ----- ok" + let succeed++ +else + echo "test if Irrigation is provided ------------ FAILED" + let failed++ +fi + +##Â test polygon layer for surface selection if provided +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./bad_polygon_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if Polygon layer for surface selection is valid ----- ok" + let succeed++ +else + echo "test if Polygon layer for surface selection is valid ------------ FAILED" + let failed++ +fi + +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./no_polygon_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if Polygon layer for surface selection is provided ----- ok" + let succeed++ +else + echo "test if Polygon layer for surface selection is provided ------------ FAILED" + let failed++ +fi + + +##Â test if coords for surface selection is valid +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./bad_coords_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if coords for surface selection is valid ----- ok" + let succeed++ +else + echo "test if coords for surface selection is valid ------------ FAILED" + let failed++ +fi + +##Â test if reclass dem rules is missing +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./bad_reclass_dem_rules_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if reclass dem rules is missing is valid ----- ok" + let succeed++ +else + echo "test if reclass dem rules is missing is valid ------------ FAILED" + let failed++ +fi + + +##Â test if step dem is valid +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./bad_step_dem_rules_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if step dem value is valid ----- ok" + let succeed++ +else + echo "test if if step dem value is valid ------------ FAILED" + let failed++ +fi + +##Â test if reclass slope rules is missing +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./bad_reclass_slope_rules_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if reclass slope rules is missing is valid ----- ok" + let succeed++ +else + echo "test if reclass slope rules is missing is valid ------------ FAILED" + let failed++ +fi + + +##Â test if reclass aspect rules is missing +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./bad_reclass_aspect_rules_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if reclass aspect rules is missing is valid ----- ok" + let succeed++ +else + echo "test if reclass aspect rules is missing is valid ------------ FAILED" + let failed++ +fi + +##Â test if basin size value is missing +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./bad_basin_size_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if basin size value is missing ----- ok" + let succeed++ +else + echo "test if basin size value is missing ------------ FAILED" + let failed++ +fi + +##Â test step1 all OK +let count++ +$DIRPATH/bin/hru-delin_step1.sh ./step1_ok_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if step 1 all OK ----- FAILED" + let failed++ +else + echo "test if step 1 all OK ------------ ok" + let succeed++ +fi +echo " " +echo "**** test hru-delin_step2.sh ****" + + +#Â test output FILE and RESULTS Directory +let count++ +$DIRPATH/bin/hru-delin_step2.sh ./empty_output_files_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Directory is provided ----- ok" + let succeed++ +else + echo "test if output FILE Directory is provided ------------ FAILED" + let failed++ +fi + + +let count++ +$DIRPATH/bin/hru-delin_step2.sh ./empty_output_results_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Results is provided ----- ok" + let succeed++ +else + echo "test if output FILE Results is provided ------------ FAILED" + let failed++ +fi + +##Â test output FILE and RESULTS Directory is valid +let count++ +$DIRPATH/bin/hru-delin_step2.sh ./bad_output_files_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Directory is valid ----- ok" + let succeed++ +else + echo "test if output FILE Directory is valid ------------ FAILED" + let failed++ +fi + + +let count++ +$DIRPATH/bin/hru-delin_step2.sh ./bad_output_results_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Results is valid ----- ok" + let succeed++ +else + echo "test if output FILE Results is valid ------------ FAILED" + let failed++ +fi + + + + + + +##Â test if basin size value is missing +let count++ +$DIRPATH/bin/hru-delin_step2.sh ./bad_basin_size_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if basin size value is missing ----- ok" + let succeed++ +else + echo "test if basin size value is missing ------------ FAILED" + let failed++ +fi + +##Â test if COLNAME is missing +let count++ +$DIRPATH/bin/hru-delin_step2.sh ./no_col_name_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if COLNAME is missing ----- ok" + let succeed++ +else + echo "test if COLNAME is missing ------------ FAILED" + let failed++ +fi + +##Â test if COLNAME is valid + +let count++ +$DIRPATH/bin/hru-delin_step2.sh ./bad_col_name_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if COLNAME is valid ----- ok" + let succeed++ +else + echo "test if COLNAME is valid ------------ FAILED" + let failed++ +fi + + +##Â test if Relocated Gauges is valid +let count++ +$DIRPATH/bin/hru-delin_step2.sh ./bad_relocated_gauges_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if Relocated Gauges is valid ----- ok" + let succeed++ +else + echo "test if Relocated Gauges is valid ------------ FAILED" + let failed++ +fi + +##Â test if Surface_tolerance_1 is valid +let count++ +$DIRPATH/bin/hru-delin_step2.sh ./bad_surface_tolerance_1_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if Surface_tolerance_1 is valid ----- ok" + let succeed++ +else + echo "test if Surface_tolerance_1 is valid ------------ FAILED" + let failed++ +fi + +##Â test if Distance_tolerance_1 is valid +let count++ +$DIRPATH/bin/hru-delin_step2.sh ./bad_distance_tolerance_1_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if Distance_tolerance_1 is valid ----- ok" + let succeed++ +else + echo "test if Distance_tolerance_1 is valid ------------ FAILED" + let failed++ +fi + +##Â test if Surface_tolerance_2 is valid +let count++ +$DIRPATH/bin/hru-delin_step2.sh ./bad_surface_tolerance_2_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if Surface_tolerance_2 is valid ----- ok" + let succeed++ +else + echo "test if Surface_tolerance_2 is valid ------------ FAILED" + let failed++ +fi + +##Â test if Distance_tolerance_2 is valid +let count++ +$DIRPATH/bin/hru-delin_step2.sh ./bad_distance_tolerance_2_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if Distance_tolerance_2 is valid ----- ok" + let succeed++ +else + echo "test if Distance_tolerance_2 is valid ------------ FAILED" + let failed++ +fi + +##Â test if Gauge area col name is provided +let count++ +$DIRPATH/bin/hru-delin_step2.sh ./bad_gauge_area_col_name_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if Gauge area col name is provided ----- ok" + let succeed++ +else + echo "test if Gauge area col name is provided ------------ FAILED" + let failed++ +fi + +##Â test if gauge area col unit is provided +let count++ +$DIRPATH/bin/hru-delin_step2.sh ./bad_gauge_area_col_unit_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if gauge area col unit is provided ----- ok" + let succeed++ +else + echo "test if gauge area col unit is provided ------------ FAILED" + let failed++ +fi + +##Â test step2 all OK +let count++ + +$DIRPATH/bin/hru-delin_step2.sh ./step2_ok_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if step 2 all OK ----- FAILED" + let failed++ +else + echo "test if step 2 all OK ------------ ok" + let succeed++ +fi + +echo " " +echo "**** test hru-delin_step3.sh ****" + + +#Â test output FILE and RESULTS Directory +let count++ +$DIRPATH/bin/hru-delin_step3.sh ./empty_output_files_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Directory is provided ----- ok" + let succeed++ +else + echo "test if output FILE Directory is provided ------------ FAILED" + let failed++ +fi + + +let count++ +$DIRPATH/bin/hru-delin_step3.sh ./empty_output_results_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Results is provided ----- ok" + let succeed++ +else + echo "test if output FILE Results is provided ------------ FAILED" + let failed++ +fi + +##Â test output FILE and RESULTS Directory is valid +let count++ +$DIRPATH/bin/hru-delin_step3.sh ./bad_output_files_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Directory is valid ----- ok" + let succeed++ +else + echo "test if output FILE Directory is valid ------------ FAILED" + let failed++ +fi + + +let count++ +$DIRPATH/bin/hru-delin_step3.sh ./bad_output_results_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Results is valid ----- ok" + let succeed++ +else + echo "test if output FILE Results is valid ------------ FAILED" + let failed++ +fi + + +##Â test if hrus min surface is valid +let count++ +$DIRPATH/bin/hru-delin_step3.sh ./bad_hrus_min_surface_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if hrus min surface is valid ----- ok" + let succeed++ +else + echo "test if hrus min surface is valid ------------ FAILED" + let failed++ +fi + +##Â test data is valid +let count++ +$DIRPATH/bin/hru-delin_step3.sh ./bad_data_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if data exist ----- ok" + let succeed++ +else + echo "test if data exist ------------ FAILED" + let failed++ +fi + + +#Â test step3 all OK +let count++ + +$DIRPATH/bin/hru-delin_step3.sh ./step3_ok_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if step 3 all OK ----- FAILED" + let failed++ +else + echo "test if step 3 all OK ------------ ok" + let succeed++ +fi + +echo " " +echo "**** test hru-delin_step4.sh ****" + + + +#Â test output FILE and RESULTS Directory +let count++ +$DIRPATH/bin/hru-delin_step4.sh ./empty_output_files_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Directory is provided ----- ok" + let succeed++ +else + echo "test if output FILE Directory is provided ------------ FAILED" + let failed++ +fi + + +let count++ +$DIRPATH/bin/hru-delin_step4.sh ./empty_output_results_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Results is provided ----- ok" + let succeed++ +else + echo "test if output FILE Results is provided ------------ FAILED" + let failed++ +fi + +##Â test output FILE and RESULTS Directory is valid +let count++ +$DIRPATH/bin/hru-delin_step4.sh ./bad_output_files_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Directory is valid ----- ok" + let succeed++ +else + echo "test if output FILE Directory is valid ------------ FAILED" + let failed++ +fi + + +let count++ +$DIRPATH/bin/hru-delin_step4.sh ./bad_output_results_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if output FILE Results is valid ----- ok" + let succeed++ +else + echo "test if output FILE Results is valid ------------ FAILED" + let failed++ +fi + +##Â test data is valid +let count++ +$DIRPATH/bin/hru-delin_step4.sh ./bad_data_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if data exist ----- ok" + let succeed++ +else + echo "test if data exist ------------ FAILED" + let failed++ +fi + + +##Â test irrigation raster if provided +let count++ +$DIRPATH/bin/hru-delin_step4.sh ./bad_irrigation_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if Irrigation is provided ----- ok" + let succeed++ +else + echo "test if Irrigation is provided ------------ FAILED" + let failed++ +fi + + +#Â test step4 all OK +let count++ + +$DIRPATH/bin/hru-delin_step4.sh ./step4_ok_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if step 4 all OK ----- FAILED" + let failed++ +else + echo "test if step 4 all OK ------------ ok" + let succeed++ +fi + +echo " " +echo "**** test all step ****" + + + +#Â test all step all OK +let count++ + +$DIRPATH/bin/hru-delin_all-steps.sh ./step4_ok_config.cfg >out 2>/dev/null +if [ $? -ne 0 ];then + echo "test if all step all OK ----- FAILED" + let failed++ +else + echo "test if all step all OK ------------ ok" + let succeed++ +fi + + +echo " " +echo " $succeed tests on $count tests succeed" +echo " $failed tests on $count tests failed" +rm -rf ./out + + + diff --git a/tests/step1_ok_config.cfg b/tests/step1_ok_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..6dfe0d6c5afc4d506f147800fb8d74cccaedb7f5 --- /dev/null +++ b/tests/step1_ok_config.cfg @@ -0,0 +1,113 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1= +distance_tolerance_1= +# second rule +surface_tolerance_2= +distance_tolerance_2= + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit= + +#relocated_gauges:/home/chris/DONNEES/Rhone/gauges_def_fil_500.shp +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name= +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/step2_ok_config.cfg b/tests/step2_ok_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..bab9f2df910ddbed48907e07db2b4a1c4e4dadfe --- /dev/null +++ b/tests/step2_ok_config.cfg @@ -0,0 +1,112 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1=1 +distance_tolerance_1=10 +# second rule +surface_tolerance_2=10 +distance_tolerance_2=100 + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit=1 + +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name=S_BH +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface= + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/step3_ok_config.cfg b/tests/step3_ok_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..dd8d0c69b72f0c4857f438e8c717118dacb9db47 --- /dev/null +++ b/tests/step3_ok_config.cfg @@ -0,0 +1,112 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1=1 +distance_tolerance_1=10 +# second rule +surface_tolerance_2=1 +distance_tolerance_2=10 + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit=1 + +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name=S_BH +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface=100 + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + + diff --git a/tests/step4_ok_config.cfg b/tests/step4_ok_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..dd8d0c69b72f0c4857f438e8c717118dacb9db47 --- /dev/null +++ b/tests/step4_ok_config.cfg @@ -0,0 +1,112 @@ + +# ----------- +# environment +# ----------- + +[dir_in] +dir:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata +[files_in] +dem:mnt_tille.tif +gauges:stations_tille.shp + +[data] +hgeo:hgeo_tille.tif +landuse:landuse_tille.tif +soil:soil_tille.tif + +[irrigation] +irrig_rast: + +[dir_out] +files:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_FILES +results:/home/michael.rabotin/1_HYBV/HRU_DELIN/hru-delin-master/tests/inputdata/OUT_RESULTS +# ------------------------- +# 1st step : hru-delin_init +# ------------------------- + +[surface] +#selection: total -> full dem +# polygon -> polygon: name of the shapefile +# coords -> give the coords upper left (west and north) and lower right (east and south) +selection:total +polygon: +west: +north: +east: +south: + + +[demfill] +# +# if demfill = yes : depressionless DEM will be generated +# no : no action on input DEM +# +demfill:yes + +# +# if rules_auto_* = yes : rules will be calculated by the module +# if no : fill the corresponding file (reclass_default_rules_*) +# +[reclass_dem] +rules_auto_dem:yes +step_dem:100 + +[reclass_slope] +rules_auto_slope:yes + +[reclass_aspect] +rules_auto_aspect:yes + +[basin_min_size] +# number of pixels +size=5 + +# --------------------------- +# 2nd step : hru-delin_basins +# --------------------------- +[auto_relocation] +to_do:yes +# first rule +surface_tolerance_1=1 +distance_tolerance_1=10 +# second rule +surface_tolerance_2=1 +distance_tolerance_2=10 + +# drained surface +gauge_area_col_name=S_BH + +# unit = 1 : m , = 2 : km +gauge_area_unit=1 + +relocated_gauges: + +[for_watershed_id] +# column name of the gauge attribute (attribute type must be numeric) +# used for identification of watersheds +col_name=S_BH +# --------------------------- +# 3rd step : hru-delin_hrugen +# --------------------------- + +[hrus_min_surface] +# +surface=100 + +# +# MNT-derived layers to be integrated in the overlay operation +# +[layer_overlay] +dem:x +slope:x +aspect:x + +# -------------------------------- +# 4th step : hru-delin_parms_J2000 +# -------------------------------- +[topology] +dissolve_cycle:y + + + +