This repository has been archived by the owner on Jun 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CheckManager.m
132 lines (113 loc) · 3.96 KB
/
CheckManager.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
%% CheckManager - SCRIPT which inputs SeaBASS data files and plots them
% for visual inspection
%
%
% Requires: the .mat file saved in ProcessingManager, if not in memory
% the .mat file saved in PreProcessingManager, if not in memory
% SeaBASS text data files
%
% Outputs: Plots for ap_rottgers, ap_slade, cp
%
% Other m-files required: importSeaBASS2
% Subfunctions: checkTimestamps
% MAT-files required: "acsPROC_(YEAR)_(DAY)" saved by ProcessingManager,
% "acsPREPROC_(YEAR)_(DAY)" saved by PreProcessingManager
%
% See also: ProcessedData, importSeaBASS2
%
% Author: Wendy Neary
% MISCLab, University of Maine
% email address: wendy.neary@maine.edu
% Website: http://misclab.umeoce.maine.edu/index.php
% Jan 2016; Last revision: 25-Apr-16
% 25-Apr-16: Added new file format that includes std and bin_count in
% SeaBASS file formats
%
%----------------------------- BEGIN CODE ---------------------------------
%%Load data file from disk
if params.RUN.LOAD_CHECK_DATA_FROM_DISK
matFileName = fullfile(params.INGEST.DATA_OUTPUT_DIRECTORY, ...
strcat('acsPROC', '_', num2str(params.INGEST.YEAR), '_', num2str(params.INGEST.YEAR_DAY)));
load(matFileName);
matFileName = fullfile(params.INGEST.DATA_OUTPUT_DIRECTORY, ...
strcat('acsPREPROC', '_', num2str(params.INGEST.YEAR), '_', num2str(params.INGEST.YEAR_DAY)));
load(matFileName);
end;
%get wavelengths
wavelengths = pd.var.ap.L7.wavelengths_slade;
sb_fname_ascii = [params.OUTPUT.SEABASS_FILE_PREFIX ...
num2str(params.INGEST.YEAR) '_' num2str(params.INGEST.YEAR_DAY)];
dataFiles = {'ap', 'cp'};
fileText = {'ap - corrected using Slade', 'cp'};
wlPrefix = {'ap', 'cp'};
%%
for iData = 1:length(dataFiles)
thisFileName = dataFiles{iData}; %;
thisPrefix = wlPrefix{iData}; %;
extension = strcat(thisFileName, '.txt');
seabassFileName = fullfile(params.INGEST.DATA_OUTPUT_DIRECTORY, ...
strcat(sb_fname_ascii, extension));
datamatrix = importSeaBASS3(seabassFileName);
date = datamatrix(:,1);
time = datamatrix(:,2);
lat = datamatrix(:,3);
lon = datamatrix(:,4);
Wt = datamatrix(:,5);
sal = datamatrix(:,6);
numWavelengths = length(wavelengths);
endColumn = 7 + numWavelengths - 1;
numericCells = datamatrix(:,7:endColumn);
% thisdata = cell2mat(numericCells);
% changed 4/25/16
thisdata=cellfun(@str2num,numericCells);
index = (thisdata(:,:) == -9999);
thisdata(index) = NaN;
timestamp = datenum(strcat(date,time),'yyyymmddHH:MM:SS');
fignum = iData+50;
titleText = fileText{iData};
figure(fignum)
hold on;
grid on;
plot(wavelengths, thisdata)
xlabel('Wavelength')
ylabel(thisFileName)
title_text = sprintf('SeaBASS data\n %s vs. Wavelength\n Cruise: %s Leg: %s \n%u-%s-%u (Yearday: %u)', ...
titleText, params.INGEST.CRUISE, params.INGEST.CRUISE_LEG, params.INGEST.DAY, ...
params.INGEST.MONTH_TEXT, params.INGEST.YEAR, params.INGEST.YEAR_DAY);
title(title_text, 'fontsize', 12);
saveas(gcf, fullfile(params.INGEST.DATA_OUTPUT_DIRECTORY, ...
strcat(num2str(params.INGEST.YEAR), '_', num2str(params.INGEST.YEAR_DAY), ...
'_CHECK_', thisFileName)));
saveas(gcf, fullfile(params.INGEST.DATA_OUTPUT_DIRECTORY, ...
strcat(num2str(params.INGEST.YEAR), '_', num2str(params.INGEST.YEAR_DAY), ...
'_CHECK_', thisFileName, '.jpg')));
end;
%%
if params.INGEST.CLEAR_VARS
clear dataFiles;
clear datamatrix;
clear date;
clear endColumn;
clear extension;
clear fignum;
clear fileText;
clear iData;
clear index;
clear lat;
clear lon;
clear numericCells;
clear numWavelengths;
clear sal;
clear sb_fname_ascii;
clear seabassFileName;
clear thisdata;
clear thisFileName;
clear thisPrefix;
clear time;
clear timestamp;
clear title_text;
clear titleText;
clear wavelengths;
clear wlPrefix;
clear Wt;
end;