GithubHelp home page GithubHelp logo

neonscience / neon-dissolved-gas Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 8.0 8.53 MB

Repository for a code package that calculates dissolved gas concentrations from air and equilibrated water data, from NEON's Dissolved gases in surface water (DP1.20097.001) data product.

License: GNU Affero General Public License v3.0

R 54.60% Python 45.40%

neon-dissolved-gas's People

Contributors

cklunch avatar jbeaulie avatar kcawley avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neon-dissolved-gas's Issues

Function documentation

def.calc.sdg is a beautiful function. Very concise and elegant. My only comment is that the equation is so elegant that it is difficult to unravel the underlying logic. Please consider providing a detailed description of the logic behind the function.

As an example/alternative, see def.calc.sdg.jb. Here I took the def.calc.sdg function and broke it down into a series of smaller calculations, along with a lot of text documenting the overall approach. The results from def.calc.sdg.jb are nearly identical to that of def.calc.sdg (see demo.R for details).

Please consider presenting def.calc.sdg in a format that is a bit more accessible to the reader. I suppose one alternative is to provide a detailed derivation of the function in the User's Manual, while leaving the function as is.

Provide function for calculating local barometric pressure

Ideally investigators will measure barometric pressure at the sampling site; however, it is not uncommon for investigators to pull this information from an online database (i.e. www.weatherunderground.com) for a local weather station. It is important that investigators realize that BP data from most online sources is corrected to sea level, whereas the dissolved gas calculations require a calculation of local BP. I think it would be helpful if we could provide a function to convert sea level corrected BP to local BP. I believe the function only requires altitude.

Function names

The functions have been given fairly long and non-intuitive names. Consider shortening.

Air concentrations in example data

The air concentrations contained in the example data file (sdgTestData.csv and sdgFormatted.Rda) are exceptionally high for CH4 and N2O (max of 9.1 and 1.43 for CH4 and N2O, respectively). As part of the EPA's 2017 National Lakes Assessment, I am analyzing air and dissolved gas samples from ~1400 lakes across the country. Thus far I have analyzed air samples from 100 lakes with the following results:

N2O: mean = 0.312 sd = 0.004
CO2: mean = 439.1 sd = 42.4
CH4: mean = 1.50 sd = 0.10

I suggest reviewing the data source used for the example data. Are the air concentrations correct and typical for the Neon program? If not, I suggest adopting a more typical data set.

def.format.sdg function

This function calls a function from the neonDataStackR package, which isn't available on CRAN. This package needs to be made available to user.

def.calc.sdg input names

Unless I am mistaken, the def.calc.sdg function insists that the dataframe names exactly match those referenced in the function (i.e., concentrationCO2Air). It would be nice if the user could map the function arguments to any column in their dataframe. For example, their column for the CO2 concentration in the source gas might be called “concentrationCO2Source”, in which case it would be convenient to call:

def.calc.sdg(inputFile, sourceCO2 = concentrationCO2Source, ….)

but this doesn’t work. Could we modify the function so that it still works seamlessly with the formatted NEON data, yet allows for flexibility in the names of the input data?

Calculate dissolved gas concentration in equilibrium with atmosphere

Investigators are frequently interested in the concentration of a dissolved gas when the water body is in equilibrium with the atmosphere. This information, combined with a measurement of the true dissolved gas concentration, allows for the calculation of excess gas, which is defined as the difference between the measured and equilibrium concentration. This parameter can be used for several purposes, including the calculation of emission rates if the air-water gas exchange rate is known.

Consider adding functions to calculate the equilibrium dissolved gas concentration at a given barometric pressure, water temperature, and atmospheric composition. Atmospheric composition data can be provided by the user (i.e., measured CO2 in air). If user provided data are not available, the function should default to the latest global average concentration. Barometric pressure should be corrected for water vapor pressure, which is assumed to be 100% humidity at the air-water interface and can be calculated as a function of barometric pressure and temperature.

It is important that this calculation be performed for the temperature of the water body, whereas the headspace equilibration temperature should be performed for the temperature of the headspace equilibrium. These two temperatures often differ and are frequently measured in the field.

Provide function to calculate partial pressure of dissolved gas

Dissolved gas concentration is often reported as a partial pressure (i.e. pCO2 = 1200 uatm). One advantage of this expression is that dissolved partial pressures that exceed the partial pressure of the same gas in the atmosphere indicate that the water body is supersaturated and is therefore a source of the gas to the atmosphere. This allows for rapid interpretation as to whether the water body is a source or sink for the gas in question.

Striegl et al (2001) is just one example of an aquatic biogeochemical study reporting partial pressure. Striegl et al. cites Plummer and Busenberg (1982) for the calculation of partial pressure. See full citation below.

Another source of information is page 23 of Colt 2012: "The partial pressure of a dissolved gas is commonly called gas tension and is expressed as mmHg. At equilibrium, the partial pressure of a gas in the gas phase is equal to the partial pressure of the same gas in the liquid phase. The gas tension is equal to the partial pressure in the gas phase that would be in equilibrium with the measured gas concentration."

Striegl, R. G., et al. (2001). "Carbon dioxide partial pressure and 13C content of north temperate and boreal lakes at spring ice melt." Limnology and Oceanography 46(4): 941-945.

Plummer, L. N. and E. Busenberg (1982). "The solubilities of calcite, aragonite and vaterite in CO2-H2O solutions between 0 and 90°C, and an evaluation of the aqueous model for the system CaCO3-CO2-H2O." Geochimica et Cosmochimica Acta 46(6): 1011-1040.

Colt, J. (2012). Dissolved gas concentration in water. Computation as functions of temperature, salinity and pressure. Amsterdam, Elsevier.

sdgFormatted missing variable 'headspaceTemp'

Hello! I am just getting started learning how to use the functions provided in this package to increase efficiency processing large quantities of GC data. Love this package!

I noticed that the sdgFormatted.rda, which I downloaded directly from Github, was missing the "headspaceTemp" variable column. This column appears to be a requirement for running the def.calc.sdg.conc() function. It was easy enough to append fake headspace temperatures for the sake of learning the package, but might be something helpful to include for future users.

Apologies if this is actually not a bug, and just a deficit in my own coding abilities. Thanks for writing such an amazingly well-documented and commented package!

Add O2, N2, and Ar

While CO2, CH4, and N2O are frequently the focus of GC-based dissolved gas measurements, investigators may also be interested in O2, N2, and Ar, which can be measured via GC-TCD. Consider adding functions for these gases.

There may also be interest in calculations for gases typically used in gas-exchange measurements, such as SF6 and propane. Consider providing functions for these gases.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.