-
Notifications
You must be signed in to change notification settings - Fork 17
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
Develop spec lean #161
Develop spec lean #161
Conversation
By the way @austinorr - I can see the use of matrix that you mentioned and that works really nicely for eliminating duplicative code in tests over mucho python versions - awesome! |
@rburghol Thanks for making this diff nice and clean. Do you want to add an HSPFresults directory with the results you got when you run it in hspf? This should probably be in a separate directory than the test10 on, maybe add a new one called test10spec? Then we can check that the code in this PR yields the same results. |
Good thinking @austinorr -- test10specl has been separated into it's own folder with HSP2results and HSPFresults folders. I will do a PR to add test coverage into the develop branch after this gets merged so that I am not updating the test files from this branch unless you think it's a must to do in one... tho we're now back in a 30+ file commit. |
These changes to main.py would overwrite some of what Tim just added in PR #159 (for instance 'Union' in the arg list). Was that an accident? |
Let’s take a look at all the new pytest code that got put together to help us automate the tests. I think once we go through it we’ll be able to remove the HSP2results directory (we only need the HSPFresults for the new test pattern) and the notebooks too, unless they’re important for documentation. In your local Python env, try the following: you’ll find that there’s a test harness in the tests directory that we can add the test10spec to, with some minor revisions, and it’ll run it and do a full comparison. |
@PaulDudaRESPEC Definitely not code that was intentionally modified in develop–specact. Git must not be able to handle this, considering this branch has been live for so long before being merged. |
I also hope we can do the chore of fixing the “*” imports before we merge this. One of the things we’ve discussed a lot is getting this project formatted and linted and I don’t think we should burden that lift with having to fixing all of these imports. Let’s fix them here instead. |
@PaulDudaRESPEC I have migrated the changes to main.py that @timcera merged in #159 |
@austinorr I am going to make these import changes. |
OK @austinorr -- the import style has been switched for all files in this PR. |
@rburghol Thanks, looking great! Common practice is to use the pandas or numpy namespace whole with I'm looking through the test directory you made for this, and I wonder what would be the best way to test the special actions code? I see the test10specl.uci, but it's never been run by hspf (there's no .hbn files referenced in that uci) and there's no differences between the test10.uci except the new one has a typo in line 381 that @PaulDudaRESPEC caught and fixed last week (SNDFG should be SDFG). Can we slim down the new test directory to just what we actually use to verify the new capabilities this PR added? |
@austinorr the files are different in that test10specl.uci has a special actions block beginning on line 994:
This was a super quick example that @PaulDudaRESPEC recommended in an email exchange we had, and thus I wonder what tests he might advise? Note: since I don't run HSPF on windows, it would be helpful if someone else ran it, I literally don't have a WinHSPF install handy. In terms of slimming the test10specl dir, sure, it's possible, but I have no opinion other than to say I think a uniform directory tree for test files would facilitate automated testing. When you requested that I add an Again, I would ask @PaulDudaRESPEC what the thinking behind the various jupyter notebooks and the 2 directories was, and whether we should carry that practice forward. |
I can do it, and with your permission, i'll clean up the test directory. |
@austinorr I'd welcome it! (both the model running and the cleanup). |
@rburghol do you have any time to screen share and talk me through how to run the specl actions? I've gotten things all run through HSPF, new hbn files etc, but they aren't matching hsp2 results in reach 5 -- the one we added actions for. |
Thanks @austinorr for pushing this forward! I'm tied up right now, but I may be able to find some time tomorrow, and definitely on Thursday I will have a great deal of flexibility. @PaulDudaRESPEC Helped me set up this example, and may have some testing insight. |
In that RCHRES SANDFG table, make sure the values are lined up in the 15th column -- they appear to be in the 16th. |
Thanks @PaulDudaRESPEC - when we set these up originally did you have a quick script to compare output between the two hsp2 runs to verify function? |
I'll send you the UCI that I suggest you use for the test (via email). |
@austinorr I have incorporated the new test10specl.uci that @PaulDudaRESPEC sent into the HSP2 and HSPF results folders. |
…ch, added domain specific specl filter in HYDR
tests for spec actions
…ated as registers that get zeroed
@austinorr I just cleaned up a last few imports. I think this is now ready to go, unless you want to wait until we rethink how the object creation should pass parent and/or child in (#162), though I'd like to give that more thought, and ultimately think it's more about readability than functionality at this juncture. |
…special case of ModelVariable, and then ModelVariable can form the base class for simple numerical data holders like UVQUAN
@rburghol I think we're close -- I'm going to do a couple quick performance checks with the tests now that they pass. One thing we should do is delete all the unrelated personal development files that are in here. I had done that already in one of my commits, but they got re-added. all compre-case.json should be deleted, right? we don't need a wdm in test10specl/HSP2results. If a contributor makes it so they can test it with the 'convert' script, please delete it or leave it out of the commit. we don't need the test10/HSP2results/pytest10.py file, it doesn't run any tests and it looks like it's just scratch notes for a readme. let's pull out the valuable notes and make this file a .md or .txt. we don't need the test10/HSP2results/test10.example.py file either, this looks like scratch work and it appears nothing imports from it. It looks like this could be avoided by using a per-file staging pattern when building a commit. VSCode and other IDEs help with this a lot, you can just click the '+' button to stage each file that has a necessary change (you can even stage selected lines!), then do |
@austinorr and @rburghol , I think that test10.example.py file is not 'needed', but it is a good example of how one could add custom python code as a sophisticated special action, and therefore is worth keeping. I think there are probably other files I've added over the years that ought to be removed. I can make a pass through before release to clean out any leftovers that shouldn't really bin there. I continue to be holding for a nod from you both, at which point I'll merge this PR. |
@austinorr the below are all now completed and have run successfully through the tests -- a couple notes follow. Thanks for the heads up, couple things:
|
@PaulDudaRESPEC @rburghol sounds good, I'm for keeping things we need -- just want to make sure we don't add things accidentally. If testcbp is ready to include in the test suite, let's make an HSPF directory for it so that we can get results to check against and add it to the suite. Currently only test10 and test10specl are in the pytest suite. Nothing in the pytest suite references HSP2results directories, those are from the tests/convert manual testing pattern. Since this tool is a drop-in replacement for HSPF, we should maybe try to migrate away from having some files for the HSPF run and other duplicated files for the HSP2 run. That's the approach the test suite takes, there's only one test case, and it runs in both HSPF and HSP2 exactly identically. If we duplicate the files and run separate tests for each, we can't say that anymore. Looping back on performance, I ran the test10 with both the 'develop' branch and this one and timings look good. under develop we have:
under this branch we have:
the first call includes compiling and caching the numba jit code, so we can ignore it. kudos @rburghol for getting this huge feature implemented without a performance hit. Note that because of all the disk io writing to H5 files, the numba compiled code (28 seconds avg) is not much faster than pure python code (32 seconds avg):
I think we should focus our attention there next. |
Thanks @austinorr for all your guidance and lift on this! Thanks @PaulDudaRESPEC !! |
@PaulDudaRESPEC @austinorr
This PR contains the changes to the HSP2 function to include special actions, classic ACTIONS. The following is included:
HSP2/SPECL.py
the base to enable special actions support.HSP2/state.py
: improved data model to hold and pass information amongst dynamic operations.om*.py
additions: entirely new code to support SPECL.py and dynamic operationsom_simtimer.py
: timer setup, maintains running date/time info instate_ix
om_model_object.py
: base class for parsing and formatting special operations into runtimeom_model_linkage.py
: managing links among operations to insure dependency ordering and data sharingom.py
: runtime execution code for special operationstests/test10/HSP2results/test10spec.uci
: a simple example of special actions added to the standard test10.uci example.SEDTRN.py
: special actions enabled into SEDTRNHYDR.py
: special actions enabled into HYDRmain.py
: calls initialization for speclThis has been run installed via pip in python 3.10.8 successfully