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

root/gliderproc/trunk/gliderCTD_2DPlots.m

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

Initial Calloway revisions to Seim revisions.

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