jpgattuso / seacarb-git

Seawater carbonate chemistry with R
8 stars 11 forks source link

Issue with function at #70

Open jpgattuso opened 3 years ago

jpgattuso commented 3 years ago

From: Jean-Pierre Gattuso gattuso@obs-vlfr.fr To: Lennart Bach lennart.bach@utas.edu.au Subject: Re: Seacarb alkalinity function "at" Date: Thu, 14 Jan 2021 18:52:16 +0100

Dear Lennart,

I also wish you a healthy and enjoyable year 2021!

I apologise for such a belated reply. I have been quite overwhelmed lately. Many thanks for your input which is much appreciated. This function was added a long time ago and we have not used it since. My colleagues at the lab use a script which reads the files saved by the titrator and process them without using seacarb. For point #1: this function is for titrations with HCl unfortified with NaCl (hence molarity and molinity are essentially the same). It is a regrettable mistake that it is not mentioned in the help file. In the help, “Total alkalinity is estimated using the non-linear least-square procedure described by Dickson et al. (2007).” is correct as SOP 3b is not mentioned, just the data processing recommended by Dickson et al. is.

So, where do we go from here? Clearly, the at function cannot stay as is. I propose to pull it off seacarb for now. A revised at function could be developed and I would be happy to also add an air-buoyancy correction function. I do not have the time to do that on my own but it would be great if you would be willing to proceed. I will assist you to make sure that the package compiles OK (CRAN is very finicky about that) and you would be the first author of the new functions.

Best regards, Jean-Pierre

On 6 Jan 2021, at 0:20, Lennart Bach wrote:

I wish you all the best for the New Year, health and good spirit for you and your family.   I recently build my alkalinity infrastructure here in Hobart. For the calculation of TA I wanted to use the seacarb function “at”. When evaluating the titration data I corresponded with Kai Schulz and Matthew Humphreys who cross-checked my titration data with their TA calculation function for Matlab (Kai) and Python (Matthew). Based on that I noted some potential issues with the seacarb function. I will list them below.   The value C as in seacarb is indicated to describe the “Normality” of the acid (i.e. mol/L). However, the applied Dickson routine wants mol/kg for the acid. This leads to a ~50 µmol offset and it took my quite long to figure out why my seacarb calculated values were always way off those calculated by the others. I think the description may need to be corrected to maybe “molinity” so that it is clear it is mol/kg? The “weight” as measured with the balance should bey air-buoyancy corrected (see SOP21 in Dickson et al., 2007) in order to get to “mass”. Seacarb indicates weight is needed as an input, which is I think not 100% correct. If you want I can send you the R-code for the air-buoyancy correction. This could perhaps be a helpful function in seacarb as well. This third point is more something I did not understand. I played around with the Etris and pHTris values and they have a strong influence on the outcome. In principle, the Dickson et al., 2003 method used here does not need these values to begin with. (Kai and Matthew do not have that in their scripts). So it is unclear to me why it is in seacarb as this seems to differ from the Dickson approach which is referenced by Seacarb. This forth point is perhaps a recommendation. It would be great to have EMF_0 as an output value because monitoring this value can help to monitor the quality of the electrode.

SanchezCabeza commented 3 years ago

Dear Jean Pierre and Lennart,

  1. I have regained contact with the at() function and I have found what I believe is a mistake with the formula used in nls(), which causes a shift. I wonder if some work has already been done so I can contribute by correcting that. I would be happy to work on the new version of at() or just the existing one.
  2. I agree with an air-buoyancy correction function (which can use rho() for seawater density).
  3. I agree that E0 should be returned, if Jean-Pierre accepts that the function returns (for example) a named vector.
  4. Tris values: NULL (I would prefer NA) values can be used if the user provides the data that, in his opinion, must be used for the calculation. In fact, most users will use a two or three-point calibration for the electrode.
  5. Uncertainty calculation should be included (and in other places of seacarb). Over. Joan Albert
jpgattuso commented 3 years ago

Dear Joan Albert, Thank you for your input. Lennart mentioned that Kimberlee Baldry (kimberlee.baldry@utas.edu.au) will be involved. I hope she follows this thread, if not you can contact her directly. I suggest to make a branch to experiment the revised function. Best, Jean-Pierre

matthiasbirkich commented 3 years ago

Dear Madams and Sirs, when I calculate the example of SOP3b, I will get a pretty good result (2260.03 umol/kg-?). It is closer to the specified value 2260.06 umol/kg-sol) SOP3b_Example_Calculation_Gran_NLLS_20201027.xlsx , as it is with the NLLS-function (2259 umol/kg-sol) from the scribbs institution. The density calculation of the acid-NaCl can be made external: http://www.aim.env.uea.ac.uk/aim/density/density_electrolyte.php SOP_3b_Seacarb_at-function.txt I am a bit confused about the two different units umol/kg (which is the CRM) and umol/kg-sol, which is sometimes used in the software packages. Are you so polite to explain it to me? Thanx.

jpgattuso commented 3 years ago

Hi, I note that Andrew Dickson replied to your question on the OA Information Exchange. Note that the at function was removed, hopefully temporarily, from seacarb. The reason is that bugs were found. Jean-Pierre

matthiasbirkich commented 3 years ago

Dear Jean-Pierre,

thank you for your fast response. In deed. Andrew answered. But I have still the problem to understand, why mol/kg-sol is somehow the same as mol/kg. In the Softwarepackage AquaEnf it is not the same. mol/kg-sol = Molinity and mol/kg = Molality. I am able to prepare the NaCl containing acid in mol/kg-sol, without calculation, but not in mol/kg. Therefor I need to use the density of the acid-NaCl-mixture. This algorithm is not implemented into most of the software packages,I am able to use. I am very bad in processing... When I want to refer to the CRM of the Scribbs, than it is in mol/kg - Andrew says mol/kg-sw is equal to mol/kg. Is that true for every Seawater? I am not the only one, who is not able to understand that circumstance clearly. Thank you very much.

best regards Matthias

------- Weitergeleitete Nachricht ------ Von: Jean-Pierre Gattuso @.> Datum: Mo. 26. Apr. 2021 um 06:42 Betreff: Re: [jpgattuso/seacarb-git] Issue with function at (#70) An: jpgattuso/seacarb-git @.> Cc: Matthias Birkicht @.>, Comment < @.>

Hi, I note that Andrew Dickson replied to your question on the OA Information Exchange. Note that the at function was removed, hopefully temporarily, from seacarb. The reason is that bugs were found. Jean-Pierre

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jpgattuso/seacarb-git/issues/70#issuecomment-826495726, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOH3QCFL5KJ2TTJVFGQ45DTTKTVKDANCNFSM4WEKQ7IQ . --

Matthias Birkicht Georg-Seebeck-Straße 47 27570 Bremerhaven mobile: 01609 48 68 28 7 phone: +49 471 306608 work: +49 421 23 800 34 skype: matthias.birkicht www.oberton.info