Skip to content

Update runoff weight mtx param - MR 1: runoff.identify_sites_from_weights()

Sleckman, Margaux requested to merge update_runoff_weight_mtx_param into main

I am working on updating the runoff module functions. They were originally built to take in the weight matrix. To align with how watches did this runoff calc, we are modifying the function so that it takes in a tabular weight df of this format:

site_no huc_cd pct_in_basin pct_in_huc
0 01014000 01010002 21.103 98.707
1 01014000 01010003 15.242 96.186
2 01014000 01010004 0.430 1.026

This first MR updated 1 of multiple functions in the runoff module. Here, I updated runoff.identify_sites_from_weights such that it no longer takes in a weight_mtx but rather a weight_tabular with no rownames. I added several parameters and updated the way the filtering happens from the previous version.

Reviewer: I opted to keep these MR related to the runoff module rather small, so this should be a quick review. Please ensure identify_sites_from_weights works and recommend using the doctest for a quick test run (or the actual dataframe - you find a downloadable version in the huc_bas_pct.txt discussed here). I added some in line comments for context.

Note: the pipeline is currently failing with this new change because I have not yet updated the function in the test runoff script here. I will update once all runoff functions are updated however, as this will require building and uploading a new demo table for the `weights_df`, like was done with demo_weights.json.

Edited by Sleckman, Margaux

Merge request reports

Loading