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

root/proc2plot/trunk/proc2plot/scratch/test_load_ims_sodar.py

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

import first verison proc2plot

  • Property svn:executable set to
Line 
1 #!/usr/bin/env python
2 # Last modified:  Time-stamp: <2008-11-21 15:19:36 haines>
3 """ims_sodar_plot_month"""
4
5 # plot each month
6
7 import os, sys, glob, re
8 import datetime, time, dateutil, dateutil.tz
9 import pycdf
10 import numpy
11
12 sys.path.append('/home/haines/nccoos/raw2proc')
13 del(sys)
14
15 os.environ["MPLCONFIGDIR"]="/home/haines/.matplotlib/"
16
17 from pylab import figure, twinx, savefig, setp, getp, cm, colorbar
18 from matplotlib.dates import DayLocator, HourLocator, MinuteLocator, DateFormatter, date2num, num2date
19 import procutil
20
21 print 'ims_sodar_plot_month ...'
22
23 proc_dir = '/seacoos/data/nccoos/level1/ims/sodar/'
24 fns = glob.glob((os.path.join(proc_dir, '*.nc')))
25 fns.sort()
26
27 fn = fns[0]
28 m=re.search('\d{4}_\d{2}', fn)
29 yyyy_mm = m.group()
30 prev_month, this_month, next_month = procutil.find_months(yyyy_mm)
31
32 # load data
33 print ' ... ... read: ' + fn
34 nc = pycdf.CDFMF((fn,))
35 ncvars = nc.variables()
36 # print ncvars
37 es = nc.var('time')[:]
38 units = nc.var('time').units
39 dt = [procutil.es2dt(e) for e in es]
40 # set timezone info to UTC (since data from level1 should be in UTC!!)
41 dt = [e.replace(tzinfo=dateutil.tz.tzutc()) for e in dt]
42 # return new datetime based on computer local
43 dt_local = [e.astimezone(dateutil.tz.tzlocal()) for e in dt]
44 dn = date2num(dt)
45 z = nc.var('z')[:]/100. # convert cm/s to m/s
46 u = nc.var('u')[:]/100.
47 v = nc.var('v')[:]/100.
48 w = nc.var('w')[:]/100.
49 e = nc.var('echo')[:]
50 nc.close()
51
Note: See TracBrowser for help on using the browser.