NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/gliderCTD_2DPlots.m

Revision 495 (checked in by cbc, 11 years ago)

Initial import of Stark code.

Line 
1 %
2 %  gliderCTD_2DPlots.m
3 %
4 %  Purpose: Generate set of 2D plots of glider CTD data
5 %
6 %  Author:  William Stark
7 %           Marine Sciences Department
8 %           UNC-Chapel Hill
9 %
10 %  Created: 11 June 2012
11 %
12 %////////////////////////////////////////////////////////////////////////////////////
13
14 function gliderCTD_2DPlots(config, nLegEndPoints, strLegEndPoints,...
15                            strDeploymentNumber, strLegNumber, legNumber, ptime_datenum,...
16                            dens, densBounds, densCorrected, depth, pres,...
17                            salin, salinBounds, salinCorrected,...
18                            temp, tempBounds, chlor, chlorBounds,...
19                            plotFlag_TS, plotFlag_TS_AllLegs, plotFlag_TS_Chlorophyll,...
20                            plotFlag_Temperature, plotFlag_Salinity, plotFlag_Density,...
21                            plotFlag_Chlorophyll, plotFlag_TemperatureProfile,...
22                            plotFlag_SalinityProfile, plotFlag_DensityProfile,...
23                            plotFlag_ChlorophyllProfile)
24                        
25                        
26
27     % set glider and deployment strings for plot titles...
28     strGliderName = config.glider_name;
29     strDeployment = ['Deployment ', strDeploymentNumber];
30
31     % colored markers to distinguish legs...
32     coloredMarker = {'r.'; 'g.'; 'b.'; 'y.'; 'm.'; 'c.'};
33
34    
35                        
36     if (plotFlag_TS_AllLegs==1)
37         % TS plot for all legs (separate color for each leg)...
38         lastLeg = length(nLegEndPoints);
39         figure('Position', [500,500,1600,900]);
40         for i=2:lastLeg
41             % get start/end points strings and indices for this leg...
42             nLegStart = nLegEndPoints(i, 1);
43             nLegEnd = nLegEndPoints(i, 2);
44             strLegStart = char(strLegEndPoints(i, 1));
45             strLegEnd = char(strLegEndPoints(i, 2));
46
47             % select data corresponding to the passed-in leg endpoints...
48             temp_thisLeg = temp(nLegStart:nLegEnd);
49             salinCorrected_thisLeg = salinCorrected(nLegStart:nLegEnd);
50
51             % set marker color and plot TS for this leg...
52             strColoredMarker = char(coloredMarker(i-1));
53             plot(salinCorrected_thisLeg, temp_thisLeg, strColoredMarker, 'MarkerSize', 10);
54             hold on;
55         end
56         % scale the x-axis and y-axis...
57         ax = axis;
58         axis([salinBounds(1) salinBounds(2) tempBounds(1) tempBounds(2)]);
59         ylabel('Temperature (°C)', 'fontsize', 18);
60         xlabel('Salinity (psu)', 'fontsize', 18);
61 %         strLegend = [];
62 %         for i=2:lastLeg
63 %             if i==2
64 %                 strLegend = ['Leg ', i-1];
65 %             else
66 %                 strLegend = strcat(strLegend, [', Leg ', i-1]);
67 %         end
68 %         legend(strLegend);
69         title([strGliderName, '  -  All legs for ', strDeployment, '   '], 'fontsize', 20, 'fontweight', 'bold');
70         x = [ax(1):0.1:ax(2)];
71         y = [ax(3):0.3:ax(4)];
72         [X,Y] = meshgrid(x,y);
73         rho = sw_pden(X, Y, 0, 0);
74         [C, H] = contour(X, Y, rho, [1024:0.2:1028], 'k--');
75         clabel(C, H, 'FontSize', 16);
76     end
77    
78    
79    
80    
81     % get start/end points strings and indices for this leg...
82     nLegStart = nLegEndPoints(legNumber+1, 1);
83     nLegEnd = nLegEndPoints(legNumber+1, 2);
84     strLegStart = char(strLegEndPoints(legNumber+1, 1));
85     strLegEnd = char(strLegEndPoints(legNumber+1, 2));
86                        
87     % select data corresponding to the passed-in leg endpoints...
88     ptime_datenum = ptime_datenum(nLegStart:nLegEnd);
89     pres = pres(nLegStart:nLegEnd);
90     depth = depth(nLegStart:nLegEnd);
91     temp = temp(nLegStart:nLegEnd);
92     salin = salin(nLegStart:nLegEnd);
93     salinCorrected = salinCorrected(nLegStart:nLegEnd);
94     dens = dens(nLegStart:nLegEnd);
95     densCorrected = densCorrected(nLegStart:nLegEnd);
96     chlor = chlor(nLegStart:nLegEnd);
97    
98     % set leg strings for plot titles...
99     if (strcmp(strLegNumber, '0'))
100         strLeg = 'Complete';
101     else
102         strLeg = ['Leg ', strLegNumber, '   ( ', strLegStart, ' to ', strLegEnd, ' )'];
103     end
104
105    
106     if (plotFlag_TS==1)
107         % TS plot...
108         figure('Position', [500,500,1600,900]);
109         % set marker color and plot TS for this leg...
110         if legNumber==0
111             strColoredMarker = char(coloredMarker(1));
112         else
113             strColoredMarker = char(coloredMarker(legNumber));
114         end
115         plot(salinCorrected, temp, strColoredMarker, 'MarkerSize', 10);
116         hold on;
117         % scale the x-axis and y-axis...
118         ax = axis;
119         axis([salinBounds(1) salinBounds(2) tempBounds(1) tempBounds(2)]);
120         ylabel('Temperature (°C)', 'fontsize', 18);
121         xlabel('Salinity (psu)', 'fontsize', 18);
122 %         legend('Original', 'Corrected');
123         title([strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
124         x = [ax(1):0.1:ax(2)];
125         y = [ax(3):0.3:ax(4)];
126         [X,Y] = meshgrid(x,y);
127         rho = sw_pden(X, Y, 0, 0);
128         [C, H] = contour(X, Y, rho, [1024:0.2:1028], 'k--');
129         clabel(C, H, 'FontSize', 16);
130     end
131
132    
133     if (plotFlag_TS_Chlorophyll==1)   
134         % TS plot with color mapped to chlorophyll...
135         figure('Position', [500,500,1600,900]);
136         ccplot(salinCorrected, temp, chlor, chlorBounds, '.', 10);
137         hold on;
138         hc = colorbar;
139         set(hc, 'fontsize', 12);
140         % scale the x-axis and y-axis...
141         ax = axis;
142         axis([salinBounds(1) salinBounds(2) tempBounds(1) tempBounds(2)]);
143         ylabel('Temperature (°C)', 'fontsize', 18);
144         xlabel('Salinity (psu)', 'fontsize', 18);
145         title([strGliderName, ' , ', strDeployment, ' , ', strLeg, '  with CHLOROPHYLL (ug/l)  '], 'fontsize', 20, 'fontweight', 'bold');
146         x = [ax(1):0.1:ax(2)];
147         y = [ax(3):0.3:ax(4)];
148         [X,Y] = meshgrid(x,y);
149         rho = sw_pden(X, Y, 0, 0);
150         [C, H] = contour(X, Y, rho, [1024:0.2:1028], 'k--');
151         clabel(C, H, 'FontSize', 16);
152     end
153    
154     if (plotFlag_Temperature==1)
155         % temperature vs depth...
156         figure('Position', [500,500,1600,900]);
157         plot(temp, depth, 'b.');
158         grid on;
159         % scale the x-axis...
160         ax = axis;
161         axis([tempBounds(1) tempBounds(2) ax(3) ax(4)]);
162         set(gca, 'fontsize', 13, 'ydir', 'reverse');
163         ylabel('Depth (m)', 'fontsize', 18);
164         xlabel('Temperature (°C)', 'fontsize', 18);
165         title(['TEMPERATURE  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
166     end
167    
168     if (plotFlag_Salinity==1)
169         % corrected salinity vs depth...
170         figure('Position', [500,500,1600,900]);
171         plot(salinCorrected, depth, 'b.');
172         grid on;
173         % scale the x-axis...
174         ax = axis;
175         axis([salinBounds(1) salinBounds(2) ax(3) ax(4)]);
176         set(gca, 'fontsize', 13, 'ydir', 'reverse');
177         ylabel('Depth (m)', 'fontsize', 18);
178         xlabel('Salinity (psu)', 'fontsize', 18);
179         title(['SALINITY  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
180     end
181    
182     if (plotFlag_Density==1)
183         % corrected density vs depth...
184         figure('Position', [500,500,1600,900]);
185         plot(densCorrected, depth, 'b.');
186         grid on;
187         % scale the x-axis...
188         ax = axis;
189         axis([densBounds(1) densBounds(2) ax(3) ax(4)]);
190         set(gca, 'fontsize', 13, 'ydir', 'reverse');
191         ylabel('Depth (m)', 'fontsize', 18);
192         xlabel('Density (kg m-3)', 'fontsize', 18);
193         title(['DENSITY  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
194     end
195    
196     if (plotFlag_Chlorophyll==1)
197         % chlorophyll vs depth...
198         figure('Position', [500,500,1600,900]);
199         plot(chlor, depth, 'b.');
200         grid on;
201         % scale the x-axis...
202         ax = axis;
203         axis([chlorBounds(1) chlorBounds(2) ax(3) ax(4)]);
204         set(gca, 'fontsize', 13, 'ydir', 'reverse');
205         ylabel('Depth (m)', 'fontsize', 18);
206         xlabel('Chlorophyll (ug/l)', 'fontsize', 18);
207         title(['CHLOROPHYLL  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
208     end
209        
210     if (plotFlag_TemperatureProfile==1)
211         % temperature profile...
212         figure('Position', [500,500,1600,900]);
213         ccplot(ptime_datenum, depth, temp, tempBounds, '.', 10);
214         set(gca, 'fontsize', 12, 'ydir', 'reverse');
215         datetick('x', 6, 'keeplimits', 'keepticks');
216         hc = colorbar;
217         set(hc, 'fontsize', 12);
218         ylabel('Depth (m)', 'fontsize', 18);
219         xlabel('Temperature (°C)', 'fontsize', 18);
220         title(['TEMPERATURE  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
221     end
222
223     if (plotFlag_SalinityProfile==1)
224         % corrected salinity profile...
225         figure('Position', [500,500,1600,900]);
226         ccplot(ptime_datenum, depth, salinCorrected, salinBounds, '.', 10);
227         set(gca, 'fontsize', 12, 'ydir', 'reverse');
228         datetick('x', 6, 'keeplimits', 'keepticks');
229         hc = colorbar;
230         set(hc, 'fontsize', 12);
231         ylabel('Depth (m)', 'fontsize', 18);
232         xlabel('Salinity (psu)', 'fontsize', 18);
233         title(['SALINITY  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
234     end
235
236     if (plotFlag_DensityProfile==1)
237         % corrected density profile...
238         figure('Position', [500,500,1600,900]);
239         ccplot(ptime_datenum, depth, densCorrected, densBounds, '.', 10);
240         set(gca, 'fontsize', 12, 'ydir', 'reverse');
241         datetick('x', 6, 'keeplimits', 'keepticks');
242         hc = colorbar;
243         set(hc, 'fontsize', 12);
244         ylabel('Depth (m)', 'fontsize', 18);
245         xlabel('Density (kg m-3)', 'fontsize', 18);
246         title(['DENSITY  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
247     end
248
249     if (plotFlag_ChlorophyllProfile==1)
250         % chlorophyll profile...
251         figure('Position', [500,500,1600,900]);
252         ccplot(ptime_datenum, depth, chlor, chlorBounds, '.', 10);
253         set(gca, 'fontsize', 12, 'ydir', 'reverse');
254         datetick('x', 6, 'keeplimits', 'keepticks');
255         hc = colorbar;
256         set(hc, 'fontsize', 12);
257         ylabel('Depth (m)', 'fontsize', 18);
258         xlabel('Chlorophyll (ug/l)', 'fontsize', 18);
259         title(['CHLOROPHYLL  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
260     end
261        
262 end
Note: See TracBrowser for help on using the browser.