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

Bugfix for MOD(X,0) and mod. of Py scripts #3

Open
wants to merge 1 commit into
base: gldas_netcdf
Choose a base branch
from

Conversation

RJVogel
Copy link

@RJVogel RJVogel commented Aug 10, 2020

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.

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.
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.

1 participant