Open lkdo opened 9 months ago
Did you run "in funnel" to validate your parameters? /*** % gsw_geo_strf_dyn_height dynamic height anomaly % (75-term equation) %==========================================================================
% Note that the 75-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" % described in McDougall et al. (2003). For dynamical oceanography we may % take the 75-term rational function expression for specific volume as % essentially reflecting the full accuracy of TEOS-10. The GSW library % function "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to % test if some of one's data lies outside this "funnel".
The k value cannot be zero. Set it to 1. The expected values are not correct. Test 1 CT = 28.8099, SA = 34.7118, p = 10 (received: 1.01234e-320) Test 2 CT = 28.439, SA = 34.8915, p = 50 (received: 2.91441e-317) Test 3 CT = 22.7862, SA = 35.0256, p = 125 (received: 4.94066e-324) Test 4 CT = 10.2262, SA = 34.8472, p = 250 (received: 1.63971e-319) Test 5 CT = 6.8272, SA = 34.7366, p = 600 (received: 0) Test 6 CT = 4.3236, SA = 34.7324, p = 1000 (received: 0)
Function void TeosBase::gsw_util_sort_dbl(double dArray,int nx,int iArray,bool ASC) seems to be called with a partially uninitialized iArray parameter, for example in gsw_util_interp1q_int(), causing segmentation fault. The call is gsw_util_sort_dbl(xi, n, k); where the k array is only initialized from index n circa.
The following code was used as main() for a quick test: