NCAR / wrf_hydro_py

Python API for the WRF-Hydro model
59 stars 43 forks source link

Start of Evaluation object #191

Closed jmccreight closed 4 years ago

jmccreight commented 5 years ago

I took Joe's code from https://github.com/NCAR/nwm_analysis/tree/master/analysis

I made some changes to it for clarity's sakes:

  1. The main object name changed : AnalysisDataset -> Evaluation
  2. I renamed the public methods on the object as so to not be confusingly identical to the module-level function definitions:
    • calc_cont_stats -> contingency
    • calc_gof_stats -> gof
    • calc_flow_metrics -> event
  3. I left the module level definitions calc_cont_stats and calc_gof_stats but renamed calc_flow_metrics -> calc_event_stats.
  4. I renamed the private methods of the object to give more clarity on why they exist:
    • _calc_cont_stats -> _group_calc_cont_stats
    • _calc_gof_stats should probably be removed so i left it alone
    • _calc_flow_metrics -> _group_calc_event_stats
  5. I left a bunch of TODOs in the code.

I implemented testing of the init of the object.

pep8speaks commented 5 years ago

Hello @jmccreight! Thanks for updating this PR.

Line 30:46: E262 inline comment should start with '# ' Line 79:47: W291 trailing whitespace Line 158:1: W293 blank line contains whitespace Line 169:5: E303 too many blank lines (2) Line 247:77: W291 trailing whitespace Line 248:73: W291 trailing whitespace Line 333:27: E251 unexpected spaces around keyword / parameter equals Line 333:29: E251 unexpected spaces around keyword / parameter equals Line 335:65: E261 at least two spaces before inline comment Line 335:66: E262 inline comment should start with '# ' Line 349:27: E251 unexpected spaces around keyword / parameter equals Line 349:29: E251 unexpected spaces around keyword / parameter equals Line 351:36: E251 unexpected spaces around keyword / parameter equals Line 351:38: E251 unexpected spaces around keyword / parameter equals Line 355:56: E701 multiple statements on one line (colon) Line 372:16: E251 unexpected spaces around keyword / parameter equals Line 372:18: E251 unexpected spaces around keyword / parameter equals Line 381:1: W293 blank line contains whitespace Line 383:87: W291 trailing whitespace Line 387:95: W291 trailing whitespace Line 390:89: W291 trailing whitespace Line 395:98: W291 trailing whitespace Line 396:92: W291 trailing whitespace Line 470:1: W293 blank line contains whitespace Line 472:1: W293 blank line contains whitespace Line 482:16: E251 unexpected spaces around keyword / parameter equals Line 482:18: E251 unexpected spaces around keyword / parameter equals Line 591:5: E722 do not use bare 'except' Line 595:5: E722 do not use bare 'except' Line 599:5: E722 do not use bare 'except' Line 603:5: E722 do not use bare 'except' Line 817:1: W293 blank line contains whitespace Line 864:1: W293 blank line contains whitespace Line 870:59: W291 trailing whitespace

Line 27:27: W291 trailing whitespace Line 50:5: E265 block comment should start with '# ' Line 53:1: E302 expected 2 blank lines, found 1 Line 54:11: E225 missing whitespace around operator Line 69:1: E305 expected 2 blank lines after class or function definition, found 1 Line 74:83: E202 whitespace before '}' Line 83:55: W291 trailing whitespace Line 84:29: E225 missing whitespace around operator Line 85:29: E225 missing whitespace around operator Line 96:58: W291 trailing whitespace Line 114:30: W291 trailing whitespace

Line 5:101: E501 line too long (353 > 100 characters) Line 8:101: E501 line too long (354 > 100 characters) Line 11:101: E501 line too long (2023 > 100 characters) Line 14:101: E501 line too long (7542 > 100 characters) Line 17:101: E501 line too long (385 > 100 characters) Line 20:101: E501 line too long (2198 > 100 characters) Line 23:101: E501 line too long (396 > 100 characters) Line 26:101: E501 line too long (7968 > 100 characters) Line 27:1: W293 blank line contains whitespace Line 31:101: E501 line too long (1551 > 100 characters) Line 34:101: E501 line too long (438 > 100 characters)

Line 269:9: E124 closing bracket does not match visual indentation Line 279:9: E124 closing bracket does not match visual indentation Line 289:9: E124 closing bracket does not match visual indentation Line 299:5: E124 closing bracket does not match visual indentation Line 1242:17: E131 continuation line unaligned for hanging indent Line 1356:17: E131 continuation line unaligned for hanging indent Line 1363:17: E131 continuation line unaligned for hanging indent Line 1368:17: E131 continuation line unaligned for hanging indent Line 1371:17: E131 continuation line unaligned for hanging indent

Line 428:13: E131 continuation line unaligned for hanging indent Line 431:13: E131 continuation line unaligned for hanging indent

Line 23:1: E302 expected 2 blank lines, found 0 Line 25:1: E305 expected 2 blank lines after class or function definition, found 1 Line 39:1: E302 expected 2 blank lines, found 1 Line 83:9: E124 closing bracket does not match visual indentation Line 90:9: E124 closing bracket does not match visual indentation Line 175:19: E251 unexpected spaces around keyword / parameter equals Line 175:21: E251 unexpected spaces around keyword / parameter equals Line 192:32: E201 whitespace after '[' Line 195:41: W291 trailing whitespace Line 207:35: E203 whitespace before ',' Line 212:54: W291 trailing whitespace Line 223:24: E225 missing whitespace around operator Line 223:37: E225 missing whitespace around operator Line 223:38: E222 multiple spaces after operator Line 223:55: E225 missing whitespace around operator Line 223:56: E222 multiple spaces after operator Line 223:75: E225 missing whitespace around operator Line 223:76: E222 multiple spaces after operator Line 224:22: E222 multiple spaces after operator Line 224:36: E222 multiple spaces after operator Line 224:53: E222 multiple spaces after operator Line 224:68: E222 multiple spaces after operator Line 233:24: E225 missing whitespace around operator Line 233:25: E222 multiple spaces after operator Line 233:40: E225 missing whitespace around operator Line 233:41: E222 multiple spaces after operator Line 233:59: E225 missing whitespace around operator Line 233:60: E222 multiple spaces after operator Line 233:80: E225 missing whitespace around operator Line 234:22: E222 multiple spaces after operator Line 234:36: E222 multiple spaces after operator Line 234:53: E222 multiple spaces after operator Line 234:68: E222 multiple spaces after operator Line 239:1: E265 block comment should start with '# ' Line 240:1: E302 expected 2 blank lines, found 1

Comment last updated at 2020-01-27 22:17:08 UTC
jmccreight commented 5 years ago

I have no idea why pytest is dying in the container. Apparently a new version in requirements.txt is not helping.

jmccreight commented 5 years ago

Testing of GOF is performed for simulations on both CHRTOUT: streamflow and LDASOUT: SOIL_M

The goal is to keep everything in the Evaluation to be suitable for any model variable. If/when certain analyses are not suitable for all variables, the appropriate subclass should be made from Evaluation to contain those.

coveralls commented 4 years ago

Pull Request Test Coverage Report for Build 521


Changes Missing Coverage Covered Lines Changed/Added Lines %
wrfhydropy/core/cycle.py 12 13 92.31%
wrfhydropy/core/ioutils.py 0 3 0.0%
wrfhydropy/tests/conftest.py 1 4 25.0%
wrfhydropy/tests/test_evaluation.py 126 129 97.67%
wrfhydropy/core/collection.py 37 42 88.1%
wrfhydropy/core/teams.py 128 138 92.75%
wrfhydropy/core/evaluation.py 193 251 76.89%
<!-- Total: 632 715 88.39% -->
Files with Coverage Reduction New Missed Lines %
wrfhydropy/tests/conftest.py 1 95.93%
wrfhydropy/util/xrcmp.py 1 70.0%
wrfhydropy/core/collection.py 7 93.37%
<!-- Total: 9 -->
Totals Coverage Status
Change from base Build 447: 0.2%
Covered Lines: 3711
Relevant Lines: 4201

💛 - Coveralls