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

Changeset 455

Show
Ignore:
Timestamp:
09/21/11 13:11:52
Author:
haines
Message:

Fix SVN locks and update code.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • proc2plot/trunk/proc2plot

    • Property svn:ignore set to *.pyc
  • proc2plot/trunk/proc2plot/billymitchell_sodar_plot.py

    r329 r455  
    5151    # open netcdf data 
    5252    if have_ncFile1 and have_ncFile2: 
    53         nc = pycdf.CDFMF((ncFile1, ncFile2)) 
     53        try: 
     54            nc = pycdf.CDFMF((ncFile1, ncFile2)) 
     55        except: # files may have different dimensions 
     56            nc = pycdf.CDFMF((ncFile2,)) 
    5457    elif not have_ncFile1 and have_ncFile2: 
    5558        nc = pycdf.CDFMF((ncFile2,)) 
     
    5861    else: 
    5962        print ' ... both files do not exist -- NO DATA LOADED' 
    60         exit() 
     63        return 
    6164 
    6265    # ncvars = nc.variables() 
     
    399402    # open netcdf data 
    400403    if have_ncFile1 and have_ncFile2: 
    401         nc = pycdf.CDFMF((ncFile1, ncFile2)) 
     404        try: 
     405            nc = pycdf.CDFMF((ncFile1, ncFile2)) 
     406        except: # files may have different dimensions 
     407            nc = pycdf.CDFMF((ncFile2,)) 
    402408    elif not have_ncFile1 and have_ncFile2: 
    403409        nc = pycdf.CDFMF((ncFile2,)) 
     
    406412    else: 
    407413        print ' ... both files do not exist -- NO DATA LOADED' 
    408         exit() 
     414        return 
    409415 
    410416    # ncvars = nc.variables() 
     
    553559    # open netcdf data 
    554560    if have_ncFile1 and have_ncFile2: 
    555         nc = pycdf.CDFMF((ncFile1, ncFile2)) 
     561        try: 
     562            nc = pycdf.CDFMF((ncFile1, ncFile2)) 
     563        except: # files may have different dimensions 
     564            nc = pycdf.CDFMF((ncFile2,)) 
    556565    elif not have_ncFile1 and have_ncFile2: 
    557566        nc = pycdf.CDFMF((ncFile2,)) 
     
    560569    else: 
    561570        print ' ... both files do not exist -- NO DATA LOADED' 
    562         exit() 
     571        return 
    563572 
    564573    # ncvars = nc.variables() 
  • proc2plot/trunk/proc2plot/bogue_adcp_plot.py

    r329 r455  
    11#!/usr/bin/env /opt/env/haines/dataproc/bin/python 
    2 # Last modified:  Time-stamp: <2010-04-12 13:37:36 haines> 
     2# Last modified:  Time-stamp: <2010-08-17 15:47:11 haines> 
    33 
    44"""bogue_adcp_plot""" 
     
    6262    else: 
    6363        print ' ... both files do not exist -- NO DATA LOADED' 
    64         exit() 
     64        return 
    6565 
    6666    # ncvars = nc.variables() 
     
    8484    u = nc.var('u')[:] 
    8585    v = nc.var('v')[:] 
     86    e1 = nc.var('e1')[:] 
    8687 
    8788    nc.close() 
     
    196197    ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) 
    197198    ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) 
    198     ax.xaxis.set_major_formatter( DateFormatter('%m/%d') ) 
    199  
    200     ax.set_xlabel('BOGUE Current Profile -- ' + yyyy_mm_str) 
    201199 
    202200    # right-hand side scale 
     
    211209    ax2.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) 
    212210    ax2.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) 
    213     ax2.xaxis.set_major_formatter( DateFormatter('%m/%d') ) 
    214211 
    215212    # legend 
     
    224221    setp(llines, linewidth=1.5)      # the legend linewidth 
    225222    # leg.draw_frame(False)           # don't draw the legend frame 
     223 
     224    ####################################### 
     225    # 
     226    ax = fig.add_subplot(4,1,3) 
     227    axs.append(ax) 
     228 
     229    # replace gaps in time with NaN 
     230    (x, y) = procutil.addnan(dt, e1, maxdelta=2./24) 
     231    dnx = date2num(x) 
     232    # use masked array to hide NaN's on plot 
     233    vm = numpy.ma.masked_where(numpy.isnan(y), y) 
     234    # (x, y) = procutil.addnan(dt, vm, maxdelta=2./24) 
     235    pc = ax.pcolor(dnx, z, vm.T, vmin=0., vmax=150.) 
     236    pc.set_label('Amplitude Beam 1 (count)') 
     237    ax.text(0.025, 0.1, pc.get_label(), fontsize="small", transform=ax.transAxes) 
     238 
     239    # ax.plot returns a list of lines, so unpack tuple 
     240    (x, y) = procutil.addnan(dt, wl, maxdelta=2./24) 
     241    l1, = ax.plot_date(x, y, fmt='k-') 
     242    l1.set_label('Water Level') 
     243 
     244    ax.set_ylabel('Depth (m)') 
     245    ax.set_ylim(-10.,2.) 
     246    ax.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1))) 
     247    ax.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) 
     248    ax.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) 
     249    ax.xaxis.set_major_formatter( DateFormatter('%m/%d') ) 
     250 
     251    ax.set_xlabel('BOGUE Current Profile -- ' + yyyy_mm_str) 
     252 
     253    # right-hand side scale 
     254    ax2 = twinx(ax) 
     255    ax2.yaxis.tick_right() 
     256    # convert (lhs) meters to (rhs) feet 
     257    feet = [procutil.meters2feet(val) for val in ax.get_ylim()] 
     258    ax2.set_ylim(feet) 
     259    ax2.set_ylabel('Depth (ft)') 
     260 
     261    ax2.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1))) 
     262    ax2.xaxis.set_major_locator( DayLocator(range(2,32,2)) ) 
     263    ax2.xaxis.set_minor_locator( HourLocator(range(0,25,12)) ) 
     264    ax2.xaxis.set_major_formatter( DateFormatter('%m/%d') ) 
     265 
     266    # legend 
     267    ls1 = l1.get_label() 
     268    leg = ax.legend((l1,), (ls1,), loc='upper left') 
     269    ltext  = leg.get_texts()  # all the text.Text instance in the legend 
     270    llines = leg.get_lines()  # all the lines.Line2D instance in the legend 
     271    frame  = leg.get_frame()  # the patch.Rectangle instance surrounding the legend 
     272    frame.set_facecolor('0.80')      # set the frame face color to light gray 
     273    frame.set_alpha(0.5)             # set alpha low to see through 
     274    setp(ltext, fontsize='small')    # the legend text fontsize 
     275    setp(llines, linewidth=1.5)      # the legend linewidth 
     276    # leg.draw_frame(False)           # don't draw the legend frame 
     277 
    226278 
    227279    # save figure for this month 
  • proc2plot/trunk/proc2plot/bogue_waves_plot.py

    r329 r455  
    11#!/usr/bin/env /opt/env/haines/dataproc/bin/python 
    2 # Last modified:  Time-stamp: <2010-04-09 16:54:06 haines> 
     2# Last modified:  Time-stamp: <2010-08-13 15:56:06 haines> 
    33 
    44""" 
     
    6767    else: 
    6868        print ' ... both files do not exist -- NO DATA LOADED' 
    69         exit() 
     69        return 
    7070 
    7171    # ncvars = nc.variables() 
     
    116116    else: 
    117117        print ' ... both files do not exist -- NO DATA LOADED' 
    118         exit() 
     118        return 
    119119 
    120120    # ncvars = nc.variables() 
     
    158158    (x, y) = procutil.addnan(dt2, wd2, maxdelta=2./24) 
    159159    l1, = ax.plot_date(x, y, fmt='b-') 
    160     l1.set_label('Water Level (HAB)') 
    161  
    162     ax.set_ylabel('HEIGHT ABOVE\nBOTTOM (m)') 
     160    l1.set_label('Water Depth (m)') 
     161 
     162    ax.set_ylabel('Depth (m)') 
    163163    # ax.set_ylim(2.,10.) 
    164164    # ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what   
     
    178178    feet = [procutil.meters2feet(val) for val in ax.get_ylim()] 
    179179    ax2.set_ylim(feet) 
    180     ax2.set_ylabel('HAB (feet)') 
     180    ax2.set_ylabel('Depth (feet)') 
    181181 
    182182    ax2.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1))) 
     
    416416    else: 
    417417        print ' ... both files do not exist -- NO DATA LOADED' 
    418         exit() 
     418        return 
    419419 
    420420    # ncvars = nc.variables() 
     
    464464    else: 
    465465        print ' ... both files do not exist -- NO DATA LOADED' 
    466         exit() 
     466        return 
    467467 
    468468    # ncvars = nc.variables() 
     
    506506    (x, y) = procutil.addnan(dt2, wd2, maxdelta=2./24) 
    507507    l1, = ax.plot_date(x, y, fmt='b-') 
    508     l1.set_label('Water Level (HAB)') 
    509  
    510     ax.set_ylabel('HEIGHT ABOVE\nBOTTOM (m)') 
     508    l1.set_label('Water Depth (m)') 
     509 
     510    ax.set_ylabel('Depth (m)') 
    511511    # ax.set_ylim(2.,10.) 
    512512    # ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what   
     
    526526    feet = [procutil.meters2feet(val) for val in ax.get_ylim()] 
    527527    ax2.set_ylim(feet) 
    528     ax2.set_ylabel('HAB (feet)') 
     528    ax2.set_ylabel('Depth (feet)') 
    529529 
    530530    ax2.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1))) 
     
    761761    else: 
    762762        print ' ... both files do not exist -- NO DATA LOADED' 
    763         exit() 
     763        return 
    764764 
    765765    # ncvars = nc.variables() 
     
    809809    else: 
    810810        print ' ... both files do not exist -- NO DATA LOADED' 
    811         exit() 
     811        return 
    812812 
    813813    # ncvars = nc.variables() 
     
    851851    (x, y) = procutil.addnan(dt2, wd2, maxdelta=2./24) 
    852852    l1, = ax.plot_date(x, y, fmt='b-') 
    853     l1.set_label('Water Level (HAB)') 
    854  
    855     ax.set_ylabel('HEIGHT ABOVE\nBOTTOM (m)') 
     853    l1.set_label('Water Depth (m)') 
     854 
     855    ax.set_ylabel('Depth (m)') 
    856856    # ax.set_ylim(2.,10.) 
    857857    # ax.set_xlim(dt[0], dt[-1]) # first to last regardless of what   
     
    871871    feet = [procutil.meters2feet(val) for val in ax.get_ylim()] 
    872872    ax2.set_ylim(feet) 
    873     ax2.set_ylabel('HAB (feet)') 
     873    ax2.set_ylabel('Depth (feet)') 
    874874 
    875875    ax2.set_xlim(date2num(this_month), date2num(next_month-datetime.timedelta(seconds=1))) 
  • proc2plot/trunk/proc2plot/crow_flow_plot.py

    r329 r455  
    5151    else: 
    5252        print ' ... both files do not exist -- NO DATA LOADED' 
    53         exit() 
     53        return 
    5454 
    5555    # ncvars = nc.variables() 
     
    9494    else: 
    9595        print ' ... both files do not exist -- NO DATA LOADED' 
    96         exit() 
     96        return 
    9797 
    9898    # ncvars = nc.variables() 
  • proc2plot/trunk/proc2plot/crow_wq_plot.py

    r329 r455  
    5151    else: 
    5252        print ' ... both files do not exist -- NO DATA LOADED' 
    53         exit() 
     53        return 
    5454 
    5555    # ncvars = nc.variables() 
     
    9494    else: 
    9595        print ' ... both files do not exist -- NO DATA LOADED' 
    96         exit() 
     96        return 
    9797 
    9898    # ncvars = nc.variables() 
  • proc2plot/trunk/proc2plot/jpier_adcp_plot.py

    r329 r455  
    3939else: 
    4040    print ' ... both files do not exist -- NO DATA LOADED' 
    41     exit() 
     41    return 
    4242 
    4343ncvars = nc.variables() 
  • proc2plot/trunk/proc2plot/jpier_allwaves_plot.py

    r329 r455  
    4040else: 
    4141    print ' ... both files do not exist -- NO DATA LOADED' 
    42     exit() 
     42    return 
    4343 
    4444ncvars = nc.variables() 
  • proc2plot/trunk/proc2plot/jpier_met1_plot.py

    r329 r455  
    4242else: 
    4343    print ' ... both files do not exist -- NO DATA LOADED' 
    44     exit() 
     44    return 
    4545     
    4646ncvars = nc.variables() 
  • proc2plot/trunk/proc2plot/jpier_met2_plot.py

    r329 r455  
    4141else: 
    4242        print ' ... both files do not exist -- NO DATA LOADED' 
    43         exit() 
     43        return 
    4444                                                     
    4545ncvars = nc.variables() 
  • proc2plot/trunk/proc2plot/jpier_swellwaves_plot.py

    r329 r455  
    4040else: 
    4141    print ' ... both files do not exist -- NO DATA LOADED' 
    42     exit() 
     42    return 
    4343 
    4444ncvars = nc.variables() 
  • proc2plot/trunk/proc2plot/jpier_windwaves_plot.py

    r329 r455  
    4040else: 
    4141    print ' ... both files do not exist -- NO DATA LOADED' 
    42     exit() 
     42    return 
    4343 
    4444ncvars = nc.variables() 
  • proc2plot/trunk/proc2plot/meet_flow_plot.py

    r329 r455  
    5151    else: 
    5252        print ' ... both files do not exist -- NO DATA LOADED' 
    53         exit() 
     53        return 
    5454 
    5555    # ncvars = nc.variables() 
     
    9494    else: 
    9595        print ' ... both files do not exist -- NO DATA LOADED' 
    96         exit() 
     96        return 
    9797 
    9898    # ncvars = nc.variables() 
  • proc2plot/trunk/proc2plot/meet_wq_plot.py

    r329 r455  
    5151    else: 
    5252        print ' ... both files do not exist -- NO DATA LOADED' 
    53         exit() 
     53        return 
    5454 
    5555    # ncvars = nc.variables() 
     
    9393    else: 
    9494        print ' ... both files do not exist -- NO DATA LOADED' 
    95         exit() 
     95        return 
    9696 
    9797    # ncvars = nc.variables() 
  • proc2plot/trunk/proc2plot/morgan_avp_plot.py

    r329 r455  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2008-09-17 13:56:54 haines> 
     2# Last modified:  Time-stamp: <2011-02-25 17:02:13 haines> 
    33"""morgan_avp_plot""" 
    44 
     
    88import numpy 
    99 
    10 sys.path.append('/home/haines/nccoos/raw2proc') 
     10sys.path.append('/home/haines/dataproc/raw2proc') 
    1111del(sys) 
    1212 
     
    1919print 'morgan_avp_plot ...' 
    2020prev_month, this_month, next_month = procutil.find_months(procutil.this_month()) 
    21 # ncFile1='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_2008_01.nc' 
    22 # ncFile2='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_2008_02.nc' 
    23 ncFile1='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_'+prev_month.strftime('%Y_%m')+'.nc' 
    24 ncFile2='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_'+this_month.strftime('%Y_%m')+'.nc' 
     21ncFile1='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_2012_01.nc' 
     22ncFile2='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_2012_02.nc' 
     23# ncFile1='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_'+prev_month.strftime('%Y_%m')+'.nc' 
     24# ncFile2='/seacoos/data/nccoos/level1/morgan/avp/morgan_avp_'+this_month.strftime('%Y_%m')+'.nc' 
    2525 
    2626have_ncFile1 = os.path.exists(ncFile1) 
     
    3939else: 
    4040    print ' ... both files do not exist -- NO DATA LOADED' 
    41     exit() 
     41    return 
    4242 
    4343ncvars = nc.variables() 
     
    7575fig.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.9, wspace=0.1, hspace=0.1) 
    7676 
     77 
     78 
    7779####################################### 
    7880# Last 30 days 
  • proc2plot/trunk/proc2plot/morgan_met_plot.py

    r329 r455  
    4141else: 
    4242        print ' ... both files do not exist -- NO DATA LOADED' 
    43         exit() 
     43        return 
    4444                                                     
    4545ncvars = nc.variables() 
  • proc2plot/trunk/proc2plot/proc2plot.py

    r329 r455  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2010-03-31 17:12:14 haines> 
     2# Last modified:  Time-stamp: <2011-02-25 14:25:26 haines> 
    33"""Create plots from monthly netCDF data files 
    44 
     
    7676        # datetime from filename  
    7777        cn = os.path.splitext(os.path.basename(config))[0] 
    78         cndt = filt_datetime(os.path.basename(config))[0] 
     78        cndt = filt_datetime(os.path.basename(config)) 
    7979        pi = get_config(cn+'.platform_info') 
    8080        if pi['config_start_date']: 
    81             config_start_dt = filt_datetime(pi['config_start_date'])[0] 
     81            config_start_dt = filt_datetime(pi['config_start_date']) 
    8282        elif pi['config_start_date'] == None: 
    8383            config_start_dt = now_dt 
    8484        if pi['config_end_date']: 
    85             config_end_dt = filt_datetime(pi['config_end_date'])[0] 
     85            config_end_dt = filt_datetime(pi['config_end_date']) 
    8686        elif pi['config_end_date'] == None: 
    8787            config_end_dt = now_dt 
     
    111111        # datetime from filename  
    112112        cn = os.path.splitext(os.path.basename(config))[0] 
    113         cndt = filt_datetime(os.path.basename(config))[0] 
     113        cndt = filt_datetime(os.path.basename(config)) 
    114114        pi = get_config(cn+'.platform_info') 
    115115        if pi['config_end_date'] == None: 
  • proc2plot/trunk/proc2plot/scratch

    • Property svn:ignore set to *.pyc
  • proc2plot/trunk/proc2plot/spin

    • Property svn:ignore set to *.pyc
  • proc2plot/trunk/proc2plot/spin/spin_crow_all_plot_month.py

    r329 r455  
    11#!/usr/bin/env /opt/env/haines/dataproc/bin/python 
    2 # Last modified:  Time-stamp: <2010-04-05 11:59:42 haines> 
     2# Last modified:  Time-stamp: <2011-02-25 14:29:22 haines> 
    33"""crow_all_plot_month""" 
    44 
     
    2121proc_dir = '/seacoos/data/nccoos/level1/crow/wq/' 
    2222# fns = glob.glob((os.path.join(proc_dir, '*.nc'))) 
    23 fns = glob.glob((os.path.join(proc_dir, '*2009_1?*.nc'))) 
     23fns = glob.glob((os.path.join(proc_dir, '*2011_0?*.nc'))) 
    2424fns.sort() 
    2525 
  • proc2plot/trunk/proc2plot/spin/spin_meet_all_plot_month.py

    r329 r455  
    11#!/usr/bin/env /opt/env/haines/dataproc/bin/python 
    2 # Last modified:  Time-stamp: <2010-03-30 14:15:02 haines> 
     2# Last modified:  Time-stamp: <2011-02-25 14:34:25 haines> 
    33"""meet_all_plot_month""" 
    44 
     
    2323proc_dir = '/seacoos/data/nccoos/level1/meet/wq/' 
    2424# fns = glob.glob((os.path.join(proc_dir, '*.nc'))) 
    25 fns = glob.glob((os.path.join(proc_dir, '*2009*.nc'))) 
     25fns = glob.glob((os.path.join(proc_dir, '*2011*.nc'))) 
    2626fns.sort() 
    2727 
  • proc2plot/trunk/proc2plot/stones_avp_plot.py

    r329 r455  
    3939else: 
    4040    print ' ... both files do not exist -- NO DATA LOADED' 
    41     exit() 
     41    return 
    4242 
    4343ncvars = nc.variables() 
  • proc2plot/trunk/proc2plot/stones_met_plot.py

    r329 r455  
    4141else: 
    4242        print ' ... both files do not exist -- NO DATA LOADED' 
    43         exit() 
     43        return 
    4444                                                     
    4545ncvars = nc.variables() 
  • proc2plot/trunk/proc2plot/template_p2p.py

    r329 r455  
    6262    else: 
    6363        print ' ... both files do not exist -- NO DATA LOADED' 
    64         exit() 
     64        return 
    6565 
    6666    # ncvars = nc.variables() 
     
    109109    else: 
    110110        print ' ... both files do not exist -- NO DATA LOADED' 
    111         exit() 
     111        return 
    112112 
    113113    # ncvars = nc.variables()