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

root/gliderproc/trunk/gliderCTD_GeneratePlots.m

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

Initial Seim revisions to Stark code.

Line 
1 %
2 %  gliderCTD_GeneratePlots.m
3 %
4 %  Purpose: Generate plots of glider CTD data
5 %
6 %  Author:  William Stark
7 %           Marine Sciences Department
8 %           UNC-Chapel Hill
9 %
10 %  Created: 18 June 2012
11 %
12 %//////////////////////////////////////////////////////////////////////////
13
14 function gliderCTD_GeneratePlots(gliderIndex, deploymentNumber, legNumber,...
15                                  plotFlag_TS, plotFlag_TS_AllLegs, plotFlag_TS_Chlorophyll,...
16                                  plotFlag_Temperature, plotFlag_Salinity, plotFlag_Density,...
17                                  plotFlag_Chlorophyll, plotFlag_TemperatureProfile,...
18                                  plotFlag_SalinityProfile, plotFlag_DensityProfile,...
19                                  plotFlag_ChlorophyllProfile, plotFlag_Temperature3D,...
20                                  plotFlag_Salinity3D, plotFlag_Density3D,...
21                                  plotFlag_Chlorophyll3D, plotFlag_AllGliderTracks)
22                              
23
24    
25     % add paths for required files...
26     addpath('MATLAB/util/');
27     addpath('MATLAB/matutil/');
28     addpath('MATLAB/seawater/');
29     addpath('MATLAB/plots/');
30     addpath('MATLAB/strfun/');
31     addpath('MATLAB/opnml/');
32     addpath('MATLAB/opnml/FEM/');
33    
34
35     % glider name string...
36     if (gliderIndex==1)
37         strGliderName = 'Pelagia';
38     else
39         strGliderName = 'Ramses';
40     end
41
42     % deployment number string...
43     strDeploymentNumber = num2str(deploymentNumber);
44
45     % leg number string...
46     strLegNumber = num2str(legNumber);
47
48     % mat file path string...
49     strMatFilePath = strcat('GLIDER_DATA_LEVEL1/', strGliderName, '_Deployment', strDeploymentNumber, '_DataL1.mat');
50
51    
52     % load glider sensor data from mat file...
53     load(strMatFilePath);
54
55    
56     % set the default bounding box lat/lon's for plots
57     lonlim = [-78.6 -77.8];  latlim = [32.7 33.3];
58
59
60     % set start/end date-time strings and other variables required for plots of the
61     % current glider/deployment/leg combination...
62     switch gliderIndex
63         case 1  % Pelagia
64             ztop = 0;  zbottom = -120;
65             switch deploymentNumber
66                 case 1  % Deployment 1 (Pelagia)
67                     % (row 1 is for complete deployment, row 2 is for Leg 1, etc...)
68                     strLegEndPoints = {'26-Jan-2012 01:57:14', '14-Feb-2012 17:10:38';...
69                                        '26-Jan-2012 01:57:14', '31-Jan-2012 12:00:00';...
70                                        '31-Jan-2012 12:00:01', '08-Feb-2012 12:00:00';...
71                                        '08-Feb-2012 12:00:01', '14-Feb-2012 17:10:38'};
72                     strLegStart = strLegEndPoints(legNumber+1, 1);
73                     strLegEnd = strLegEndPoints(legNumber+1, 2);
74                 case 2  % Deployment 2 (Pelagia)
75                     % (row 1 is for complete deployment, row 2 is for Leg 1, etc...)
76                     strLegEndPoints = {'16-Feb-2012 13:47:27', '08-Mar-2012 12:36:28';...
77                                        '16-Feb-2012 13:47:27', '18-Feb-2012 10:30:00';...
78                                        '18-Feb-2012 10:30:01', '20-Feb-2012 06:00:00';...
79                                        '20-Feb-2012 06:00:01', '25-Feb-2012 05:30:00';...
80                                        '25-Feb-2012 05:30:01', '29-Feb-2012 02:30:00';...
81                                        '29-Feb-2012 02:30:01', '08-Mar-2012 12:36:28'};
82                     strLegStart = strLegEndPoints(legNumber+1, 1);
83                     strLegEnd = strLegEndPoints(legNumber+1, 2);
84                 case 3  % Deployment 3 (Pelagia)
85                     % (row 1 is for complete deployment, row 2 is for Leg 1, etc...)
86                     strLegEndPoints = {'16-Mar-2012 12:58:45', '04-Apr-2012 10:36:01';...
87                                        '16-Mar-2012 12:58:45', '18-Mar-2012 21:40:00';...
88                                        '18-Mar-2012 21:40:01', '22-Mar-2012 17:30:00';...
89                                        '22-Mar-2012 17:30:01', '25-Mar-2012 14:00:00';...
90                                        '25-Mar-2012 14:00:01', '28-Mar-2012 22:00:00';...
91                                        '28-Mar-2012 22:00:01', '31-Mar-2012 19:00:00';...
92                                        '31-Mar-2012 19:00:01', '04-Apr-2012 10:36:01'};
93                     strLegStart = strLegEndPoints(legNumber+1, 1);
94                     strLegEnd = strLegEndPoints(legNumber+1, 2);
95             end
96         case 2  % Ramses
97             ztop = 0;  zbottom = -200;
98             switch deploymentNumber
99                 case 1  % Deployment 1 (Ramses)
100                     lonlim = [-78.3 -77.9];  latlim = [32.7 33.2];
101                    
102                     % (row 1 is for complete deployment, row 2 is for Leg 1, etc...)
103                     strLegEndPoints = {'26-Jan-2012 01:06:22', '14-Feb-2012 12:35:11';...
104                                        '26-Jan-2012 01:06:22', '28-Jan-2012 20:00:00';...
105                                        '28-Jan-2012 20:00:01', '30-Jan-2012 03:00:00';...
106                                        '30-Jan-2012 03:00:01', '31-Jan-2012 14:00:00';...
107                                        '31-Jan-2012 14:00:01', '07-Feb-2012 10:30:00';...
108                                        '07-Feb-2012 10:30:01', '14-Feb-2012 12:35:11'};
109                     strLegStart = strLegEndPoints(legNumber+1, 1);
110                     strLegEnd = strLegEndPoints(legNumber+1, 2);
111                 case 2  % Deployment 2 (Ramses)
112                     % (row 1 is for complete deployment, row 2 is for Leg 1, etc...)
113                     strLegEndPoints = {'16-Feb-2012 01:29:39', '12-Mar-2012 16:24:18';...
114                                        '16-Feb-2012 01:29:39', '28-Feb-2012 12:00:00';...
115                                        '28-Feb-2012 12:00:01', '04-Mar-2012 12:00:00';...
116                                        '04-Mar-2012 12:00:01', '07-Mar-2012 11:30:00';...
117                                        '07-Mar-2012 11:30:01', '12-Mar-2012 16:24:18'};
118                     strLegStart = strLegEndPoints(legNumber+1, 1);
119                     strLegEnd = strLegEndPoints(legNumber+1, 2);
120                 case 3  % Deployment 3 (Ramses)
121                     % (row 1 is for complete deployment, row 2 is for Leg 1, etc...)
122                     strLegEndPoints = {'16-Mar-2012 15:41:35', '03-Apr-2012 19:24:45';...
123                                        '16-Mar-2012 15:41:35', '22-Mar-2012 12:00:00';...
124                                        '22-Mar-2012 12:00:01', '27-Mar-2012 03:00:00';...
125                                        '27-Mar-2012 03:00:01', '29-Mar-2012 02:00:00';...
126                                        '29-Mar-2012 02:00:01', '03-Apr-2012 19:24:45'};
127                     strLegStart = strLegEndPoints(legNumber+1, 1);
128                     strLegEnd = strLegEndPoints(legNumber+1, 2);
129             end
130     end
131
132    
133     % use start/end SDNs and the ptime_datenum vector to find start/end indices...
134     for i = 1:length(strLegEndPoints)
135         if (i == 0)
136             nLegEndPoints(i,1) = 1;
137             nLegEndPoints(i,2) = length(ptime_datenum);
138         else
139             I = find(ptime_datenum >= datenum(strLegEndPoints(i,1)));
140             nLegEndPoints(i,1) = I(1);
141             I = find(ptime_datenum <= datenum(strLegEndPoints(i,2)));
142             nLegEndPoints(i,2) = I(end);
143         end
144     end
145
146    
147     % FOR PECS TS PLOTS
148     tempBounds =  [17.0 24.0];
149     salinBounds = [36.0 36.7];
150
151
152     % draw 2D plots...
153     gliderCTD_2DPlots(config, nLegEndPoints, strLegEndPoints,...
154                       strDeploymentNumber, strLegNumber, legNumber, ptime_datenum,...
155                       dens, densBounds, densCorrected, depth, pres,...
156                       salin, salinBounds, salinCorrected,...
157                       temp, tempBounds, chlor, chlorBounds,...
158                       plotFlag_TS, plotFlag_TS_AllLegs, plotFlag_TS_Chlorophyll,...
159                       plotFlag_Temperature, plotFlag_Salinity, plotFlag_Density,...
160                       plotFlag_Chlorophyll, plotFlag_TemperatureProfile,...
161                       plotFlag_SalinityProfile, plotFlag_DensityProfile,...
162                       plotFlag_ChlorophyllProfile);
163
164     % draw 3D plots...
165     gliderCTD_3DPlots(config, nLegEndPoints, strLegEndPoints,...
166                       strDeploymentNumber, strLegNumber, legNumber, lonlim, latlim,...
167                       ztop, zbottom, gpsLat, gpsLon, depth, pres,...
168                       salinCorrected, salinBounds, densCorrected, densBounds,...
169                       temp, tempBounds, chlor, chlorBounds,...
170                       plotFlag_Temperature3D, plotFlag_Salinity3D,...
171                       plotFlag_Density3D, plotFlag_Chlorophyll3D,...
172                       plotFlag_AllGliderTracks);
173
174
175 end
176                
Note: See TracBrowser for help on using the browser.