Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update of NHDNetwork class for ngen t-route #580

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kumdonoaa
Copy link
Contributor

@kumdonoaa kumdonoaa commented Aug 31, 2022

[Short description explaining the high-level reason for the pull request]
As part of goal for integrating t-route model developed for NMW v3.0 into Next Gen Water Modeling Framework, NHDNetwork class is modified to produce needed network and input forcing data for eventually running t-route through BMI. In the process, functions in preprocess.py are directly called inside NHDNetwork.py for initial time loop. For subsequent time loops, main.py was refactored to update forcing data by directly calling functions in preprocess.py. t-route with these refactored files produced the exactly same results as t-route from t-route main branch.

Additions

NHDNetwork_v4.py is used instead of NHDNetwork.py only for test purpose.

Removals

Changes

  1. AbstractNetwork.py for adding _coastal_boundary_depth as an abstract property
  2. Added def main_v04 in main.py for first instantiating NHDNetwork class so as to prepare network and forcing data and subsequently updating forcing data for multiple time loops.

Testing

  1. To run t-route from t-route main branch, "python -m nwm_routing -V3 -f ....yaml"
  2. To run ngen t-route, "python -m nwm_routing -V4 -f ....yaml"

Screenshots

Notes

Todos

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (link if applicable)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Visually tested in supported browsers and devices (see checklist below 👇)
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

Testing checklist

Target Environment support

  • Windows
  • Linux
  • Browser

Accessibility

  • Keyboard friendly
  • Screen reader friendly

Other

  • Is useable without CSS
  • Is useable without JS
  • Flexible from small to large screens
  • No linting errors or warnings
  • JavaScript tests are passing

Copy link
Member

@hellkite500 hellkite500 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple things we really need to address before this moves forward further. Please see the comments regarding the internal file versioning semantics as well as the file name versioning.

@@ -1,4 +1,4 @@
from .AbstractNetwork import AbstractNetwork
from .AbstractNetwork import AbstractNetwork
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This extra space at the beginning of the line may cause some issues...either way, for consistency it should be removed.

@@ -0,0 +1,318 @@
from .AbstractNetwork import AbstractNetwork
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should simply replace the existing NHDNetwork.py file. This way the changes from one version to the next are marked in the version control. A well crafted commit message for this single change will make going back into the history and finding the old version straight forward, and we don't have multiple files to maintain.

@@ -28,6 +33,689 @@

LOG = logging.getLogger('')

'''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we really don't need to maintain v02 main, as long as the functionality of v04 main works as needed. I would propose dropping v02 main and make sure v04 (which should probably just be main) is functional.

LOG.debug("process complete in %s seconds." % (time.time() - main_start_time))

if showtiming:
print('************ TIMING SUMMARY ************')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since task_times contains all the relevant info, I would pull this logic into a function and pass in task_times

if v_args[0].input_version == 3:
LOG.info("Running main v03 - looping")
main_v03(v_args[1])
if v_args[0].input_version == 4:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, let's try to get to a single main function. If backwards compatibility is important, we can discuss ways to support that, but with 4 versions of main and an async v3 interface, it is reasonably confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants