-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake_webplot.py
More file actions
executable file
·47 lines (32 loc) · 1.24 KB
/
make_webplot.py
File metadata and controls
executable file
·47 lines (32 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
import sys, time, os
from webplot import webPlot, readGrid, drawOverlay, saveNewMap
def log(msg): print time.ctime(time.time()),':', msg
log('Begin Script'); stime = time.time()
regions = ['CONUS', 'NGP', 'SGP', 'CGP', 'MATL', 'NE', 'NW', 'SE', 'SW']
if not os.path.exists('picklefilename.pk'):
saveNewMap(wrfout='wrfout_file_containing_lat_lons', domstr='name_for_domain')
newPlot = webPlot()
log('Reading Data'); newPlot.readEnsemble()
for dom in regions:
file_not_created, num_attempts = True, 0
while file_not_created and num_attempts <= 3:
newPlot.domain = dom
newPlot.createFilename()
fname = newPlot.outfile
log('Loading Map for %s'%newPlot.domain)
newPlot.loadMap()
log('Plotting Data')
if newPlot.opts['interp']:
newPlot.plotInterp()
else:
newPlot.plotFields()
newPlot.plotTitleTimes()
log('Writing Image')
newPlot.saveFigure(trans=newPlot.opts['over'])
if os.path.exists(fname):
file_not_created = False
log('Created %s, %.1f KB'%(fname,os.stat(fname).st_size/1000.0))
num_attempts += 1
etime = time.time()
log('End Plotting (took %.2f sec)'%(etime-stime))