This pull request attempts to replace the default z value in x and y scalar gradients from 999 to -1. The reasoning behind this change is that a model with (up to) 999 atmosphere layers could exist even if the computations would take forever, while needing the scalar gradient of a point in the -1st layer of atmosphere is impossible. The only problem with this alternative is that using negative indices for the height "coordinate" would be forbidden and it should be taken into consideration when coding any new functionalities.
Something to note is that None would be the preferred option in most cases but, given that it will eventually be compiled using Cython, using None could potentially give more trouble down the line as it cannot be translated easily into C.
There might be better options than the one presented here. In this Stack Overflow answer, creating a Python object that could hold either an integer value or a None is proposed, but it could make the code slower defeating the purpose of using Cython.
This is no longer necessary, since in the last stream (2020-09-02) each of the two functions was subdivided into two other functions, one for the 2D case and one for the 3D case.
This pull request attempts to replace the default z value in x and y scalar gradients from
999
to-1
. The reasoning behind this change is that a model with (up to) 999 atmosphere layers could exist even if the computations would take forever, while needing the scalar gradient of a point in the -1st layer of atmosphere is impossible. The only problem with this alternative is that using negative indices for the height "coordinate" would be forbidden and it should be taken into consideration when coding any new functionalities.Something to note is that
None
would be the preferred option in most cases but, given that it will eventually be compiled using Cython, usingNone
could potentially give more trouble down the line as it cannot be translated easily into C.There might be better options than the one presented here. In this Stack Overflow answer, creating a Python object that could hold either an integer value or a
None
is proposed, but it could make the code slower defeating the purpose of using Cython.