Skip to content

Commit 8c4016e

Browse files
committed
First version
1 parent e8c3558 commit 8c4016e

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

list_max_depths.m

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
function depths = list_max_depths(float_ids)
2+
% list_max_depths This function is part of the
3+
% MATLAB toolbox for accessing Argo float data.
4+
%
5+
% USAGE:
6+
% depths = list_max_depths(float_ids)
7+
%
8+
% DESCRIPTION:
9+
% This function lists the maximum depths reached by all profiles
10+
% and the deepest depth reached by one profile for each of the
11+
% selected floats. The values are also returned.
12+
%
13+
% INPUT:
14+
% float_ids : array with WMO IDs of the floats to be considered
15+
%
16+
% OUTPUT:
17+
% depths : Nx3 array (N: number of floats); the first column contains
18+
% the maximum depths reached by all profiles per float,
19+
% the second column contains the deepest depth reached by
20+
% a profile per float;
21+
% the third column contains the float IDs.
22+
%
23+
% AUTHORS:
24+
% H. Frenzel, J. Sharp, A. Fassbender (NOAA-PMEL), N. Buzby (UW)
25+
%
26+
% CITATION:
27+
% H. Frenzel, J. Sharp, A. Fassbender, N. Buzby, 2022. OneArgo-Mat:
28+
% A MATLAB toolbox for accessing and visualizing Argo data.
29+
% Zenodo. https://doi.org/10.5281/zenodo.6588041
30+
%
31+
% LICENSE: oneargo_mat_license.m
32+
%
33+
% DATE: JUNE 1, 2022 (Version 1.0.1)
34+
35+
if nargin < 1
36+
warning('Usage: list_max_depths(float_ids)')
37+
return
38+
end
39+
40+
Data = load_float_data(float_ids, 'PRES');
41+
floats = fieldnames(Data);
42+
nfloats = length(floats);
43+
if ~nfloats
44+
warning('no valid float numbers provided')
45+
end
46+
47+
depths = nan(nfloats, 3);
48+
49+
fprintf('%-9s %-12s %-12s%-6s\n', ' WMO ID', ' Max. depth', ...
50+
'Max. depth', 'Mode')
51+
fprintf('%s(overall) (all prof.) (pressure)\n', repelem(' ', 12));
52+
fprintf('%s\n', repelem('-', 48));
53+
for f = 1:nfloats
54+
this_float = strrep(char(floats{f}), 'F', '');
55+
depths(f, 3) = str2double(this_float);
56+
fprintf(' %-10s ', this_float);
57+
if isfield(Data.(floats{f}), 'PRES_ADJUSTED')
58+
mode = 'Adjusted';
59+
pres = Data.(floats{f}).PRES_ADJUSTED;
60+
else
61+
mode = 'Raw';
62+
pres = Data.(floats{f}).PRES;
63+
end
64+
max_prof = max(pres); % highest pressure for all profiles
65+
depths(f, 1) = max(max_prof);
66+
depths(f, 2) = min(max_prof);
67+
fprintf('%6.1f db ', max(max_prof));
68+
fprintf(' %6.1f db ', min(max_prof));
69+
fprintf(' %s\n', mode)
70+
end

0 commit comments

Comments
 (0)