Closed ggebbie closed 1 year ago
The last time a function was added to this C library was 5 years ago: https://github.com/TEOS-10/GSW-C/pull/30. It's not difficult for simple, well-behaved functions, but it is not well documented; the README files are only partially updated from their originals. I think the main point of potential confusion is that currently one should edit and use make_data_from_mat.py, not make_check_data.py and make_saar_data.py to generate the ascii static data files.
After adding a function to the C library, wrapping it in the Python library is also not very well documented. It can be quite easy, or more involved, depending on the function's signature. The Python docstring is generated using info parsed from the Matlab version of the function.
Regarding the two functions you mention here:
def internal_energy_t_exact(SA, t, p):
return (gsw.gibbs(0, 0, 0, SA, t, p)
- (t + 273.15) * gsw.gibbs(0, 1, 0, SA, t, p)
- (1e4*p + 101325) * gsw.gibbs(0, 0, 1, SA, t, p))
So, if your use case simply requires those functions in Python, you could define these simple translations directly in your code. If it would be worthwhile to integrate some or all of the thermodynamics_from_t/*
set of functions into the GSW_
Python, R, and Julia libraries, then the C library should be the starting point.
Thank you, efiring. I will take the approach of writing my own supplementary functions rather than attempting to update this package.
If I am reading the C code correctly,
gsw_internal_energy_t_exact
andgsw_isochoric_heat_cap_t_exact
from GSW-MATLAB are not implemented. (I did not attempt to make a complete list.) Consequently, these functions do not exist in the Python and Julia packages that wrap the C code. These functions would have usage in an introductory physical oceanography course that I teach in the MIT/WHOI Joint Program.Does it make sense to try to implement these functions here? Is there a previous issue that gives a blueprint for adding functions?
Alternatively, there are Python or Julia wrappers that could handle the difference between
gsw_internal_energy_t_exact
andgsw_internal_energy
in those languages instead.