function conc = ghobsconv(counts, SN) % GHOBSCONV- Convert Grays Harbor 2001 OBS data from Counts to g/L % using calibration equations specific to each OBS. % This includes the datalogger specific counts to volts conversion. % % Input: counts - OBS data in counts % SN - Serial number of the OBS which collected the data % - must be a S/N used in the Grays Harbor 2001 experiment % % Returns conc = -999 for invalid serial numbers % Returns a value of zero for all negative concentrations % % Laura Landerman, USGS % December 30, 2002 % Load calibration equations - units for columns are: S/N counts/V counts v/(g/L) volts EQ = [795 12820 88.553 0.36822 0.04487; % ND 796 12820 88.553 0.36822 0.04487; % ND 1242 12819 14.257 0.33966 0.01337; % MD 1135 12819 14.257 0.36354 0.03607; % MD 928 12824 25.898 0.34059 0.06665; % MS 1104 12824 25.898 0.35955 0.05486; % MS 829 12796 40.452 0.34196 0.02640; % 231 - MIA 1 830 12796 40.452 0.34646 0.03119; % 231 - MIA 2 924 12834 130.95 0.24210 0.07163; % 244 - MIA 1 925 12834 130.95 0.24210 0.07163; % 244 - MIA 2 694 12818 8.4416 0.33370 0.05367; % H40 - MIA 794 12818 8.4416 0.34618 0.03274; % H40 - MIA 1244 12827 30.806 0.28366 0.07790; % MIB 1429 12827 30.806 0.28366 0.07790; % MIB 1243 12830 29.489 0.31320 0.03009; % SD 1428 12830 29.489 0.32184 0.03978]; % SD [i,j] = find(EQ(:,1)== SN); % Find which row contains the necessary calibration if isempty(i) conc = -999; % Return value of -999 if Serial Number can not be found else volts = (counts - EQ(i,3))./EQ(i,2); % Convert from counts to volts conc = (volts - EQ(i,5))./EQ(i,4); % Convert from volts to g/L end conc(find(conc<0))=0; % Replace negative value with zero