Index: proc2plot/trunk/proc2plot/billymitchell_sodar_plot.py =================================================================== --- proc2plot/trunk/proc2plot/billymitchell_sodar_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/billymitchell_sodar_plot.py (revision 455) @@ -51,5 +51,8 @@ # open netcdf data if have_ncFile1 and have_ncFile2: - nc = pycdf.CDFMF((ncFile1, ncFile2)) + try: + nc = pycdf.CDFMF((ncFile1, ncFile2)) + except: # files may have different dimensions + nc = pycdf.CDFMF((ncFile2,)) elif not have_ncFile1 and have_ncFile2: nc = pycdf.CDFMF((ncFile2,)) @@ -58,5 +61,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() @@ -399,5 +402,8 @@ # open netcdf data if have_ncFile1 and have_ncFile2: - nc = pycdf.CDFMF((ncFile1, ncFile2)) + try: + nc = pycdf.CDFMF((ncFile1, ncFile2)) + except: # files may have different dimensions + nc = pycdf.CDFMF((ncFile2,)) elif not have_ncFile1 and have_ncFile2: nc = pycdf.CDFMF((ncFile2,)) @@ -406,5 +412,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() @@ -553,5 +559,8 @@ # open netcdf data if have_ncFile1 and have_ncFile2: - nc = pycdf.CDFMF((ncFile1, ncFile2)) + try: + nc = pycdf.CDFMF((ncFile1, ncFile2)) + except: # files may have different dimensions + nc = pycdf.CDFMF((ncFile2,)) elif not have_ncFile1 and have_ncFile2: nc = pycdf.CDFMF((ncFile2,)) @@ -560,5 +569,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() Index: proc2plot/trunk/proc2plot/bogue_adcp_plot.py =================================================================== --- proc2plot/trunk/proc2plot/bogue_adcp_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/bogue_adcp_plot.py (revision 455) @@ -1,4 +1,4 @@ #!/usr/bin/env /opt/env/haines/dataproc/bin/python -# Last modified: Time-stamp: <2010-04-12 13:37:36 haines> +# Last modified: Time-stamp: <2010-08-17 15:47:11 haines> """bogue_adcp_plot""" @@ -62,5 +62,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() @@ -84,4 +84,5 @@ u = nc.var('u')[:] v = nc.var('v')[:] + e1 = nc.var('e1')[:] nc.close() @@ -196,7 +197,4 @@ ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) - ax.xaxis.set_major_formatter( DateFormatter('%m/%d') ) - - ax.set_xlabel('BOGUE Current Profile -- ' + yyyy_mm_str) # right-hand side scale @@ -211,5 +209,4 @@ ax2.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) ax2.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) - ax2.xaxis.set_major_formatter( DateFormatter('%m/%d') ) # legend @@ -224,4 +221,59 @@ setp(llines, linewidth=1.5) # the legend linewidth # leg.draw_frame(False) # don't draw the legend frame + + ####################################### + # + ax = fig.add_subplot(4,1,3) + axs.append(ax) + + # replace gaps in time with NaN + (x, y) = procutil.addnan(dt, e1, maxdelta=2./24) + dnx = date2num(x) + # use masked array to hide NaN's on plot + vm = numpy.ma.masked_where(numpy.isnan(y), y) + # (x, y) = procutil.addnan(dt, vm, maxdelta=2./24) + pc = ax.pcolor(dnx, z, vm.T, vmin=0., vmax=150.) + pc.set_label('Amplitude Beam 1 (count)') + ax.text(0.025, 0.1, pc.get_label(), fontsize="small", transform=ax.transAxes) + + # ax.plot returns a list of lines, so unpack tuple + (x, y) = procutil.addnan(dt, wl, maxdelta=2./24) + l1, = ax.plot_date(x, y, fmt='k-') + l1.set_label('Water Level') + + ax.set_ylabel('Depth (m)') + ax.set_ylim(-10.,2.) + ax.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1))) + ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) + ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) + ax.xaxis.set_major_formatter( DateFormatter('%m/%d') ) + + ax.set_xlabel('BOGUE Current Profile -- ' + yyyy_mm_str) + + # right-hand side scale + ax2 = twinx(ax) + ax2.yaxis.tick_right() + # convert (lhs) meters to (rhs) feet + feet = [procutil.meters2feet(val) for val in ax.get_ylim()] + ax2.set_ylim(feet) + ax2.set_ylabel('Depth (ft)') + + ax2.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1))) + ax2.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) + ax2.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) + ax2.xaxis.set_major_formatter( DateFormatter('%m/%d') ) + + # legend + ls1 = l1.get_label() + leg = ax.legend((l1,), (ls1,), loc='upper left') + ltext = leg.get_texts() # all the text.Text instance in the legend + llines = leg.get_lines() # all the lines.Line2D instance in the legend + frame = leg.get_frame() # the patch.Rectangle instance surrounding the legend + frame.set_facecolor('0.80') # set the frame face color to light gray + frame.set_alpha(0.5) # set alpha low to see through + setp(ltext, fontsize='small') # the legend text fontsize + setp(llines, linewidth=1.5) # the legend linewidth + # leg.draw_frame(False) # don't draw the legend frame + # save figure for this month Index: proc2plot/trunk/proc2plot/bogue_waves_plot.py =================================================================== --- proc2plot/trunk/proc2plot/bogue_waves_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/bogue_waves_plot.py (revision 455) @@ -1,4 +1,4 @@ #!/usr/bin/env /opt/env/haines/dataproc/bin/python -# Last modified: Time-stamp: <2010-04-09 16:54:06 haines> +# Last modified: Time-stamp: <2010-08-13 15:56:06 haines> """ @@ -67,5 +67,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() @@ -116,5 +116,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() @@ -158,7 +158,7 @@ (x, y) = procutil.addnan(dt2, wd2, maxdelta=2./24) l1, = ax.plot_date(x, y, fmt='b-') - l1.set_label('Water Level (HAB)') - - ax.set_ylabel('HEIGHT ABOVE\nBOTTOM (m)') + l1.set_label('Water Depth (m)') + + ax.set_ylabel('Depth (m)') # ax.set_ylim(2.,10.) # ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what @@ -178,5 +178,5 @@ feet = [procutil.meters2feet(val) for val in ax.get_ylim()] ax2.set_ylim(feet) - ax2.set_ylabel('HAB (feet)') + ax2.set_ylabel('Depth (feet)') ax2.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1))) @@ -416,5 +416,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() @@ -464,5 +464,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() @@ -506,7 +506,7 @@ (x, y) = procutil.addnan(dt2, wd2, maxdelta=2./24) l1, = ax.plot_date(x, y, fmt='b-') - l1.set_label('Water Level (HAB)') - - ax.set_ylabel('HEIGHT ABOVE\nBOTTOM (m)') + l1.set_label('Water Depth (m)') + + ax.set_ylabel('Depth (m)') # ax.set_ylim(2.,10.) # ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what @@ -526,5 +526,5 @@ feet = [procutil.meters2feet(val) for val in ax.get_ylim()] ax2.set_ylim(feet) - ax2.set_ylabel('HAB (feet)') + ax2.set_ylabel('Depth (feet)') ax2.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1))) @@ -761,5 +761,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() @@ -809,5 +809,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() @@ -851,7 +851,7 @@ (x, y) = procutil.addnan(dt2, wd2, maxdelta=2./24) l1, = ax.plot_date(x, y, fmt='b-') - l1.set_label('Water Level (HAB)') - - ax.set_ylabel('HEIGHT ABOVE\nBOTTOM (m)') + l1.set_label('Water Depth (m)') + + ax.set_ylabel('Depth (m)') # ax.set_ylim(2.,10.) # ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what @@ -871,5 +871,5 @@ feet = [procutil.meters2feet(val) for val in ax.get_ylim()] ax2.set_ylim(feet) - ax2.set_ylabel('HAB (feet)') + ax2.set_ylabel('Depth (feet)') ax2.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1))) Index: proc2plot/trunk/proc2plot/crow_flow_plot.py =================================================================== --- proc2plot/trunk/proc2plot/crow_flow_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/crow_flow_plot.py (revision 455) @@ -51,5 +51,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() @@ -94,5 +94,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() Index: proc2plot/trunk/proc2plot/crow_wq_plot.py =================================================================== --- proc2plot/trunk/proc2plot/crow_wq_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/crow_wq_plot.py (revision 455) @@ -51,5 +51,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() @@ -94,5 +94,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() Index: proc2plot/trunk/proc2plot/jpier_adcp_plot.py =================================================================== --- proc2plot/trunk/proc2plot/jpier_adcp_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/jpier_adcp_plot.py (revision 455) @@ -39,5 +39,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return ncvars = nc.variables() Index: proc2plot/trunk/proc2plot/jpier_allwaves_plot.py =================================================================== --- proc2plot/trunk/proc2plot/jpier_allwaves_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/jpier_allwaves_plot.py (revision 455) @@ -40,5 +40,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return ncvars = nc.variables() Index: proc2plot/trunk/proc2plot/jpier_met1_plot.py =================================================================== --- proc2plot/trunk/proc2plot/jpier_met1_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/jpier_met1_plot.py (revision 455) @@ -42,5 +42,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return ncvars = nc.variables() Index: proc2plot/trunk/proc2plot/jpier_met2_plot.py =================================================================== --- proc2plot/trunk/proc2plot/jpier_met2_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/jpier_met2_plot.py (revision 455) @@ -41,5 +41,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return ncvars = nc.variables() Index: proc2plot/trunk/proc2plot/jpier_swellwaves_plot.py =================================================================== --- proc2plot/trunk/proc2plot/jpier_swellwaves_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/jpier_swellwaves_plot.py (revision 455) @@ -40,5 +40,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return ncvars = nc.variables() Index: proc2plot/trunk/proc2plot/jpier_windwaves_plot.py =================================================================== --- proc2plot/trunk/proc2plot/jpier_windwaves_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/jpier_windwaves_plot.py (revision 455) @@ -40,5 +40,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return ncvars = nc.variables() Index: proc2plot/trunk/proc2plot/meet_flow_plot.py =================================================================== --- proc2plot/trunk/proc2plot/meet_flow_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/meet_flow_plot.py (revision 455) @@ -51,5 +51,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() @@ -94,5 +94,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() Index: proc2plot/trunk/proc2plot/meet_wq_plot.py =================================================================== --- proc2plot/trunk/proc2plot/meet_wq_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/meet_wq_plot.py (revision 455) @@ -51,5 +51,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() @@ -93,5 +93,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() Index: proc2plot/trunk/proc2plot/morgan_avp_plot.py =================================================================== --- proc2plot/trunk/proc2plot/morgan_avp_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/morgan_avp_plot.py (revision 455) @@ -1,4 +1,4 @@ #!/usr/bin/env python -# Last modified: Time-stamp: <2008-09-17 13:56:54 haines> +# Last modified: Time-stamp: <2011-02-25 17:02:13 haines> """morgan_avp_plot""" @@ -8,5 +8,5 @@ import numpy -sys.path.append('/home/haines/nccoos/raw2proc') +sys.path.append('/home/haines/dataproc/raw2proc') del(sys) @@ -19,8 +19,8 @@ print 'morgan_avp_plot ...' prev_month, this_month, next_month = procutil.find_months(procutil.this_month()) -# ncFile1='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_2008_01.nc' -# ncFile2='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_2008_02.nc' -ncFile1='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_'+prev_month.strftime('%Y_%m')+'.nc' -ncFile2='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_'+this_month.strftime('%Y_%m')+'.nc' +ncFile1='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_2012_01.nc' +ncFile2='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_2012_02.nc' +# ncFile1='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_'+prev_month.strftime('%Y_%m')+'.nc' +# ncFile2='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_'+this_month.strftime('%Y_%m')+'.nc' have_ncFile1 = os.path.exists(ncFile1) @@ -39,5 +39,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return ncvars = nc.variables() @@ -75,4 +75,6 @@ fig.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.9, wspace=0.1, hspace=0.1) + + ####################################### # Last 30 days Index: proc2plot/trunk/proc2plot/morgan_met_plot.py =================================================================== --- proc2plot/trunk/proc2plot/morgan_met_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/morgan_met_plot.py (revision 455) @@ -41,5 +41,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return ncvars = nc.variables() Index: proc2plot/trunk/proc2plot/proc2plot.py =================================================================== --- proc2plot/trunk/proc2plot/proc2plot.py (revision 329) +++ proc2plot/trunk/proc2plot/proc2plot.py (revision 455) @@ -1,4 +1,4 @@ #!/usr/bin/env python -# Last modified: Time-stamp: <2010-03-31 17:12:14 haines> +# Last modified: Time-stamp: <2011-02-25 14:25:26 haines> """Create plots from monthly netCDF data files @@ -76,12 +76,12 @@ # datetime from filename cn = os.path.splitext(os.path.basename(config))[0] - cndt = filt_datetime(os.path.basename(config))[0] + cndt = filt_datetime(os.path.basename(config)) pi = get_config(cn+'.platform_info') if pi['config_start_date']: - config_start_dt = filt_datetime(pi['config_start_date'])[0] + config_start_dt = filt_datetime(pi['config_start_date']) elif pi['config_start_date'] == None: config_start_dt = now_dt if pi['config_end_date']: - config_end_dt = filt_datetime(pi['config_end_date'])[0] + config_end_dt = filt_datetime(pi['config_end_date']) elif pi['config_end_date'] == None: config_end_dt = now_dt @@ -111,5 +111,5 @@ # datetime from filename cn = os.path.splitext(os.path.basename(config))[0] - cndt = filt_datetime(os.path.basename(config))[0] + cndt = filt_datetime(os.path.basename(config)) pi = get_config(cn+'.platform_info') if pi['config_end_date'] == None: Index: proc2plot/trunk/proc2plot/scratch/bogue_allwaves_plot.py =================================================================== --- (revision ) +++ proc2plot/trunk/proc2plot/scratch/bogue_allwaves_plot.py (revision 455) @@ -1,0 +1,374 @@ +#!/usr/bin/env /opt/env/haines/dataproc/bin/python +# Last modified: Time-stamp: <2010-03-29 17:28:14 haines> +"""bogue_allwaves_plot""" + +import os, sys +import datetime, time, dateutil.tz +import pycdf +import numpy + +sys.path.append('/opt/env/haines/dataproc/raw2proc') +del(sys) + +os.environ["MPLCONFIGDIR"]="/home/haines/.matplotlib/" + +from pylab import figure, twinx, savefig, setp, getp, cm, colorbar +from matplotlib.dates import DayLocator, HourLocator, MinuteLocator, DateFormatter, date2num, num2date +import procutil + +print 'bogue_allwaves_plot ...' +prev_month, this_month, next_month = procutil.find_months(procutil.this_month()) +# ncFile1='/seacoos/data/nccoos/level1/bogue/adcpwaves/bogue_adcpwaves_2008_01.nc' +# ncFile2='/seacoos/data/nccoos/level1/bogue/adcpwaves/bogue_adcpwaves_2008_02.nc' + +ncFile1='/seacoos/data/nccoos/level1/bogue/adcpwaves/bogue_adcpwaves_'+prev_month.strftime('%Y_%m')+'.nc' +ncFile2='/seacoos/data/nccoos/level1/bogue/adcpwaves/bogue_adcpwaves_'+this_month.strftime('%Y_%m')+'.nc' + +have_ncFile1 = os.path.exists(ncFile1) +have_ncFile2 = os.path.exists(ncFile2) + +print ' ... loading data for graph from ...' +print ' ... ... ' + ncFile1 + ' ... ' + str(have_ncFile1) +print ' ... ... ' + ncFile2 + ' ... ' + str(have_ncFile2) + +# load data +if have_ncFile1 and have_ncFile2: + nc = pycdf.CDFMF((ncFile1, ncFile2)) +elif not have_ncFile1 and have_ncFile2: + nc = pycdf.CDFMF((ncFile2,)) +elif have_ncFile1 and not have_ncFile2: + nc = pycdf.CDFMF((ncFile1,)) +else: + print ' ... both files do not exist -- NO DATA LOADED' + exit() + +ncvars = nc.variables() +# print ncvars +es = nc.var('time')[:] +units = nc.var('time').units +dt = [procutil.es2dt(e) for e in es] +# set timezone info to UTC (since data from level1 should be in UTC!!) +dt = [e.replace(tzinfo=dateutil.tz.tzutc()) for e in dt] +# return new datetime based on computer local +dt_local = [e.astimezone(dateutil.tz.tzlocal()) for e in dt] +dn = date2num(dt) +Hs = nc.var('Hs')[:] +Tp = nc.var('Tp')[:] +Tm = nc.var('Tm')[:] +#Hmax = nc.var('Hmax')[:] +Dp = nc.var('Dp')[:] +Dm = nc.var('Dm')[:] +nc.close() + +# ancillary data to plot +ncFile1='/seacoos/data/nccoos/level1/bogue/adcp/bogue_adcp_'+prev_month.strftime('%Y_%m')+'.nc' +ncFile2='/seacoos/data/nccoos/level1/bogue/adcp/bogue_adcp_'+this_month.strftime('%Y_%m')+'.nc' + +print ' ... loading ancillary data for graph from ...' +print ' ... ... ' + ncFile1 + ' ... ' + str(have_ncFile1) +print ' ... ... ' + ncFile2 + ' ... ' + str(have_ncFile2) +# load data +if have_ncFile1 and have_ncFile2: + nc = pycdf.CDFMF((ncFile1, ncFile2)) +elif not have_ncFile1 and have_ncFile2: + nc = pycdf.CDFMF((ncFile2,)) +elif have_ncFile1 and not have_ncFile2: + nc = pycdf.CDFMF((ncFile1,)) +else: + print ' ... both files do not exist -- NO ANCILLARY DATA LOADED' + exit() + +ncvars = nc.variables() +# print ncvars +es = nc.var('time')[:] +units = nc.var('time').units +dt_anc = [procutil.es2dt(e) for e in es] +# set timezone info to UTC (since data from level1 should be in UTC!!) +dt_anc = [e.replace(tzinfo=dateutil.tz.tzutc()) for e in dt_anc] +# return new datetime based on computer local +dt_anc_local = [e.astimezone(dateutil.tz.tzlocal()) for e in dt_anc] +dn_anc = date2num(dt) +wd_anc = nc.var('wd')[:] +nc.close + +# range for pcolor plots +cmin, cmax = (-0.5, 0.5) +# last dt in data for labels +dt1 = dt[-1] +dt2 = dt_local[-1] + +diff = abs(dt1 - dt2) +if diff.days>0: + last_dt_str = dt1.strftime("%H:%M %Z on %b %d, %Y") + ' (' + dt2.strftime("%H:%M %Z, %b %d") + ')' +else: + last_dt_str = dt1.strftime("%H:%M %Z") + ' (' + dt2.strftime("%H:%M %Z") + ')' \ + + dt2.strftime(" on %b %d, %Y") + +fig = figure(figsize=(10, 8)) +fig.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.9, wspace=0.1, hspace=0.1) + +####################################### +# Last 30 days +####################################### +print ' ... Last 30 days' + +ax = fig.add_subplot(4,1,1) +axs = [ax] + +# ibad = y <= -6999. +# y[ibad] = numpy.nan +# # just in case they are all NaNs make one real so it will plot +# if numpy.isnan(y).all(): +# y[-1]=0. + +# use masked array to hide NaN's on plot +# wd_anc = numpy.ma.masked_where(numpy.isnan(wd_anc), wd_anc) + +# ax.plot returns a list of lines, so unpack tuple +(x, y) = procutil.addnan(dt_anc, wd_anc, maxdelta=2./24) +l1, = ax.plot_date(x, y, fmt='b-') +l1.set_label('Water Level (HAB)') + +# right-hand side scale +ax2 = twinx(ax) +ax2.yaxis.tick_right() +# convert (lhs) meters to (rhs) feet +feet = [procutil.meters2feet(val) for val in ax.get_ylim()] +ax2.set_ylim(feet) +ax2.set_ylabel('HAB (feet)') + +ax.set_ylabel('HEIGHT ABOVE\nBOTTOM (m)') +# ax.set_ylim(2.,10.) +# ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what +ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax.set_xticklabels([]) + +# this only moves the label not the tick labels +ax.xaxis.set_label_position('top') +ax.set_xlabel('Bogue ALL WAVES -- Last 30 days from ' + last_dt_str) + + +# ax2.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +# ax2.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +# ax2.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +# ax2.set_xticklabels([]) + +# legend +ls1 = l1.get_label() +leg = ax.legend((l1,), (ls1,), loc='upper left') +ltext = leg.get_texts() # all the text.Text instance in the legend +llines = leg.get_lines() # all the lines.Line2D instance in the legend +frame = leg.get_frame() # the patch.Rectangle instance surrounding the legend +frame.set_facecolor('0.80') # set the frame face color to light gray +frame.set_alpha(0.5) # set alpha low to see through +setp(ltext, fontsize='small') # the legend text fontsize +setp(llines, linewidth=1.5) # the legend linewidth +# leg.draw_frame(False) # don't draw the legend frame + +####################################### +# +ax = fig.add_subplot(4,1,2) +axs.append(ax) + +# use masked array to hide NaN's on plot +# Hs = numpy.ma.masked_where(numpy.isnan(Hs), Hs) +# Hmax = numpy.ma.masked_where(numpy.isnan(Hmax), Hmax) + +# ax.plot returns a list of lines, so unpack tuple +(x, y) = procutil.addnan(dt, Hs, maxdelta=2./24) +l1, = ax.plot_date(x, y, fmt='b-') +l1.set_label('Significant Wave Height (Hs)') + +# l2, = ax.plot_date(dt, Hmax, fmt='c-') +# l2.set_label('Max Wave Height (Hmax)') + +ax.set_ylabel('WAVE\nHEIGHT (m)') +# ax.set_ylim(2.,10.) +# ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what +ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax.set_xticklabels([]) + +# right-hand side scale +ax2 = twinx(ax) +ax2.yaxis.tick_right() +# convert (lhs) meters to (rhs) feet +feet = [procutil.meters2feet(val) for val in ax.get_ylim()] +ax2.set_ylim(feet) +ax2.set_ylabel('(feet)') + +ax2.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +ax2.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax2.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax2.set_xticklabels([]) + +# legend +ls1 = l1.get_label() +# ls2 = l2.get_label() +# leg = ax.legend((l1,l2), (ls1,ls2), loc='upper left') +leg = ax.legend((l1,), (ls1,), loc='upper left') +ltext = leg.get_texts() # all the text.Text instance in the legend +llines = leg.get_lines() # all the lines.Line2D instance in the legend +frame = leg.get_frame() # the patch.Rectangle instance surrounding the legend +frame.set_facecolor('0.80') # set the frame face color to light gray +frame.set_alpha(0.5) # set alpha low to see through +setp(ltext, fontsize='small') # the legend text fontsize +setp(llines, linewidth=1.5) # the legend linewidth +# leg.draw_frame(False) # don't draw the legend frame + +####################################### +# +ax = fig.add_subplot(4,1,3) +axs.append(ax) + +# use masked array to hide NaN's on plot +# Tp = numpy.ma.masked_where(numpy.isnan(Tp), Tp) +# Tm = numpy.ma.masked_where(numpy.isnan(Tm), Tm) + +# ax.plot returns a list of lines, so unpack tuple +(x, y) = procutil.addnan(dt, Tp, maxdelta=2./24) +l1, = ax.plot_date(x, y, fmt='b-') +l1.set_label('Peak Wave Period (Tp)') + +(x, y) = procutil.addnan(dt, Tm, maxdelta=2./24) +l2, = ax.plot_date(x, y, fmt='c-') +l2.set_label('Mean Wave Period (Tm)') + +ax.set_ylabel('WAVE\nPERIOD (s)') +# ax.set_ylim(2.,10.) +# ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what +ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax.set_xticklabels([]) + +# legend +ls1 = l1.get_label() +ls2 = l2.get_label() +leg = ax.legend((l1,l2), (ls1,ls2), loc='upper left') +ltext = leg.get_texts() # all the text.Text instance in the legend +llines = leg.get_lines() # all the lines.Line2D instance in the legend +frame = leg.get_frame() # the patch.Rectangle instance surrounding the legend +frame.set_facecolor('0.80') # set the frame face color to light gray +frame.set_alpha(0.5) # set alpha low to see through +setp(ltext, fontsize='small') # the legend text fontsize +setp(llines, linewidth=1.5) # the legend linewidth +# leg.draw_frame(False) # don't draw the legend frame + +####################################### +# +ax = fig.add_subplot(4,1,4) +axs.append(ax) + +# use masked array to hide NaN's on plot +# Dp = numpy.ma.masked_where(numpy.isnan(Dp), Dp) +# Dm = numpy.ma.masked_where(numpy.isnan(Dm), Dm) + +# ax.plot returns a list of lines, so unpack tuple +(x, y) = procutil.addnan(dt, Dp, maxdelta=2./24) +l1, = ax.plot_date(x, y, fmt='b-') +l1.set_label('Peak Wave Direction (Dp)') + +(x, y) = procutil.addnan(dt, Dm, maxdelta=2./24) +l2, = ax.plot_date(x, y, fmt='c-') +l2.set_label('Mean Wave Direction (Dp)') + +ax.set_ylabel('WAVE\nDIR (deg N)') +ax.set_ylim(0.,360.) +# first to last regardless of what +# ax.set_xlim(dt[0], dt[-1]) +# last minus 30 days, +ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax.xaxis.set_major_formatter( DateFormatter('%m/%d') ) + +ax.set_xlabel('Bogue ALL WAVES -- Last 30 days from ' + last_dt_str) + +# legend +ls1 = l1.get_label() +ls2 = l2.get_label() +leg = ax.legend((l1,l2), (ls1,ls2), loc='upper left') +ltext = leg.get_texts() # all the text.Text instance in the legend +llines = leg.get_lines() # all the lines.Line2D instance in the legend +frame = leg.get_frame() # the patch.Rectangle instance surrounding the legend +frame.set_facecolor('0.80') # set the frame face color to light gray +frame.set_alpha(0.5) # set alpha low to see through +setp(ltext, fontsize='small') # the legend text fontsize +setp(llines, linewidth=1.5) # the legend linewidth +# leg.draw_frame(False) # don't draw the legend frame + +# save figure +savefig('/home/haines/rayleigh/img/bogue_allwaves_last30days.png') + +####################################### +# Last 7 days +####################################### + +print ' ... Last 7 days' +ax = axs[0] +ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(0,32,1)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) ) +ax.set_xticklabels([]) +ax.set_xlabel('Bogue ALL WAVES -- Last 7 days from ' + last_dt_str) + +ax = axs[1] +ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(0,32,1)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) ) +ax.set_xticklabels([]) + +ax = axs[2] +ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(0,32,1)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) ) +ax.set_xticklabels([]) + +ax = axs[3] +ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(0,32,1)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) ) +ax.xaxis.set_major_formatter( DateFormatter('%m/%d') ) +ax.set_xlabel('Bogue ALL WAVES -- Last 7 days from ' + last_dt_str) + +savefig('/home/haines/rayleigh/img/bogue_allwaves_last07days.png') + +####################################### +# Last 1 day (24hrs) +####################################### + +print ' ... Last 1 days' + +ax = axs[0] +ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1])) +ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) ) +ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) ) +ax.set_xticklabels([]) +ax.set_xlabel('Bogue ALL WAVES -- Last 24 hours from ' + last_dt_str) + +ax = axs[1] +ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1])) +ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) ) +ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) ) +ax.set_xticklabels([]) + +ax = axs[2] +ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1])) +ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) ) +ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) ) +ax.set_xticklabels([]) + +ax = axs[3] +ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1])) +ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) ) +ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) ) +ax.xaxis.set_major_formatter( DateFormatter('%H') ) +ax.set_xlabel('Bogue ALL WAVES -- Last 24 hours from ' + last_dt_str) + +savefig('/home/haines/rayleigh/img/bogue_allwaves_last01days.png') + + Index: proc2plot/trunk/proc2plot/scratch/bogue_swellwaves_plot.py =================================================================== --- (revision ) +++ proc2plot/trunk/proc2plot/scratch/bogue_swellwaves_plot.py (revision 455) @@ -1,0 +1,353 @@ +#!/usr/bin/env /opt/env/haines/dataproc/bin/python +# Last modified: Time-stamp: <2009-10-29 16:15:21 haines> +"""bogue_swellwaves_plot""" + +import os, sys +import datetime, time, dateutil.tz +import pycdf +import numpy + +sys.path.append('/opt/env/haines/dataproc/raw2proc') +del(sys) + +os.environ["MPLCONFIGDIR"]="/home/haines/.matplotlib/" + +from pylab import figure, twinx, savefig, setp, getp, cm, colorbar +from matplotlib.dates import DayLocator, HourLocator, MinuteLocator, DateFormatter, date2num, num2date +import procutil + +print 'bogue_swellwaves_plot ...' +prev_month, this_month, next_month = procutil.find_months(procutil.this_month()) +# ncFile1='/seacoos/data/nccoos/level1/bogue/adcpwaves/bogue_adcpwaves_2008_01.nc' +# ncFile2='/seacoos/data/nccoos/level1/bogue/adcpwaves/bogue_adcpwaves_2008_02.nc' + +ncFile1='/seacoos/data/nccoos/level1/bogue/adcpwaves/bogue_adcpwaves_'+prev_month.strftime('%Y_%m')+'.nc' +ncFile2='/seacoos/data/nccoos/level1/bogue/adcpwaves/bogue_adcpwaves_'+this_month.strftime('%Y_%m')+'.nc' + +# load data +have_ncFile1 = os.path.exists(ncFile1) +have_ncFile2 = os.path.exists(ncFile2) + +print ' ... loading data for graph from ...' +print ' ... ... ' + ncFile1 + ' ... ' + str(have_ncFile1) +print ' ... ... ' + ncFile2 + ' ... ' + str(have_ncFile2) + +# load data +if have_ncFile1 and have_ncFile2: + nc = pycdf.CDFMF((ncFile1, ncFile2)) +elif not have_ncFile1 and have_ncFile2: + nc = pycdf.CDFMF((ncFile2,)) +elif have_ncFile1 and not have_ncFile2: + nc = pycdf.CDFMF((ncFile1,)) +else: + print ' ... both files do not exist -- NO DATA LOADED' + exit() + +ncvars = nc.variables() +# print ncvars +es = nc.var('time')[:] +units = nc.var('time').units +dt = [procutil.es2dt(e) for e in es] +# set timezone info to UTC (since data from level1 should be in UTC!!) +dt = [e.replace(tzinfo=dateutil.tz.tzutc()) for e in dt] +# return new datetime based on computer local +dt_local = [e.astimezone(dateutil.tz.tzlocal()) for e in dt] +dn = date2num(dt) +Hss = nc.var('Hs_swell')[:] +Tps = nc.var('Tp_swell')[:] +Tms = nc.var('Tm_swell')[:] +#Hmax = nc.var('Hmax')[:] +Dps = nc.var('Dp_swell')[:] +Dms = nc.var('Dm_swell')[:] +nc.close() + +# ancillary data to plot +ncFile1='/seacoos/data/nccoos/level1/bogue/adcp/bogue_adcp_'+prev_month.strftime('%Y_%m')+'.nc' +ncFile2='/seacoos/data/nccoos/level1/bogue/adcp/bogue_adcp_'+this_month.strftime('%Y_%m')+'.nc' +print ' ... loading ancillary data for graph from ...' +print ' ... ... ' + ncFile1 + ' ... ' + str(have_ncFile1) +print ' ... ... ' + ncFile2 + ' ... ' + str(have_ncFile2) +# load data +if have_ncFile1 and have_ncFile2: + nc = pycdf.CDFMF((ncFile1, ncFile2)) +elif not have_ncFile1 and have_ncFile2: + nc = pycdf.CDFMF((ncFile2,)) +elif have_ncFile1 and not have_ncFile2: + nc = pycdf.CDFMF((ncFile1,)) +else: + print ' ... both files do not exist -- NO ANCILLARY DATA LOADED' + exit() + +ncvars = nc.variables() +# print ncvars +es = nc.var('time')[:] +units = nc.var('time').units +dt_anc = [procutil.es2dt(e) for e in es] +# set timezone info to UTC (since data from level1 should be in UTC!!) +dt_anc = [e.replace(tzinfo=dateutil.tz.tzutc()) for e in dt_anc] +# return new datetime based on computer local +dt_anc_local = [e.astimezone(dateutil.tz.tzlocal()) for e in dt_anc] +dn_anc = date2num(dt) +wd_anc = nc.var('wd')[:] +nc.close + +# range for pcolor plots +cmin, cmax = (-0.5, 0.5) +# last dt in data for labels +dt1 = dt[-1] +dt2 = dt_local[-1] + +diff = abs(dt1 - dt2) +if diff.days>0: + last_dt_str = dt1.strftime("%H:%M %Z on %b %d, %Y") + ' (' + dt2.strftime("%H:%M %Z, %b %d") + ')' +else: + last_dt_str = dt1.strftime("%H:%M %Z") + ' (' + dt2.strftime("%H:%M %Z") + ')' \ + + dt2.strftime(" on %b %d, %Y") + +fig = figure(figsize=(10, 8)) +fig.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.9, wspace=0.1, hspace=0.1) + +####################################### +# Last 30 days +####################################### +print ' ... Last 30 days' + +ax = fig.add_subplot(4,1,1) +axs = [ax] + +# ax.plot returns a list of lines, so unpack tuple +(x, y) = procutil.addnan(dt_anc, wd_anc, maxdelta=2./24) +l1, = ax.plot_date(x, y, fmt='b-') +l1.set_label('Water Level (HAB)') + +ax.set_ylabel('HEIGHT ABOVE\nBOTTOM (m)') +# ax.set_ylim(2.,10.) +# ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what +ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax.set_xticklabels([]) + +# this only moves the label not the tick labels +ax.xaxis.set_label_position('top') +ax.set_xlabel('Bogue ADCPWAVES -- Last 30 days from ' + last_dt_str) + +# right-hand side scale +ax2 = twinx(ax) +ax2.yaxis.tick_right() +# convert (lhs) meters to (rhs) feet +feet = [procutil.meters2feet(val) for val in ax.get_ylim()] +ax2.set_ylim(feet) +ax2.set_ylabel('HAB (feet)') + +ax2.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +ax2.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax2.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax2.set_xticklabels([]) + +# legend +ls1 = l1.get_label() +leg = ax.legend((l1,), (ls1,), loc='upper left') +ltext = leg.get_texts() # all the text.Text instance in the legend +llines = leg.get_lines() # all the lines.Line2D instance in the legend +frame = leg.get_frame() # the patch.Rectangle instance surrounding the legend +frame.set_facecolor('0.80') # set the frame face color to light gray +frame.set_alpha(0.5) # set alpha low to see through +setp(ltext, fontsize='small') # the legend text fontsize +setp(llines, linewidth=1.5) # the legend linewidth +# leg.draw_frame(False) # don't draw the legend frame + +####################################### +# +ax = fig.add_subplot(4,1,2) +axs.append(ax) + +# ax.plot returns a list of lines, so unpack tuple +(x, y) = procutil.addnan(dt, Hss, maxdelta=2./24) +l1, = ax.plot_date(x, y, fmt='b-') +l1.set_label('Significant Swell Wave Height (Hss)') + +# (x, y) = procutil.addnan(dt, Hmax, maxdelta=2./24) +# l2, = ax.plot_date(x, y, fmt='g-') +# l2.set_label('Max Wave Height (Hmax)') + +ax.set_ylabel('WAVE\nHEIGHT (m)') +# ax.set_ylim(2.,10.) +# ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what +ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax.set_xticklabels([]) + +# right-hand side scale +ax2 = twinx(ax) +ax2.yaxis.tick_right() +# convert (lhs) meters to (rhs) feet +feet = [procutil.meters2feet(val) for val in ax.get_ylim()] +ax2.set_ylim(feet) +ax2.set_ylabel('(feet)') + +ax2.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +ax2.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax2.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax2.set_xticklabels([]) + +# legend +ls1 = l1.get_label() +# ls2 = l2.get_label() +# leg = ax.legend((l1,l2), (ls1,ls2), loc='upper left') +leg = ax.legend((l1,), (ls1,), loc='upper left') +ltext = leg.get_texts() # all the text.Text instance in the legend +llines = leg.get_lines() # all the lines.Line2D instance in the legend +frame = leg.get_frame() # the patch.Rectangle instance surrounding the legend +frame.set_facecolor('0.80') # set the frame face color to light gray +frame.set_alpha(0.5) # set alpha low to see through +setp(ltext, fontsize='small') # the legend text fontsize +setp(llines, linewidth=1.5) # the legend linewidth +# leg.draw_frame(False) # don't draw the legend frame + +####################################### +# +ax = fig.add_subplot(4,1,3) +axs.append(ax) + +# ax.plot returns a list of lines, so unpack tuple +(x, y) = procutil.addnan(dt, Tps, maxdelta=2./24) +l1, = ax.plot_date(x, y, fmt='b-') +l1.set_label('Peak Swell Period (Tp)') + +(x, y) = procutil.addnan(dt, Tms, maxdelta=2./24) +l2, = ax.plot_date(x, y, fmt='c-') +l2.set_label('Mean Swell Period (Tm)') + +ax.set_ylabel('WAVE\nPERIOD (s)') +# ax.set_ylim(2.,10.) +# ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what +ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax.set_xticklabels([]) + +# legend +ls1 = l1.get_label() +ls2 = l2.get_label() +leg = ax.legend((l1,l2), (ls1,ls2), loc='upper left') +ltext = leg.get_texts() # all the text.Text instance in the legend +llines = leg.get_lines() # all the lines.Line2D instance in the legend +frame = leg.get_frame() # the patch.Rectangle instance surrounding the legend +frame.set_facecolor('0.80') # set the frame face color to light gray +frame.set_alpha(0.5) # set alpha low to see through +setp(ltext, fontsize='small') # the legend text fontsize +setp(llines, linewidth=1.5) # the legend linewidth +# leg.draw_frame(False) # don't draw the legend frame + +####################################### +# +ax = fig.add_subplot(4,1,4) +axs.append(ax) + +# ax.plot returns a list of lines, so unpack tuple +(x, y) = procutil.addnan(dt, Dps, maxdelta=2./24) +l1, = ax.plot_date(x, y, fmt='b-') +l1.set_label('Peak Swell Direction (Dp)') + +(x, y) = procutil.addnan(dt, Dms, maxdelta=2./24) +l2, = ax.plot_date(x, y, fmt='c-') +l2.set_label('Mean Swell Direction (Dp)') + +ax.set_ylabel('WAVE\nDIR (deg N)') +ax.set_ylim(0.,360.) +# first to last regardless of what +# ax.set_xlim(dt[0], dt[-1]) +# last minus 30 days, +ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax.xaxis.set_major_formatter( DateFormatter('%m/%d') ) + +ax.set_xlabel('Bogue SWELL WAVES -- Last 30 days from ' + last_dt_str) + +# legend +ls1 = l1.get_label() +ls2 = l2.get_label() +leg = ax.legend((l1,l2), (ls1,ls2), loc='upper left') +ltext = leg.get_texts() # all the text.Text instance in the legend +llines = leg.get_lines() # all the lines.Line2D instance in the legend +frame = leg.get_frame() # the patch.Rectangle instance surrounding the legend +frame.set_facecolor('0.80') # set the frame face color to light gray +frame.set_alpha(0.5) # set alpha low to see through +setp(ltext, fontsize='small') # the legend text fontsize +setp(llines, linewidth=1.5) # the legend linewidth +# leg.draw_frame(False) # don't draw the legend frame + +# save figure +savefig('/home/haines/rayleigh/img/bogue_swellwaves_last30days.png') + +####################################### +# Last 7 days +####################################### + +print ' ... Last 7 days' +ax = axs[0] +ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(0,32,1)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) ) +ax.set_xticklabels([]) +ax.set_xlabel('Bogue ADCPWAVES -- Last 7 days from ' + last_dt_str) + +ax = axs[1] +ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(0,32,1)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) ) +ax.set_xticklabels([]) + +ax = axs[2] +ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(0,32,1)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) ) +ax.set_xticklabels([]) + +ax = axs[3] +ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(0,32,1)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) ) +ax.xaxis.set_major_formatter( DateFormatter('%m/%d') ) +ax.set_xlabel('Bogue ADCPWAVES -- Last 7 days from ' + last_dt_str) + +savefig('/home/haines/rayleigh/img/bogue_swellwaves_last07days.png') + +####################################### +# Last 1 day (24hrs) +####################################### + +print ' ... Last 1 days' + +ax = axs[0] +ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1])) +ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) ) +ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) ) +ax.set_xticklabels([]) +ax.set_xlabel('Bogue ADCPWAVES -- Last 24 hours from ' + last_dt_str) + +ax = axs[1] +ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1])) +ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) ) +ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) ) +ax.set_xticklabels([]) + +ax = axs[2] +ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1])) +ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) ) +ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) ) +ax.set_xticklabels([]) + +ax = axs[3] +ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1])) +ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) ) +ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) ) +ax.xaxis.set_major_formatter( DateFormatter('%H') ) +ax.set_xlabel('Bogue ADCPWAVES -- Last 24 hours from ' + last_dt_str) + +savefig('/home/haines/rayleigh/img/bogue_swellwaves_last01days.png') + + Index: proc2plot/trunk/proc2plot/scratch/bogue_windwaves_plot.py =================================================================== --- (revision ) +++ proc2plot/trunk/proc2plot/scratch/bogue_windwaves_plot.py (revision 455) @@ -1,0 +1,357 @@ +#!/usr/bin/env /opt/env/haines/dataproc/bin/python +# Last modified: Time-stamp: <2010-08-12 15:18:36 haines> +"""bogue_windwaves_plot""" + +import os, sys +import datetime, time, dateutil.tz +import pycdf +import numpy + +sys.path.append('/opt/env/haines/dataproc/raw2proc') +del(sys) + +os.environ["MPLCONFIGDIR"]="/home/haines/.matplotlib/" + +from pylab import figure, twinx, savefig, setp, getp, cm, colorbar +from matplotlib.dates import DayLocator, HourLocator, MinuteLocator, DateFormatter, date2num, num2date +import procutil + +print 'bogue_windwaves_plot ...' +prev_month, this_month, next_month = procutil.find_months(procutil.this_month()) +# ncFile1='/seacoos/data/nccoos/level1/bogue/adcpwaves/bogue_adcpwaves_2008_01.nc' +# ncFile2='/seacoos/data/nccoos/level1/bogue/adcpwaves/bogue_adcpwaves_2008_02.nc' + +ncFile1='/seacoos/data/nccoos/level1/bogue/adcpwaves/bogue_adcpwaves_'+prev_month.strftime('%Y_%m')+'.nc' +ncFile2='/seacoos/data/nccoos/level1/bogue/adcpwaves/bogue_adcpwaves_'+this_month.strftime('%Y_%m')+'.nc' + +# load data +have_ncFile1 = os.path.exists(ncFile1) +have_ncFile2 = os.path.exists(ncFile2) + +print ' ... loading data for graph from ...' +print ' ... ... ' + ncFile1 + ' ... ' + str(have_ncFile1) +print ' ... ... ' + ncFile2 + ' ... ' + str(have_ncFile2) + +# load data +if have_ncFile1 and have_ncFile2: + nc = pycdf.CDFMF((ncFile1, ncFile2)) +elif not have_ncFile1 and have_ncFile2: + nc = pycdf.CDFMF((ncFile2,)) +elif have_ncFile1 and not have_ncFile2: + nc = pycdf.CDFMF((ncFile1,)) +else: + print ' ... both files do not exist -- NO DATA LOADED' + exit() + +ncvars = nc.variables() +# print ncvars +es = nc.var('time')[:] +units = nc.var('time').units +dt = [procutil.es2dt(e) for e in es] +# set timezone info to UTC (since data from level1 should be in UTC!!) +dt = [e.replace(tzinfo=dateutil.tz.tzutc()) for e in dt] +# return new datetime based on computer local +dt_local = [e.astimezone(dateutil.tz.tzlocal()) for e in dt] +dn = date2num(dt) +Hsw = nc.var('Hs_wind')[:] +Tpw = nc.var('Tp_wind')[:] +Tmw = nc.var('Tm_wind')[:] +#Hmax = nc.var('Hmax')[:] +Dpw = nc.var('Dp_wind')[:] +Dmw = nc.var('Dm_wind')[:] +nc.close() + +# ancillary data to plot +ncFile1='/seacoos/data/nccoos/level1/bogue/adcp/bogue_adcp_'+prev_month.strftime('%Y_%m')+'.nc' +ncFile2='/seacoos/data/nccoos/level1/bogue/adcp/bogue_adcp_'+this_month.strftime('%Y_%m')+'.nc' +print ' ... loading ancillary data for graph from ...' +print ' ... ... ' + ncFile1 + ' ... ' + str(have_ncFile1) +print ' ... ... ' + ncFile2 + ' ... ' + str(have_ncFile2) +# load data +if have_ncFile1 and have_ncFile2: + nc = pycdf.CDFMF((ncFile1, ncFile2)) +elif not have_ncFile1 and have_ncFile2: + nc = pycdf.CDFMF((ncFile2,)) +elif have_ncFile1 and not have_ncFile2: + nc = pycdf.CDFMF((ncFile1,)) +else: + print ' ... both files do not exist -- NO ANCILLARY DATA LOADED' + exit() + +ncvars = nc.variables() +# print ncvars +es = nc.var('time')[:] +units = nc.var('time').units +dt_anc = [procutil.es2dt(e) for e in es] +# set timezone info to UTC (since data from level1 should be in UTC!!) +dt_anc = [e.replace(tzinfo=dateutil.tz.tzutc()) for e in dt_anc] +# return new datetime based on computer local +dt_anc_local = [e.astimezone(dateutil.tz.tzlocal()) for e in dt_anc] +dn_anc = date2num(dt) +wd_anc = nc.var('wd')[:] +nc.close + +# range for pcolor plots +cmin, cmax = (-0.5, 0.5) +# last dt in data for labels +dt1 = dt[-1] +dt2 = dt_local[-1] + +diff = abs(dt1 - dt2) +if diff.days>0: + last_dt_str = dt1.strftime("%H:%M %Z on %b %d, %Y") + ' (' + dt2.strftime("%H:%M %Z, %b %d") + ')' +else: + last_dt_str = dt1.strftime("%H:%M %Z") + ' (' + dt2.strftime("%H:%M %Z") + ')' \ + + dt2.strftime(" on %b %d, %Y") + +fig = figure(figsize=(10, 8)) +fig.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.9, wspace=0.1, hspace=0.1) + +####################################### +# Last 30 days +####################################### +print ' ... Last 30 days' + +ax = fig.add_subplot(4,1,1) +axs = [ax] + +# ax.plot returns a list of lines, so unpack tuple +(x, y) = procutil.addnan(dt_anc, wd_anc, maxdelta=2./24) +l1, = ax.plot_date(x, y, fmt='b-') +l1.set_label('Water Depth (m)') + +ax.set_ylabel('Depth (m)') +# ax.set_ylim(2.,10.) +# ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what +ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax.set_xticklabels([]) + +# this only moves the label not the tick labels +ax.xaxis.set_label_position('top') +ax.set_xlabel('Bogue WIND WAVES -- Last 30 days from ' + last_dt_str) + +# right-hand side scale +ax2 = twinx(ax) +ax2.yaxis.tick_right() +# convert (lhs) meters to (rhs) feet +feet = [procutil.meters2feet(val) for val in ax.get_ylim()] +ax2.set_ylim(feet) +ax2.set_ylabel('Depth (feet)') + +ax2.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +ax2.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax2.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax2.set_xticklabels([]) + +# legend +ls1 = l1.get_label() +leg = ax.legend((l1,), (ls1,), loc='upper left') +ltext = leg.get_texts() # all the text.Text instance in the legend +llines = leg.get_lines() # all the lines.Line2D instance in the legend +frame = leg.get_frame() # the patch.Rectangle instance surrounding the legend +frame.set_facecolor('0.80') # set the frame face color to light gray +frame.set_alpha(0.5) # set alpha low to see through +setp(ltext, fontsize='small') # the legend text fontsize +setp(llines, linewidth=1.5) # the legend linewidth +# leg.draw_frame(False) # don't draw the legend frame + +####################################### +# +ax = fig.add_subplot(4,1,2) +axs.append(ax) + +# ax.plot returns a list of lines, so unpack tuple +(x, y) = procutil.addnan(dt, Hsw, maxdelta=2./24) +l1, = ax.plot_date(x, y, fmt='b-') +l1.set_label('Significant Wind Wave Height (Hsw)') + +# (x, y) = procutil.addnan(dt, Hmax, maxdelta=2./24) +# l2, = ax.plot_date(x, y, fmt='c-') +# l2.set_label('Max Wave Height (Hmax)') + +ax.set_ylabel('WAVE\nHEIGHT (m)') +# ax.set_ylim(2.,10.) +# ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what +ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax.set_xticklabels([]) + +# right-hand side scale +ax2 = twinx(ax) +ax2.yaxis.tick_right() +# convert (lhs) meters to (rhs) feet +feet = [procutil.meters2feet(val) for val in ax.get_ylim()] +ax2.set_ylim(feet) +ax2.set_ylabel('(feet)') + +ax2.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +ax2.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax2.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax2.set_xticklabels([]) + +# legend +ls1 = l1.get_label() +# ls2 = l2.get_label() +# leg = ax.legend((l1,l2), (ls1,ls2), loc='upper left') +leg = ax.legend((l1,), (ls1,), loc='upper left') +ltext = leg.get_texts() # all the text.Text instance in the legend +llines = leg.get_lines() # all the lines.Line2D instance in the legend +frame = leg.get_frame() # the patch.Rectangle instance surrounding the legend +frame.set_facecolor('0.80') # set the frame face color to light gray +frame.set_alpha(0.5) # set alpha low to see through +setp(ltext, fontsize='small') # the legend text fontsize +setp(llines, linewidth=1.5) # the legend linewidth +# leg.draw_frame(False) # don't draw the legend frame + +####################################### +# +ax = fig.add_subplot(4,1,3) +axs.append(ax) + +# use masked array to hide NaN's on plot +Tpw = numpy.ma.masked_where(numpy.isnan(Tpw), Tpw) +Tmw = numpy.ma.masked_where(numpy.isnan(Tmw), Tmw) + +# ax.plot returns a list of lines, so unpack tuple +(x, y) = procutil.addnan(dt, Tpw, maxdelta=2./24) +l1, = ax.plot_date(x, y, fmt='b-') +l1.set_label('Peak Wind Period (Tpw)') + +(x, y) = procutil.addnan(dt, Tmw, maxdelta=2./24) +l2, = ax.plot_date(x, y, fmt='c-') +l2.set_label('Mean Wind Period (Tmw)') + +ax.set_ylabel('WAVE\nPERIOD (s)') +# ax.set_ylim(2.,10.) +# ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what +ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) # last minus 30 days to last +ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax.set_xticklabels([]) + +# legend +ls1 = l1.get_label() +ls2 = l2.get_label() +leg = ax.legend((l1,l2), (ls1,ls2), loc='upper left') +ltext = leg.get_texts() # all the text.Text instance in the legend +llines = leg.get_lines() # all the lines.Line2D instance in the legend +frame = leg.get_frame() # the patch.Rectangle instance surrounding the legend +frame.set_facecolor('0.80') # set the frame face color to light gray +frame.set_alpha(0.5) # set alpha low to see through +setp(ltext, fontsize='small') # the legend text fontsize +setp(llines, linewidth=1.5) # the legend linewidth +# leg.draw_frame(False) # don't draw the legend frame + +####################################### +# +ax = fig.add_subplot(4,1,4) +axs.append(ax) + +# ax.plot returns a list of lines, so unpack tuple +(x, y) = procutil.addnan(dt, Dpw, maxdelta=2./24) +l1, = ax.plot_date(x, y, fmt='b-') +l1.set_label('Peak Wind Direction (Dpw)') + +(x, y) = procutil.addnan(dt, Dmw, maxdelta=2./24) +l2, = ax.plot_date(x, y, fmt='c-') +l2.set_label('Mean Wind Direction (Dmw)') + +ax.set_ylabel('WAVE\nDIR (deg N)') +ax.set_ylim(0.,360.) +# first to last regardless of what +# ax.set_xlim(dt[0], dt[-1]) +# last minus 30 days, +ax.set_xlim(date2num(dt[-1])-30, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) +ax.xaxis.set_major_formatter( DateFormatter('%m/%d') ) + +ax.set_xlabel('Bogue WIND WAVES -- Last 30 days from ' + last_dt_str) + +# legend +ls1 = l1.get_label() +ls2 = l2.get_label() +leg = ax.legend((l1,l2), (ls1,ls2), loc='upper left') +ltext = leg.get_texts() # all the text.Text instance in the legend +llines = leg.get_lines() # all the lines.Line2D instance in the legend +frame = leg.get_frame() # the patch.Rectangle instance surrounding the legend +frame.set_facecolor('0.80') # set the frame face color to light gray +frame.set_alpha(0.5) # set alpha low to see through +setp(ltext, fontsize='small') # the legend text fontsize +setp(llines, linewidth=1.5) # the legend linewidth +# leg.draw_frame(False) # don't draw the legend frame + +# save figure +savefig('/home/haines/rayleigh/img/bogue_windwaves_last30days.png') + +####################################### +# Last 7 days +####################################### + +print ' ... Last 7 days' +ax = axs[0] +ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(0,32,1)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) ) +ax.set_xticklabels([]) +ax.set_xlabel('Bogue ADCPWAVES -- Last 7 days from ' + last_dt_str) + +ax = axs[1] +ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(0,32,1)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) ) +ax.set_xticklabels([]) + +ax = axs[2] +ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(0,32,1)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) ) +ax.set_xticklabels([]) + +ax = axs[3] +ax.set_xlim(date2num(dt[-1])-7, date2num(dt[-1])) +ax.xaxis.set_major_locator( DayLocator(range(0,32,1)) ) +ax.xaxis.set_minor_locator( HourLocator(range(0,25,6)) ) +ax.xaxis.set_major_formatter( DateFormatter('%m/%d') ) +ax.set_xlabel('Bogue WIND WAVES -- Last 7 days from ' + last_dt_str) + +savefig('/home/haines/rayleigh/img/bogue_windwaves_last07days.png') + +####################################### +# Last 1 day (24hrs) +####################################### + +print ' ... Last 1 days' + +ax = axs[0] +ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1])) +ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) ) +ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) ) +ax.set_xticklabels([]) +ax.set_xlabel('Bogue WIND WAVES -- Last 24 hours from ' + last_dt_str) + +ax = axs[1] +ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1])) +ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) ) +ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) ) +ax.set_xticklabels([]) + +ax = axs[2] +ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1])) +ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) ) +ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) ) +ax.set_xticklabels([]) + +ax = axs[3] +ax.set_xlim(date2num(dt[-1])-1, date2num(dt[-1])) +ax.xaxis.set_major_locator( HourLocator(range(0,25,1)) ) +ax.xaxis.set_minor_locator( MinuteLocator(range(0,61,30)) ) +ax.xaxis.set_major_formatter( DateFormatter('%H') ) +ax.set_xlabel('Bogue WIND WAVES -- Last 24 hours from ' + last_dt_str) + +savefig('/home/haines/rayleigh/img/bogue_windwaves_last01days.png') + + Index: proc2plot/trunk/proc2plot/scratch/test_swan_model.py =================================================================== --- (revision ) +++ proc2plot/trunk/proc2plot/scratch/test_swan_model.py (revision 455) @@ -1,0 +1,102 @@ +#!/usr/bin/env python +# Last modified: Time-stamp: <2010-10-28 20:20:48 haines> +"""swan_model_plot""" + +import os, sys +import datetime, time, dateutil.tz +import pycdf +import numpy + +sys.path.append('/opt/env/haines/dataproc/raw2proc') +del(sys) + +os.environ["MPLCONFIGDIR"]="/home/haines/.matplotlib/" + +from pylab import figure, twinx, savefig, setp, getp, cm, colorbar +import procutil +import ncutil + +print 'swan_model_plot ...' + +# shows how to load mulitple files of same structure. +ncFile1='/seacoos/data/nccoos/test_data/20101018_1800_NSNH_CG1.nc' +ncFile2='/some/other/data/file.nc' + +# load data +have_ncFile1 = os.path.exists(ncFile1) +have_ncFile2 = os.path.exists(ncFile2) + +print ' ... loading data for graph from ...' +print ' ... ... ' + ncFile1 + ' ... ' + str(have_ncFile1) +print ' ... ... ' + ncFile2 + ' ... ' + str(have_ncFile2) + +if have_ncFile1 and have_ncFile2: + nc = pycdf.CDFMF((ncFile1, ncFile2)) +elif not have_ncFile1 and have_ncFile2: + nc = pycdf.CDFMF((ncFile2,)) +elif have_ncFile1 and not have_ncFile2: + nc = pycdf.CDFMF((ncFile1,)) +else: + print ' ... both files do not exist -- NO DATA LOADED' + exit() + +ncvars = nc.variables() +print ncvars +print ncvars['wndMag'] + + +####################################### +fig = figure(figsize=(8, 10)) +fig.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.9, wspace=0.1, hspace=0.1) + +ax = fig.add_subplot(2,1,1) + +# ---------- LAT and LON -------- + +x = nc.var('x')[:] +y = nc.var('y')[:] + +# -------- WIND DATA ------------ + +wndDir = nc.var('wndDir')[:] +wndMag = nc.var('wndMag')[:] + +# subset first record and first level, but all y and x +# ('record', 'level', 'y', 'x'), (12, 1, 143, 103) +# and then transpose so that wdir(x,y) + +wdir = wndDir[0,0,:,:] +wdir = wdir.T + +wmag = wndMag[0,0,:,:] +wmag = wmag.T + +u = wmag*numpy.sin(wdir*numpy.pi/180) +v = wmag*numpy.cos(wdir*numpy.pi/180) + +# use masked array to hide 0's on plot +mu = numpy.ma.masked_where(u==0, u) +mv = numpy.ma.masked_where(v==0, v) + +ax.barbs(x, y, mu, mv) + +ax.set_ylabel('Latitude') +ax.set_xlabel('Longitude') + +# ------- WAVE DATa ---------- + +Hs = nc.var('htsgw')[:] +Dp = nc.var('dirpw')[:] + +Hs = Hs[0,0,:,:] +Dp = Dp[0,0,:,:] + +X,Y = numpy.meshgrid(x,y) +mHs = numpy.ma.masked_where(Hs==10, Hs) + +ax = fig.add_subplot(2,1,2) +ax.pcolor(X, Y, mHs) + + +savefig('/home/haines/rayleigh/test_swan_model_plot.png') + Index: proc2plot/trunk/proc2plot/spin/spin_billymitchell_sfas.py =================================================================== --- (revision ) +++ proc2plot/trunk/proc2plot/spin/spin_billymitchell_sfas.py (revision 455) @@ -1,0 +1,9 @@ +#!/usr/bin/env python +"""Spin processing of monthly netCDF data files top plots.""" + +from proc2plot import * + +proc2plot('manual', 'billymitchell', 'sfas', '2011_06') +proc2plot('manual', 'billymitchell', 'sfas', '2011_07') +proc2plot('manual', 'billymitchell', 'sfas', '2011_08') +proc2plot('manual', 'billymitchell', 'sfas', '2011_09') Index: proc2plot/trunk/proc2plot/spin/spin_crow_all_plot_month.py =================================================================== --- proc2plot/trunk/proc2plot/spin/spin_crow_all_plot_month.py (revision 329) +++ proc2plot/trunk/proc2plot/spin/spin_crow_all_plot_month.py (revision 455) @@ -1,4 +1,4 @@ #!/usr/bin/env /opt/env/haines/dataproc/bin/python -# Last modified: Time-stamp: <2010-04-05 11:59:42 haines> +# Last modified: Time-stamp: <2011-02-25 14:29:22 haines> """crow_all_plot_month""" @@ -21,5 +21,5 @@ proc_dir = '/seacoos/data/nccoos/level1/crow/wq/' # fns = glob.glob((os.path.join(proc_dir, '*.nc'))) -fns = glob.glob((os.path.join(proc_dir, '*2009_1?*.nc'))) +fns = glob.glob((os.path.join(proc_dir, '*2011_0?*.nc'))) fns.sort() Index: proc2plot/trunk/proc2plot/spin/spin_meet_all_plot_month.py =================================================================== --- proc2plot/trunk/proc2plot/spin/spin_meet_all_plot_month.py (revision 329) +++ proc2plot/trunk/proc2plot/spin/spin_meet_all_plot_month.py (revision 455) @@ -1,4 +1,4 @@ #!/usr/bin/env /opt/env/haines/dataproc/bin/python -# Last modified: Time-stamp: <2010-03-30 14:15:02 haines> +# Last modified: Time-stamp: <2011-02-25 14:34:25 haines> """meet_all_plot_month""" @@ -23,5 +23,5 @@ proc_dir = '/seacoos/data/nccoos/level1/meet/wq/' # fns = glob.glob((os.path.join(proc_dir, '*.nc'))) -fns = glob.glob((os.path.join(proc_dir, '*2009*.nc'))) +fns = glob.glob((os.path.join(proc_dir, '*2011*.nc'))) fns.sort() Index: proc2plot/trunk/proc2plot/stones_avp_plot.py =================================================================== --- proc2plot/trunk/proc2plot/stones_avp_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/stones_avp_plot.py (revision 455) @@ -39,5 +39,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return ncvars = nc.variables() Index: proc2plot/trunk/proc2plot/stones_met_plot.py =================================================================== --- proc2plot/trunk/proc2plot/stones_met_plot.py (revision 329) +++ proc2plot/trunk/proc2plot/stones_met_plot.py (revision 455) @@ -41,5 +41,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return ncvars = nc.variables() Index: proc2plot/trunk/proc2plot/template_p2p.py =================================================================== --- proc2plot/trunk/proc2plot/template_p2p.py (revision 329) +++ proc2plot/trunk/proc2plot/template_p2p.py (revision 455) @@ -62,5 +62,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables() @@ -109,5 +109,5 @@ else: print ' ... both files do not exist -- NO DATA LOADED' - exit() + return # ncvars = nc.variables()