Skip to content

Commit

Permalink
create empty gradient barrier table on db setup, tidy gradient barrie…
Browse files Browse the repository at this point in the history
…r README
  • Loading branch information
smnorris committed Feb 21, 2024
1 parent 5da0528 commit 53c5bb7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 24 deletions.
File renamed without changes.
32 changes: 11 additions & 21 deletions model/01_access/gradient_barriers/README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,22 @@
# Gradient barriers

Generate points at which FWA streams exceed given slope threshold(s) for more than a specified distance.
Methods are outlined [in the docs](https://smnorris.github.io/bcfishpass/02_model_access.html#generate-gradient-barriers).
Create and load potential [gradient barriers](https://smnorris.github.io/bcfishpass/02_model_access.html#generate-gradient-barriers).

## Usage
- gradient barriers are generated at 5/7/10/12/15/20/25/30 percent thresholds, using a 100m minimum length
- only watershed groups included in `bcfishpass.parameters_habitat_method` are processed/included

To create and load the gradient barrier table:

make

This tool creates potential gradient barriers at 5/7/10/12/15/20/25/30 percent thresholds, finding slope over 100m.
To change the slope thresholds of interest or the interval over which slope is measured, edit `sql/gradient_barriers.sql`.
## Usage

Note that this tool identifies the locations of *all* potential gradient barriers based on *all* given thresholds. The gradient
threshold modelled as a barrier for a given species is controlled by the access model query corresponding to that species.
To load the gradient barrier table:

## Output table
./gradient_barriers.sh

Table "bcfishpass.gradient_barriers"
Column | Type | Collation | Nullable | Default
--------------------------+------------------+-----------+----------+---------
blue_line_key | integer | | not null |
downstream_route_measure | double precision | | not null |
gradient_class | integer | | |
Indexes:
"gradient_barriers_pkey" PRIMARY KEY, btree (blue_line_key, downstream_route_measure)
"gradient_barriers_test_blue_line_key_idx" btree (blue_line_key)
1. To change the slope thresholds of interest or the length interval over which slope is measured, edit `sql/gradient_barriers_load.sql`.

## Override data errors / note gradient barriers that do not exist
2. This tool identifies the locations of *all* potential gradient barriers based on *all* given thresholds. The gradient
threshold modelled as a barrier for a given species is controlled by the access model query corresponding to that species.

If any gradient barriers need to be removed because they are not present/not barriers, add them to `bcfishpass/data/user_barriers_definite_control.csv`.
3. If any of the created gradient barriers need to be ignored when modelling (because they are not present/not barriers),
add them to `bcfishpass/data/user_barriers_definite_control.csv`.
3 changes: 0 additions & 3 deletions model/01_access/gradient_barriers/gradient_barriers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@ set -euxo pipefail
PSQL="psql $DATABASE_URL -v ON_ERROR_STOP=1"
WSGS=$($PSQL -AXt -c "SELECT watershed_group_code FROM bcfishpass.parameters_habitat_method")

# create table
$PSQL -f sql/gradient_barriers.sql

# load
parallel $PSQL -f sql/gradient_barriers_load.sql -v wsg={1} ::: $WSGS

0 comments on commit 53c5bb7

Please sign in to comment.