Closed jithuraju1290 closed 7 years ago
Would you be wiling to send a PR with those suggestions? Unfortunately I no longer have time to support python-gsw
.
In general we want to use broadcasting rules, but here we need to specify which axis is the pressure axis. I think the best solution would be to have an "axis" kwarg for this, and then document its default of "0", matching present behavior which we inherited from Matlab.
I am closing all issues in TEOS-10/python-gsw now that https://github.com/TEOS-10/GSW-Python is live.
Nsquared function for a 2-d array in gsw/gibbs/water_column_48.py gives correct values when the "sea pressure", "Absolute Salinity" and "Conservative Temperature" are given as an array in which pressure change is in rows.
Instead if the inputs are given as an array in which pressure is given in columns then the calculated 'N2' gives 'inf' values.
This was not mentioned in documentation or in the code comments.
In code the values for ishallow and ideep are calculated as follows. ishallow = (slice(0, -1), Ellipsis) ideep = (slice(1, None), Ellipsis) which slices rows but all the values of columns are being taken. Thus, it doesn't work when given in columns.
For Eg.:
Output:
[[-inf inf inf -inf inf]] [[ -2.90694938e-04 -1.17676546e-03] [ -2.01312134e-04 8.08101340e-05] [ -2.01236464e-04 7.25545252e-04] [ -1.34105985e-04 -8.40277657e-04]]
It would be better if the code is written accordingly or mention it in the comments of code or include in the documentation.