Switch to using np.arctan2 for Probabilistic Advection#2
Switch to using np.arctan2 for Probabilistic Advection#2KristianHMoller wants to merge 2 commits into
Conversation
|
You should have permissions to request reviewers now. |
|
That backfired 😉 ... Should this go into |
elbdmi
left a comment
There was a problem hiding this comment.
This change is resonable for me. The only this I would like that doesn't have to do with this pull request but it is a general one is to create a CHANGELOG and also add your change to the changelog as well. It would be nice also if you could add a comment in the code in order to know why we have arctan2 and not arctan
I certainly think, that we should also have a PR to |

It was noted, that even with the alpha and beta noise parameters both set to zero, running probabilistic_advection in ensemble mode (e.g. by not specifically requesting ens_members=1) yielded results different from those obtained in deterministic mode.
The source of the discrepancy was tracked to the calculation of pert_motion_field in the script
Models/ProbabilisticAdvection.py. The original code:np.arctandoes not consider the signs of the input values and additionally, the implementation will fail forx=0. https://numpy.org/doc/stable/reference/generated/numpy.arctan.htmlBy replacing
np.arctanwithnp.arctan2, these issues are avoided. https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html