Matlab Workup Script - nthallen/keutsch-hcho GitHub Wiki

Purpose

After downloading the data off of the virtual machine onto your Windows (or Mac) computer, the main workup script, HarvardFILIF_Workup.m, takes the raw counts and applies the necessary corrections to convert from counts to a HCHO mixing ratio. When running this script, the current Matlab directory should be in the folder containing the raw data files and config file (see below) that you wish to process.

The main workup script and its associated support files are located in eng/workup/. Adding this to your Matlab path is recommended.

Config File

The purpose of the config.ini file is to contain any settings and cal factors that are unique to each experimental run. This is extremely useful since we can use the config file to apply the cal factor associated with that run or specify other settings that are unique to that run without having to change the main workup script.

To create a new config.ini file, just copy a previously used one from another directory and change the run_date to the directory name whose raw data you wish to process. If the cal factor has changed, you also would change that variable to the correct value. Among other things, the config file is also useful for automatically tossing out data collected outside a certain pressure range or data collected with a laser power that was too low.

Output

Whenever the main workup script is run completely, it outputs a Matlab .mat file called FILIF_ProcessedHCHO.mat. This file contains the 10 Hz HCHO mixing ratios as well as an associated Matlab datetime object and posixtime. Additionally, the output file contains any flags (at 1 Hz resolution) that were set as data was collected. All of this data is saved in a Matlab structure called FILIF.

You can then load the FILIF_ProcessedHCHO.mat output into whatever other script you're using to analyze data from a particular field campaign or lab study.

Backwards Compatibility

It might become necessary to add additional functionality to the main workup script as the instrument continues to be worked on and upgraded.

Pro tip: Instead of creating multiple versions of HarvardFILIF_Workup.m (as it becomes hard to track which workup script version should be used with which data directory), you could add a new variable in the config.ini file (for example, new_functionality = 1). Then, in the main workup script, you can create an if statement that has Matlab check whether s.new_functionality exists. If it exists, then whatever code you wrote will run. If the variable doesn't exist (i.e., in all data sets collected prior to the change you made), then Matlab will skip over that part of the code. Check Matlab's help documentation for more information on the exist Matlab function.