From 62adc4a14155c3600ddb8c9c94d2dc43dade6378 Mon Sep 17 00:00:00 2001 From: Randy LeVeque Date: Wed, 21 Dec 2016 23:40:01 -0800 Subject: [PATCH 1/2] update setplot to allow plotdata=None --- examples/multi-layer/plane_wave/setplot.py | 8 +++++++- examples/storm-surge/ike/setplot.py | 9 ++++++++- examples/tsunami/bowl-radial/setplot.py | 7 ++++++- examples/tsunami/bowl-slosh/setplot.py | 7 ++++++- examples/tsunami/chile2010/setplot.py | 7 ++++++- 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/examples/multi-layer/plane_wave/setplot.py b/examples/multi-layer/plane_wave/setplot.py index 16cb9137d..241dbd5a8 100644 --- a/examples/multi-layer/plane_wave/setplot.py +++ b/examples/multi-layer/plane_wave/setplot.py @@ -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. @@ -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')) diff --git a/examples/storm-surge/ike/setplot.py b/examples/storm-surge/ike/setplot.py index 5f6dcf1b6..7362b66cf 100644 --- a/examples/storm-surge/ike/setplot.py +++ b/examples/storm-surge/ike/setplot.py @@ -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' diff --git a/examples/tsunami/bowl-radial/setplot.py b/examples/tsunami/bowl-radial/setplot.py index e4a521722..bf2e1f194 100644 --- a/examples/tsunami/bowl-radial/setplot.py +++ b/examples/tsunami/bowl-radial/setplot.py @@ -10,6 +10,7 @@ from __future__ import absolute_import from __future__ import print_function + try: from setplotfg import setplotfg except: @@ -18,7 +19,7 @@ #-------------------------- -def setplot(plotdata): +def setplot(plotdata=None): #-------------------------- """ @@ -28,6 +29,10 @@ def setplot(plotdata): """ + if plotdata is None: + from clawpack.visclaw.data import ClawPlotData + plotdata = ClawPlotData() + from clawpack.visclaw import colormaps, geoplot diff --git a/examples/tsunami/bowl-slosh/setplot.py b/examples/tsunami/bowl-slosh/setplot.py index 2a9f7a80e..c317bb0cc 100644 --- a/examples/tsunami/bowl-slosh/setplot.py +++ b/examples/tsunami/bowl-slosh/setplot.py @@ -16,7 +16,7 @@ omega = numpy.sqrt(2.*grav*h0) / a #-------------------------- -def setplot(plotdata): +def setplot(plotdata=None): #-------------------------- """ @@ -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): diff --git a/examples/tsunami/chile2010/setplot.py b/examples/tsunami/chile2010/setplot.py index 43ffd104e..0db16a51f 100644 --- a/examples/tsunami/chile2010/setplot.py +++ b/examples/tsunami/chile2010/setplot.py @@ -21,7 +21,7 @@ print("*** Could not load DART data file") #-------------------------- -def setplot(plotdata): +def setplot(plotdata=None): #-------------------------- """ @@ -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 From d437d614413ae232d1aadcaced4e8c5bf0771994 Mon Sep 17 00:00:00 2001 From: Randy LeVeque Date: Wed, 21 Dec 2016 23:52:46 -0800 Subject: [PATCH 2/2] add plotdata.parallel = True to setplot files --- examples/multi-layer/plane_wave/setplot.py | 1 + examples/storm-surge/ike/setplot.py | 1 + examples/tsunami/bowl-radial/setplot.py | 6 ++++-- examples/tsunami/bowl-slosh/setplot.py | 1 + examples/tsunami/chile2010/setplot.py | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/multi-layer/plane_wave/setplot.py b/examples/multi-layer/plane_wave/setplot.py index 241dbd5a8..04d83e067 100644 --- a/examples/multi-layer/plane_wave/setplot.py +++ b/examples/multi-layer/plane_wave/setplot.py @@ -610,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 diff --git a/examples/storm-surge/ike/setplot.py b/examples/storm-surge/ike/setplot.py index 7362b66cf..8ad48c439 100644 --- a/examples/storm-surge/ike/setplot.py +++ b/examples/storm-surge/ike/setplot.py @@ -683,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 diff --git a/examples/tsunami/bowl-radial/setplot.py b/examples/tsunami/bowl-radial/setplot.py index bf2e1f194..b2f94e332 100644 --- a/examples/tsunami/bowl-radial/setplot.py +++ b/examples/tsunami/bowl-radial/setplot.py @@ -38,6 +38,9 @@ def setplot(plotdata=None): 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. @@ -342,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 diff --git a/examples/tsunami/bowl-slosh/setplot.py b/examples/tsunami/bowl-slosh/setplot.py index c317bb0cc..a435f2972 100644 --- a/examples/tsunami/bowl-slosh/setplot.py +++ b/examples/tsunami/bowl-slosh/setplot.py @@ -176,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 diff --git a/examples/tsunami/chile2010/setplot.py b/examples/tsunami/chile2010/setplot.py index 0db16a51f..d1773667a 100644 --- a/examples/tsunami/chile2010/setplot.py +++ b/examples/tsunami/chile2010/setplot.py @@ -176,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