Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update functions to more closely match matlab? #9

Closed
efiring opened this issue Mar 20, 2017 · 5 comments
Closed

update functions to more closely match matlab? #9

efiring opened this issue Mar 20, 2017 · 5 comments

Comments

@efiring
Copy link
Member

efiring commented Mar 20, 2017

I am working on an automated wrapping of the C code in Python, in the course of which I find some C functions that could be updated in various ways to better match the matlab, and some functions that I suspect are left over from earlier versions; they have no matching m-files. The functions I have encountered so far are:

In C only? Obsolete? Delete?

  • ct_freezing_exact
  • pt0_cold_ice_poly
  • pt_from_pot_enthalpy_ice_poly_dh
  • t_freezing_exact

Extra (optional) arguments in matlab:

  • pot_enthalpy_ice_freezing mismatch: ('sa', 'p'), ('SA', 'p', 'saturation_fraction')
  • z_from_p mismatch: ('p', 'lat'), ('p', 'lat', 'geo_strf_dyn_height', 'sea_surface_geopotental')

I could make PRs for such changes to bring the C closer to the current matlab; would they be welcome? (I would probably not do anything about optional output arguments; in the one case that comes to mind, it is a nearly-useless validity flag that can be obtained separately.) The method to be used for handling optional arguments is open to discussion. Options include using separate functions for each signature, or using a single variadic signature.

My priority is in the basic functionality, especially the simple scalar functions; for some of the more complex functions, including most that operate on profiles, I think that re-implementation in Python will be adequate for my purposes.

@PaulMBarker
Copy link
Member

the codes that appear in C only are subroutines that probably are at the end of one of the functions.
eg. pt_from_pot_enthalpy_ice_poly_dh is a subroutine in pt_from_pot_enthalpy_ice

@PaulMBarker
Copy link
Member

we added the extra inputs to z_from_p in a more recent version of the programme, adding dynamic height improves the accuracy of the calculation.

@efiring
Copy link
Member Author

efiring commented Mar 20, 2017

@PaulMBarker Thanks for the info. I completely forgot to check for subroutines.

@hylandg
Copy link
Member

hylandg commented Mar 21, 2017

The 2 temperature freezing functions

  • ct_freezing_exact
  • t_freezing_exact

are Fortran specific (as per TEOS-10/GSW-Fortran#4) and within the C-code could be renamed to

  • ct_freezing
  • t_freezing

without loss of functionality.

@efiring
Copy link
Member Author

efiring commented Apr 3, 2017

Closed by #10.

@efiring efiring closed this as completed Apr 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants