# README #

* Hosted location
https://bitbucket.org/em27gi/egi

NOTE: This location changed 15-Nov-2017. EGI is now fully public. Please update your
.hg/hgrc file if necessary.

### What is EGI? ###

* Quick summary:
The EM27/SUN GGG interferogram processing suite is a collection of open-source scripts designed to simplify 
processing of the raw interferograms collected using commercial EM27/SUN instruments through GGG. It can 
take 7 different steps to run GGG. With EGI, it takes just one line. All of the subroutines 
(e.g., coordinating meteorological data with the interferograms, running I2S, creating runlogs,
obtaining .mod files, running GFIT, and running post-processing) are done for you. In addition,
EGI includes a few quality checks along the way to prevent further processing if there are errors 
such as missing files. It also is designed to better optimize running things on parallel.

The end products are GGG outputs i.e., column abundances of various atmospheric gases.

* Who uses this?
This software primarily designed for other EM27/SUN operators. These operators are usually
atmospheric scientists who are involved in ground-based remote-sensing of various atmospheric
trace gases (e.g., CO2, CH4, H2O, CO, N2O).

This software could probably be adapted for other instruments (e.g. 125HR spectrometers)
but currently there has not been a need...

* What is an EM27/SUN?
EM27/SUN instruments are solar viewing spectrometers, made and sold by Bruker. 
(https://www.bruker.com/products/infrared-near-infrared-and-raman-spectroscopy/remote-sensing/em27sun/learn-more.html)

References:

 Gisi, M., Hase, F., Dohe, S., Blumenstock, T., Simon, A., and Keens, A.: XCO2-measurements with a tabletop FTS 
 using solar absorption spectroscopy, Atmos. Meas. Tech., 5, 2969-2980, https://doi.org/10.5194/amt-5-2969-2012, 2012. 

 Hedelius, J. K., Viatte, C., Wunch, D., Roehl, C. M., Toon, G. C., Chen, J., Jones, T., Wofsy, S. C., Franklin, J. E., 
 Parker, H., Dubey, M. K., and Wennberg, P. O.: Assessment of errors and biases in retrievals of XCO2, XCH4, XCO, and 
 XN2O from a 0.5 cm–1 resolution solar-viewing spectrometer, Atmos. Meas. Tech., 9, 3527-3546, 
 https://doi.org/10.5194/amt-9-3527-2016, 2016. 

* What is GGG?
GGG is a collection of software for FFTs on interferograms to spectra, and then fitting the spectra to obtain
column abundances of various gases. GGG is open-source and is used by the TCCON.

Reference:

 Wunch, D., G. C. Toon, V. Sherlock, N. M. Deutscher, X. Liu, D. G. Feist, and P. O. Wennberg. The Total
 Carbon Column Observing Network's GGG2014 Data Version. doi:10.14291/tccon.ggg2014.documentation.R0/1221662, 2015.

* Version
Major versions correspond with GGG releases (e.g., GGG2014).


### How do I get set up? ###

Please see the online wiki for a more complete description
https://bitbucket.org/em27gi/egi

GGGPATH, gggpath, and i2spath need to be set in your source file (e.g., ~/.bash. ~/.bashrc, or ~/.cshrc).

GGG needs to be downloaded and compiled prior to running EGI. See the TCCON wiki for instructions
https://tccon-wiki.caltech.edu/Software/GGG/Download/GGG_2012_Release_Notes#.22Clone.22_method
I2S also needs to be compiled.

Until the release of GGG201X (2018) also known as "GGG NEXT" you will likely need a developmental version
of I2S cloned, and compiled that works with EM27s. This is different from the native version included with GGG.
See instructions in the wiki.

The repository can be cloned with:
> hg clone https://bitbucket.org/em27gi/egi

For python use open sub_scripts/univ_vars and set line ~33 to:
> matlaborpython=1 #0 = matlab, 1=python
(Python will probably be default in the future).

I highly recommend you run the setup_test first time through
> ./setup_test
Follow the prompts.

To setup EGI to work with your particular instrument & file structure you will need to create
a file_loc.lst. See the wiki page for more information.

### Issues ###

To report issues, bugs, or request features please contact Jacob directly,
or submit as issues through bitbucket.


### Licenses ###

As far as possible EGI is released under a Creative Commons Attribution-ShareAlike
([CC BY-SA](https://creativecommons.org/licenses/)) license, but falls under any additional licenses required by the 
California Institute of Technology or other locations where financial support was 
received while developing it. Please make yourself aware of actions performed by 
viewing the source code before executing scripts.

The initial versions of EGI were developed while Jacob was employed as a graduate 
student at the California Institute of Technology. Financial support is acknowledged. 



