Riverscapes / riverscapes-tools

Open-source Python 3.0 tools for the Riverscapes organization
https://tools.riverscapes.net/
GNU General Public License v3.0
10 stars 8 forks source link

Stream Stats Equations #1008

Closed philipbaileynar closed 2 weeks ago

philipbaileynar commented 2 weeks ago

We want a more automated approach for defining streamflow for the hydrologic context project type (that feeds into BRAT). I have downloaded all the peak (2yr recurrence interval) and low flow equations from the National Stream Stats database:

2024_08_26_nss_depvars.csv

Tasks 1

Add a column to this CSV called python_equation and convert these "Excel" equations into Python syntax that will run with the eval command. This should be fairly straightforward. The exponent operation is different etc, but most of the syntax should be unchanged. Here's where we do this in hydro:

https://github.com/Riverscapes/riverscapes-tools/blob/a64481874e269a9e7e592a0da543c17e00847549/packages/hydro/hydro/utils/hydrology.py#L118

Task 2

This is hard... abort if it gets out of hand...

The "equations" listed refer to parameters, such as PRECIP for precipitation and FORESTPC for percent forested. Is it possible to strip out all the parameter names and then rank them by the decending frequency with which they occur? So I expect the result to be something like the following. The values to the right of the variable names are counts that they occur in the equations.

PRECIP 87
FORESTPC 78
ELEV500 67
....

Essentially I want to know the top 10 to 20 parameters that occur in these equations. The next step will be adding the calculation of these parameters to Riverscapes Context model.

FYI @jtgilbert

philipbaileynar commented 2 weeks ago

This old video where I explain the NSS database is just for my reference.

FYI related to #277

r-k-g commented 2 weeks ago

Full results for Task 2: most_common.txt

r-k-g commented 2 weeks ago

Results for Task 1: updated_equations.csv

There are a few problems that could prevent the new last column from running smoothly in a python eval().

philipbaileynar commented 2 weeks ago

Thank you!