From 6170072049770d9063f2e71176505d84e1820010 Mon Sep 17 00:00:00 2001 From: mauzey1 Date: Wed, 25 Sep 2024 15:58:30 -0700 Subject: [PATCH 1/2] Add gsw_sa_ct_interp as an interpolation option for gsw_geo_strf_dyn_height_1 --- gsw_oceanographic_toolbox.c | 7 ++++++- gswteos-10.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gsw_oceanographic_toolbox.c b/gsw_oceanographic_toolbox.c index 1bda1f3..2ad24d4 100644 --- a/gsw_oceanographic_toolbox.c +++ b/gsw_oceanographic_toolbox.c @@ -4269,8 +4269,13 @@ gsw_geo_strf_dyn_height_1(double *sa, double *ct, double *p, double p_ref, err = err || gsw_util_pchip_interp(p, ct, nz, p_i, ct_i, n_i); if (err) err = 6; } + else if (interp_method == INTERP_METHOD_MRST) { + err = gsw_sa_ct_interp(sa, ct, p, nz, + p_i, n_i, sa_i, ct_i); + if (err) err = 7; + } else { - err = 7; + err = 8; } if (err) { free(p_i); diff --git a/gswteos-10.h b/gswteos-10.h index e273cad..4fb1e76 100644 --- a/gswteos-10.h +++ b/gswteos-10.h @@ -35,6 +35,7 @@ extern "C" { #define INTERP_METHOD_LINEAR 1 #define INTERP_METHOD_PCHIP 2 +#define INTERP_METHOD_MRST 3 /* ** Prototypes: From e0418ced5e1aa3c2d02b5f92a309b1e01a2638e2 Mon Sep 17 00:00:00 2001 From: mauzey1 Date: Wed, 25 Sep 2024 16:11:45 -0700 Subject: [PATCH 2/2] Update gsw_geo_strf_dyn_height_1 docstring with new interpolation option --- gsw_oceanographic_toolbox.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gsw_oceanographic_toolbox.c b/gsw_oceanographic_toolbox.c index 2ad24d4..de545aa 100644 --- a/gsw_oceanographic_toolbox.c +++ b/gsw_oceanographic_toolbox.c @@ -4010,8 +4010,9 @@ gsw_geo_strf_dyn_height_1(double *sa, double *ct, double *p, double p_ref, ! ! This function evaluates the pressure integral of specific volume using ! SA and CT interpolated with respect to pressure. The interpolation method -! may be chosen as linear or "PCHIP", piecewise cubic Hermite using a shape- -! preserving algorithm for setting the derivatives. +! may be chosen as linear, "PCHIP" (piecewise cubic Hermite using a shape- +! preserving algorithm for setting the derivatives), or "MRST-PCHIP" +! (Multiply-Rotated Salinity–Temperature PCHIP). ! ! SA = Absolute Salinity [ g/kg ] ! CT = Conservative Temperature (ITS-90) [ deg C ] @@ -4023,7 +4024,7 @@ gsw_geo_strf_dyn_height_1(double *sa, double *ct, double *p, double p_ref, ! geo_strf_dyn_height = dynamic height anomaly [ m^2/s^2 ] ! max_dp_i = maximum pressure difference between points for triggering ! interpolation. -! interp_method = 1 for linear, 2 for PCHIP +! interp_method = 1 for linear, 2 for PCHIP, 3 for MRST-PCHIP ! ! Note. If p_ref falls outside the range of a ! vertical profile, the dynamic height anomaly for each bottle