TEOS-10 / GSW-C

C implementation of the Thermodynamic Equation Of Seawater - 2010 (TEOS-10)
Other
18 stars 17 forks source link

adding `gsw_internal_energy_t_exact`, `gsw_isochoric_heat_cap_t_exact` #62

Closed ggebbie closed 1 year ago

ggebbie commented 1 year ago

If I am reading the C code correctly, gsw_internal_energy_t_exact and gsw_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 and gsw_internal_energy in those languages instead.

efiring commented 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:

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.

ggebbie commented 1 year ago

Thank you, efiring. I will take the approach of writing my own supplementary functions rather than attempting to update this package.