Command line tool for creating the static files necessary to run AWSM and SMRF
2.0K
The basin setup tools is a set of CLI tools designed to create the required inputs for running SMRF and AWSM snow simulations.
Building GDAL can sometimes be a headache if you are unfamiliar with normal build practices. If you would like to just use the tool with no questions asked, then use the docker command. However note that the file structure is what is represented inside the docker. So you must mount local directories to docker ones fortunately we have created a data folder for you to do just that. Mounting these will also ensure files you generate persist.
The commands listed in this README are used the same but with extra:
docker run -it --rm --entrypoint <COMMAND> -v $(pwd):/data usdaarsnwrc/basin_setup <ARGS>
The command above is performing the following:
/data folder
inside docker (linux only, otherwise use absolute paths)Prequisites:
To begin the install for basin\_setup, ensure that GDAL is compiled from
source. Note: Do not install the python library for GDAL but rather the
command line utiltiies. To compile from source follow the instructions
provided at:
http://trac.osgeo.org/gdal/wiki/BuildHints
Once GDAL is installed, install the python requirements create a virtualenv using python3:
virtualenv -p python3 basinenv
source basinenv/bin/activate
pip install -r requirements.txt
Finally to install basin_setup for commandline use use:
python install setup.py
If you want to develop on basin_setup use the following command to install the utility so that you changes to the source will be used without having to reinstall
python setup.py develop
The delineation script automatically delineates a basin using pour points and a dem. The tool simply wraps the tools from TaudDEM and streamlines the process.
The script will produce shapefiles of all the subbasins using a threshold(s). It also saves data to allow for re-running faster.
delineate -p pour_points.bna -d dem.tif --rerun -t 2000000 -n 2 --debug
Using the debug flag will leave lots of extra files that were generated on the way in a folder named delineation
To get files necessary for streamflow add --streamflow flag to the command which will preserve streamflow files like reaches and tree files.
Outputs a single netcdf file containing:
To use generate_topo you only need
delineate). This will become the projections for the topo.ncgenerate_topo uses a configuration file to specify all the required parameters to run. See the CoreConfig for options and the sample configuration files.
basin_setup config.ini
The GRM tool aggregates lidar geotiffs into a single netcdf for each water year. The images are stored in time according to hours from the 10-01-YYYY
The following will generate a netcdf named lidar_depths_wy2020.nc with two flights stored at 4-11-2020 and 4-15-2020 as determined by the image filenames.
grm -t topo.nc -i 20200411_SuperDepths.tif 20200415_superDepths.tif -b lakes
Content type
Image
Digest
Size
793 MB
Last updated
about 5 years ago
docker pull usdaarsnwrc/basin_setup