Installation¶
River Architect applies on ArcGIS Pro’s arcpy package and needs to be executed with ArcGIS Pro’s conda environment (C:\Program Files\ArcGIS\Pro\bin\Python\scripts\propy.bat). The requirements section provides more details and installation hints for external packages.
River Architect is designed as an external application rather than a python package, but its modules can be imported as packages for external use (see the Alternative Run sections in the module Wikis).
Installation with Git Bash/GUI¶
We recommend downloading and updating River Architect using Git Bash (or Git GUI). Alternatively, River Architect can be downloaded as zip file. However, updates are tricky when River Architect is downloaded as zip file.
Git Bash
GitHub provides detailed descriptions and standard procedures to work with their repositories (read more). The following “recipe” guides through the first time installation (cloning) of River Architect:
Open Git Bash
Type
cd "D:/Target/Directory/"to change to the target installation directory (recommended:cd "D:/Python/RiverArchitect/"). If the directory does not exist, it can be created in the system explorer (right-click in empty space >New >>Folder).Clone the repository:
git clone https://github.com/RiverArchitect/program
Done. Close Git Bash and start working with River Architect.
Git GUI
For using Git GUI, open Git GUI and choose Clone Existing Repository. Enter the Source Location: https://github.com/RiverArchitect/program, and the Target Directory: D:/Python/RiverArchitect (or any other directory, but ensure that the directory does not exist). Click Clone. Done.
Update with Git Bash/GUI (re- pull)¶
Currently, Git Bash (or Git GUI) are the only options to update local copies of River Architect. Before updating River Architect, we recommend to save any files and Conditions produced with River Architect externally (create a save copy).
Git Bash
Open Git Bash and do the following:
Go to the local River Architect installation directory:
cd "D:/Python/RiverArchitect/program/"(or wherever River Architect was cloned).Check the current status:
git statusPull changes:
git pull
Please note that merge errors may occur when changes were made in the local copy of River Architect. In this case, Git Bash will guide through the manual merge process.
If you modified template workbooks (Fish.xlsx or threshold_values.xlsx): Create a .gitignore file in the /RiverArchitect/ directory. Open the .gitignore file with a text editor and enter the following:
/LifespanDesign/.templates/threshold_values.xlsx
/.site_packages/templates/Fish.xlsx
Save the .gitignore file and close the text editor. Now git pull will no longer overwrite Fish.xlsx and threshold_values.xlsx.
Git GUI
Open Git Bash and open D:/Python/RiverArchitect from the Open Recent Repository list (or wherever River Architect is installed). If not listed, click on Open Existing Repository and select the River Architect installation directory. Then:
Click on
Rescan.Click on the
Remotedrop-down menu >Fetch from>origin.Click on the
Mergedrop-down menu >Local Merge.
Launch River Architect¶
To start using River Architect:
Right-click on
DRIVE:\path\to\...\RiverArchitect\Start_River_Architect.batand click onEdit.In the
Start_River_Architect.batchfile, ensure that the Python path is correctly defined according to the installed version of ArcGIS:callEDIT>>"%PROGRAMFILES%\ArcGIS\Pro\bin\Python\Scripts\propy"<<"%cd%\master_gui.py". For more information about running standalone Python scripts in ArcGIS Pro’s conda environment, read their descriptions.Save and close
Start_River_Architect.bat.
Double-click on
DRIVE:\path\to\...\RiverArchitect\Start_River_Architect.batto start River Architect.Create a Condition on the Welcome (Get Started) tab.
Analyze and create ecohydraulic paradises for Physical Habitats prefered by target (fish) species with sustainable river design features using lifespan maps.
Hint: The Quick GUIde sections in the module Wikis provide straight-forward application guidance.
River Architect starts in a GUI that is stored in master_gui.py. Alternatively, the modules can be individually launched by double-clicking on the LAUNCH_Windows_x64.bat in the module folders (not recommended and may be abandoned in future versions).
Package structure, requirements and logfiles¶
File structure¶
The main directory (/RiverArchitect/) contains the program launcher named Start_River_Architect.bat and the Python3 file master_gui.py. The River Architect modules are located in sub-folders. The master folder (/RiverArchitect/) includes the following files and directories (the full list of all files for developers is available here):
.sitepackages Contains adapted third-party Python packages and own packages
openpyxlContains a modified version of theopenpyxlpackage (version 2.5.2) adapted for River ArchitectriverpyParticular python scripts with recurring routines and classes that are used in multiple modules.cDefinitions.pycontains inter-module information of reach and feature keywords.cFeatures.pycontains river design features classes with pointers to parameters and threshold values.cFish.pycontains the class that reads characteristic species and lifestage data fromriverpy/templates/Fish.xlsx.cFlows.pycontains classes for creating flow duration curves and interpolating the annual/seasonal flow durations of 2D-modeled discharges.cGravel.pycontains subfeatures of the Gravel augmentation-feature incFeatures.cInputOutput.pycontains workbook (.xlsx) read and write routines.cInterpolator.pyprovides routines for interpolating data between exact data points (x and y).cLogger.pycontains theLogger()class that specifies the appearance of logging messages.cMakeTables.pymake habitat evaluation workbook tables (.xlsxformat).cMapper.pycontains mapping routines (see Mapping Wiki).cPlants.pycontains subfeatures of the Plantings-feature incFeaturesand theModifyTerrainmodule.cReachManager.pyprocesses reach information and reach-wise terrain change (volume differences).cThresholdDirector.pyprovides theThresholdDirector()class for reading threshold values from the “thresholds.xlsx” workbook.config.pycontains global parameter definitions and pointers to workbooks.fGlobal.pyprovides functions that are required in this module and the other modules in several classes.
templatescontains global template files (content will be enriched in future versions)
00_Flows contains templates for flow (discharge) analyses.
01_Conditions contains
Conditionfolders with parameter Rasters. The condition name begins with a 4-digit year number (e.g.,2018), optionally followed by a 3-characters reach ID (e.g.,xyz) and a feature layer indicator (e.g.,lyr10for terraforming features). The syllables are separated by an underscore. The process of defining of reaches is explained in the Signposts and the ModifyTerrain Wiki.02_Maps contains a map
templatessubfolder that is copied by River Architect’s modules for processed conditions (e.g.,02_Maps/CONDITION/) for Mapping of Rasters and Shapefiles. The following templates and folders may be modified:symbology\ contains a standard symbology layer file (.lyrx) for partially logarithmic lifespan classificationriver_template.aprxis the standard ArcGIS Pro project file, where developers recommend to adapt background image (layer) connections.
Module (folder):
RiverArchitect/StrandingRiskfor stranding risk analyses of restoration efforts.Outputdirectory where Stranding Risk module outputs are saved.connect_gui.pyis a standalone script that creates the graphical user interface (GUI) for running the Stranding Risk module.cConnectivityAnalysis.pyprovides methods for calculating stranding risk metrics.cGraph.pycontains graphic representation routines for habitat connectivity analyses.
Module (folder):
RiverArchitect/GetStartedprepare input Conditions from scratch or existing conditions..cachefolder occurs temporarily when the module is executed..templatesfolder should not be modified and contains the welcome screen imagery.cConditionCreator.pycontains a managing class for creating and populating Conditions.cDetrendedDEM.pyprovides routines for generating detrended DEM Rasters.cMakeInp.pyprovides routines for creating input files (.inp) for lifespan mapping.cMorphUnit.pyprovides routines for calculating instream morphological units (Wyrick and Pasternack 2014).cWaterLevel.pyprovides routines for calculating depth to water table Rasters.fSubCondition.pycontains routines for creating a spatial subset of an existing Condition.popup_ ... .pycontain popup window classes guiding through the creation and population of Conditions.welcome_gui.pycontains theGet Startedtab source code.
Module (folder):
RiverArchitect/LifespanDesignfor Lifespan and Design analyses of restoration features.Outputfolder with sub-folders forRastersfrom individual module runs..cachefolder occurs temporarily when the module is executed..templatesfolder should not be modified and contains input (*.inp) files; if required, the module includes routines for changing the input files.cLifespanDesignAnalysis.pycontains a GIS-based functional core for processingRasterfiles.cParameters.pycontains the parameter input core with pointers toRasters andRasternames.cReadInpLifespan.pycontains classes that read input data from*.inpfiles.feature_analysis.pycoordinates class and function calls.lifespan_design_gui.pyis a standalone script that creates the graphical user interface (GUI) for running the LifespanDesign module.
Module (folder):
RiverArchitect/MaxLifespanfor maximum lifespan assessment of feature groups (concurring features)Outputfolder with sub-folders forLayouts,MapsandRastersfrom individual module runs..cachefolder occurs temporarily when the module is executed..templatesfolder contains additional Rasters, which are required by this module; other Rasters are loaded from01_Conditions.action_gui.pyis a standalone script that creates the graphical user interface (GUI) for running the MaxLifespan module.action_planner.pycoordinates class instantiations and function calls.cActionAssessment.pycontains the GIS-based functional core that identifies optimum lifespans and associated features by processing lifespan/designRasterandshapefiles.cFeatureActions.pycontains pointers to river restoration feature data in the LifespanDesign module.cReadActionInput.pycontains functions for reading*.inpfiles from the.templatesfolder.
Module (folder):
RiverArchitect/ModifyTerrainperforms half-automated terrain modificationsInputfolder containing optional modified DEMs for volume difference assessment.Outputfolder with sub-foldersRastersfrom individual module runs.RiverBuilderfolder contains original River Builder code (riverbuilder.r) and input files, as well as help messages..cachefolder occurs when the module is executed..templatesfolder contains the reach-defining workbookcomputation_extents.xlsx.cModifyTerrain.pycontains GIS-based functional core for modifying DEMRasters with threshold values (grading and widening).cRiverBuilder.pycontains routines for launching River Builder.cRiverBuilderConstruct.pycontains routines for creating input files for River Builder.modify_terrain_gui.pyis a standalone script that creates the graphical user interface (GUI) for running the ModifyTerrain module.sub_gui_rb.pycontains the GUI for creating River Builder input files.
Module (folder):
RiverArchitect/SHArCcreates Habitat Suitability Index Rasters/maps and quantifies annually usable habitat area for target fish species and user-defined ranges of discharges.CHSIcontains subfolders with composite habitat suitability index Rasters for pre- and post-projectconditions.HSIcontains subfolders with habitat suitability indexRastersfor pre- and post-projectconditions.SHAreacontains result workbooks with SHArea values for examinedconditions. TheRasterssubfolder contains the associated composite habitat suitability Rasters..cachefolder occurs temporarily when the module is executed..templatesfolder contains spreadsheet templates for the quantification of annually usable habitat area and the definition of fish species, lifestages, and associated habitat suitability curves.cHSI.pycontains classes to calculate composite habitat suitability Rasters, hydraulic habitat suitability Rasters and interpolating the annual flow duration of considered discharges.sharc_gui.pycontains the class of this module.sub_gui_covhhsi.pyopens a new GUI window to create cover habitat suitability Rasters.sub_gui_hhsi.pyopens a new GUI window to create hydraulic habitat suitability Rasters and determine associated annual flow duration.
Module (folder):
RiverArchitect/ProjectMakerapplies on results from MaxLifespan and SHArC, as well as manual inputs to calculate project cost-benefit metrics..cachefolder occurs temporarily when the module is executed..templatesfolder contains a template folder tree and template workbooks with unit cost tables, as well as sample application data that illustrate potential results of the module.cSHArC.pyapplies SHArC results, in particular cHSI Rasters for calculating SHArea in the project area.project_maker_gui.pycontains the class of this module.s20_plantings_delineation.pyapplies LifespanDesign and MaxLifespan for assessing the most suitable vegetation plantings within the project area.s21_plantings_stabilization.pyapplies LifespanDesign and MaxLifespan outputs as well as user-defined input parameters for mapping nature-based engineering features required to stabilize vulnerable vegetation plantings.s30_terrain_stabilization.pyapplies LifespanDesign and MaxLifespan outputs to stabilize terraforming features.s40_compare_wua.pyapplies on SHArC cHSI Rasters used incSHArC.pyfor assessing the annually usable habitat area for a target fish species and lifestage within the project area.LAUNCH_Windows_x64.batis a batchfile that runsproject_maker_gui.pyon Windows x64.
Module (folder):
RiverArchitect/VolumeAssessmentcalculates excavation / fill volumes of terraforming features.Outputfolder for calculation results..cachefolder occurs when the module is executed..templatesfolder containsvolume_template.xlsx.cVolumeAssessment.pycontains GIS-based functional core for calculating volumes using an ArcGIS “3D” extension.volume_gui.pyis a standalone script that creates the graphical user interface (GUI) for running the VolumeAssessment module
Folder:
Toolsapplies on results from MaxLifespan and SHArC, as well as manual inputs to calculate project cost-benefit metrics..cachefolder occurs temporarily when the module is executed..templatesfolder contains a template workbooks for multiple purposes.Productsfolder contains results of any script in this folder.cHydraulic.pycontains a class with routines for calculating cross-section-averaged flow characteristics.cInputOutput.pycontains classes required for reading and writing data, as well as calculation progress logging.cPoolRiffle.pyprovides routines for designing self-sustaining pool-riffle channels.fTools.pyis a set of functions used by other Python applications within this folder.make_annual_peak.pyprepares required input data for statistic flow analyses and with the U.S. Army Corps of Engineers’ HEC-SPP software.make_annual_flow_duration.py- deprecated (will be removed) creates flow duration curves (annual averages) for the assessment of SHArea (deprecated). A more sophisticated version of this function is integrated in the SHArC module with options to limit flow duration assessments to fish-lifestage seasons.morphology_designer.pycreates design tables for self-sustaining pool-riffle channels (usescHydraulic.pyandcPoolRiffle.py).run_make_….batare a batchfiles that runmake_….pyon Windows.run_morphology_designer.batis a batchfiles that runsmorphology_designer.py.
Program environment setup and batchfile modification¶
The package is designed for an ArcGIS Pro’s Python3 conda environment. Before launching the River Architect package for the first time, the batchfiles may require adaptions for the system environment. On Windows only (Linux is not yet available because of arcpy issues - we are working on it), set the batch file environment as follows:
Right-click on
Start_River_Architect.batand choose Edit (with Texteditor) or Open with … and choose a Texteditor software.Check, and if necessary, replace the path to the good python interpreter:
Default:"%PROGRAMFILES%\ArcGIS\Pro\bin\Python\Scripts\propy"
Note: Future versions of River Architect’s will requiregdalandrasterio. Therefore, developers recommend to create a new conda environment and to install these packages to that new environment:Open “ArcGIS Pro” and click on the Project pane in the upper left corner
Click on the Python tab
Click on the Manage Environments button and on Clone default (or manually copy the default environment) to, for example,
C:\Python\envs\arcgispro-py3-custWhen cloning was successful, restart ArcGIS Pro and go back to the Project > Python tab and click on Add Packages
Search for, and install
gdal(lib-gdalalso works) andrasterioFor starting River Architect from an IDE, set the new conda environment as interpreter (e.g.,
C:\Python\envs\arcgispro-py3-cust\python.exe). The new environment may also be used in the batchfiles.The ArcGIS Pro website provides more information on how to install Python packages.
Save
LAUNCH_River_ArchitectWINx64.batand close Texteditor.Set default application to open input file type documents (
*.inpfiles):
Go to folder...\River Architect\LifespanDesign\.templates\and right-click onmapping.inpto access the menuOpen with .... Choose any text editor, such asNotepad,TexteditororNotepad++and clickOK.
There is no standard easy way to import ArcGIS’ arcpy package in Python running on UNIX platforms (Apple or Linux). Future versions of River Architect aim at using other packages for geodata processing, which will also run on UNIX platforms (we are currently experimenting with gdal and qgis.core).
After editing the batch files, launch River Architect by double-clicking on Start_River_Architect.bat.
Requirements and dependencies¶
Python packages¶
The execution of River Architect requires the following packages, which are part of the standard ArcGIS Pro - Python3 distribution:
arcpyargparseglobloggingopenpyxlosshutilsubprocess(not mandatory, also works without this package)tkinter
Additional packages:
rpy2and the R language: The Morphology\ModifyTerrain module requires an installation of the R language to automate the production of river topographic data via the RiverBuilder R package. Note: environmental variables%R_HOME%and%R_USER%must also be properly defined for Python to access the user installation of R.
River Architect incorporates a modified version of openpyxl, but a more proper way is installing openpyxl with ArcGIS Pro’s package manager. Future versions may additionally require the gdal and rasterio packages (see above instructions).
Furthermore, River Architect requires ArcGIS Pro’s “Spatial Analyst” and “3D” (Volume Assessment only) extensions. Another version of River Architect based on open-source geodata processing packages is planned for the future.
Any folder beginning with a “.” for example .cache or .idea must not be modified or assessed by any other program, in particular during the execution of package methods. Files stored in .templates folders are directly called by the GUIs if user definitions are admitted. At the end of execution, the applied modules have created their output folders, which are indicated in the command prompt.
Other software and dependencies¶
A workbook editing software such as Excel or LibreOffice is required for modifications of user-defined databases (.xlsx files).
For the visualization of geodata (.shp and .tif files), and mapping with project files (.aprx), an installation of ArcGIS Pro is required. Open-source alternatives are QGIS or SAGA (Please note: There are more GIS alternatives out there.).
Logfiles¶
Logfiles logfile.log are created in the module directories during every run task. These files contain time-stamped terminal messages of program activities, warnings and error messages. Thus, logfiles enable the user to review process duration and to trace back problems. The handling of potential errors and warning messages are listed in the Troubleshooting Wiki with descriptions of problem sources (cause) and solutions (remedy).