International-Soil-Radiocarbon-Database / ISRaD

Repository for the development and release of ISRaD data and tools
https://international-soil-radiocarbon-database.github.io/ISRaD/
24 stars 15 forks source link

Typos in ISRaD.extra.Cstocks.R (?) #119

Closed olgavinduskova closed 5 years ago

olgavinduskova commented 5 years ago
  1. I think the conversion of lyr_bd_tot to lyr_bd_samp in line 15 is missing the division of lyr_coarse_tot by 100 to convert percent to fraction. Should be: database$layer[ix,"lyr_bd_samp"] <- database$layer[ix,"lyr_bd_tot"] - (database$layer[ix,"lyr_bd_tot"] * (database$layer[ix,"lyr_coarse_tot"] / 100)) or more concisely: database$layer[ix,"lyr_bd_samp"] <- database$layer[ix,"lyr_bd_tot"] * (1 - (database$layer[ix,"lyr_coarse_tot"] / 100))

  2. I think that in lines 25, 27 and 28, lyr_bd_tot should be replaced by lyr_bd_samp. In line 25, BD without coarse fragments should be used to back-calculate OC content from SOC stock. Correspondingly in lines 27 and 28, BD without coarse fragments should be used to calculate SOC stock from OC content. Correct version: line 25 database$layer[ix,"lyr_c_org"] <-database$layer[ix,"lyr_soc"]/database$layer[ix,"lyr_bd_samp"]/(database$layer[ix,"lyr_bot"]-database$layer[ix,"lyr_top"])*100 line 27 ix <- which(is.na(database$layer$lyr_soc) & !is.na(database$layer$lyr_bd_samp) & !is.na(database$layer$lyr_c_org)) line 28 database$layer[ix,"lyr_soc"] <- (database$layer[ix,"lyr_c_org"]/100)*database$layer[ix,"lyr_bd_samp"]*(database$layer[ix,"lyr_bot"]-database$layer[ix,"lyr_top"])

jb388 commented 5 years ago

Good call, Olga! Thanks for looking into this.

You are definitely right that lines 25-28 should use bd_samp, not bd_tot.

I'm actually not sure what I was trying to do with line 15---I don't think the math checks out there. Definitely would need to be divided by 100, but you can't calculate bd_samp from bd_tot and coarse_tot like that. In order to do the calculation I think we'd need to assume a rock density constant: e.g. 2.6 g cm^3. With this assumption we can set the volume to 100 cm^3, and bd_samp = (bd_tot100-(coarse_tot2.6))/(100-coarse_tot).

Originally I think what I did was to set bd_samp = bd_tot only for cases where coarse_tot = 0, but somehow that got changed into line 15...

Do you have an opinion about how to proceed? Should we use an assumed coarse_tot density constant, or just set bd_samp equal to bd_tot for cases where bd_samp is NA and coarse_tot = 0?

olgavinduskova commented 5 years ago

Hi Jeff, forgot to say - thanks to everyone for the awesome israd.extra functions, they have been super useful for me, already!! Actually, I think we don't need rock density here. The template info says that coarse_tot is "The mass percent of sample...", that implies, that by multiplying bd_tot by coarse_tot/100 you should get mass of coarse fraction per cm-3 and then be able to subtract this from bd_tot to get bd_samp.

I think the setting of variables in the template reflects the situation (most common in agricultural and weathered soils) when a layer contains only relatively small rocks (gravel) and people sample the gravel together with soil using bulk density rings, then dry and weigh the whole content of the ring (m_tot, to get bd_tot) and then sieve the soils to separate >2mm rocks and again weigh these (m_coarse), so then they express coarse_tot as m_coarse / m_tot * 100. From these numbers, people can decide whether they report bd_tot, or bd_samp (which can be calculated as bd_samp = (m_tot-m_coarse) / volume of ring).

The other situation typical for soils with rocks which are larger than bulk density rings so can't be sampled. People usually guesstimate the volume percent the rocks take up in the layer by looking at the profile (coarse_tot_volume) and take bulk density rings from in between these rocks (bd_inbetween). Then for calculating a <2mm soil mass of 100 cm3 bd_samp[100 cm3] = (100-coarse_tot_volume/100)*(bd_inbetween) (assuming here for simplicity that bulk density rings contain only <2mm soil). As a note, reporting measurements of this kind using the current template is probably a bit tricky (requires the user to use rock density to convert coarse_tot_volume to coarse_tot and convert bd_inbetween to bd_samp).

I think the situation you were thinking Jeff is a third one, in which we would have bd_tot (a mass of soil including rocks divided by its volume, as in case no. 1) but for some reason we would have coarse fraction expressed in volume percent. Also your calculation ((100-coarse_tot in denominator) implies you would be obtaining bd_inbetween, which reflects how "packed" soil is in between the rocks. This is definitely a valid and interesting variable, e.g. in terms of calculating porosity, water storage, root permeability, etc., but I wouldn't call it bd_samp, because you couldn't use it for calculating the SOC stocks the way the function does it now in line 28. I think that to obtain bd_samp in this third case, we would need (bd_tot100-(coarse_tot2.6))/(100). But I'm not sure how common this situation is.

As a side note, I would be really careful in assuming rock density of 2.6 g cm-3. In a recent study of mine we had 26 soils on sedimentary parent material where rock density ranged from 1.9 to 2.5 g cm-3 and averaged 2.2. And coming back to bd_inbetween, from soil carbon saturation perspective, looking at carbon densities in the <2mm soil in gC.cm-3 can be interesting but this requires bd_inbetween, when rocks are present. Calculating bd_inbetween from bd_sample and/or bd_tot and coarse_tot requires rock density. Maybe it would useful to add a "rock density" column in the future anyways?

I'd be grateful for opinions of others on this!

jb388 commented 5 years ago

Honestly I was thinking that the coarse_tot variable was coarse fragments expressed in terms of volumetric percent! I guess I had forgotten (I am more used to seeing the volumetric data reported). So if the coarse_tot data are percent by mass, then the formula works.

I agree that assuming a rock density of 2.6 in all cases is not good---and can lead to serious over or underestimates of SOC stocks. That's why I didn't put that in originally. So let's keep it that way. I agree that a rock density column could be useful, and although those data aren't reported too commonly, I don't see a reason not to include it.

If you are satisfied with your edits to the function I can implement them. Thanks again for chiming in on this.

olgavinduskova commented 5 years ago

Yep, you are right that you don't see rock density in papers that much although I think sometimes people measure/guesstimate it and use it to calculate other variables.

And yes, I agree with the edits above!

jb388 commented 5 years ago

typos fixed