Commit a83f0c7c authored by Jorn Bruggeman's avatar Jorn Bruggeman

compute delta13C of HCO3 from delta13C of DIC

parent eb4492a7
......@@ -19,6 +19,7 @@ df.requireColumn('pCO2')
df.requireColumn('Strain')
df.requireColumn('Mol_Corg_per_cell')
df.requireColumn('d13CDIC')
#df.exclude('Strain','CBR')
print '%i rows left after filtering out rows with missing data.' % (len(df.data),)
......@@ -33,6 +34,23 @@ Cpercell = df.grabColumn('Mol_Corg_per_cell')
d13CDICs = df.grabColumn('d13CDIC')
unique_strains = tuple(set(strains))
# Fractionation of different carbon species with respect to CO2 (g) from Zhang et al. (1995)
temp = 15.
eps_CO2_g = 0.0049*temp - 1.31
eps_HCO3_g = -0.114 *temp + 10.78
eps_CO3_g = -0.052 *temp + 7.22
# Convert to equilibrium fractionation factors
alpha_HCO3_CO2 = (eps_CO2_g/1000.+1)/(eps_HCO3_g/1000.+1)
alpha_HCO3_CO3 = (eps_CO3_g/1000.+1)/(eps_HCO3_g/1000.+1)
# Calculate fractionation of HCO3 using equilibrium fractionation factors and
co2_per_hco3 = 0.0045
co3_per_hco3 = 0.1158
R_DIC = d13CDICs/1000.+1. # 13C to 12C ratio in DIC, relative to PDB
R_HCO3 = R_DIC*(co2_per_hco3+1.+co3_per_hco3)/(alpha_HCO3_CO2*co2_per_hco3 + 1. + alpha_HCO3_CO3*co3_per_hco3)
d13C_HCO3s = 1000.*(R_HCO3-1.)
class Problem(optimize.OptimizationProblem):
def __init__(self,parameternames):
self.model = model.Model()
......@@ -54,8 +72,8 @@ class Problem(optimize.OptimizationProblem):
ssq_org = 0.
ssq_cal = 0.
for r,F_FIX,F_CAL,d13Corg,d13Ccal,pCO2,d13CDIC,FB_vu in zip(rs,F_FIXs,F_CALs,d13Corgs,d13Ccals,pCO2s,d13CDICs,FB_vus):
res = self.model.getBicarbonateFluxes(r,F_FIX,F_CAL,pCO2,d13CDIC,fixed_FB_vu=FB_vu)
for r,F_FIX,F_CAL,d13Corg,d13Ccal,pCO2,d13C_HCO3,FB_vu in zip(rs,F_FIXs,F_CALs,d13Corgs,d13Ccals,pCO2s,d13C_HCO3s,FB_vus):
res = self.model.getBicarbonateFluxes(r,F_FIX,F_CAL,pCO2,d13C_HCO3,fixed_FB_vu=FB_vu)
# If the parameter set was invalid, return maximum penalty (fitness = -infinity)
if res is None: return -numpy.Inf
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment