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

root/proc2plot/trunk/proc2plot/scratch/test_crow_wq_plot.py

Revision 329 (checked in by haines, 14 years ago)

import first verison proc2plot

  • Property svn:executable set to
Line 
1 #!/usr/bin/env /opt/env/haines/dataproc/bin/python
2 # Last modified:  Time-stamp: <2009-09-16 17:27:43 haines>
3 """crow_wq_plot"""
4
5 import os, sys, glob, re
6 import datetime, time, dateutil, dateutil.tz
7 import pycdf
8 import numpy
9
10 sys.path.append('/opt/env/haines/dataproc/raw2proc')
11 del(sys)
12
13 os.environ["MPLCONFIGDIR"]="/home/haines/.matplotlib/"
14
15 from pylab import figure, twinx, savefig, setp, getp, cm, colorbar
16 from matplotlib.dates import DayLocator, HourLocator, MinuteLocator, DateFormatter, date2num, num2date
17 import procutil
18
19 print 'crow_wq_plot ...'
20
21 data_dir = '/seacoos/data/nccoos/level1'
22 platform = 'crow'
23 package = 'wq'
24 # yyyy_mm = None
25 # can be a past month
26 yyyy_mm = '2009_08'
27
28 if not yyyy_mm:
29     yyyy_mm = procutil.this_month()
30     plot_latest = True
31 else:
32     plot_latest = False
33    
34 prev_month, this_month, next_month = procutil.find_months(yyyy_mm)
35
36 package1 = package
37 #ncFile1='/seacoos/data/nccoos/level1/meet/wq/meet_wq_2009_08.nc'
38 #ncFile2='/seacoos/data/nccoos/level1/meet/wq/meet_wq_2008_09.nc'
39 ncFile1 = os.path.join(data_dir, platform, package1, platform+'_'+package1+'_'+prev_month.strftime('%Y_%m')+'.nc')
40 ncFile2 = os.path.join(data_dir, platform, package1, platform+'_'+package1+'_'+this_month.strftime('%Y_%m')+'.nc')
41
42 # load wq data
43
44 have_ncFile1 = os.path.exists(ncFile1)
45 have_ncFile2 = os.path.exists(ncFile2)
46
47 print ' ... loading data for graph from ...'
48 print ' ... ... ' + ncFile1 + ' ... ' + str(have_ncFile1)
49 print ' ... ... ' + ncFile2 + ' ... ' + str(have_ncFile2)
50
51 if have_ncFile1 and have_ncFile2:
52     nc = pycdf.CDFMF((ncFile1, ncFile2))
53 elif not have_ncFile1 and have_ncFile2:
54     nc = pycdf.CDFMF((ncFile2,))
55 elif have_ncFile1 and not have_ncFile2:
56     nc = pycdf.CDFMF((ncFile1,))
57 else:
58     print ' ... both files do not exist -- NO DATA LOADED'
59     print ' ... NO PLOTS CREATED'
60     exit()
61
62 # get variable names
63 ncvars = nc.variables()
64 # print ncvars
65 es = nc.var('time')[:]
66 units = nc.var('time').units
67 dt = [procutil.es2dt(e) for e in es]
68 # set timezone info to UTC (since data from level1 should be in UTC!!)
69 dt = [e.replace(tzinfo=dateutil.tz.tzutc()) for e in dt]
70 # return new datetime based on computer local
71 dt_local = [e.astimezone(dateutil.tz.tzlocal()) for e in dt]
72 dn = date2num(dt)
73
74 z = nc.var('z')[:]
75 wtemp = nc.var('wtemp')[:]
76 cond = nc.var('cond')[:]
77 turb = nc.var('turb')[:]
78 ph = nc.var('ph')[:]
79 do_mg = nc.var('do_mg')[:]
80 do_sat = nc.var('do_sat')[:]
81 batt = nc.var('battvolts')[:]
82 nc.close()
83
84 package2 = 'flow'
85 ncFile1 = os.path.join(data_dir, platform, package2, platform+'_'+package2+'_'+prev_month.strftime('%Y_%m')+'.nc')
86 ncFile2 = os.path.join(data_dir, platform, package2, platform+'_'+package2+'_'+this_month.strftime('%Y_%m')+'.nc')
87
88 # load flow data
89
90 have_ncFile1 = os.path.exists(ncFile1)
91 have_ncFile2 = os.path.exists(ncFile2)
92
93 print ' ... loading data for graph from ...'
94 print ' ... ... ' + ncFile1 + ' ... ' + str(have_ncFile1)
95 print ' ... ... ' + ncFile2 + ' ... ' + str(have_ncFile2)
96
97 if have_ncFile1 and have_ncFile2:
98     nc = pycdf.CDFMF((ncFile1, ncFile2))
99 elif not have_ncFile1 and have_ncFile2:
100     nc = pycdf.CDFMF((ncFile2,))
101 elif have_ncFile1 and not have_ncFile2:
102     nc = pycdf.CDFMF((ncFile1,))
103 else:
104     print ' ... both files do not exist -- NO DATA LOADED'
105
106 # get variable names
107 ncvars = nc.variables()
108 # print ncvars
109 es2 = nc.var('time')[:]
110 units = nc.var('time').units
111 dt2 = [procutil.es2dt(e) for e in es2]
112 # set timezone info to UTC (since data from level1 should be in UTC!!)
113 dt2 = [e.replace(tzinfo=dateutil.tz.tzutc()) for e in dt2]
114 dn2 = date2num(dt2)
115
116 r2 = nc.var('rain')[:] # inches of rain in past 15 min
117 have_sontek = 'sontek_wl' in ncvars.keys() or 'sontek_flow' in ncvars.keys()
118 have_press = 'press_wl' in ncvars.keys() or 'press_flow' in ncvars.keys()
119
120 if have_press:
121     pwl2 = nc.var('press_wl')[:] # feet
122     pfl2 = nc.var('press_flow')[:] # cfs
123
124 if have_sontek:
125     swl2 = nc.var('sontek_wl')[:] # feet
126     sfl2 = nc.var('sontek_flow')[:] # cfs
127
128 nc.close()
129
130 # last dt in data for labels
131 dtu = dt[-1]
132 dtl = dt_local[-1]
133
134 diff = abs(dtu - dtl)
135 if diff.days>0:
136     last_dt_str = dtu.strftime("%H:%M %Z on %b %d, %Y") + ' (' + dtl.strftime("%H:%M %Z, %b %d") + ')'
137 else:
138     last_dt_str = dtu.strftime("%H:%M %Z") + ' (' + dtl.strftime("%H:%M %Z") + ')' \
139                   + dtl.strftime(" on %b %d, %Y")
140        
141 #######################################
142 # Plot month all wq (plus flow) the timeseries data
143 #######################################
144
145 fig = figure(figsize=(10, 9))
146 fig.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.9, wspace=0.1, hspace=0.1)
147
148 ax = fig.add_subplot(6,1,1)
149 axs = [ax]
150
151 # ax.plot returns a list of lines, so unpack tuple
152 (x, y) = procutil.addnan(dt, wtemp)
153 ibad = y <= -6999.
154 y[ibad] = numpy.nan
155 # if all are NaN's then pyplot throws an error for autoscale
156 # for some reason setting one value in the timeseries to a real value
157 # fixes this.
158 if numpy.isnan(y).all():
159     y[-1]=0.
160
161 l1, = ax.plot_date(x, y, fmt='b-')
162 l1.set_label('Water Temperature')
163
164 ax.set_ylabel('TEMP\n (deg C)')
165 ax.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1)))
166 ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) )
167 ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) )
168 ax.xaxis.set_major_formatter( DateFormatter('%m/%d') )
169 ax.set_xticklabels([])
170
171 # right-hand side scale
172 ax2 = twinx(ax)
173 ax2.yaxis.tick_right()
174 # convert (lhs) deg C to (rhs) deg F
175 f = [procutil.celsius2fahrenheit(val) for val in ax.get_ylim()]
176 ax2.set_ylim(f)
177 ax2.set_ylabel('(deg F)')
178
179 ax2.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1)))
180 ax2.xaxis.set_major_locator( DayLocator(range(2,32,2)) )
181 ax2.xaxis.set_minor_locator( HourLocator(range(0,25,12)) )
182 ax2.set_xticklabels([])
183
184 # this only moves the label not the tick labels
185 ax.xaxis.set_label_position('top')
186 ax.set_xlabel('CROW Water Quality -- ' + yyyy_mm)
187
188 # legend
189 ls1 = l1.get_label()
190 leg = ax.legend((l1,), (ls1,), loc='upper left')
191 ltext  = leg.get_texts()  # all the text.Text instance in the legend
192 llines = leg.get_lines()  # all the lines.Line2D instance in the legend
193 frame  = leg.get_frame()  # the patch.Rectangle instance surrounding the legend
194 frame.set_facecolor('0.80')      # set the frame face color to light gray
195 frame.set_alpha(0.5)             # set alpha low to see through
196 setp(ltext, fontsize='small')    # the legend text fontsize
197 setp(llines, linewidth=1.5)      # the legend linewidth
198 # leg.draw_frame(False)           # don't draw the legend frame
199
200 #######################################
201 #
202 ax = fig.add_subplot(6,1,2)
203 axs.append(ax)
204
205 # ax.plot returns a list of lines, so unpack tuple
206 (x, y) = procutil.addnan(dt, cond)
207 l1, = ax.plot_date(x, y, fmt='b-')
208 l1.set_label('Specific Conductivity')
209
210 ax.set_ylabel('Cond\n (mS/cm)')
211 # ax.set_ylim(0,10)
212 ax.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1)))
213 ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) )
214 ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) )
215 ax.xaxis.set_major_formatter( DateFormatter('%m/%d') )
216 ax.set_xticklabels([])
217
218 # legend
219 ls1 = l1.get_label()
220 leg = ax.legend((l1,), (ls1,), loc='upper left')
221 ltext  = leg.get_texts()  # all the text.Text instance in the legend
222 llines = leg.get_lines()  # all the lines.Line2D instance in the legend
223 frame  = leg.get_frame()  # the patch.Rectangle instance surrounding the legend
224 frame.set_facecolor('0.80')      # set the frame face color to light gray
225 frame.set_alpha(0.5)             # set alpha low to see through
226 setp(ltext, fontsize='small')    # the legend text fontsize
227 setp(llines, linewidth=1.5)      # the legend linewidth
228 # leg.draw_frame(False)           # don't draw the legend frame
229
230 #######################################
231 #
232 ax = fig.add_subplot(6,1,3)
233 axs.append(ax)
234
235 # ax.plot returns a list of lines, so unpack tuple
236 (x, y) = procutil.addnan(dt, do_mg)
237 l1, = ax.plot_date(x, y, fmt='b-')
238 l1.set_label('Dissolved Oxygen (DO)')
239
240 ax.set_ylabel('DO \n(mg/l)')
241 # ax.set_ylim(20,120)
242 ax.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1)))
243 ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) )
244 ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) )
245 ax.xaxis.set_major_formatter( DateFormatter('%m/%d') )
246 ax.set_xticklabels([])
247
248 # right-hand side scale
249 ax2 = twinx(ax)
250 ax2.yaxis.tick_right()
251 (x, y) = procutil.addnan(dt, do_sat)
252 l2, = ax2.plot_date(x, y, fmt='c-')
253 l2.set_label('Percent Air Saturation')   
254 # convert (lhs) deg C to (rhs) deg F
255 # ax2.set_ylim(0,200)
256 ax2.set_ylabel('DO (%)')
257 ax2.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1)))
258 ax2.xaxis.set_major_locator( DayLocator(range(2,32,2)) )
259 ax2.xaxis.set_minor_locator( HourLocator(range(0,25,12)) )
260 ax2.set_xticklabels([])
261
262 # legend
263 ls1 = l1.get_label()
264 ls2 = l2.get_label()
265 leg = ax.legend((l1,l2), (ls1,ls2), loc='upper left')
266 ltext  = leg.get_texts()  # all the text.Text instance in the legend
267 llines = leg.get_lines()  # all the lines.Line2D instance in the legend
268 frame  = leg.get_frame()  # the patch.Rectangle instance surrounding the legend
269 frame.set_facecolor('0.80')      # set the frame face color to light gray
270 frame.set_alpha(0.5)             # set alpha low to see through
271 setp(ltext, fontsize='small')    # the legend text fontsize
272 setp(llines, linewidth=1.5)      # the legend linewidth
273 # leg.draw_frame(False)           # don't draw the legend frame
274 #######################################
275 #
276 ax = fig.add_subplot(6,1,4)
277 axs.append(ax)
278
279 # ax.plot returns a list of lines, so unpack tuple
280 (x, y) = procutil.addnan(dt, ph)
281 l1, = ax.plot_date(x, y, fmt='b-')
282 l1.set_label('pH')
283
284 ax.set_ylabel('pH')
285 # ax.set_ylim(6, 12)
286 ax.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1)))
287 ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) )
288 ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) )
289 ax.xaxis.set_major_formatter( DateFormatter('%m/%d') )
290 ax.set_xticklabels([])
291
292 # legend
293 ls1 = l1.get_label()
294 leg = ax.legend((l1,), (ls1,), loc='upper left')
295 ltext  = leg.get_texts()  # all the text.Text instance in the legend
296 llines = leg.get_lines()  # all the lines.Line2D instance in the legend
297 frame  = leg.get_frame()  # the patch.Rectangle instance surrounding the legend
298 frame.set_facecolor('0.80')      # set the frame face color to light gray
299 frame.set_alpha(0.5)             # set alpha low to see through
300 setp(ltext, fontsize='small')    # the legend text fontsize
301 setp(llines, linewidth=1.5)      # the legend linewidth
302 # leg.draw_frame(False)           # don't draw the legend frame
303
304 #######################################
305 #
306 ax = fig.add_subplot(6,1,5)
307 axs.append(ax)
308
309 # ax.plot returns a list of lines, so unpack tuple
310 (x, y) = procutil.addnan(dt, turb)
311 l1, = ax.plot_date(x, y, fmt='b-')
312 l1.set_label('Turbidity')
313
314 ax.set_ylabel('Turb \n(NTU)')
315 # ax.set_ylim(0,100)
316 ax.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1)))
317 ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) )
318 ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) )
319 ax.xaxis.set_major_formatter( DateFormatter('%m/%d') )
320 ax.set_xticklabels([])
321
322 # legend
323 ls1 = l1.get_label()
324 leg = ax.legend((l1,), (ls1,), loc='upper left')
325 ltext  = leg.get_texts()  # all the text.Text instance in the legend
326 llines = leg.get_lines()  # all the lines.Line2D instance in the legend
327 frame  = leg.get_frame()  # the patch.Rectangle instance surrounding the legend
328 frame.set_facecolor('0.80')      # set the frame face color to light gray
329 frame.set_alpha(0.5)             # set alpha low to see through
330 setp(ltext, fontsize='small')    # the legend text fontsize
331 setp(llines, linewidth=1.5)      # the legend linewidth
332 # leg.draw_frame(False)           # don't draw the legend frame
333
334 #######################################
335 #
336 ax = fig.add_subplot(6,1,6)
337 axs.append(ax)
338
339 # ax.plot returns a list of lines, so unpack tuple
340 if have_press:
341     (x, y) = procutil.addnan(dt2, pfl2)
342     l1, = ax.plot_date(x, y, fmt='b-')
343     l1.set_label('Derived from pressure')
344     ls1 = l1.get_label()
345 if have_sontek:
346     (x, y) = procutil.addnan(dt2, sfl2)
347     l2, = ax.plot_date(x, y, fmt='c-')
348     l2.set_label('Depth-avg Acoustic Profile')   
349     ls2 = l2.get_label()
350
351 ax.set_ylabel('Flow\n (cfs)')
352 # ax.set_ylim(0,15)
353 ax.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1)))
354 ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) )
355 ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) )
356 ax.xaxis.set_major_formatter( DateFormatter('%m/%d') )
357
358 ax.set_xlabel('CROW Water Quality -- ' + yyyy_mm)
359
360 # legend
361 if have_press and have_sontek:
362     leg = ax.legend((l1,l2), (ls1,ls2), loc='upper left')
363 elif have_press:
364     leg = ax.legend((l1,), (ls1,), loc='upper left')       
365 if have_sontek:
366     leg = ax.legend((l2,), (ls2,), loc='upper left')       
367
368 ltext  = leg.get_texts()  # all the text.Text instance in the legend
369 llines = leg.get_lines()  # all the lines.Line2D instance in the legend
370 frame  = leg.get_frame()  # the patch.Rectangle instance surrounding the legend
371 frame.set_facecolor('0.80')      # set the frame face color to light gray
372 frame.set_alpha(0.5)             # set alpha low to see through
373 setp(ltext, fontsize='small')    # the legend text fontsize
374 setp(llines, linewidth=1.5)      # the legend linewidth
375 # leg.draw_frame(False)           # don't draw the legend frame
376
377 # save figure   
378 ofn = '/home/haines/rayleigh/img/'+platform+'/'+platform+'_'+package+'_'+yyyy_mm+'.png'
379 print '... ... write: %s' % (ofn,)
380 savefig(ofn)
381
382 if plot_latest:
383     #######################################
384     # Last 30 days
385     #######################################
386    
387     print ' ... Last 30 days'
388     ax = axs[0]
389     ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1]))
390     ax.xaxis.set_major_locator( DayLocator(range(0,32,2)) )
391     ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) )
392     ax.set_xticklabels([])
393     ax.set_xlabel('CROW Water Quality -- Last 30 days from ' + last_dt_str)
394
395     ax = axs[1]
396     ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1]))
397     ax.xaxis.set_major_locator( DayLocator(range(0,32,2)) )
398     ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) )
399     ax.set_xticklabels([])
400
401     ax = axs[2]
402     ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1]))
403     ax.xaxis.set_major_locator( DayLocator(range(0,32,2)) )
404     ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) )
405     ax.set_xticklabels([])
406
407     ax = axs[3]
408     ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1]))
409     ax.xaxis.set_major_locator( DayLocator(range(0,32,2)) )
410     ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) )
411     ax.set_xticklabels([])
412
413     ax = axs[4]
414     ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1]))
415     ax.xaxis.set_major_locator( DayLocator(range(0,32,2)) )
416     ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) )
417     ax.set_xticklabels([])
418
419     ax = axs[5]
420     ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1]))
421     ax.xaxis.set_major_locator( DayLocator(range(0,32,2)) )
422     ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) )
423     ax.xaxis.set_major_formatter( DateFormatter('%m/%d') )
424     ax.set_xlabel('CROW Water Quality -- Last 7 days from ' + last_dt_str)
425
426     # save figure
427     savefig('/home/haines/rayleigh/img/crow_wq_last30days.png')
428
429     #######################################
430     # Last 7 days
431     #######################################
432
433     print ' ... Last 7 days'
434     ax = axs[0]
435     ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1]))
436     ax.xaxis.set_major_locator( DayLocator(range(0,32,1)) )
437     ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) )
438     ax.set_xticklabels([])
439     ax.set_xlabel('CROW Water Quality -- Last 7 days from ' + last_dt_str)
440
441     ax = axs[1]
442     ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1]))
443     ax.xaxis.set_major_locator( DayLocator(range(2,32,1)) )
444     ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) )
445     ax.set_xticklabels([])
446
447     ax = axs[2]
448     ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1]))
449     ax.xaxis.set_major_locator( DayLocator(range(2,32,1)) )
450     ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) )
451     ax.set_xticklabels([])
452
453     ax = axs[3]
454     ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1]))
455     ax.xaxis.set_major_locator( DayLocator(range(2,32,1)) )
456     ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) )
457     ax.set_xticklabels([])
458
459     ax = axs[4]
460     ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1]))
461     ax.xaxis.set_major_locator( DayLocator(range(2,32,1)) )
462     ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) )
463     ax.set_xticklabels([])
464
465     ax = axs[5]
466     ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1]))
467     ax.xaxis.set_major_locator( DayLocator(range(2,32,1)) )
468     ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) )
469     ax.xaxis.set_major_formatter( DateFormatter('%m/%d') )
470     ax.set_xlabel('CROW Water Quality -- Last 7 days from ' + last_dt_str)
471
472     savefig('/home/haines/rayleigh/img/crow_wq_last07days.png')
473
474     #######################################
475     # Last 1 day (24hrs)
476     #######################################
477
478     print ' ... Last 1 days'
479
480     ax = axs[0]
481     ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1]))
482     ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) )
483     ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) )
484     ax.set_xticklabels([])
485     ax.set_xlabel('CROW Water Quality -- Last 24 hours from ' + last_dt_str)
486
487     ax = axs[1]
488     ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1]))
489     ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) )
490     ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) )
491     ax.set_xticklabels([])
492
493     ax = axs[2]
494     ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1]))
495     ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) )
496     ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) )
497     ax.set_xticklabels([])
498
499     ax = axs[3]
500     ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1]))
501     ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) )
502     ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) )
503     ax.set_xticklabels([])
504
505     ax = axs[4]
506     ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1]))
507     ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) )
508     ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) )
509     ax.set_xticklabels([])
510
511     ax = axs[5]
512     ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1]))
513     ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) )
514     ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) )
515     ax.xaxis.set_major_formatter( DateFormatter('%H') )
516     ax.set_xlabel('CROW Water Quality -- Last 24 hours from ' + last_dt_str)
517
518     savefig('/home/haines/rayleigh/img/crow_wq_last01days.png')
Note: See TracBrowser for help on using the browser.