From c9a3fdbca3dc92f9aa2300502e1f4a1eda2f9bd0 Mon Sep 17 00:00:00 2001 From: Giovanni Galli Date: Thu, 12 Jun 2025 10:54:00 +0200 Subject: [PATCH 1/2] =?UTF-8?q?new=20formulation=20for=20BGC=5FArgo=20bbp7?= =?UTF-8?q?00=20to=20POC=20conversion,=20after=20Gal=C3=AC=20et=20al.=2020?= =?UTF-8?q?22?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bitsea/instruments/superfloat.py | 41 +++++++++++++++---- src/bitsea/validation/deliverables/metrics.py | 12 +++--- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/src/bitsea/instruments/superfloat.py b/src/bitsea/instruments/superfloat.py index 3033979a..97cb5504 100644 --- a/src/bitsea/instruments/superfloat.py +++ b/src/bitsea/instruments/superfloat.py @@ -7,6 +7,7 @@ from bitsea.instruments.instrument import Instrument, Profile from scipy.optimize import curve_fit from bitsea.instruments.var_conversions import FLOATVARS as conversion +from bitsea.validation.deliverables.metrics import MLD mydtype= np.dtype([ ('file_name','S200'), @@ -138,15 +139,39 @@ def read(self,var,var_mod=None): ii=Profile<=0 Profile[ii] = 0.0 + #if (var_mod == "POC"): + # POC = Profile * 52779.37 - 3.57 # Bellacicco 2019 + # if ii.sum() > 0 : + # shift=POC[ii].mean() + # print( "POC: adding a shift of " + str(shift)) + # Profile = POC - shift + # ii=Profile<=0 + # Profile[ii] = 0.0 if (var_mod == "POC"): - POC = Profile * 52779.37 - 3.57 # Bellacicco 2019 - if ii.sum() > 0 : - shift=POC[ii].mean() - print( "POC: adding a shift of " + str(shift)) - Profile = POC - shift - ii=Profile<=0 - Profile[ii] = 0.0 - + # POC/bbp700 ratio after Gali' et al. 2022 + Pres_PSAL, PSAL, Qc_PSAL = self.read_raw('PSAL') + Pres_TEMP, TEMP, Qc_TEMP = self.read_raw('TEMP') + z_mld = MLD(TEMP, PSAL, Pres_TEMP, insitu_T=True)[0] + # Interpolate TEMP @ Z = Pres, because Pres and Pres_TEMP are different + TEMP = np.interp(Pres, Pres_TEMP, TEMP) #piecewise linear interpolation + PSAL = np.interp(Pres, Pres_PSAL, PSAL) #piecewise linear interpolation + # Gali et al. 2022 parameters + #c = 1000.0 # [mmol_C m^-2] best value globally + c = 500.0 # [mmol_C m^-2] best fit in subtropical biomes + c = c * 12.011 # [mg_C m^-2] + b = 6.57 # [m^-1] + a = 41305.0 # [mg_C m^-2] + z_surf_Med = 14.0 # [m] + # + Z_term = np.maximum(0.0, Pres - z_surf_Med) + PB_ratio = c + a * np.exp(-0.001 * b * Z_term) + # + z_ref = np.max([z_surf_Med, z_mld]) + z_term_i = np.max([0.0, z_ref - z_surf_Med]) + PB_zref = c + a * np.exp(-0.001 * b * z_term_i) + PB_ratio[Pres<=z_ref] = PB_zref + # POC / bbp700 ratio + Profile = Profile * PB_ratio return Pres, Profile, Qc diff --git a/src/bitsea/validation/deliverables/metrics.py b/src/bitsea/validation/deliverables/metrics.py index 7393d63e..4c518115 100644 --- a/src/bitsea/validation/deliverables/metrics.py +++ b/src/bitsea/validation/deliverables/metrics.py @@ -30,7 +30,7 @@ def find_DCM(Chl_profile, zlev): return CM, DCM -def MLD(Temperature, Salinity, Pres): +def MLD(Temperature, Salinity, Pres, insitu_T=False): """Calculation of Mixed Layer Depth based on temperature difference of 0.2 mld is defined as the level where the difference of temperature with respect the reference level of 10m is of 0.2C @@ -41,15 +41,17 @@ def MLD(Temperature, Salinity, Pres): i_10 = ( i_less_than_10[-1] + 1 ) # (this is the index corresponding approx ~10m of the zlevel array) - i_10 = ( - i_less_than_10[-1] + 1 - ) # (this is the index corresponding approx ~10m of the zlevel array) + # NO IT IS NOT! THIS IS: + #i_10 = np.abs(Pres - th).argmin() T = Temperature S = Salinity + # if T is in-situ (e.g. float data) convert to potential temperature + if insitu_T: + T = sw.ptmp(S, T, Pres) D1000 = Pres[ (Pres < 1000) & (Pres > th) ] # CONSIDER VALUES the reference level at 10m (de Boyer-Montegut 2004) - T1000 = T[(Pres < 1000) & (Pres > th)] + bitsea/validation/deliverablesT1000 = T[(Pres < 1000) & (Pres > th)] S1000 = S[(Pres < 1000) & (Pres > th)] Dens1000 = sw.dens(S1000, T1000, D1000) - 1000 # DENSITY # SIGMA PDens1000 = ( From fcf8299a9f061ab7eda1c73795cc6f20e20dfee8 Mon Sep 17 00:00:00 2001 From: Giovanni Galli Date: Thu, 12 Jun 2025 12:05:57 +0200 Subject: [PATCH 2/2] typo in metrics.py --- src/bitsea/validation/deliverables/metrics.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/bitsea/validation/deliverables/metrics.py b/src/bitsea/validation/deliverables/metrics.py index 4c518115..b8317432 100644 --- a/src/bitsea/validation/deliverables/metrics.py +++ b/src/bitsea/validation/deliverables/metrics.py @@ -37,12 +37,7 @@ def MLD(Temperature, Salinity, Pres, insitu_T=False): It resurns also DENSITY (SIGMA) and POTENTIAL DENSITY (SIGMA THETA) """ th = 10 # threshold of depth minimum - i_less_than_10 = Pres < th - i_10 = ( - i_less_than_10[-1] + 1 - ) # (this is the index corresponding approx ~10m of the zlevel array) - # NO IT IS NOT! THIS IS: - #i_10 = np.abs(Pres - th).argmin() + i_10 = np.abs(Pres - th).argmin() T = Temperature S = Salinity # if T is in-situ (e.g. float data) convert to potential temperature @@ -51,7 +46,7 @@ def MLD(Temperature, Salinity, Pres, insitu_T=False): D1000 = Pres[ (Pres < 1000) & (Pres > th) ] # CONSIDER VALUES the reference level at 10m (de Boyer-Montegut 2004) - bitsea/validation/deliverablesT1000 = T[(Pres < 1000) & (Pres > th)] + T1000 = T[(Pres < 1000) & (Pres > th)] S1000 = S[(Pres < 1000) & (Pres > th)] Dens1000 = sw.dens(S1000, T1000, D1000) - 1000 # DENSITY # SIGMA PDens1000 = (