Skip to content

2. Running StreamCat Scripts

JLuke edited this page Nov 27, 2023 · 5 revisions

How to Run Scripts

The scripts make use of a Control Table to pass all the particular parameters to the two primary scripts:

In turn, these scripts rely on a generic functions in StreamCat_functions.py, and pathways as described by stream_cat_config.py , which will need to be formated and saved as .py to fit your directories

To generate the riparian buffers we used in StreamCat we used the code in RiparianBuffers.py

To generate percent full for catchments on the US border for point features, we used the code in border.py

Running StreamCat.py to generate new StreamCat metrics

After editing the control tables to provide necessary information, such as directory paths, the following steps will execute processes to generate new watershed metrics for the conterminous US. This example uses Conda format within Spyder IDE.

  1. Edit ControlTable_StreamCat and set desired layer's "run" column to 1. All other rows should be set to 0 in run column.
  2. Open a conda shell and type "activate StreamCat".
  3. At the conda shell type "spyder" to activate Spyder IDE.
  4. Open file selection in Spyder and select your project location
  5. Open "StreamCat.py" in the code editor
  6. Open "StreamCat_functions.py" and "stream_cat_config.py" as well

StreamCat Config

  1. Save stream_cat_config.py.template as .py in project folder
  2. Set LOCAL_DIR to the proper directory. (This will be your project folder)
  3. Ensure the LYR_DIR has proper directory (Normally the QA Complete Rasters). This will be .tif files that you have stored on local drive.
  4. Check the STREAMCAT_DIR is running through Streamcat Allocations_and_Accumulation folder. * This runs data through Streamcat first in the Allocation and Accumulation folder
  5. Check NHD_DIR is in your own local NHD folder
  6. Check STATES_FILE is your own local folder
  7. Set ACCUM_DIR to "(project file director)/accum_npy/"
    • The first time running StreamCat.py, the accum_npy folder will need to be removed from project file. This folder will autopopulate with information and files
  8. OUT_DIR goes to local drive
  9. FINAL_DIR goes to FTP Staging Hydroregions
  10. Double check that only the metrics you want to run have a 1, all others have a zero
  11. Run StreamCat.py script

Make Final Tables

Once StreamCat.py has run

  1. Open Make_Final_Tables.py in editor
  2. These final tables will show up in the OUT_DIR from stream_cat_config.py
  3. Run Make_Final_Tables.py