From 37fbc01e6667a826b0d0110dfa28d24b60ec8d8b Mon Sep 17 00:00:00 2001 From: Benoit Pasquier Date: Mon, 4 Jul 2022 14:34:34 +1000 Subject: [PATCH 01/13] Fix inexact slope in Newton solve for pH from TA --- main/CO2SYS.m | 62 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/main/CO2SYS.m b/main/CO2SYS.m index 7c9efe8..58d6cba 100644 --- a/main/CO2SYS.m +++ b/main/CO2SYS.m @@ -1853,34 +1853,56 @@ function Constants(TempC,Pdbar) nF=(abs(deltapH) > pHTol); while any(nF) H = 10.^(-pH); + dH_dpHx = -ln10 .* H; Denom = (H.*H + K1F.*H + K1F.*K2F); + dDenom_dH = K1F + 2 * H; CAlk = TCi.*K1F.*(H + 2.*K2F)./Denom; + dCAlk_dH = (K1F .* TCi - dDenom_dH .* CAlk) ./ Denom; BAlk = TBF.*KBF./(KBF + H); + dBAlk_dH = -BAlk ./ (KBF + H); OH = KWF./H; + dOH_dH = -KWF ./ (H .* H); PhosTop = KP1F.*KP2F.*H + 2.*KP1F.*KP2F.*KP3F - H.*H.*H; + dPhosTop_dH = KP1F .* KP2F - 3 * H .* H; PhosBot = H.*H.*H + KP1F.*H.*H + KP1F.*KP2F.*H + KP1F.*KP2F.*KP3F; + dPhosBot_dH = 3 * H .* H + KP1F .* KP2F + 2 * H .* KP1F; PAlk = TPF.*PhosTop./PhosBot; + dPAlkex_dPhosTop = TPF ./ PhosBot; + dPAlkex_dPhosBot = -PhosTop .* TPF ./ (PhosBot .* PhosBot); + dPAlk_dH = dPAlkex_dPhosTop .* dPhosTop_dH + dPAlkex_dPhosBot .* dPhosBot_dH; SiAlk = TSiF.*KSiF./(KSiF + H); + dSiAlk_dH = -SiAlk ./ (H + KSiF); AmmAlk = TNH4F.*KNH4F./(KNH4F + H); + dAmmAlk_dH = -AmmAlk ./ (H + KNH4F); HSAlk = TH2SF.*KH2SF./(KH2SF + H); - [~,~,pHfree,~] = FindpHOnAllScales(pH); % this converts pH to pHfree no matter the scale - Hfree = 10.^-pHfree; % this converts pHfree to Hfree + dHSAlk_dH = -HSAlk ./ (H + KH2SF); + Hfree = 10.^(-pHfree); % this converts pHfree to Hfree + % Changing from pH to pHfree is just a tranlsation (± C) + % and changing from H to Hfree is just a scaling by C + % so all we need to do is grab that constant to get dH_scaleA/dH_scaleB = 1/C + [~,~,pHfree,~,~,~,scaling_constant] = FindpHOnAllScales(pH); % this converts pH to pHfree no matter the scale + dHfree_dH = 1 ./ scaling_constant; % HSO4 = TSF./(1 + KSF./Hfree); % since KS is on the free scale + dHSO4_dHfree = KSF ./ (Hfree .* Hfree) .* HSO4 ./ (1 + KSF ./ Hfree); + dHSO4_dH = dHSO4_dHfree .* dHfree_dH; HF = TFF./(1 + KFF./Hfree); % since KF is on the free scale - Residual = TAi - CAlk - BAlk - OH - PAlk - SiAlk - AmmAlk - HSAlk + Hfree + HSO4 + HF; + dHF_dHfree = KFF ./ (Hfree .* Hfree) .* HF ./ (1 + KFF ./ Hfree); + dHF_dH = dHF_dHfree .* dHfree_dH; + Residual = TAi - CAlk - BAlk - OH - PAlk - SiAlk - AmmAlk - HSAlk + Hfree + HSO4 + HF; % find Slope dTA/dpH; - % (this is not exact, but keeps all important terms); - Slope = ln10.*(TCi.*K1F.*H.*(H.*H + K1F.*K2F + 4.*H.*K2F)./Denom./Denom + BAlk.*H./(KBF + H) + OH + H); - deltapH = Residual./Slope; %' this is Newton's method - % ' to keep the jump from being too big: + % (this is now exact!) + Slope = dH_dpHx .* (-dCAlk_dH - dBAlk_dH - dOH_dH - dPAlk_dH ... + - dSiAlk_dH - dAmmAlk_dH - dHSAlk_dH + dHfree_dH + dHSO4_dH + dHF_dH); + deltapH = -Residual./Slope; % this is Newton's method + % to keep the jump from being too big: while any(abs(deltapH) > 1) FF=abs(deltapH)>1; deltapH(FF)=deltapH(FF)./2; end pH(nF) = pH(nF) + deltapH(nF); nF = abs(deltapH) > pHTol; loopc=loopc+1; - - if loopc>10000 + + if loopc > 100 % BP: changed max iterations to 100 Fr=find(abs(deltapH) > pHTol); pH(Fr)=NaN; disp(['pH value did not converge for data on row(s): ' num2str((Fr)')]); deltapH=pHTol*0.9; @@ -2712,7 +2734,7 @@ function Constants(TempC,Pdbar) end % end nested function function varargout=FindpHOnAllScales(pH) -global pHScale K T TS KS TF KF fH F ntps; +global pHScale TS KS TF KF fH F % ' SUB FindpHOnAllScales, version 01.02, 01-08-97, written by Ernie Lewis. % ' Inputs: pHScale%, pH, K(), T(), fH % ' Outputs: pHNBS, pHfree, pHTot, pHSWS @@ -2726,17 +2748,25 @@ function Constants(TempC,Pdbar) nF=pHScale(F)==1; %'"pHtot" factor(nF) = 0; nF=pHScale(F)==2; % '"pHsws" -factor(nF) = -log(SWStoTOT(nF))./log(0.1); +factor(nF) = log10(SWStoTOT(nF)); nF=pHScale(F)==3; % '"pHfree" -factor(nF) = -log(FREEtoTOT(nF))./log(0.1); +factor(nF) = log10(FREEtoTOT(nF)); nF=pHScale(F)==4; %'"pHNBS" -factor(nF) = -log(SWStoTOT(nF))./log(0.1) + log(fHx(nF))./log(0.1); +factor(nF) = log10(SWStoTOT(nF)) - log10(fHx(nF)); pHtot = pH - factor; % ' pH comes into this sub on the given scale -pHNBS = pHtot - log(SWStoTOT) ./log(0.1) + log(fHx)./log(0.1); -pHfree = pHtot - log(FREEtoTOT)./log(0.1); -pHsws = pHtot - log(SWStoTOT) ./log(0.1); +pHNBS = pHtot + log10(SWStoTOT ./ fHx); +pHfree = pHtot + log10(FREEtoTOT); +pHsws = pHtot + log10(SWStoTOT); varargout{1}=pHtot; varargout{2}=pHsws; varargout{3}=pHfree; varargout{4}=pHNBS; +% If requested, return the scaling constant +% (useful for derivative of H(scale in) wrt H(scale out)) +if nargout > 4 + varargout{5}=factor; + varargout{6}=factor - log10(SWStoTOT ./ fHx); + varargout{7}=factor - log10(FREEtoTOT); + varargout{8}=factor - log10(SWStoTOT); +end end % end nested function From 52169fc7d160c82781ed4a1a449aab41d0b376d6 Mon Sep 17 00:00:00 2001 From: Benoit Pasquier Date: Mon, 4 Jul 2022 15:00:01 +1000 Subject: [PATCH 02/13] Fix line order in pH from TA --- main/CO2SYS.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/CO2SYS.m b/main/CO2SYS.m index 58d6cba..b8815ba 100644 --- a/main/CO2SYS.m +++ b/main/CO2SYS.m @@ -1876,10 +1876,10 @@ function Constants(TempC,Pdbar) dAmmAlk_dH = -AmmAlk ./ (H + KNH4F); HSAlk = TH2SF.*KH2SF./(KH2SF + H); dHSAlk_dH = -HSAlk ./ (H + KH2SF); - Hfree = 10.^(-pHfree); % this converts pHfree to Hfree % Changing from pH to pHfree is just a tranlsation (± C) % and changing from H to Hfree is just a scaling by C % so all we need to do is grab that constant to get dH_scaleA/dH_scaleB = 1/C + Hfree = 10.^(-pHfree); % this converts pHfree to Hfree [~,~,pHfree,~,~,~,scaling_constant] = FindpHOnAllScales(pH); % this converts pH to pHfree no matter the scale dHfree_dH = 1 ./ scaling_constant; % HSO4 = TSF./(1 + KSF./Hfree); % since KS is on the free scale From cb98a967dc879097a817523c56a7c196942ad414 Mon Sep 17 00:00:00 2001 From: Benoit Pasquier Date: Mon, 4 Jul 2022 15:00:35 +1000 Subject: [PATCH 03/13] Fix line order for good in pH from TA --- main/CO2SYS.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/CO2SYS.m b/main/CO2SYS.m index b8815ba..eb5617f 100644 --- a/main/CO2SYS.m +++ b/main/CO2SYS.m @@ -1879,8 +1879,8 @@ function Constants(TempC,Pdbar) % Changing from pH to pHfree is just a tranlsation (± C) % and changing from H to Hfree is just a scaling by C % so all we need to do is grab that constant to get dH_scaleA/dH_scaleB = 1/C - Hfree = 10.^(-pHfree); % this converts pHfree to Hfree [~,~,pHfree,~,~,~,scaling_constant] = FindpHOnAllScales(pH); % this converts pH to pHfree no matter the scale + Hfree = 10.^(-pHfree); % this converts pHfree to Hfree dHfree_dH = 1 ./ scaling_constant; % HSO4 = TSF./(1 + KSF./Hfree); % since KS is on the free scale dHSO4_dHfree = KSF ./ (Hfree .* Hfree) .* HSO4 ./ (1 + KSF ./ Hfree); From 45eb57d8d04436e4a8bade26834f00105aaeda81 Mon Sep 17 00:00:00 2001 From: Benoit Pasquier Date: Mon, 4 Jul 2022 15:18:16 +1000 Subject: [PATCH 04/13] Add git commit comparison script --- comparisons/compare_against_master.m | 59 ++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 comparisons/compare_against_master.m diff --git a/comparisons/compare_against_master.m b/comparisons/compare_against_master.m new file mode 100644 index 0000000..4f984a9 --- /dev/null +++ b/comparisons/compare_against_master.m @@ -0,0 +1,59 @@ +% Compares your latest commit with CO2SYS v3.2.0 + +%% Set up input conditions +PARvalues = [2250 2100 8.1 400 405]; +PARTYPEs = 1:5; +pHSCALEIN_opts = 1:4; +K1K2CONSTANTS_opts = 1:15; +KSO4CONSTANTS_opts = 1:4; +KFCONSTANT_opts = 1; +SALvalue = 33.1; +[P1, P2, P1type, P2type, sal, pHscales, K1K2, KSO4_only, KSO4, KF, ... + BSal, U1, U2] = CO2SYSigen(PARvalues, PARTYPEs, SALvalue, pHSCALEIN_opts, ... + K1K2CONSTANTS_opts, KSO4CONSTANTS_opts, KFCONSTANT_opts); +tempin = 24; +tempout = 12; +presin = 1; +presout = 1647; +si = 10; +phos = 1; + +%% Determine whether to calculate each input row or not +% xrow = 1 + 210; % just do one row, or... +xrow = 1:numel(P1); % ... do all rows (do this for saving output file) +P1 = P1(xrow); +P2 = P2(xrow); +P1type = P1type(xrow); +P2type = P2type(xrow); +sal = sal(xrow); +pHscales = pHscales(xrow); +K1K2 = K1K2(xrow); +KSO4_only = KSO4_only(xrow); + +%% Run CO2SYS v3.2.0 +disp('Running CO2SYS v3.2.0') +system('git checkout v3.2.0'); % Checkout the v3.2.0 tag +tic +[DATA_v3, HEADERS_v3] = ... +CO2SYS(P1, P2, P1type, P2type, sal, tempin, tempout, presin, ... +presout, si, phos, 0, 0, pHscales, K1K2, KSO4, KF, BSal); +toc + +%% Run current commit CO2SYS +disp('Running CO2SYS current commit/head') +system('git switch -'); % Switch back to your commit +tic +[DATA, HEADERS] = ... + CO2SYS(P1, P2, P1type, P2type, sal, tempin, tempout, presin, ... + presout, si, phos, 0, 0, pHscales, K1K2, KSO4, KF, BSal); +toc + +disp("Relative change vs v3.2.0") +fprintf("%20s %20s\n", "Variable", "Max rel. change") +for V = 1:length(HEADERS_v3) + err = DATA(:,V) - DATA_v3(:,V); + relerr = abs(err) ./ abs(DATA_v3(:,V)); + maxrelerr = max(relerr); + fprintf("%20s %20.2g\n", HEADERS_v3{V}, maxrelerr) +end + From e40085bf07defd40c77b1d68ccc5d17a6feab0e7 Mon Sep 17 00:00:00 2001 From: Benoit Pasquier Date: Mon, 4 Jul 2022 15:26:33 +1000 Subject: [PATCH 05/13] Style: fix indentation --- comparisons/compare_against_master.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comparisons/compare_against_master.m b/comparisons/compare_against_master.m index 4f984a9..bb89869 100644 --- a/comparisons/compare_against_master.m +++ b/comparisons/compare_against_master.m @@ -35,8 +35,8 @@ system('git checkout v3.2.0'); % Checkout the v3.2.0 tag tic [DATA_v3, HEADERS_v3] = ... -CO2SYS(P1, P2, P1type, P2type, sal, tempin, tempout, presin, ... -presout, si, phos, 0, 0, pHscales, K1K2, KSO4, KF, BSal); + CO2SYS(P1, P2, P1type, P2type, sal, tempin, tempout, presin, ... + presout, si, phos, 0, 0, pHscales, K1K2, KSO4, KF, BSal); toc %% Run current commit CO2SYS From b0b67681fada438f1a62be86d176670d8ca0ba61 Mon Sep 17 00:00:00 2001 From: Benoit Pasquier Date: Mon, 4 Jul 2022 15:33:42 +1000 Subject: [PATCH 06/13] Fix git version comparison script --- comparisons/compare_against_master.m | 46 +++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/comparisons/compare_against_master.m b/comparisons/compare_against_master.m index bb89869..e9581d8 100644 --- a/comparisons/compare_against_master.m +++ b/comparisons/compare_against_master.m @@ -1,5 +1,9 @@ % Compares your latest commit with CO2SYS v3.2.0 +%% Run CO2SYS v3.2.0 +disp('Running CO2SYS v3.2.0') +system('git checkout v3.2.0'); % Checkout the v3.2.0 tag + %% Set up input conditions PARvalues = [2250 2100 8.1 400 405]; PARTYPEs = 1:5; @@ -30,18 +34,49 @@ K1K2 = K1K2(xrow); KSO4_only = KSO4_only(xrow); -%% Run CO2SYS v3.2.0 -disp('Running CO2SYS v3.2.0') -system('git checkout v3.2.0'); % Checkout the v3.2.0 tag tic [DATA_v3, HEADERS_v3] = ... CO2SYS(P1, P2, P1type, P2type, sal, tempin, tempout, presin, ... presout, si, phos, 0, 0, pHscales, K1K2, KSO4, KF, BSal); toc + + + %% Run current commit CO2SYS disp('Running CO2SYS current commit/head') system('git switch -'); % Switch back to your commit + +%% Set up input conditions +PARvalues = [2250 2100 8.1 400 405]; +PARTYPEs = 1:5; +pHSCALEIN_opts = 1:4; +K1K2CONSTANTS_opts = 1:15; +KSO4CONSTANTS_opts = 1:4; +KFCONSTANT_opts = 1; +SALvalue = 33.1; +[P1, P2, P1type, P2type, sal, pHscales, K1K2, KSO4_only, KSO4, KF, ... + BSal, U1, U2] = CO2SYSigen(PARvalues, PARTYPEs, SALvalue, pHSCALEIN_opts, ... + K1K2CONSTANTS_opts, KSO4CONSTANTS_opts, KFCONSTANT_opts); +tempin = 24; +tempout = 12; +presin = 1; +presout = 1647; +si = 10; +phos = 1; + +%% Determine whether to calculate each input row or not +% xrow = 1 + 210; % just do one row, or... +xrow = 1:numel(P1); % ... do all rows (do this for saving output file) +P1 = P1(xrow); +P2 = P2(xrow); +P1type = P1type(xrow); +P2type = P2type(xrow); +sal = sal(xrow); +pHscales = pHscales(xrow); +K1K2 = K1K2(xrow); +KSO4_only = KSO4_only(xrow); + tic [DATA, HEADERS] = ... CO2SYS(P1, P2, P1type, P2type, sal, tempin, tempout, presin, ... @@ -49,11 +84,12 @@ toc disp("Relative change vs v3.2.0") -fprintf("%20s %20s\n", "Variable", "Max rel. change") +fprintf("%20s %20s %20s\n", "Variable", "Mean rel. change", "Max rel. change") for V = 1:length(HEADERS_v3) err = DATA(:,V) - DATA_v3(:,V); relerr = abs(err) ./ abs(DATA_v3(:,V)); maxrelerr = max(relerr); - fprintf("%20s %20.2g\n", HEADERS_v3{V}, maxrelerr) + meanrelerr = mean(relerr); + fprintf("%20s %20.2g %20.2g\n", HEADERS_v3{V}, meanrelerr, maxrelerr) end From 4a333fbcf6ebfb78db57d47cebf65e4e8467578a Mon Sep 17 00:00:00 2001 From: Benoit Pasquier Date: Mon, 4 Jul 2022 15:35:49 +1000 Subject: [PATCH 07/13] Fix comparison script --- comparisons/compare_against_master.m | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/comparisons/compare_against_master.m b/comparisons/compare_against_master.m index e9581d8..340e92f 100644 --- a/comparisons/compare_against_master.m +++ b/comparisons/compare_against_master.m @@ -12,8 +12,8 @@ KSO4CONSTANTS_opts = 1:4; KFCONSTANT_opts = 1; SALvalue = 33.1; -[P1, P2, P1type, P2type, sal, pHscales, K1K2, KSO4_only, KSO4, KF, ... - BSal, U1, U2] = CO2SYSigen(PARvalues, PARTYPEs, SALvalue, pHSCALEIN_opts, ... +[P1, P2, P1type, P2type, sal, pHscales, K1K2, ~, KSO4, KF, ... + BSal, ~, ~] = CO2SYSigen(PARvalues, PARTYPEs, SALvalue, pHSCALEIN_opts, ... K1K2CONSTANTS_opts, KSO4CONSTANTS_opts, KFCONSTANT_opts); tempin = 24; tempout = 12; @@ -32,7 +32,6 @@ sal = sal(xrow); pHscales = pHscales(xrow); K1K2 = K1K2(xrow); -KSO4_only = KSO4_only(xrow); tic [DATA_v3, HEADERS_v3] = ... @@ -55,8 +54,8 @@ KSO4CONSTANTS_opts = 1:4; KFCONSTANT_opts = 1; SALvalue = 33.1; -[P1, P2, P1type, P2type, sal, pHscales, K1K2, KSO4_only, KSO4, KF, ... - BSal, U1, U2] = CO2SYSigen(PARvalues, PARTYPEs, SALvalue, pHSCALEIN_opts, ... +[P1, P2, P1type, P2type, sal, pHscales, K1K2, ~, KSO4, KF, ... + BSal, ~, ~] = CO2SYSigen(PARvalues, PARTYPEs, SALvalue, pHSCALEIN_opts, ... K1K2CONSTANTS_opts, KSO4CONSTANTS_opts, KFCONSTANT_opts); tempin = 24; tempout = 12; @@ -75,7 +74,6 @@ sal = sal(xrow); pHscales = pHscales(xrow); K1K2 = K1K2(xrow); -KSO4_only = KSO4_only(xrow); tic [DATA, HEADERS] = ... From 39844a7a3386e8bc5c3f1373e66d947e9a0b1aa8 Mon Sep 17 00:00:00 2001 From: Benoit Pasquier Date: Mon, 4 Jul 2022 15:49:03 +1000 Subject: [PATCH 08/13] Fiux comparsion script --- comparisons/compare_against_master.m | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/comparisons/compare_against_master.m b/comparisons/compare_against_master.m index 340e92f..8229262 100644 --- a/comparisons/compare_against_master.m +++ b/comparisons/compare_against_master.m @@ -82,12 +82,14 @@ toc disp("Relative change vs v3.2.0") -fprintf("%20s %20s %20s\n", "Variable", "Mean rel. change", "Max rel. change") +fprintf("%20s %20s %20s %20s %20s\n", "Variable", "Mean rel. change", "Min rel. change", "Max rel. change", "# of samples") for V = 1:length(HEADERS_v3) - err = DATA(:,V) - DATA_v3(:,V); - relerr = abs(err) ./ abs(DATA_v3(:,V)); - maxrelerr = max(relerr); - meanrelerr = mean(relerr); - fprintf("%20s %20.2g %20.2g\n", HEADERS_v3{V}, meanrelerr, maxrelerr) -end - + x = DATA_v3(:,V); + y = DATA(:,V); + relerr = abs(y - x) ./ abs(x); + ix = x ~= -999; % Only compare non fill-in values + maxrelerr = max(relerr(idx)); + minrelerr = min(relerr(idx)); + meanrelerr = mean(relerr(idx)); + fprintf("%20s %20.2g %20.2g %20.2g %20i\n", HEADERS_v3{V}, meanrelerr, minrelerr, maxrelerr, length(ix)) +end \ No newline at end of file From 24f349c30e20e0945695eb0df0417177507f17c2 Mon Sep 17 00:00:00 2001 From: Benoit Pasquier Date: Mon, 4 Jul 2022 16:01:30 +1000 Subject: [PATCH 09/13] Try rehash to prevent function caching --- comparisons/compare_against_master.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/comparisons/compare_against_master.m b/comparisons/compare_against_master.m index 8229262..ee9bc27 100644 --- a/comparisons/compare_against_master.m +++ b/comparisons/compare_against_master.m @@ -41,6 +41,10 @@ +% Circumvent caching of CO2SYS function +rehash + + %% Run current commit CO2SYS disp('Running CO2SYS current commit/head') @@ -81,8 +85,8 @@ presout, si, phos, 0, 0, pHscales, K1K2, KSO4, KF, BSal); toc -disp("Relative change vs v3.2.0") -fprintf("%20s %20s %20s %20s %20s\n", "Variable", "Mean rel. change", "Min rel. change", "Max rel. change", "# of samples") +fprintf("\n\nRelative change vs v3.2.0:\n"); ... +fprintf("%20s %20s %20s %20s %20s\n", "Variable", "Mean rel. change", "Min rel. change", "Max rel. change", "# of samples"); ... for V = 1:length(HEADERS_v3) x = DATA_v3(:,V); y = DATA(:,V); From 685a531d8e248f46fbb7b1c5d369dc95262f9948 Mon Sep 17 00:00:00 2001 From: Benoit Pasquier Date: Mon, 4 Jul 2022 16:02:18 +1000 Subject: [PATCH 10/13] Use rehash path instead of just rehash --- comparisons/compare_against_master.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comparisons/compare_against_master.m b/comparisons/compare_against_master.m index ee9bc27..6ecb815 100644 --- a/comparisons/compare_against_master.m +++ b/comparisons/compare_against_master.m @@ -42,7 +42,7 @@ % Circumvent caching of CO2SYS function -rehash +rehash path From 417c03063b4aea923613319151b12278760b19f0 Mon Sep 17 00:00:00 2001 From: Benoit Pasquier Date: Mon, 4 Jul 2022 16:08:04 +1000 Subject: [PATCH 11/13] Fix comparsion script --- comparisons/compare_against_master.m | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/comparisons/compare_against_master.m b/comparisons/compare_against_master.m index 6ecb815..6d86e30 100644 --- a/comparisons/compare_against_master.m +++ b/comparisons/compare_against_master.m @@ -1,7 +1,10 @@ % Compares your latest commit with CO2SYS v3.2.0 + + %% Run CO2SYS v3.2.0 disp('Running CO2SYS v3.2.0') +rehash path % Circumvent caching of CO2SYS function system('git checkout v3.2.0'); % Checkout the v3.2.0 tag %% Set up input conditions @@ -41,13 +44,9 @@ -% Circumvent caching of CO2SYS function -rehash path - - - %% Run current commit CO2SYS disp('Running CO2SYS current commit/head') +rehash path % Circumvent caching of CO2SYS function system('git switch -'); % Switch back to your commit %% Set up input conditions From 25aaf177cebd22c5566b96851a073f559d06c2bd Mon Sep 17 00:00:00 2001 From: Benoit Pasquier Date: Mon, 4 Jul 2022 16:09:38 +1000 Subject: [PATCH 12/13] test which version is running with disp --- main/CO2SYS.m | 1 + 1 file changed, 1 insertion(+) diff --git a/main/CO2SYS.m b/main/CO2SYS.m index eb5617f..755a5f3 100644 --- a/main/CO2SYS.m +++ b/main/CO2SYS.m @@ -318,6 +318,7 @@ % NOTHING BELOW THIS SHOULD REQUIRE EDITING BY USER! %************************************************************************** +disp("Running new one") % Declare global variables global pHScale WhichKs WhoseKSO4 WhoseKF WhoseTB Pbar From 8506cd5d59cbedb7a31ca3d559f86c36a1b1a39f Mon Sep 17 00:00:00 2001 From: Benoit Pasquier Date: Mon, 4 Jul 2022 16:11:26 +1000 Subject: [PATCH 13/13] Remove disp --- main/CO2SYS.m | 2 -- 1 file changed, 2 deletions(-) diff --git a/main/CO2SYS.m b/main/CO2SYS.m index 755a5f3..63f7199 100644 --- a/main/CO2SYS.m +++ b/main/CO2SYS.m @@ -318,8 +318,6 @@ % NOTHING BELOW THIS SHOULD REQUIRE EDITING BY USER! %************************************************************************** -disp("Running new one") - % Declare global variables global pHScale WhichKs WhoseKSO4 WhoseKF WhoseTB Pbar global Sal sqrSal TempK logTempK TempCi TempCo Pdbari Pdbaro;