|
setplot_island_topo.py.html |
|
|
Source file: setplot_island_topo.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.
|
"""
For figure showing the island topography only.
Set up the plot figures, axes, and items to be done for each frame.
This module is imported by the plotting routines and then the
function setplot is called to set the plot parameters.
"""
from pyclaw.geotools import topotools
from mapper import latlong
from pyclaw.data import Data
probdata = Data('setprob.data')
theta_island = probdata.theta_island
geodata = Data('setgeo.data')
Rearth = geodata.Rearth
#--------------------------
def setplot(plotdata):
#--------------------------
"""
Specify what is to be plotted at each frame.
Input: plotdata, an instance of pyclaw.plotters.data.ClawPlotData.
Output: a modified version of plotdata.
"""
from pyclaw.plotters import colormaps, geoplot
from numpy import linspace
plotdata.clearfigures() # clear any old figures,axes,items data
# To plot gauge locations on pcolor or contour plot, use this as
# an afteraxis function:
def addgauges(current_data):
from pyclaw.plotters import gaugetools
reload(gaugetools)
gaugetools.plot_gauge_locations(current_data.plotdata, \
gaugenos='all', format_string='ko', add_labels=True, \
markersize=8, fontsize=20)
#-----------------------------------------
# Figure for zoom
#-----------------------------------------
plotfigure = plotdata.new_plotfigure(name='Zoom1', figno=7)
# Set up for axes in this figure:
plotaxes = plotfigure.new_plotaxes('zoom on island')
plotaxes.title = 'Zoom1'
plotaxes.scaled = True
xisland,yisland = latlong(1600e3, theta_island, 40., Rearth)
plotaxes.xlimits = [xisland-0.6, xisland+0.6]
plotaxes.ylimits = [yisland-0.6, yisland+0.6]
def fixup(current_data):
import pylab
addgauges(current_data)
if theta_island==220:
testtitle = 'Bathymetry for Test 1'
elif theta_island==260:
testtitle = 'Bathymetry for Test 2'
else:
testtitle = 'Bathymetry'
pylab.title(testtitle,fontsize=20)
pylab.xticks(fontsize=15)
pylab.yticks(fontsize=15)
plotaxes.afteraxes = fixup
# Land
plotitem = plotaxes.new_plotitem(plot_type='2d_pcolor')
plotitem.plot_var = geoplot.land
plotitem.pcolor_cmap = colormaps.all_white # to print better in B&W
#plotitem.pcolor_cmap = geoplot.land_colors
plotitem.pcolor_cmin = 0.0
plotitem.pcolor_cmax = 100.0
plotitem.add_colorbar = False
plotitem.amr_gridlines_show = [0,0,0,1,0]
plotitem.gridedges_show = 0
# add contour lines of bathy if desired:
plotitem = plotaxes.new_plotitem(plot_type='2d_contour')
plotitem.show = True
plotitem.plot_var = geoplot.topo
plotitem.contour_levels = [-160, -120, -80, -40, 0.01]
#plotitem.contour_levels = [-150, -120, -90, -60, -30, 0.01]
plotitem.amr_contour_colors = ['k'] # color on each level
plotitem.kwargs = {'linewidths':2}
#plotitem.kwargs = {'linestyles':'dashed','linewidths':2}
plotitem.amr_contour_show = [0,0,0,1,0]
plotitem.amr_gridlines_show = [0]
plotitem.gridedges_show = 1
def printfigs(current_data):
import pylab
pylab.figure(7)
pylab.savefig('island_bathy_%s.png' % int(theta_island))
#pylab.savefig('island_bathy_%s.tif' % int(theta_island))
plotdata.afterframe = printfigs
#-----------------------------------------
# Parameters used only when creating html and/or latex hardcopy
# e.g., via pyclaw.plotters.frametools.printframes:
plotdata.printfigs = True # print figures
plotdata.print_format = 'png' # file format
plotdata.print_framenos = 'all' # list of frames to print
plotdata.print_gaugenos = 'all' # list of gauges to print
plotdata.print_fignos = 'all' # list of figures to print
plotdata.html = True # create html files of plots?
plotdata.html_homelink = '../README.html' # pointer for top of index
plotdata.latex = True # create latex file of plots?
plotdata.latex_figsperline = 2 # layout of plots
plotdata.latex_framesperline = 1 # layout of plots
plotdata.latex_makepdf = False # also run pdflatex?
return plotdata