Skip to content

Commit

Permalink
Merge pull request #238 from rjleveque/setplot_fixes
Browse files Browse the repository at this point in the history
make plotdata an optional argument in setplot
  • Loading branch information
mandli authored Dec 22, 2016
2 parents 004f09c + d437d61 commit 09a3948
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 7 deletions.
9 changes: 8 additions & 1 deletion examples/multi-layer/plane_wave/setplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"""

from __future__ import absolute_import
def setplot(plotdata, bathy_location=0.15, bathy_angle=0.0,

def setplot(plotdata=None, bathy_location=0.15, bathy_angle=0.0,
bathy_left=-1.0, bathy_right=-0.2):
"""Setup the plotting data objects.
Expand All @@ -32,6 +33,11 @@ def setplot(plotdata, bathy_location=0.15, bathy_angle=0.0,

import clawpack.geoclaw.multilayer.plot as ml_plot

if plotdata is None:
from clawpack.visclaw.data import ClawPlotData
plotdata = ClawPlotData()


# Load data from output
clawdata = clawutil.ClawInputData(2)
clawdata.read(os.path.join(plotdata.outdir,'claw.data'))
Expand Down Expand Up @@ -604,6 +610,7 @@ def bottom_speed(current_data):
plotdata.latex_figsperline = 2 # layout of plots
plotdata.latex_framesperline = 1 # layout of plots
plotdata.latex_makepdf = False # also run pdflatex?
plotdata.parallel = True # make multiple frame png's at once

return plotdata

Expand Down
10 changes: 9 additions & 1 deletion examples/storm-surge/ike/setplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,16 @@
- datetime.datetime(2008,1,1,0))
gauge_landfall.append(days2seconds(4.25))

def setplot(plotdata):
#--------------------------
def setplot(plotdata=None):
#--------------------------

r"""Setplot function for surge plotting"""

if plotdata is None:
from clawpack.visclaw.data import ClawPlotData
plotdata = ClawPlotData()


plotdata.clearfigures() # clear any old figures,axes,items data
plotdata.format = 'binary'
Expand Down Expand Up @@ -676,6 +683,7 @@ def gauge_after_axes(cd):
plotdata.latex_figsperline = 2 # layout of plots
plotdata.latex_framesperline = 1 # layout of plots
plotdata.latex_makepdf = False # also run pdflatex?
plotdata.parallel = True # make multiple frame png's at once

return plotdata

13 changes: 10 additions & 3 deletions examples/tsunami/bowl-radial/setplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from __future__ import absolute_import
from __future__ import print_function

try:
from setplotfg import setplotfg
except:
Expand All @@ -18,7 +19,7 @@


#--------------------------
def setplot(plotdata):
def setplot(plotdata=None):
#--------------------------

"""
Expand All @@ -28,11 +29,18 @@ def setplot(plotdata):
"""

if plotdata is None:
from clawpack.visclaw.data import ClawPlotData
plotdata = ClawPlotData()


from clawpack.visclaw import colormaps, geoplot

plotdata.clearfigures() # clear any old figures,axes,items data

plotdata.format = 'ascii' # Format of output
# plotdata.format = 'netcdf'

def set_drytol(current_data):
# The drytol parameter is used in masking land and water and
# affects what color map is used for cells with small water depth h.
Expand Down Expand Up @@ -337,8 +345,7 @@ def q_vs_radius(current_data):
plotdata.latex_figsperline = 2 # layout of plots
plotdata.latex_framesperline = 1 # layout of plots
plotdata.latex_makepdf = False # also run pdflatex?
plotdata.format = 'ascii' # Format of output
# plotdata.format = 'netcdf'
plotdata.parallel = True # make multiple frame png's at once

return plotdata

Expand Down
8 changes: 7 additions & 1 deletion examples/tsunami/bowl-slosh/setplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
omega = numpy.sqrt(2.*grav*h0) / a

#--------------------------
def setplot(plotdata):
def setplot(plotdata=None):
#--------------------------

"""
Expand All @@ -29,6 +29,11 @@ def setplot(plotdata):

from clawpack.visclaw import colormaps, geoplot

if plotdata is None:
from clawpack.visclaw.data import ClawPlotData
plotdata = ClawPlotData()


plotdata.clearfigures() # clear any old figures,axes,items data

def set_drytol(current_data):
Expand Down Expand Up @@ -171,6 +176,7 @@ def xsec(current_data):
plotdata.latex_figsperline = 2 # layout of plots
plotdata.latex_framesperline = 1 # layout of plots
plotdata.latex_makepdf = False # also run pdflatex?
plotdata.parallel = True # make multiple frame png's at once

return plotdata

Expand Down
8 changes: 7 additions & 1 deletion examples/tsunami/chile2010/setplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
print("*** Could not load DART data file")

#--------------------------
def setplot(plotdata):
def setplot(plotdata=None):
#--------------------------

"""
Expand All @@ -35,6 +35,11 @@ def setplot(plotdata):
from clawpack.visclaw import colormaps, geoplot
from numpy import linspace

if plotdata is None:
from clawpack.visclaw.data import ClawPlotData
plotdata = ClawPlotData()


plotdata.clearfigures() # clear any old figures,axes,items data


Expand Down Expand Up @@ -171,6 +176,7 @@ def add_zeroline(current_data):
plotdata.latex_figsperline = 2 # layout of plots
plotdata.latex_framesperline = 1 # layout of plots
plotdata.latex_makepdf = False # also run pdflatex?
plotdata.parallel = True # make multiple frame png's at once

return plotdata

0 comments on commit 09a3948

Please sign in to comment.