Bugfix for MOD(X,0) and mod. of Py scripts #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
create_forcing_netcdf.F: The problem was that with my compiler (gfortran 9.3) the code checks if full_ic_frq>0 and if it is zero, it also checks (mod(ihour, full_ic_frq)==0). Then for the mod function both arguments are zero, which leads to an arithmetic error, since MOD(X,0) is not allowed. I guess that other compilers either do not check the second argument of an AND, when the first is false, or they define that MOD(x,0)=0. My workaround is long and it needs another variable. Maybe you can come up with a better solution.
module_NoahMP_hrldas_driver.F: The problem here was again that MOD(x,0) was called and an error “invalid arithmetic operation” was thrown. I took the easy way here and split the “IF AND” condition up into two IF conditions, which worked for me since I don’t use RUNOFF_OPTION 5. ;) Of course this is not a permanent solution, but I am not sure what should happen for STEPWTD==0, if the code segment should run or not, so I left it at that.
Python scripts: The indentation was not correct in my editor (Spyder 4), probably due to tabstopps. Also the print statements did not work, I had to put the arguments in brackets, maybe due to a different Python version? I am using Python 3.8. Finally, I did a lot of minor style changes, only because my editor complained about it and I wanted to get rid of the warnings. And I rearranged some code. You can ignore all these changes.