make_figures.py.html CLAWPACK  
 Source file:   make_figures.py
 Directory:   /var/www/html/clawpack/links/awr11/radial-ocean-island
 Converted:   Sat Mar 5 2011 at 20:51:33   using clawcode2html
 This documentation file will not reflect any later changes in the source file.

 
"""
Make figures for the paper.
"""

from pyclaw.plotters.data import ClawPlotData
from pyclaw.plotters.frametools import plotframe


from pylab import *
import os,sys,glob

run_code = False   # set to False if _output_220 and _output_260 exist already

figdir = 'figures'
if os.path.isfile(figdir):
    print "*** Error figure directory exists as a file: ",figdir
    raise

if not os.path.isdir(figdir):
    os.system('mkdir %s' % figdir)

def savefigs(fname):
    fname1 = fname + '.png'
    savefig(os.path.join(figdir,fname1))
    #fname2 = fname + '.tif'
    #savefig(os.path.join(figdir,fname2))



# Test 1
# ======

os.system("rm -f .data .output")
os.system("make topo -f Makefile_220")

if run_code:
    print "Running   'make .output -f Makefile_220'"
    os.system("make .output -f Makefile_220")


print "Making figures"

os.system("make .data -f Makefile_220")
plotdata = ClawPlotData()
import setplot
reload(setplot)
plotdata = setplot.setplot(plotdata)
plotdata.outdir = "_output_220"

plotframe(5, plotdata)
figure(0)

text(-13,41,'Level 1')
text(-7,41,'2')
text(-4.5,41,'3')

savefigs('theta220_t5_withlevels')

plotframe(10, plotdata)
figure(0)
savefigs('theta220_t10_ocean')
figure(7)
savefigs('theta220_t10')

plotframe(12, plotdata)
figure(7)
savefigs('theta220_t12')

import setplot_island_topo
reload(setplot_island_topo)
plotdata = setplot_island_topo.setplot(plotdata)
plotframe(11, plotdata)
figure(7)


# Test 2
# ======


os.system("rm -f .data .output")
os.system("make topo -f Makefile_260")

if run_code:
    print "Running   'make .output -f Makefile_260'"
    os.system("make .output -f Makefile_260")

print "Making figures"
reload(setplot)
plotdata = setplot.setplot(plotdata)
plotdata.outdir = "_output_260"
plotdata.plotdir = figdir


os.system("make .data -f Makefile_260")

plotframe(10, plotdata)
figure(7)
savefigs('theta260_t10')

plotframe(12, plotdata)
figure(7)
savefigs('theta260_t12')

reload(setplot_island_topo)
plotdata = setplot_island_topo.setplot(plotdata)
plotframe(11, plotdata)
figure(7)
os.system("mv island_bathy* %s" % figdir)


execfile("compare_gauges.py")
os.system("mv gauges1-2.* %s" % figdir)
os.system("mv gauges3-4.* %s" % figdir)


execfile("plot_ocean.py")
print "mv ocean.png %s" % figdir
os.system("mv ocean.png %s" % figdir)
os.system("mv ocean.tif %s" % figdir)

execfile("plot_xsec.py")
os.system("mv topo*.png %s" % figdir)
os.system("mv topo*.tif %s" % figdir)

print "Created ocean and cross section plots in directory ",figdir