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

root/gliderproc/trunk/gliderCTD_2DPlots.m

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

Initial Seim revisions to 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         title([strGliderName, '  -  All legs for ', strDeployment, '   '], 'fontsize', 20, 'fontweight', 'bold');
62         x = [ax(1):0.1:ax(2)];
63         y = [ax(3):0.3:ax(4)];
64         [X,Y] = meshgrid(x,y);
65         rho = sw_pden(X, Y, 0, 0);
66         [C, H] = contour(X, Y, rho, [1024:0.2:1028], 'k--');
67         clabel(C, H, 'FontSize', 16);
68     end
69    
70    
71    
72    
73     % get start/end points strings and indices for this leg...
74     nLegStart = nLegEndPoints(legNumber+1, 1);
75     nLegEnd = nLegEndPoints(legNumber+1, 2);
76     strLegStart = char(strLegEndPoints(legNumber+1, 1));
77     strLegEnd = char(strLegEndPoints(legNumber+1, 2));
78                        
79     % select data corresponding to the passed-in leg endpoints...
80     ptime_datenum = ptime_datenum(nLegStart:nLegEnd);
81     pres = pres(nLegStart:nLegEnd);
82     depth = depth(nLegStart:nLegEnd);
83     temp = temp(nLegStart:nLegEnd);
84     salin = salin(nLegStart:nLegEnd);
85     salinCorrected = salinCorrected(nLegStart:nLegEnd);
86     dens = dens(nLegStart:nLegEnd);
87     densCorrected = densCorrected(nLegStart:nLegEnd);
88     chlor = chlor(nLegStart:nLegEnd);
89    
90     % set leg strings for plot titles...
91     if (strcmp(strLegNumber, '0'))
92         strLeg = 'Complete';
93     else
94         strLeg = ['Leg ', strLegNumber, '   ( ', strLegStart, ' to ', strLegEnd, ' )'];
95     end
96
97    
98     if (plotFlag_TS==1)
99         % TS plot...
100         figure('Position', [500,500,1600,900]);
101         % set marker color and plot TS for this leg...
102         if legNumber==0
103             strColoredMarker = char(coloredMarker(1));
104         else
105             strColoredMarker = char(coloredMarker(legNumber));
106         end
107         plot(salinCorrected, temp, strColoredMarker, 'MarkerSize', 10);
108         hold on;
109         % scale the x-axis and y-axis...
110         ax = axis;
111         axis([salinBounds(1) salinBounds(2) tempBounds(1) tempBounds(2)]);
112         ylabel('Temperature (°C)', 'fontsize', 18);
113         xlabel('Salinity (psu)', 'fontsize', 18);
114 %         legend('Original', 'Corrected');
115         title([strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
116         x = [ax(1):0.1:ax(2)];
117         y = [ax(3):0.3:ax(4)];
118         [X,Y] = meshgrid(x,y);
119         rho = sw_pden(X, Y, 0, 0);
120         [C, H] = contour(X, Y, rho, [1024:0.2:1028], 'k--');
121         clabel(C, H, 'FontSize', 16);
122     end
123
124    
125     if (plotFlag_TS_Chlorophyll==1)   
126         % TS plot with color mapped to chlorophyll...
127         figure('Position', [500,500,1600,900]);
128         ccplot(salinCorrected, temp, chlor, chlorBounds, '.', 10);
129         hold on;
130         hc = colorbar;
131         set(hc, 'fontsize', 12);
132         % scale the x-axis and y-axis...
133         ax = axis;
134         axis([salinBounds(1) salinBounds(2) tempBounds(1) tempBounds(2)]);
135         ylabel('Temperature (°C)', 'fontsize', 18);
136         xlabel('Salinity (psu)', 'fontsize', 18);
137         title([strGliderName, ' , ', strDeployment, ' , ', strLeg, '  with CHLOROPHYLL (ug/l)  '], 'fontsize', 20, 'fontweight', 'bold');
138         x = [ax(1):0.1:ax(2)];
139         y = [ax(3):0.3:ax(4)];
140         [X,Y] = meshgrid(x,y);
141         rho = sw_pden(X, Y, 0, 0);
142         [C, H] = contour(X, Y, rho, [1024:0.2:1028], 'k--');
143         clabel(C, H, 'FontSize', 16);
144     end
145    
146     if (plotFlag_Temperature==1)
147         % temperature vs depth...
148         figure('Position', [500,500,1600,900]);
149         plot(temp, depth, 'b.');
150         grid on;
151         % scale the x-axis...
152         ax = axis;
153         axis([tempBounds(1) tempBounds(2) ax(3) ax(4)]);
154         set(gca, 'fontsize', 13, 'ydir', 'reverse');
155         ylabel('Depth (m)', 'fontsize', 18);
156         xlabel('Temperature (°C)', 'fontsize', 18);
157         title(['TEMPERATURE  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
158     end
159    
160     if (plotFlag_Salinity==1)
161         % corrected salinity vs depth...
162         figure('Position', [500,500,1600,900]);
163         plot(salinCorrected, depth, 'b.');
164         grid on;
165         % scale the x-axis...
166         ax = axis;
167         axis([salinBounds(1) salinBounds(2) ax(3) ax(4)]);
168         set(gca, 'fontsize', 13, 'ydir', 'reverse');
169         ylabel('Depth (m)', 'fontsize', 18);
170         xlabel('Salinity (psu)', 'fontsize', 18);
171         title(['SALINITY  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
172     end
173    
174     if (plotFlag_Density==1)
175         % corrected density vs depth...
176         figure('Position', [500,500,1600,900]);
177         plot(densCorrected, depth, 'b.');
178         grid on;
179         % scale the x-axis...
180         ax = axis;
181         axis([densBounds(1) densBounds(2) ax(3) ax(4)]);
182         set(gca, 'fontsize', 13, 'ydir', 'reverse');
183         ylabel('Depth (m)', 'fontsize', 18);
184         xlabel('Density (kg m-3)', 'fontsize', 18);
185         title(['DENSITY  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
186     end
187    
188     if (plotFlag_Chlorophyll==1)
189         % chlorophyll vs depth...
190         figure('Position', [500,500,1600,900]);
191         plot(chlor, depth, 'b.');
192         grid on;
193         % scale the x-axis...
194         ax = axis;
195         axis([chlorBounds(1) chlorBounds(2) ax(3) ax(4)]);
196         set(gca, 'fontsize', 13, 'ydir', 'reverse');
197         ylabel('Depth (m)', 'fontsize', 18);
198         xlabel('Chlorophyll (ug/l)', 'fontsize', 18);
199         title(['CHLOROPHYLL  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
200     end
201        
202     if (plotFlag_TemperatureProfile==1)
203         % temperature profile...
204         figure('Position', [500,500,1600,900]);
205         ccplot(ptime_datenum, depth, temp, tempBounds, '.', 10);
206         set(gca, 'fontsize', 12, 'ydir', 'reverse');
207         datetick('x', 6, 'keeplimits', 'keepticks');
208         hc = colorbar;
209         set(hc, 'fontsize', 12);
210         ylabel('Depth (m)', 'fontsize', 18);
211         xlabel('Temperature (°C)', 'fontsize', 18);
212         title(['TEMPERATURE  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
213     end
214
215     if (plotFlag_SalinityProfile==1)
216         % corrected salinity profile...
217         figure('Position', [500,500,1600,900]);
218         ccplot(ptime_datenum, depth, salinCorrected, salinBounds, '.', 10);
219         set(gca, 'fontsize', 12, 'ydir', 'reverse');
220         datetick('x', 6, 'keeplimits', 'keepticks');
221         hc = colorbar;
222         set(hc, 'fontsize', 12);
223         ylabel('Depth (m)', 'fontsize', 18);
224         xlabel('Salinity (psu)', 'fontsize', 18);
225         title(['SALINITY  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
226     end
227
228     if (plotFlag_DensityProfile==1)
229         % corrected density profile...
230         figure('Position', [500,500,1600,900]);
231         ccplot(ptime_datenum, depth, densCorrected, densBounds, '.', 10);
232         set(gca, 'fontsize', 12, 'ydir', 'reverse');
233         datetick('x', 6, 'keeplimits', 'keepticks');
234         hc = colorbar;
235         set(hc, 'fontsize', 12);
236         ylabel('Depth (m)', 'fontsize', 18);
237         xlabel('Density (kg m-3)', 'fontsize', 18);
238         title(['DENSITY  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
239     end
240
241     if (plotFlag_ChlorophyllProfile==1)
242         % chlorophyll profile...
243         figure('Position', [500,500,1600,900]);
244         ccplot(ptime_datenum, depth, chlor, chlorBounds, '.', 10);
245         set(gca, 'fontsize', 12, 'ydir', 'reverse');
246         datetick('x', 6, 'keeplimits', 'keepticks');
247         hc = colorbar;
248         set(hc, 'fontsize', 12);
249         ylabel('Depth (m)', 'fontsize', 18);
250         xlabel('Chlorophyll (ug/l)', 'fontsize', 18);
251         title(['CHLOROPHYLL  -  ', strGliderName, ' , ', strDeployment, ' , ', strLeg, '  '], 'fontsize', 20, 'fontweight', 'bold');
252     end
253        
254 end
Note: See TracBrowser for help on using the browser.