Closed bomtuckle closed 1 year ago
@bomtuckle I've added a draft correction for the Middlemost Fe-correction based on TAS here but haven't tested it just yet. If you have a few minutes to look over it that'd be handy. I've added a note on the docs page too, as well as split the volcanic/non-volcanic samples there.
MWE for accessing the Middlemost correction, and using it in the CIPW Norm:
import pandas as pd
import pyrolite.geochem
from pyrolite.mineral.normative import CIPW_norm, Middlemost_Fe_correction
from pyrolite.util.meta import pyrolite_datafolder
df = (
pd.read_csv(pyrolite_datafolder() / "testing" / "CIPW_Verma_Test.csv")
.dropna(how="all", axis=1)
.pyrochem.parse_chem()
)
df.pyrochem.compositional = df.pyrochem.compositional.apply(
pd.to_numeric, errors="coerce"
).fillna(0)
df.loc[:, [c for c in df.columns if "NORM" in c]] = df.loc[
:, [c for c in df.columns if "NORM" in c]
].apply(pd.to_numeric, errors="coerce")
#%%
Middlemost_Fe_correction(df)
#%%
CIPW_norm(df, Fe_correction="Middle")
Thanks @morganjwilliams . I've had a quick look and seems fine to me, and it runs ok. I will try and do a comparison with the output of IgRoCs to confirm the pyrolite output.
@bomtuckle that'd be great! If things look OK after that, it'll be time for v0.3.2!
@morganjwilliams unfortunately I don't think it is working correctly. The adjusted Fe values are quite different from those out of igrocs. I think it actually looks like the FeO and Fe2O3 values are reversed, but not sure looking at your code at what point this has happened.
@bomtuckle I'll take a look today; if I got the ratios in the wrong order somewhere that'll do it.
Edit: I think I did indeed have the ratio around the wrong way when converting from Fe2O3/FeO
to Fe2O3/(Fe2O3+FeO)
. I've fixed this specifically and added a test to formally check the outputs of these are as expected (100cb1c44b0d5ff11262dde78fdcdc8d8d73555b).
@morganjwilliams looks better now! Compared to the igrocs output its broadly ok now, but there are still some discrepancies. I suspect this may be coming from a few differences in the TAS classification? I will try and investigate, but the igrocs is a bit confusing to understand
OK, good! If you spy some samples that are particularly bad let me know their compositions/TAS classification and I'll debug a bit. The TAS diagram in Middlemost's paper is slightly different to the one I'm using by default in pyrolite, but most things transfer over fine. The main complication is for a few low-SiO2 fields which have additional boundaries, some fields in the TAS diagram which are split (e.g. Ba/Bs instead of the single Basalt field; these are easily dealt with using two entries with the same value), but Middlemost does point to additional fields below 41% SiO2 which don't line up well (the upper one is within Foidite, the lower one is ~picrobasalt but less SiO2).
Is your feature request related to a problem? Please describe. The normative calculation currently implements the Le Maitre method of calculating Fe oxidation ratios. Another method is the by classification of the sample on a TAS diagram and then using a set of standard ratios per classification.
Describe the solution you'd like Add in a function within the current normative function, that implements this method of determining Fe oxidation ratio
Relevant References Middlemost 1989