-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add python version the set of functions of cell integral and their test functions #420
base: master
Are you sure you want to change the base?
Conversation
Can you please add some description to this PR to explain the use case you have in mind for this? Also the doc string in the function is not very informative so I'm not sure how I'd use it. One thing that would be useful in some cases is to be able to provide a set of topofiles, (or Also I see your test problem generates random data. For a unit test I think it would be better to do something deterministic and check against stored values or known cell averages for a simple function? And at the moment the tests are not passing due to being called with the wrong number of arguments? |
@RunxinNi can you respond to this? |
Hi Kyle, sure, prepared for today morning's final yesterday. Sorry for delaying response. |
Update the docstring. Put the functions outside the Topography class.
Update the test function with deterministic data. Test the cell integral and cell averages with continuous and discontinuous functions.
Add the PR description. |
This looks good to me save for a warning that is popping up in the tests:
Do you see this locally as well? |
src/python/geoclaw/topotools.py
Outdated
return topoint | ||
|
||
|
||
class patch: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the duplicate name in PyClaw and the fact that this is simply a data container can we change this to a dictionary?
Hi Kyle, I fixed the warning issue. |
Can you also change |
Hi Kyle, I change |
Thanks @RunxinNi. @rjleveque does this look good to you now? |
I started trying to test this and ran into unexpected results in the simple case where I defined a small topo array and a patch that was exactly aligned with that array, so I expected |
Dear Prof. LeVeque, I detected the bug associated with a function. I fixed it. I re-did the test. Here is the result. I think there is a little issue about defining the topo. I will work with Kyle about it and give you updates later. |
@RunxinNi - Yes, you are right that I defined my topo data incorrectly to obtain what I was expecting to see. Since the topo values are assumed to be pointwise values and the cell averages are computed by averaging the resulting piecewise bilinear function, you are right that you need to define the topo values at cell corners in order for the resulting cell average to have the the expected value from the same linear test function I used. I would like to do some more testing now with overlapping topo files at different resolutions. We're trying to get v5.8.0 out soon since that has some important bug fixes, so I might not get to this right away, but will try to soon. This will be a very useful capability to have in Python and will assist in setting up grid extents and resolutions for geoclaw runs, so thanks for working on this. |
@rjleveque It's my pleasure to contribute to GeoClaw. Look forward to your further suggestions. |
Just realized that this PR is still in the waiting. @rjleveque have you had a chance to look at this again? |
This PR is to add the python version for the cell integral and cell averages functions which are originally written in Fortran. Also, add the test function to test these functions in python.