-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrmPatmRBR.m
47 lines (33 loc) · 1.34 KB
/
rmPatmRBR.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function out = rmPatmRBR(in,patm)
%
% usage: out = rmPatmRBR(in,patm)
%
%
% where
% in : structure of rbr data created by output from
% rbrExtractVals.m
%
% patm : Optional input argument specifying atmospheric
% pressure. Use 10.1325 dbar to specify the nominal
% atmospheric sea level pressure. If not supplied,
% then rmPatmRBR estimates atmospheric pressure as
% the median of all pressure measurements occuring
% when conductivity is less than 1 mS/cm. Note that
% using the near-zero conductivity to find in-air
% pressure will likely fail in fresh water. In this
% case you can either specify your own atmoshperic
% pressure or reduce the conductivity threshold.
%
% Mark Halverson, July 2016
out = in;
if nargin==1,
% find all the in-air values, defined as scans when C<1 mS/cm.
kk = in.Conductivity<1;
% atmospheric pressure is median of all the in-air pressure values
patm = nanmedian(in.Pressure(kk));
end
out.Pressure = out.Pressure - patm;
%% append processing log
nlog = length(in.processingLog);
out.processingLog(nlog+1) = {['Atmospheric pressure of ' num2str(patm,6) ...
' dbar removed from total pressure']};