Skip to content

Update runoff weight mtx param alt

Sleckman, Margaux requested to merge update_runoff_weight_mtx_param_alt into main

This MR builds on the work done for !54 (closed) but eliminates the need for weights matrix conversion function entirely and instead modifies calculate_geometric_runoff() to work directly with the weights table. Many elements of the changes introduced to convert_df_to_matrix in !54 (closed) were directly incorporated into calculate_geometric_runoff(). I also added a internal function _weight_factor() to calculcate teh weight factor applying the condition described in huc runoff calculcation readme under section under [4] (2nd page). readme_huc_weights.pdf

Reviewer: I've attached a notebook to use for testing the changes in the function. In the notebook, I pull nwis data from dataretrieval, which is required for calculating runoff. calculate_runoff_fun_v2.ipynb.

Using the notebook, please review the changes and additions to the function calculate_geometric_runoff() and let me know if it works or if you run into issues. Please review any formatting or linters issues as well. Can also test with a different df, such huc_bas_pct.txt which was used for WW by Xiaodong.

Note - I also updated calculate_multiple_geometric_runoff() , which is a simple 'wrapper' function around calculate_geometric_runoff. While I encounter no error when testing the latter, I run into the following error with multiple geometric runoff version.
raise TypeError(f"cannot convert the series to {converter}"). (error line indicated in line.) I likely missed something when translating this function given the changes made to calculate_geometric_runoff(). Please let me know if you encounter this error as well, and we can work together to resolve.


pipeline is failing. edits to pipeline will be done after mr is reviewed.

Edited by Sleckman, Margaux

Merge request reports