-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fix Specific volume second derivative SA P mistake (from Matlab) #53
Fix Specific volume second derivative SA P mistake (from Matlab) #53
Conversation
If I update to the latest matlab file we fix those but get more errors, probably other updates that got dumped in the matlab code.
|
Commit d8c48ed fixed these:
3 more to go! |
Good catch on d8c48ed |
geo_strf_dyn_height is expected to fail with the matlab check values; we are using a different algorithm, so we need to patch in our own check values. See #36. |
Are the data and check values in this PR now coming from gsw_matlab_v3_06_16.zip? |
Yep. Downloaded from https://www.teos-10.org/software/gsw_matlab_v3_06_16.zip and sent as a PR to TEOS-10/GSW-Matlab#15 for tracking purposes.
I thought that the check data Lines 334 to 336 in b5ecb2a
|
You are correct, running make_data_from_mat.py should take care of the patch, provided none of the inputs to the test have changed. |
I'm making some progress in tracking it down; it looks like a change in the check values for conductivity in the fresh-water case; the failure now is occurring in a value that was masked before. |
I do not remember changing the code in SP_from_C or C_from _SP. |
@PaulMBarker , just to clarify. The check values should be the same, but would those be still adequate to validate It's intriguing. I'm using the data from 3_06_16 to validate those functions in Rust with success. It is interesting that in other functions I can match the validation dataset with precision epsilon, but in this group of functions the difference was slightly larger. |
If your code matches my matlab code then the values will be correct. |
(Edited, 2022-10-07, to correct the description of the cast where the failures occur.) @PaulMBarker The comparisons here are between what was in the gsw_matlab_v3_06_11 zipfile and the gsw_matlab_v3_06_16 zipfile. The failures in the two tests in the C code, for C_from_SP and SP_from_C are not related to the I have not yet looked closely at the low-S part of the C code in C_from_SP to see whether it is somehow different from Once C_from_SP has failed, it is inevitable that SP_from_C will also fail, since the latter is using the output of the former. |
@efiring and @PaulMBarker , thanks for the info. |
I have found the problem: a difference in the sign of coefficient q7. |
Done!
If you don't mind let's merge this one as-is then, with only the
|
Fixed a bug in the calculation of v_sa_p in gsw_specvol_second_derivatives, in which a division by the square root of offset-salinity was omitted. This bug was detected by the MOM6 self-consistency testing, but it turns out that it was previously corrected in the matlab version of the TEOS-10 code on Sept. 29, 2022, at github.com/TEOS-10/GSW-Matlab/commit/38c9635, and subsequently ported to the C version of the code via github.com/TEOS-10/GSW-C/pull/53, on Oct. 3, 2022, but the Fortran version was somehow omitted. This commit makes the analogous correction to the Fortran version of TEOS-10, and once this commit is fully merged into the master branch of TEOS-10/GSW-Fortran, I expect that github.com/TEOS-10/issues/26 can be closed. At this point we are not detecting any other self-inconsistencies in the TEOS-10 Fortran code that we are using with MOM6. However, this bug might still raise the question of whether there are other corrections that have been made to the Matlab or C versions of TEOS-10 that have not propagated to the Fortran version.
Port TEOS-10/GSW-Matlab@38c9635
Thanks @richardsc for pointing this out.
Closes #52
We need to update the test values for: