Ruby code for finding greenhouse-gas fluxes given a dataset of millivolt values.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Dependencies: linefit-0.0.1.gem,  peak_finder-1.0.1.gem,  peak_integration-1.0.0.gem, pg, dbi, dbd-pg

peak_main.rb: Finds peaks in peak simple files generated from a chromatograph (N20 and CH4)

   Note: Negative mV values are ignored by peak finder

   A ruby program that accepts two options: 

   1) Database processing: 

	Four command line arguments; <db name> <db username> <db password> <Pos.tolerance size>

	(default tolerance is 100 mV) 4th argument is optional

	This program finds the peaks within each injection period (for both n2o and ch4) for unprocessed runs 

	(Limit 50). Next it calculates their areas. 

	Finally, it updates the injections table with the area and its peak_start and peak_end times.  

   2) Manual Peak-Simple file processing:

	Two command line arguments; <peak simple filename> <Pos.tolerance size> 

	(default tolerance is 100 mV) 2nd argument is optional

	If the file is valid it uses the peak_finder gem to find the peaks, extracts the start/end times, and extracts the volt measures

	that are used by the peak_integration gem to find the area of the peaks discovered. 

	The main class then outputs a comma seperated text file with the Start, End, and Area in a file named millivolt.txt

	This program can process Peak Simple files with or without timestamps included as columns.

sample_concentration.rb: This program calculates the sample concentration for a Run.

   Two command line arguments; <db name> <db username> <db password> 

	This program calculates the sample concentrations for n2o, ch4, and co2 gases for all runs that have

	the areas calculated. (Limit 500)

	It then updates the injections table with those values.

	Note: if no area is contained for an injection in a run, it is skipped over and no ppm is entered for that injection.

flux.rb: This program calculates the Flux (ppm/minute) of a gas in a given chamber over time.

   Three command line arguments; <db name> <db username> <db password>

	The flux calculations are made and the data is entered into the incubations datatable.

Nate DiPiazza