-
Notifications
You must be signed in to change notification settings - Fork 2
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
Cannot use RiverMapper & pyDEM in the same script #1
Comments
I'm not sure if this just means we shouldn't set the error handling or we should fix the pyDEM's failure as a result of setting this error handling. If I comment that line in Update |
Hi Soroosh, I'm glad you are testing the tools. I set "np.seterr(all='raise') " to catch any error during numpy calculation such as division by zero or other invalid values. It is werid it can cause a different output from pyDEM without actually throwing an error in pyDEM. I can ask Linlin to check what caused the problem. @cuill In the meantime, I'll just comment this line out, since make_river_map never throws this error in my previous tests. Update: I've committed the change. |
Hi, no problem! OK, I'll also let you know if I figured out why pyDEM is doing this.
Thank you, I'll let you know if during my tests I notice anything strange in RiverMapper as a results of commenting this out. @cuill in my case the easiest way to see the issue is by adding + import numpy as np
+ np.seterr(all='raise') after importing all other packages in the |
@SorooshMani-NOAA Thanks for the information. I'll take a look. |
It looks like the issue is caused by the difference between the python built-in function and numpy's function. For example, python's built-in max(0, 1) will return 1, while np.max(0, 1) will raise an error. The correct format is np.max([0, 1]). I am not sure how pyDEM was triggered to call numpy's functions in this case. I'll modify the code to use numpy's functions to avoid this error. |
Thank you for investigating this. Please let me know when I can test on my side to close the ticket. |
@SorooshMani-NOAA You can pull the latest changes and test now. The issue with NaN values was also resolved. It should only have feature_id not reach_id. |
@cuill I'm using the latest code from the repo, but I still get the same error when I set
|
@SorooshMani-NOAA Yes, I just got this error, too. In the previous test, I accidentally comment out np.seterr(all='raise') which did not raise an error. I'll look into this again when I have time. |
@feiye-vims while you're working on the latest generated mesh to see if it's useful or not, I started using RiverMapper and pyDEM to learn a bit more about them. To start I tried both serial and parallel sample for each of them successfully.
My next step was to try to combine the two serial scripts so that I end up with a single script that gets DEM as input and outputs river polygons. This is where I ran into an issue.
After some digging I realized that the issue stems from this line:
RiverMeshTools/RiverMapper/RiverMapper/make_river_map.py
Line 35 in 4ee6cd1
Basically setting this error handling in RiverMapper affects the results of pyDEM. So when at the top of myscript I import:
I run into an issue during the calculation of the DEM thalwegs:
So I was wondering if there's any reason why this error handling is set for
numpy
errors?The text was updated successfully, but these errors were encountered: