|
1 | 1 | # StreamCat
|
2 | 2 |
|
3 | 3 | ## Description:
|
4 |
| -The StreamCat Dataset (http://www2.epa.gov/national-aquatic-resource-surveys/streamcat) provides summaries of natural and anthropogenic landscape features for ~2.65 million streams, and their associated catchments, within the conterminous USA. This repo contains code used in StreamCat to process a suite of landscape rasters to watersheds for streams and their associated catchments (local reach contributing area) within the conterminous USA using the [NHDPlus Version 2](http://www.horizon-systems.com/NHDPlus/NHDPlusV2_data.php) as the geospatial framework. See [Running-StreamCat-Scripts](https://github.com/USEPA/StreamCat/wiki/Running-StreamCat-Scripts) for details on running the scripts to produce StreamCat data. |
| 4 | +The StreamCat Dataset (http://www2.epa.gov/national-aquatic-resource-surveys/streamcat) provides summaries of natural and anthropogenic landscape features for ~2.65 million streams, and their associated catchments, within the conterminous USA. This repo contains code used in StreamCat to process a suite of landscape rasters to watersheds for streams and their associated catchments (local reach contributing area) within the conterminous USA using the [NHDPlus Version 2](http://www.horizon-systems.com/NHDPlus/NHDPlusV2_data.php) as the geospatial framework. |
5 | 5 |
|
6 | 6 | ## Necessary Python Packages and Installation Tips
|
7 |
| -The scripts for StreamCat rely on several python modules a user will need to install such as numpy, pandas, gdal, fiona, rasterio, geopandas, shapely, pysal, and ArcPy with an ESRI license (minimal steps still using ArcPy). We highly recommend using a scientific python distribution such as [Anaconda](https://www.continuum.io/downloads) or [Enthought Canopy](https://www.enthought.com/products/canopy/). We used the conda package manager to install necessary python modules. Our essential packages and versions used are listed below (Windows 64 and Python 2.7.11): |
| 7 | +The scripts for StreamCat rely on several python modules a user will need to install such as numpy, pandas, gdal, fiona, rasterio, geopandas, shapely, pysal, and ArcPy with an ESRI license (minimal steps still using ArcPy). We highly recommend using a scientific python distribution such as [Anaconda](https://www.continuum.io/downloads) or [Enthought Canopy](https://www.enthought.com/products/canopy/). We used the conda package manager to install necessary python modules. Our essential packages and versions when code was last used are listed below - note that other configurations may work, we simply have verified this particular combination (Windows 64 and Python 3.6.10): |
8 | 8 |
|
9 | 9 | | Package | Version |
|
10 | 10 | | ------------- |--------------:|
|
11 |
| -| fiona | 1.7.7 | |
12 |
| -| gdal | 2.2.0 | |
13 |
| -| geopandas | 0.2.1 | |
14 |
| -| geos | 3.5.1 | |
15 |
| -| libgdal | 2.0.0 | |
16 |
| -| numpy | 1.12.1 | |
17 |
| -| pandas | 0.20.2 | |
18 |
| -| pyproj | 1.9.5.1 | |
19 |
| -| pysal | 1.13.0 | |
20 |
| -| rasterio | 1.0a9 | |
21 |
| -| shapely | 1.5.17 | |
| 11 | +| python | 3.6.10 | |
| 12 | +| fiona | 1.8.9.post2 | |
| 13 | +| gdal | 2.4.4 | |
| 14 | +| geopandas | 0.8.1 | |
| 15 | +| geos | 3.8.1 | |
| 16 | +| libgdal | 2.4.4 | |
| 17 | +| numpy | 1.19.1 | |
| 18 | +| pandas | 1.1.1 | |
| 19 | +| pyproj | 2.6.1 | |
| 20 | +| rasterio | 1.1.5 | |
| 21 | +| shapely | 1.7.1 | |
22 | 22 |
|
23 | 23 | If you are using Anaconda, creating a new, clean 'StreamCat' environment with these needed packages can be done easily and simply one of several ways:
|
24 | 24 |
|
25 | 25 | * In your conda shell, add one necessary channel and then download the streamcat environment from the Anaconda cloud:
|
26 | 26 | + conda config --add channels conda-forge
|
27 |
| - + conda env create mweber36/streamcat |
| 27 | + + conda env create mweber36/StreamCat |
28 | 28 |
|
29 | 29 | * Alternatively, using the streamcat.yml file in this repository, in your conda shell cd to the directory where your streamcat.yml file is located and run:
|
30 |
| - + conda env create -f StreamCat.yml |
| 30 | + + conda env create -f streamcat_py3.yml |
31 | 31 |
|
32 | 32 | * To build environment yourself, do:
|
33 |
| - + conda env create -n StreamCat rasterio geopandas |
34 |
| - + pip install georasters |
| 33 | + + conda create --name StreamCat -c conda-forge python=3.6 geopandas rasterio=1.1.5=py36h2409764_0 |
35 | 34 |
|
36 |
| -* To activate this new environment and open Spyder, type the following at the conda prompt |
| 35 | +* To activate this new environment, you'll need to install Spyder in the environment, and possibly re-install pyqt with specific version (we did). You may even need to uninstall pyqt after installing Spyder (as below) and then specifically re-install: |
| 36 | + |
| 37 | + + install spyder=4.1.4=py36h9f0ad1d_0 -c conda-forge |
| 38 | + + install pyqt=5.12.3=py36h6538335_1 -c conda-forge |
| 39 | + |
| 40 | +* To open Spyder, type the following at the conda prompt |
37 | 41 | + activate Streamcat
|
38 | 42 |
|
39 | 43 | Then
|
40 | 44 |
|
41 | 45 | + Spyder
|
42 | 46 |
|
43 |
| -Finally, to use arcpy in this new environment, you will need to copy your Arc .pth file into your new environment. Copy the .pth file for your install of ArcGIS located in a directory like: |
| 47 | +Finally, to use arcpy in this new environment, you will need to copy several ArcPro files and folders to your new environment as follows: |
| 48 | + |
| 49 | ++ C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/Lib/site-packages/ArcGISPro.pth |
| 50 | + |
| 51 | ++ C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/Lib/site-packages/Arcgisscripting |
44 | 52 |
|
45 |
| -+ C:\Python27\ArcGISx6410.3\Lib\site-packages\DTBGGP64.pth |
| 53 | ++ C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/Lib/site-packages/arcpy_wmx |
| 54 | + |
| 55 | ++ C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/Lib/site-packages/Gapy |
46 | 56 |
|
47 | 57 | To your environment directory which should look something like:
|
48 | 58 |
|
49 |
| -+ C:\Anaconda\envs\streamcat\Lib\site-packages\DTBGGP64.pth |
| 59 | ++ C:/Users/mweber/AppData/Local/Continuum/anaconda3/envs/StreamCat/Lib/site-packages |
| 60 | + |
| 61 | +You will also need to install dateutils: |
| 62 | + + conda install -c anaconda python-dateutil |
50 | 63 |
|
51 | 64 | Note that the exact paths may vary depending on the version of ArcGIS and Anaconda you have installed and the configuration of your computer
|
52 | 65 |
|
| 66 | +## How to Run Scripts |
| 67 | +### The scripts make use of 'control tables' to pass all the particular parameters to the three primary scripts: |
| 68 | + |
| 69 | ++ [StreamCat_PreProcessing.py](https://github.com/USEPA/StreamCat/blob/master/StreamCat_PreProcessing.py) |
| 70 | ++ [StreamCat.py](https://github.com/USEPA/StreamCat/blob/master/StreamCat.py) |
| 71 | ++ [MakeFinalTables.py](https://github.com/USEPA/StreamCat/blob/master/StreamCat_functions.py). |
| 72 | + |
| 73 | +In turn, these scripts rely on a generic functions in [StreamCat_functions.py](https://github.com/USEPA/StreamCat/blob/master/StreamCat_functions.py). |
| 74 | + |
| 75 | +To generate the riparian buffers we used in [StreamCat](ftp://newftp.epa.gov/EPADataCommons/ORD/NHDPlusLandscapeAttributes/StreamCat/Documentation/ReadMe.html) we used the code in [RiparianBuffers.py](https://github.com/USEPA/StreamCat/blob/master/RiparianBuffer.py) |
| 76 | + |
| 77 | +To generate percent full for catchments on the US border for point features, we used the code in [border.py](https://github.com/USEPA/StreamCat/blob/master/border.py) |
| 78 | + |
| 79 | +Examples of control tables used in scripts are: |
| 80 | ++ [RasterControlTable](https://github.com/USEPA/StreamCat/blob/master/RasterControlTable.csv) |
| 81 | ++ [ReclassTable](https://github.com/USEPA/StreamCat/blob/master/ReclassTable.csv) |
| 82 | ++ [FieldCalcTable.](https://github.com/USEPA/StreamCat/blob/master/FieldCalcTable.csv) |
| 83 | ++ [Lithology_lookup](https://github.com/USEPA/StreamCat/blob/master/Lithology_lookup.csv) |
| 84 | ++ [NLCD2006_lookup](https://github.com/USEPA/StreamCat/blob/master/NLCD2006_lookup.csv) |
| 85 | ++ [ControlTable_StreamCat](https://github.com/USEPA/StreamCat/blob/master/ControlTable_StreamCat.csv) |
| 86 | ++ [MakeFinalTables](https://github.com/USEPA/StreamCat/blob/master/MakeFinalTables.csv) |
| 87 | + |
| 88 | +### Running StreamCat.py to generate new StreamCat metrics |
| 89 | + |
| 90 | +After editing the control tables to provide necessary information, such as directory paths, the following stesps will excecute processes to generate new watershed metrics for the conterminous US. All examples in the control table are for layers (e.g., STATSGO % clay content of soils) that were processed as part of the StreamCat Dataset. This example assumes run in Anaconda within Conda shell. |
| 91 | + |
| 92 | +1. Edit [ControlTable_StreamCat](https://github.com/USEPA/StreamCat/blob/master/ControlTable_StreamCat.csv) and set desired layer's "run" column to 1. All other columns should be set to 0 |
| 93 | +2. Open a Conda shell and type "activate StreamCat" |
| 94 | +3. At the Conda shell type: "Python<space>" |
| 95 | +4. Drag and drop "StreamCat.py" to the Conda shell from a file manager followed by another space |
| 96 | +5. Drag and drop the control table to the Conda shell |
| 97 | + |
| 98 | +Final text in Conda shell should resemble this: python C:\some_path\StreamCat.py C:\some_other_path\ControlTable.csv |
| 99 | + |
53 | 100 |
|
54 | 101 | ## EPA Disclaimer
|
55 | 102 | The United States Environmental Protection Agency (EPA) GitHub project code is provided on an "as is" basis and the user assumes responsibility for its use. EPA has relinquished control of the information and no longer has responsibility to protect the integrity , confidentiality, or availability of the information. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by EPA. The EPA seal and logo shall not be used in any manner to imply endorsement of any commercial product or activity by EPA or the United States Government.
|
|
0 commit comments