def __init__(self, run_number=1, wave_tolerance=1.0, deep_depth=300.0):

        super(SweepJob, self).__init__(time=720)

        self.omp_num_threads = 16

        self.run_number = run_number
        self.type = 'sweep'
        self.name = 'wave_deep_01'
        self.prefix = 'run_%s_wave_%s_deep_%s' % (self.run_number,
                                                  wave_tolerance, deep_depth)
        self.executable = 'xgeoclaw'

        self.group = 'yetiapam'

        import setrun
        self.rundata = setrun.setrun()

        # incorporate storm parameters
        self.rundata.add_data(surge.SurgeData(), 'stormdata')
        setrun.set_storm(self.rundata)
        self.rundata.add_data(surge.FrictionData(), 'frictiondata')
        setrun.set_friction(self.rundata)

        ### modify setrun parameters here ###
        refine_data = self.rundata.refinement_data
        refine_data.wave_tolerance = wave_tolerance
        refine_data.deep_depth = deep_depth
Esempio n. 2
0
    def __init__(self,
                 run_number=1,
                 wave_tolerance=1.0,
                 deep_depth=300.0,
                 speed_tolerance=False):

        super(SweepJob, self).__init__(time=24 * 60, memory=15000)

        self.omp_num_threads = 16

        self.run_number = run_number
        self.type = 'sweep'
        if speed_tolerance:
            self.name = 'wave_deep_speed_l5'
        else:
            self.name = 'wave_deep_no_speed_l5'
        self.prefix = 'run_%s_wave_%s_deep_%s' % (self.run_number,
                                                  wave_tolerance, deep_depth)
        self.executable = 'xgeoclaw'

        self.group = 'yetiapam'

        import setrun
        self.rundata = setrun.setrun()

        # incorporate storm parameters
        self.rundata.add_data(surge.SurgeData(), 'stormdata')
        setrun.set_storm(self.rundata)
        self.rundata.add_data(surge.FrictionData(), 'frictiondata')
        setrun.set_friction(self.rundata)

        ### modify setrun parameters here ###
        refine_data = self.rundata.refinement_data
        refine_data.wave_tolerance = wave_tolerance
        refine_data.deep_depth = deep_depth
        if not speed_tolerance:
            refine_data.speed_tolerance = [999999
                                           ]  #big number so it never triggers

        amrdata = self.rundata.amrdata
        amrdata.amr_levels_max = 5
Esempio n. 3
0
def setplot(plotdata):
    r"""Setplot function for surge plotting"""

    plotdata.clearfigures()  # clear any old figures,axes,items data
    plotdata.format = 'binary'

    fig_num_counter = surgeplot.figure_counter()

    # Load data from output
    clawdata = clawutil.ClawInputData(2)
    clawdata.read(os.path.join(plotdata.outdir, 'claw.data'))
    amrdata = amrclaw.AmrclawInputData(clawdata)
    amrdata.read(os.path.join(plotdata.outdir, 'amr.data'))
    physics = geodata.GeoClawData()
    physics.read(os.path.join(plotdata.outdir, 'geoclaw.data'))
    surge_data = surgedata.SurgeData()
    surge_data.read(os.path.join(plotdata.outdir, 'surge.data'))
    friction_data = surgedata.FrictionData()
    friction_data.read(os.path.join(plotdata.outdir, 'friction.data'))

    # Load storm track
    track = surgeplot.track_data(os.path.join(plotdata.outdir, 'fort.track'))

    # Calculate landfall time, off by a day, maybe leap year issue?
    landfall_dt = datetime.datetime(2008, 9, 13, 7) - datetime.datetime(
        2008, 1, 1, 0)
    landfall = (landfall_dt.days - 1.0) * 24.0 * 60**2 + landfall_dt.seconds

    # Set afteraxes function
    surge_afteraxes = lambda cd: surgeplot.surge_afteraxes(
        cd, track, landfall, plot_direction=False)

    # Color limits
    surface_range = 5.0
    speed_range = 3.0
    eta = physics.sea_level
    if not isinstance(eta, list):
        eta = [eta]
    surface_limits = [eta[0] - surface_range, eta[0] + surface_range]
    # surface_contours = numpy.linspace(-surface_range, surface_range,11)
    surface_contours = [
        -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 0.5, 1, 1.5, 2, 2.5,
        3, 3.5, 4, 4.5, 5
    ]
    surface_ticks = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
    surface_labels = [str(value) for value in surface_ticks]
    speed_limits = [0.0, speed_range]
    speed_contours = numpy.linspace(0.0, speed_range, 13)
    speed_ticks = [0, 1, 2, 3]
    speed_labels = [str(value) for value in speed_ticks]

    wind_limits = [0, 64]
    # wind_limits = [-0.002,0.002]
    pressure_limits = [935, 1013]
    friction_bounds = [0.01, 0.04]

    # vorticity_limits = [-1.e-2,1.e-2]

    # def pcolor_afteraxes(current_data):
    #     surge_afteraxes(current_data)
    #     surge.plot.gauge_locations(current_data,gaugenos=[6])

    def contour_afteraxes(current_data):
        surge_afteraxes(current_data)

    def add_custom_colorbar_ticks_to_axes(axes,
                                          item_name,
                                          ticks,
                                          tick_labels=None):
        axes.plotitem_dict[item_name].colorbar_ticks = ticks
        axes.plotitem_dict[item_name].colorbar_tick_labels = tick_labels

    # ==========================================================================
    # ==========================================================================
    #   Plot specifications
    # ==========================================================================
    # ==========================================================================

    # ========================================================================
    #  Entire Gulf
    # ========================================================================
    gulf_xlimits = [clawdata.lower[0], clawdata.upper[0]]
    gulf_ylimits = [clawdata.lower[1], clawdata.upper[1]]
    gulf_shrink = 0.9

    def gulf_after_axes(cd):
        plt.subplots_adjust(left=0.08, bottom=0.04, right=0.97, top=0.96)
        surge_afteraxes(cd)

    #
    #  Surface
    #
    plotfigure = plotdata.new_plotfigure(name='Surface - Entire Domain',
                                         figno=fig_num_counter.get_counter())
    plotfigure.show = True

    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.title = 'Surface'
    plotaxes.scaled = True
    plotaxes.xlimits = gulf_xlimits
    plotaxes.ylimits = gulf_ylimits
    plotaxes.afteraxes = gulf_after_axes

    surgeplot.add_surface_elevation(plotaxes,
                                    plot_type='contourf',
                                    contours=surface_contours,
                                    shrink=gulf_shrink)
    surgeplot.add_land(plotaxes, topo_min=-10.0, topo_max=5.0)
    # surge.plot.add_bathy_contours(plotaxes)
    if article:
        plotaxes.plotitem_dict['surface'].add_colorbar = False
    else:
        add_custom_colorbar_ticks_to_axes(plotaxes, 'surface', surface_ticks,
                                          surface_labels)
    plotaxes.plotitem_dict['surface'].amr_patchedges_show = [
        1, 1, 1, 1, 1, 1, 1, 1
    ]

    #
    #  Water Speed
    #
    plotfigure = plotdata.new_plotfigure(name='Currents - Entire Domain',
                                         figno=fig_num_counter.get_counter())
    plotfigure.show = True

    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.title = 'Currents'
    plotaxes.scaled = True
    plotaxes.xlimits = gulf_xlimits
    plotaxes.ylimits = gulf_ylimits
    plotaxes.afteraxes = gulf_after_axes

    # Speed
    surgeplot.add_speed(plotaxes,
                        plot_type='contourf',
                        contours=speed_contours,
                        shrink=gulf_shrink)
    if article:
        plotaxes.plotitem_dict['speed'].add_colorbar = False
    else:
        add_custom_colorbar_ticks_to_axes(plotaxes, 'speed', speed_ticks,
                                          speed_labels)

    # Land
    surgeplot.add_land(plotaxes)
    surgeplot.add_bathy_contours(plotaxes)

    #
    # Friction field
    #
    plotfigure = plotdata.new_plotfigure(name='Friction',
                                         figno=fig_num_counter.get_counter())
    plotfigure.show = friction_data.variable_friction and True

    def friction_after_axes(cd):
        plt.subplots_adjust(left=0.08, bottom=0.04, right=0.97, top=0.96)
        plt.title(r"Manning's $n$ Coefficient")
        # surge_afteraxes(cd)

    plotaxes = plotfigure.new_plotaxes()
    plotaxes.xlimits = gulf_xlimits
    plotaxes.ylimits = gulf_ylimits
    # plotaxes.title = "Manning's N Coefficient"
    plotaxes.afteraxes = friction_after_axes
    plotaxes.scaled = True

    surgeplot.add_friction(plotaxes, bounds=friction_bounds, shrink=0.9)
    plotaxes.plotitem_dict['friction'].amr_patchedges_show = [
        0, 0, 0, 0, 0, 0, 0
    ]
    plotaxes.plotitem_dict['friction'].colorbar_label = "$n$"

    # ========================================================================
    #  LaTex Shelf
    # ========================================================================
    latex_xlimits = [-97.5, -88.5]
    latex_ylimits = [27.5, 30.5]
    latex_shrink = 1.0

    def latex_after_axes(cd):
        if article:
            plt.subplots_adjust(left=0.07, bottom=0.14, right=1.0, top=0.86)
        else:
            plt.subplots_adjust(right=1.0)
        surge_afteraxes(cd)

    #
    # Surface
    #
    plotfigure = plotdata.new_plotfigure(name='Surface - LaTex Shelf',
                                         figno=fig_num_counter.get_counter())
    plotfigure.show = True
    if article:
        plotfigure.kwargs = {'figsize': (8, 2.7), 'facecolor': 'none'}
    else:
        plotfigure.kwargs = {'figsize': (9, 2.7), 'facecolor': 'none'}

    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.title = 'Surface'
    plotaxes.scaled = True
    plotaxes.xlimits = latex_xlimits
    plotaxes.ylimits = latex_ylimits
    plotaxes.afteraxes = latex_after_axes
    surgeplot.add_surface_elevation(plotaxes,
                                    plot_type='contourf',
                                    contours=surface_contours,
                                    shrink=latex_shrink)

    if article:
        plotaxes.plotitem_dict['surface'].add_colorbar = False
        # plotaxes.afteraxes = lambda cd: article_latex_after_axes(cd, landfall)
    else:
        add_custom_colorbar_ticks_to_axes(
            plotaxes, 'surface', [-5, -2.5, 0, 2.5, 5.0],
            ["-5.0", "-2.5", " 0", " 2.5", " 5.0"])
    # plotaxes.plotitem_dict['surface'].contour_cmap = plt.get_cmap('OrRd')
    # surge.plot.add_surface_elevation(plotaxes,plot_type='contour')
    surgeplot.add_land(plotaxes)
    # plotaxes.plotitem_dict['surface'].amr_patchedges_show = [1,1,1,0,0,0,0]
    plotaxes.plotitem_dict['surface'].amr_patchedges_show = [
        0, 0, 0, 0, 0, 0, 0
    ]
    # plotaxes.plotitem_dict['land'].amr_patchedges_show = [1,1,1,0,0,0,0]
    plotaxes.plotitem_dict['land'].amr_patchedges_show = [0, 0, 0, 0, 0, 0, 0]

    # Plot using jet and 0.0 to 5.0 to match figgen generated ADCIRC results
    # plotaxes.plotitem_dict['surface'].pcolor_cmin = 0.0
    # plotaxes.plotitem_dict['surface'].pcolor_cmax = 5.0
    # plotaxes.plotitem_dict['surface'].pcolor_cmap = plt.get_cmap('jet')

    #
    # Water Speed
    #
    plotfigure = plotdata.new_plotfigure(name='Currents - LaTex Shelf',
                                         figno=fig_num_counter.get_counter())
    plotfigure.show = True
    if article:
        plotfigure.kwargs = {'figsize': (8, 2.7), 'facecolor': 'none'}
    else:
        plotfigure.kwargs = {'figsize': (9, 2.7), 'facecolor': 'none'}

    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.title = 'Currents'
    plotaxes.scaled = True
    plotaxes.xlimits = latex_xlimits
    plotaxes.ylimits = latex_ylimits
    plotaxes.afteraxes = latex_after_axes
    surgeplot.add_speed(plotaxes,
                        plot_type='contourf',
                        contours=speed_contours,
                        shrink=latex_shrink)

    if article:
        plotaxes.plotitem_dict['speed'].add_colorbar = False
    else:
        add_custom_colorbar_ticks_to_axes(plotaxes, 'speed', speed_ticks,
                                          speed_labels)
    # surge.plot.add_surface_elevation(plotaxes,plot_type='contour')
    surgeplot.add_land(plotaxes)
    # plotaxes.plotitem_dict['speed'].amr_patchedges_show = [1,1,0,0,0,0,0]
    # plotaxes.plotitem_dict['land'].amr_patchedges_show = [1,1,1,0,0,0,0]
    plotaxes.plotitem_dict['speed'].amr_patchedges_show = [0, 0, 0, 0, 0, 0, 0]
    plotaxes.plotitem_dict['land'].amr_patchedges_show = [0, 0, 0, 0, 0, 0, 0]

    # ========================================================================
    #  Houston/Galveston
    # ========================================================================
    houston_xlimits = [-(95.0 + 26.0 / 60.0), -(94.0 + 25.0 / 60.0)]
    houston_ylimits = [29.1, 29.0 + 55.0 / 60.0]
    houston_shrink = 0.9

    def houston_after_axes(cd):
        if article:
            plt.subplots_adjust(left=0.05, bottom=0.07, right=0.99, top=0.92)
        else:
            plt.subplots_adjust(left=0.12, bottom=0.06, right=0.97, top=0.97)
        surge_afteraxes(cd)
        # surge.plot.gauge_locations(cd)

    #
    # Surface Elevations
    #
    plotfigure = plotdata.new_plotfigure(name='Surface - Houston/Galveston',
                                         figno=fig_num_counter.get_counter())
    plotfigure.show = True
    # if article:
    #     plotfigure.kwargs['figsize'] =

    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.title = 'Surface'
    plotaxes.scaled = True
    plotaxes.xlimits = houston_xlimits
    plotaxes.ylimits = houston_ylimits
    plotaxes.afteraxes = houston_after_axes
    surgeplot.add_surface_elevation(plotaxes,
                                    plot_type='contourf',
                                    contours=surface_contours,
                                    shrink=houston_shrink)

    if article:
        plotaxes.plotitem_dict['surface'].add_colorbar = False
    else:
        add_custom_colorbar_ticks_to_axes(plotaxes, 'surface', surface_ticks,
                                          surface_labels)
    surgeplot.add_land(plotaxes)
    plotaxes.plotitem_dict['surface'].amr_patchedges_show = [
        0, 0, 0, 0, 0, 0, 0
    ]
    plotaxes.plotitem_dict['land'].amr_patchedges_show = [0, 0, 0, 0, 0, 0, 0]
    # surge.plot.add_bathy_contours(plotaxes)

    # Plot using jet and 0.0 to 5.0 to match figgen generated ADCIRC results
    # plotaxes.plotitem_dict['surface'].pcolor_cmin = 0.0
    # plotaxes.plotitem_dict['surface'].pcolor_cmax = 5.0
    # plotaxes.plotitem_dict['surface'].pcolor_cmap = plt.get_cmap('jet')

    #
    # Water Speed
    #
    plotfigure = plotdata.new_plotfigure(name='Currents - Houston/Galveston',
                                         figno=fig_num_counter.get_counter())
    plotfigure.show = True

    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.title = 'Currents'
    plotaxes.scaled = True
    plotaxes.xlimits = houston_xlimits
    plotaxes.ylimits = houston_ylimits
    plotaxes.afteraxes = houston_after_axes
    surgeplot.add_speed(plotaxes,
                        plot_type='contourf',
                        contours=speed_contours,
                        shrink=houston_shrink)

    if article:
        plotaxes.plotitem_dict['speed'].add_colorbar = False
    else:
        add_custom_colorbar_ticks_to_axes(plotaxes, 'speed', speed_ticks,
                                          speed_labels)
    surgeplot.add_land(plotaxes)
    # surge.plot.add_bathy_contours(plotaxes)
    # plotaxes.plotitem_dict['speed'].amr_patchedges_show = [1,1,1,1,1,1,1,1]
    # plotaxes.plotitem_dict['land'].amr_patchedges_show = [1,1,1,1,1,1,1,1]
    plotaxes.plotitem_dict['speed'].amr_patchedges_show = [0, 0, 0, 0, 0, 0, 0]
    plotaxes.plotitem_dict['land'].amr_patchedges_show = [0, 0, 0, 0, 0, 0, 0]

    # ==========================
    #  Hurricane Forcing fields
    # ==========================

    # Pressure field
    plotfigure = plotdata.new_plotfigure(name='Pressure',
                                         figno=fig_num_counter.get_counter())
    plotfigure.show = surge_data.pressure_forcing and True

    plotaxes = plotfigure.new_plotaxes()
    plotaxes.xlimits = gulf_xlimits
    plotaxes.ylimits = gulf_ylimits
    plotaxes.title = "Pressure Field"
    plotaxes.afteraxes = gulf_after_axes
    plotaxes.scaled = True
    surgeplot.add_pressure(plotaxes,
                           bounds=pressure_limits,
                           shrink=gulf_shrink)
    surgeplot.add_land(plotaxes)

    # Wind field
    plotfigure = plotdata.new_plotfigure(name='Wind Speed',
                                         figno=fig_num_counter.get_counter())
    plotfigure.show = surge_data.wind_forcing and True

    plotaxes = plotfigure.new_plotaxes()
    plotaxes.xlimits = gulf_xlimits
    plotaxes.ylimits = gulf_ylimits
    plotaxes.title = "Wind Field"
    plotaxes.afteraxes = gulf_after_axes
    plotaxes.scaled = True
    surgeplot.add_wind(plotaxes,
                       bounds=wind_limits,
                       plot_type='pcolor',
                       shrink=gulf_shrink)
    surgeplot.add_land(plotaxes)

    # ========================================================================
    #  Figures for gauges
    # ========================================================================
    plotfigure = plotdata.new_plotfigure(name='Surface & topo', figno=300, \
                    type='each_gauge')
    plotfigure.show = True
    plotfigure.clf_each_gauge = True

    # plotfigure.kwargs['figsize'] = (16,10)

    def gauge_after_axes(cd):

        if cd.gaugeno in [1, 2, 3, 4]:
            axes = plt.gca()
            # # Add Kennedy gauge data
            # kennedy_gauge = kennedy_gauges[gauge_name_trans[cd.gaugeno]]
            # axes.plot(kennedy_gauge['t'] - seconds2days(date2seconds(gauge_landfall[0])),
            #          kennedy_gauge['mean_water'] + kennedy_gauge['depth'], 'k-',
            #          label='Gauge Data')

            # Add GeoClaw gauge data
            geoclaw_gauge = cd.gaugesoln
            axes.plot(seconds2days(geoclaw_gauge.t -
                                   date2seconds(gauge_landfall[1])),
                      geoclaw_gauge.q[3, :] + gauge_surface_offset[0],
                      'b--',
                      label="GeoClaw")

            # Add ADCIRC gauge data
            # ADCIRC_gauge = ADCIRC_gauges[kennedy_gauge['gauge_no']]
            # axes.plot(seconds2days(ADCIRC_gauge[:,0] - gauge_landfall[2]),
            #          ADCIRC_gauge[:,1] + gauge_surface_offset[1], 'r-.', label="ADCIRC")

            # Fix up plot
            axes.set_title('Station %s' % cd.gaugeno)
            axes.set_xlabel('Days relative to landfall')
            axes.set_ylabel('Surface (m)')
            axes.set_xlim([-2, 1])
            axes.set_ylim([-1, 5])
            axes.set_xticks([-2, -1, 0, 1])
            axes.set_xticklabels([r"$-2$", r"$-1$", r"$0$", r"$1$"])
            axes.grid(True)
            axes.legend()

            plt.hold(False)

        # surge.plot.gauge_afteraxes(cd)

    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.xlimits = [-2, 1]
    # plotaxes.xlabel = "Days from landfall"
    # plotaxes.ylabel = "Surface (m)"
    plotaxes.ylimits = [-1, 5]
    plotaxes.title = 'Surface'
    plotaxes.afteraxes = gauge_after_axes

    # Plot surface as blue curve:
    plotitem = plotaxes.new_plotitem(plot_type='1d_plot')
    plotitem.plot_var = 3
    plotitem.plotstyle = 'b-'

    # =====================
    #  Gauge Location Plot
    # =====================
    gauge_xlimits = [-95.5, -94]
    gauge_ylimits = [29.0, 30.0]
    gauge_location_shrink = 0.75

    def gauge_after_axes(cd):
        plt.subplots_adjust(left=0.12, bottom=0.06, right=0.97, top=0.97)
        surge_afteraxes(cd)
        surgeplot.gauge_locations(cd, gaugenos=[1, 2, 3, 4])
        plt.title("Gauge Locations")

    plotfigure = plotdata.new_plotfigure(name='Gauge Locations',
                                         figno=fig_num_counter.get_counter())
    plotfigure.show = True

    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.title = 'Surface'
    plotaxes.scaled = True
    plotaxes.xlimits = gauge_xlimits
    plotaxes.ylimits = gauge_ylimits
    plotaxes.afteraxes = gauge_after_axes
    surgeplot.add_surface_elevation(plotaxes,
                                    plot_type='contourf',
                                    contours=surface_contours,
                                    shrink=gauge_location_shrink)
    # surge.plot.add_surface_elevation(plotaxes, plot_type="contourf")
    add_custom_colorbar_ticks_to_axes(plotaxes, 'surface', surface_ticks,
                                      surface_labels)
    surgeplot.add_land(plotaxes)
    # plotaxes.plotitem_dict['surface'].amr_patchedges_show = [0,0,0,0,0,0,0]
    # plotaxes.plotitem_dict['surface'].add_colorbar = False
    # plotaxes.plotitem_dict['surface'].pcolor_cmap = plt.get_cmap('jet')
    # plotaxes.plotitem_dict['surface'].pcolor_cmap = plt.get_cmap('gist_yarg')
    # plotaxes.plotitem_dict['surface'].pcolor_cmin = 0.0
    # plotaxes.plotitem_dict['surface'].pcolor_cmax = 5.0
    plotaxes.plotitem_dict['surface'].amr_patchedges_show = [
        0, 0, 0, 0, 0, 0, 0
    ]
    plotaxes.plotitem_dict['land'].amr_patchedges_show = [0, 0, 0, 0, 0, 0, 0]

    # ==============================================================
    #  Debugging Plots, only really work if using interactive plots
    # ==============================================================
    #
    # Water Velocity Components
    #
    plotfigure = plotdata.new_plotfigure(
        name='Velocity Components - Entire Domain',
        figno=fig_num_counter.get_counter())
    plotfigure.show = False

    # X-Component
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.axescmd = "subplot(121)"
    plotaxes.title = 'Velocity, X-Component'
    plotaxes.scaled = True
    plotaxes.xlimits = gulf_xlimits
    plotaxes.ylimits = gulf_ylimits
    plotaxes.afteraxes = gulf_after_axes

    plotitem = plotaxes.new_plotitem(plot_type='2d_pcolor')
    plotitem.plot_var = surgeplot.water_u
    plotitem.pcolor_cmap = colormaps.make_colormap({
        1.0: 'r',
        0.5: 'w',
        0.0: 'b'
    })
    plotitem.pcolor_cmin = -speed_limits[1]
    plotitem.pcolor_cmax = speed_limits[1]
    plotitem.colorbar_shrink = gulf_shrink
    plotitem.add_colorbar = True
    plotitem.amr_celledges_show = [0, 0, 0]
    plotitem.amr_patchedges_show = [1, 1, 1]

    surgeplot.add_land(plotaxes)

    # Y-Component
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.axescmd = "subplot(122)"
    plotaxes.title = 'Velocity, Y-Component'
    plotaxes.scaled = True
    plotaxes.xlimits = gulf_xlimits
    plotaxes.ylimits = gulf_ylimits
    plotaxes.afteraxes = gulf_after_axes

    plotitem = plotaxes.new_plotitem(plot_type='2d_pcolor')
    plotitem.plot_var = surgeplot.water_v
    plotitem.pcolor_cmap = colormaps.make_colormap({
        1.0: 'r',
        0.5: 'w',
        0.0: 'b'
    })
    plotitem.pcolor_cmin = -speed_limits[1]
    plotitem.pcolor_cmax = speed_limits[1]
    plotitem.colorbar_shrink = gulf_shrink
    plotitem.add_colorbar = True
    plotitem.amr_celledges_show = [0, 0, 0]
    plotitem.amr_patchedges_show = [1, 1, 1]
    surgeplot.add_land(plotaxes)

    #
    # Depth
    #
    plotfigure = plotdata.new_plotfigure(name='Depth - Entire Domain',
                                         figno=fig_num_counter.get_counter())
    plotfigure.show = False

    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.title = 'depth'
    plotaxes.scaled = True
    plotaxes.xlimits = gulf_xlimits
    plotaxes.ylimits = gulf_ylimits
    plotaxes.afteraxes = gulf_after_axes

    plotitem = plotaxes.new_plotitem(plot_type='2d_imshow')
    plotitem.plot_var = 0
    plotitem.imshow_cmap = colormaps.make_colormap({
        1.0: 'r',
        0.5: 'w',
        0.0: 'b'
    })
    plotitem.imshow_cmin = 0
    plotitem.imshow_cmax = 100
    plotitem.colorbar_shrink = gulf_shrink
    plotitem.add_colorbar = True
    plotitem.amr_celledges_show = [0, 0, 0]
    plotitem.amr_patchedges_show = [1, 1, 1, 1, 1, 1, 1, 1, 1]

    # Surge field
    plotfigure = plotdata.new_plotfigure(name='Surge Field',
                                         figno=fig_num_counter.get_counter())
    plotfigure.show = ((surge_data.wind_forcing or surge_data.pressure_forcing)
                       and False)

    plotaxes = plotfigure.new_plotaxes()
    plotaxes.xlimits = gulf_xlimits
    plotaxes.ylimits = gulf_ylimits
    plotaxes.title = "Storm Surge Source Term S"
    plotaxes.afteraxes = gulf_after_axes
    plotaxes.scaled = True

    plotitem = plotaxes.new_plotitem(plot_type='2d_pcolor')
    plotitem.plot_var = surgeplot.pressure_field + 1
    plotitem.pcolor_cmap = plt.get_cmap('PuBu')
    plotitem.pcolor_cmin = 0.0
    plotitem.pcolor_cmax = 1e-3
    plotitem.add_colorbar = True
    plotitem.colorbar_shrink = gulf_shrink
    plotitem.colorbar_label = "Source Strength"
    plotitem.amr_celledges_show = [0, 0, 0]
    plotitem.amr_patchedges_show = [1, 1, 1, 1, 1, 0, 0]
    surgeplot.add_land(plotaxes)

    plotfigure = plotdata.new_plotfigure(name='Friction/Coriolis Source',
                                         figno=fig_num_counter.get_counter())
    plotfigure.show = False

    plotaxes = plotfigure.new_plotaxes()
    plotaxes.xlimits = gulf_xlimits
    plotaxes.ylimits = gulf_ylimits
    plotaxes.title = "Friction/Coriolis Source"
    plotaxes.afteraxes = surge_afteraxes
    plotaxes.scaled = True

    plotitem = plotaxes.new_plotitem(plot_type='2d_pcolor')
    plotitem.plot_var = surgeplot.pressure_field + 2
    plotitem.pcolor_cmap = plt.get_cmap('PuBu')
    plotitem.pcolor_cmin = 0.0
    plotitem.pcolor_cmax = 1e-3
    plotitem.add_colorbar = True
    plotitem.colorbar_shrink = gulf_shrink
    plotitem.colorbar_label = "Source Strength"
    plotitem.amr_celledges_show = [0, 0, 0]
    plotitem.amr_patchedges_show = [1, 1, 1, 1, 1, 0, 0]
    surgeplot.add_land(plotaxes)

    #-----------------------------------------

    # Parameters used only when creating html and/or latex hardcopy
    # e.g., via pyclaw.plotters.frametools.printframes:

    if article:
        plotdata.printfigs = True  # print figures
        plotdata.print_format = 'png'  # file format
        plotdata.print_framenos = [54, 60, 66, 72, 78,
                                   84]  # list of frames to print
        plotdata.print_gaugenos = [1, 2, 3, 4]  # list of gauges to print
        plotdata.print_fignos = [4, 5, 6, 7, 10, 3,
                                 300]  # 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 = False  # 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?

    else:
        plotdata.printfigs = True  # print figures
        plotdata.print_format = 'png'  # file format
        plotdata.print_framenos = 'all'  # list of frames to print
        plotdata.print_gaugenos = [1, 2, 3, 4]  # 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
Esempio n. 4
0
def set_friction(rundata):

    data = rundata.frictiondata

    # Variable friction
    data.variable_friction = True

    # Region based friction
    # Entire domain
    data.friction_regions.append([rundata.clawdata.lower, 
                                  rundata.clawdata.upper,
                                  [np.infty,0.0,-np.infty],
                                  [0.050, 0.025]])

    return data


if __name__ == '__main__':
    # Set up run-time parameters and write all data files.
    import sys
    if len(sys.argv) == 2:
        rundata = setrun(sys.argv[1])
    else:
        rundata = setrun()

    rundata.add_data(surge.SurgeData(),'stormdata')
    set_storm(rundata)
    rundata.add_data(surge.FrictionData(),'frictiondata')
    set_friction(rundata)

    rundata.write()
def setrun(claw_pkg='geoclaw'):
    #------------------------------
    """
    Define the parameters used for running Clawpack.

    INPUT:
        claw_pkg expected to be "geoclaw" for this setrun.

    OUTPUT:
        rundata - object of class ClawRunData

    """

    from clawpack.clawutil import data

    assert claw_pkg.lower() == 'geoclaw', "Expected claw_pkg = 'geoclaw'"

    num_dim = 2
    rundata = data.ClawRunData(claw_pkg, num_dim)

    #------------------------------------------------------------------
    # GeoClaw specific parameters:
    #------------------------------------------------------------------
    rundata = setgeo(rundata)

    rundata.add_data(multilayer.MultilayerData(), 'multilayer_data')
    set_multilayer(rundata)
    rundata.add_data(surge.FrictionData(), 'frictiondata')
    set_friction(rundata)
    rundata.add_data(surge.SurgeData(), 'stormdata')
    set_storm(rundata)

    #------------------------------------------------------------------
    # Standard Clawpack parameters to be written to claw.data:
    #   (or to amr2ez.data for AMR)
    #------------------------------------------------------------------
    clawdata = rundata.clawdata  # initialized when rundata instantiated

    # Set single grid parameters first.
    # See below for AMR parameters.

    # ---------------
    # Spatial domain:
    # ---------------

    # Number of space dimensions:
    clawdata.num_dim = num_dim

    # Lower and upper edge of computational domain:
    clawdata.lower[0] = -1  # west longitude
    clawdata.upper[0] = 2.0  # east longitude

    clawdata.lower[1] = -1.0  # south latitude
    clawdata.upper[1] = 2.0  # north latitude

    # Number of grid cells: Coarsest grid
    clawdata.num_cells[0] = 150
    clawdata.num_cells[1] = 150

    # ---------------
    # Size of system:
    # ---------------

    # Number of equations in the system:
    clawdata.num_eqn = 6

    # Number of auxiliary variables in the aux array (initialized in setaux)
    clawdata.num_aux = 4 + rundata.multilayer_data.num_layers
    if rundata.stormdata.storm_type > 0:
        clawdata.num_aux += 3

    # Index of aux array corresponding to capacity function, if there is one:
    clawdata.capa_index = 0

    # -------------
    # Initial time:
    # -------------

    clawdata.t0 = 0.0

    # Restart from checkpoint file of a previous run?
    # Note: If restarting, you must also change the Makefile to set:
    #    RESTART = True
    # If restarting, t0 above should be from original run, and the
    # restart_file 'fort.chkNNNNN' specified below should be in
    # the OUTDIR indicated in Makefile.

    clawdata.restart = False  # True to restart from prior results
    clawdata.restart_file = 'fort.chk00036'  # File to use for restart data

    # -------------
    # Output times:
    #--------------

    # Specify at what times the results should be written to fort.q files.
    # Note that the time integration stops after the final output time.
    # The solution at initial time t0 is always written in addition.

    clawdata.output_style = 1

    if clawdata.output_style == 1:
        # Output nout frames at equally spaced times up to tfinal:
        clawdata.num_output_times = 40
        clawdata.tfinal = 1.0
        clawdata.output_t0 = True  # output at initial (or restart) time?

    elif clawdata.output_style == 2:
        # Specify a list of output times.
        clawdata.output_times = [0.5, 1.0]

    elif clawdata.output_style == 3:
        # Output every iout timesteps with a total of ntot time steps:
        clawdata.output_step_interval = 1
        clawdata.total_steps = 10
        clawdata.output_t0 = True

    clawdata.output_format = 'ascii'  # 'ascii' or 'binary'

    clawdata.output_q_components = 'all'  # need all
    clawdata.output_aux_components = 'all'  # eta=h+B is in q
    clawdata.output_aux_onlyonce = False  # output aux arrays each frame

    # ---------------------------------------------------
    # Verbosity of messages to screen during integration:
    # ---------------------------------------------------

    # The current t, dt, and cfl will be printed every time step
    # at AMR levels <= verbosity.  Set verbosity = 0 for no printing.
    #   (E.g. verbosity == 2 means print only on levels 1 and 2.)
    clawdata.verbosity = 1

    # --------------
    # Time stepping:
    # --------------

    # if dt_variable==1: variable time steps used based on cfl_desired,
    # if dt_variable==0: fixed time steps dt = dt_initial will always be used.
    clawdata.dt_variable = True

    # Initial time step for variable dt.
    # If dt_variable==0 then dt=dt_initial for all steps:
    clawdata.dt_initial = 0.00225

    # Max time step to be allowed if variable dt used:
    clawdata.dt_max = 1e+99

    # Desired Courant number if variable dt used, and max to allow without
    # retaking step with a smaller dt:
    clawdata.cfl_desired = 0.75
    clawdata.cfl_max = 1.0
    # clawdata.cfl_desired = 0.45
    # clawdata.cfl_max = 0.5

    # Maximum number of time steps to allow between output times:
    clawdata.steps_max = 5000

    # ------------------
    # Method to be used:
    # ------------------

    # Order of accuracy:  1 => Godunov,  2 => Lax-Wendroff plus limiters
    clawdata.order = 2

    # Use dimensional splitting? (not yet available for AMR)
    #  0 or 'unsplit' or none'  ==> Unsplit
    #  1 or 'increment'         ==> corner transport of waves
    #  2 or 'all'               ==> corner transport of 2nd order corrections too
    clawdata.dimensional_split = "unsplit"

    # For unsplit method, transverse_waves can be
    #  0 or 'none'      ==> donor cell (only normal solver used)
    #  1 or 'increment' ==> corner transport of waves
    #  2 or 'all'       ==> corner transport of 2nd order corrections too
    clawdata.transverse_waves = 2

    # Number of waves in the Riemann solution:
    clawdata.num_waves = 6

    # List of limiters to use for each wave family:
    # Required:  len(limiter) == num_waves
    # Some options:
    #   0 or 'none'     ==> no limiter (Lax-Wendroff)
    #   1 or 'minmod'   ==> minmod
    #   2 or 'superbee' ==> superbee
    #   3 or 'mc'       ==> MC limiter
    #   4 or 'vanleer'  ==> van Leer
    clawdata.limiter = ['mc', 'mc', 'mc', 'mc', 'mc', 'mc']

    clawdata.use_fwaves = True  # True ==> use f-wave version of algorithms

    # Source terms splitting:
    #   src_split == 0 or 'none'    ==> no source term (src routine never called)
    #   src_split == 1 or 'godunov' ==> Godunov (1st order) splitting used,
    #   src_split == 2 or 'strang'  ==> Strang (2nd order) splitting used,  not recommended.
    clawdata.source_split = 'godunov'

    # --------------------
    # Boundary conditions:
    # --------------------

    # Number of ghost cells (usually 2)
    clawdata.num_ghost = 2

    # Choice of BCs at xlower and xupper:
    #   0 => user specified (must modify bcN.f to use this option)
    #   1 => extrapolation (non-reflecting outflow)
    #   2 => periodic (must specify this at both boundaries)
    #   3 => solid wall for systems where q(2) is normal velocity

    clawdata.bc_lower[0] = 'extrap'
    clawdata.bc_upper[0] = 'extrap'

    clawdata.bc_lower[1] = 'extrap'
    clawdata.bc_upper[1] = 'extrap'

    # --------------
    # Checkpointing:
    # --------------

    # Specify when checkpoint files should be created that can be
    # used to restart a computation.

    clawdata.checkpt_style = 0

    if clawdata.checkpt_style == 0:
        # Do not checkpoint at all
        pass

    elif clawdata.checkpt_style == 1:
        # Checkpoint only at tfinal.
        pass

    elif clawdata.checkpt_style == 2:
        # Specify a list of checkpoint times.
        clawdata.checkpt_times = [0.1, 0.15]

    elif clawdata.checkpt_style == 3:
        # Checkpoint every checkpt_interval timesteps (on Level 1)
        # and at the final time.
        clawdata.checkpt_interval = 5

    # ---------------
    # AMR parameters:
    # ---------------
    amrdata = rundata.amrdata

    # max number of refinement levels:
    amrdata.amr_levels_max = 1

    # List of refinement ratios at each level (length at least mxnest-1)
    amrdata.refinement_ratios_x = [2, 6]
    amrdata.refinement_ratios_y = [2, 6]
    amrdata.refinement_ratios_t = [2, 6]

    # Specify type of each aux variable in amrdata.auxtype.
    # This must be a list of length maux, each element of which is one of:
    #   'center',  'capacity', 'xleft', or 'yleft'  (see documentation).

    amrdata.aux_type = [
        'center', 'center', 'yleft', 'center', 'center', 'center'
    ]

    # Flag using refinement routine flag2refine rather than richardson error
    amrdata.flag_richardson = False  # use Richardson?
    amrdata.flag2refine = True

    # steps to take on each level L between regriddings of level L+1:
    amrdata.regrid_interval = 3

    # width of buffer zone around flagged points:
    # (typically the same as regrid_interval so waves don't escape):
    amrdata.regrid_buffer_width = 2

    # clustering alg. cutoff for (# flagged pts) / (total # of cells refined)
    # (closer to 1.0 => more small grids may be needed to cover flagged cells)
    amrdata.clustering_cutoff = 0.700000

    # print info about each regridding up to this level:
    amrdata.verbosity_regrid = 0

    #  ----- For developers -----
    # Toggle debugging print statements:
    amrdata.dprint = False  # print domain flags
    amrdata.eprint = False  # print err est flags
    amrdata.edebug = False  # even more err est flags
    amrdata.gprint = False  # grid bisection/clustering
    amrdata.nprint = False  # proper nesting output
    amrdata.pprint = False  # proj. of tagged points
    amrdata.rprint = False  # print regridding summary
    amrdata.sprint = False  # space/memory output
    amrdata.tprint = True  # time step reporting each level
    amrdata.uprint = False  # update/upbnd reporting

    # More AMR parameters can be set -- see the defaults in pyclaw/data.py

    # ---------------
    # Regions:
    # ---------------
    rundata.regiondata.regions = []
    # to specify regions of refinement append lines of the form
    #  [minlevel,maxlevel,t1,t2,x1,x2,y1,y2]

    # ---------------
    # Gauges:
    # ---------------
    rundata.gaugedata.gauges = []
    # for gauges append lines of the form  [gaugeno, x, y, t1, t2]
    gauge_locations = [-0.1, 0.0, 0.1, 0.2, 0.3]
    for (i, x_c) in enumerate(gauge_locations):
        # y0 = (self.run_data.clawdata.yupper - self.run_data.clawdata.ylower) / 2.0
        # x_p,y_p = transform_c2p(x_c,0.0,location[0],location[1],angle)
        x_p = x_c * numpy.cos(0.0)
        y_p = x_c * numpy.sin(0.0)
        # print "+=====+"
        # print x_c,0.0
        # print x_p,y_p
        if (rundata.clawdata.lower[0] < x_p < rundata.clawdata.upper[0] and
                rundata.clawdata.lower[1] < y_p < rundata.clawdata.upper[1]):
            rundata.gaugedata.gauges.append([i, x_p, y_p, 0.0, 1e10])
            # print "Gauge %s: (%s,%s)" % (i,x_p,y_p)
    # print "+=====+"

    return rundata
Esempio n. 6
0
def setplot(plotdata):
    r"""Setplot function for surge plotting"""

    plotdata.clearfigures()  # clear any old figures,axes,items data
    plotdata.format = 'binary'

    fig_num_counter = surgeplot.figure_counter()

    # Load data from output
    clawdata = clawutil.ClawInputData(2)
    clawdata.read(os.path.join(plotdata.outdir, 'claw.data'))

    amrdata = amrclaw.AmrclawInputData(clawdata)
    amrdata.read(os.path.join(plotdata.outdir, 'amr.data'))

    physics = geodata.GeoClawData()
    physics.read(os.path.join(plotdata.outdir, 'geoclaw.data'))

    surge_data = surgedata.SurgeData()
    surge_data.read(os.path.join(plotdata.outdir, 'surge.data'))

    friction_data = surgedata.FrictionData()
    friction_data.read(os.path.join(plotdata.outdir, 'friction.data'))

    # Load storm track
    track = surgeplot.track_data(os.path.join(plotdata.outdir, 'fort.track'))

    # Calculate landfall time, off by a day, maybe leap year issue?
    landfall_dt = datetime.datetime(2008, 9, 13, 7) - datetime.datetime(
        2008, 1, 1, 0)
    landfall = (landfall_dt.days - 1.0) * 24.0 * 60**2 + landfall_dt.seconds

    # Color limits
    surface_range = 5.0
    speed_range = 3.0
    eta = physics.sea_level
    if not isinstance(eta, list):
        eta = [eta]
    surface_limits = [eta[0] - surface_range, eta[0] + surface_range]
    # surface_contours = numpy.linspace(-surface_range, surface_range,11)
    surface_contours = [
        -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 0.5, 1, 1.5, 2, 2.5,
        3, 3.5, 4, 4.5, 5
    ]

    speed_limits = [0.0, speed_range]
    speed_contours = numpy.linspace(0.0, speed_range, 13)

    wind_limits = [0, 64]
    # wind_limits = [-0.002,0.002]
    pressure_limits = [935, 1013]
    friction_bounds = [0.01, 0.04]
    # vorticity_limits = [-1.e-2,1.e-2]

    # ==========================================================================
    # ==========================================================================
    #   Plot specifications
    # ==========================================================================
    # ==========================================================================

    #-----------------------------------------
    # Some global kml flags
    #-----------------------------------------
    plotdata.kml_name = "Ike"
    plotdata.kml_starttime = [2008, 9, 3, 15, 0,
                              0]  # Time of event in UTC [None]
    plotdata.kml_tz_offset = 5  # Time zone offset (in hours) of event. [None]

    plotdata.kml_index_fname = "Ike"  # name for .kmz and .kml files ["_GoogleEarth"]

    # Set to path where KMZ files will be stored;   KML file will then
    # link to this path.
    # plotdata.kml_publish = 'http://www.domain.edu/path/to/kmz/files'

    # ========================================================================
    #  Entire Gulf
    # ========================================================================
    gulf_xlimits = [clawdata.lower[0], clawdata.upper[0]]
    gulf_ylimits = [clawdata.lower[1], clawdata.upper[1]]
    gulf_shrink = 1.0

    # --------------------------
    #  Surface - entire gulf
    # --------------------------

    plotfigure = plotdata.new_plotfigure(name='Surface - Entire Domain',
                                         figno=0)
    plotfigure.show = True

    plotfigure.use_for_kml = True
    plotfigure.kml_use_for_initial_view = True

    # These override axes limits set below in plotitems
    plotfigure.kml_xlimits = gulf_xlimits
    plotfigure.kml_ylimits = gulf_ylimits

    # Resolution - needs to be set carefully for the transparent colormap
    rcl = 40
    plotfigure.kml_dpi = rcl * 2
    plotfigure.kml_figsize = [11.6, 9.6]
    plotfigure.kml_tile_images = False  # Tile images for faster loading.  Requires GDAL [False]

    plotaxes = plotfigure.new_plotaxes()
    plotitem = plotaxes.new_plotitem(name='surface', plot_type='2d_pcolor')
    plotitem.plot_var = geoplot.surface_or_depth
    plotitem.pcolor_cmap = geoplot.googleearth_transparent
    plotitem.pcolor_cmin = -surface_range
    plotitem.pcolor_cmax = surface_range

    def kml_colorbar(filename):
        cmin = -surface_range
        cmax = surface_range
        geoplot.kml_build_colorbar(filename, geoplot.googleearth_transparent,
                                   cmin, cmax)

    plotfigure.kml_colorbar = kml_colorbar

    # --------------------------
    #  Water Speed - entire gulf
    # --------------------------
    plotfigure = plotdata.new_plotfigure(name='Currents - Entire Domain',
                                         figno=1)
    plotfigure.show = True

    plotfigure.use_for_kml = True
    plotfigure.kml_use_for_initial_view = False

    # These override axes limits set below in plotitems
    plotfigure.kml_xlimits = gulf_xlimits
    plotfigure.kml_ylimits = gulf_ylimits
    plotfigure.kml_figsize = [11.6, 9.6]
    plotfigure.kml_dpi = 80  # size not so important with contourf
    plotfigure.kml_tile_images = False  # Tile images for faster loading.  Requires GDAL [False]

    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()

    plotitem = plotaxes.new_plotitem(name='surface', plot_type='2d_contourf')
    plotitem.plot_var = geoplot.surface_or_depth
    plotitem.contour_levels = speed_contours
    plotitem.fill_cmin = min(speed_contours)
    plotitem.fill_cmax = max(speed_contours)

    cmap = plt.get_cmap('OrRd')
    cmap._rgba_under = (0.0, 0.0, 0.0, 0.0)
    plotitem.fill_cmap = cmap

    def cbar_speeds(filename):
        cmin = min(speed_contours)
        cmax = max(speed_contours)
        geoplot.kml_build_colorbar(filename, cmap, cmin, cmax)

    plotfigure.kml_colorbar = cbar_speeds

    # ========================================================================
    #  Houston/Galveston
    # ========================================================================
    houston_xlimits = [-(95.0 + 26.0 / 60.0), -(94.0 + 25.0 / 60.0)]
    houston_ylimits = [29.1, 29.0 + 55.0 / 60.0]
    houston_shrink = 0.9

    #No need to worry about fitting the plot exactly if we are not using
    # the transparent colormap with pcolor.
    #num_cells = [116, 96]
    #dx = (gulf_xlimits[1] - float(gulf_xlimits[0]))/num_cells[0]   # = 0.25
    #dy = (gulf_ylimits[1] - float(gulf_ylimits[0]))/num_cells[1]   # = 0.25
    #houston_xlimits = [gulf_xlimits[0] + 14*dx, gulf_xlimits[0] + 21*dx]  # [-95.25, -94.5]
    #houston_ylimits = [gulf_ylimits[0] + 82*dy, gulf_ylimits[0] + 88*dy]  # [-95.25, -94.5]
    #figsize = [(21-14)*dx,(88-82)*dy]  # relative to [11.6, 9.6] occupied by larger grid

    figsize = [
        houston_xlimits[1] - houston_xlimits[0],
        houston_ylimits[1] - houston_ylimits[0]
    ]
    dpi = 400

    # --------------------------------------
    # Surface Elevations - Houston/Galveston
    # --------------------------------------
    plotfigure = plotdata.new_plotfigure(name='Surface - Houston/Galveston',
                                         figno=2)
    plotfigure.show = True
    plotfigure.use_for_kml = True

    plotfigure.kml_xlimits = houston_xlimits
    plotfigure.kml_ylimits = houston_ylimits
    plotfigure.kml_dpi = dpi  # data is not more resolve than this
    plotfigure.kml_figsize = figsize
    plotfigure.kml_tile_images = False

    # pcolor for water.
    plotaxes = plotfigure.new_plotaxes()
    plotitem = plotaxes.new_plotitem(name='surface', plot_type='2d_contourf')
    plotitem.contour_levels = surface_contours
    plotitem.fill_cmin = min(surface_contours)
    plotitem.fill_cmax = max(surface_contours)

    # what is the colormap used here?
    #plotfigure.kml_colorbar = cbar_houston

    # --------------------------------
    # Water Speed - Houston/Galveston
    # --------------------------------
    plotfigure = plotdata.new_plotfigure(name='Currents - Houston/Galveston',
                                         figno=3)
    plotfigure.show = True
    plotfigure.use_for_kml = True

    # These override axes limits set below in plotitems
    plotfigure.kml_xlimits = houston_xlimits
    plotfigure.kml_ylimits = houston_ylimits
    plotfigure.kml_figsize = figsize
    plotfigure.kml_dpi = dpi  # data is not more resolve than this
    plotfigure.kml_tile_images = False  # Tile images for faster loading.  Requires GDAL [False]

    # Water
    plotaxes = plotfigure.new_plotaxes()
    plotitem = plotaxes.new_plotitem(name='surface', plot_type='2d_contourf')
    plotitem.plot_var = geoplot.surface_or_depth
    plotitem.contour_levels = speed_contours
    plotitem.fill_cmin = min(speed_contours)
    plotitem.fill_cmax = max(speed_contours)

    cmap = plt.get_cmap('OrRd')
    cmap._rgba_under = (0.0, 0.0, 0.0, 0.0)
    plotitem.fill_cmap = cmap

    # ========================================================================
    #  Figures for gauges
    # ========================================================================
    plotfigure = plotdata.new_plotfigure(name='Surface & topo', figno=300, \
                    type='each_gauge')
    plotfigure.show = True
    plotfigure.clf_each_gauge = True

    # plotfigure.kwargs['figsize'] = (16,10)

    def gauge_after_axes(cd):

        if cd.gaugeno in [1, 2, 3, 4]:
            axes = plt.gca()
            # # Add Kennedy gauge data
            # kennedy_gauge = kennedy_gauges[gauge_name_trans[cd.gaugeno]]
            # axes.plot(kennedy_gauge['t'] - seconds2days(date2seconds(gauge_landfall[0])),
            #          kennedy_gauge['mean_water'] + kennedy_gauge['depth'], 'k-',
            #          label='Gauge Data')

            # Add GeoClaw gauge data
            geoclaw_gauge = cd.gaugesoln
            axes.plot(seconds2days(geoclaw_gauge.t -
                                   date2seconds(gauge_landfall[1])),
                      geoclaw_gauge.q[3, :] + gauge_surface_offset[0],
                      'b--',
                      label="GeoClaw")

            # Add ADCIRC gauge data
            # ADCIRC_gauge = ADCIRC_gauges[kennedy_gauge['gauge_no']]
            # axes.plot(seconds2days(ADCIRC_gauge[:,0] - gauge_landfall[2]),
            #          ADCIRC_gauge[:,1] + gauge_surface_offset[1], 'r-.', label="ADCIRC")

            # Fix up plot
            axes.set_title('Station %s' % cd.gaugeno)
            axes.set_xlabel('Days relative to landfall')
            axes.set_ylabel('Surface (m)')
            axes.set_xlim([-2, 1])
            axes.set_ylim([-1, 5])
            axes.set_xticks([-2, -1, 0, 1])
            axes.set_xticklabels([r"$-2$", r"$-1$", r"$0$", r"$1$"])
            axes.grid(True)
            axes.legend()

            plt.hold(False)

        surgeplot.gauge_afteraxes(cd)

    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.xlimits = [-2, 1]
    #plotaxes.xlabel = "Days from landfall"
    #plotaxes.ylabel = "Surface (m)"
    plotaxes.ylimits = [-1, 5]
    plotaxes.title = 'Surface'
    plotaxes.afteraxes = gauge_after_axes

    # Plot surface as blue curve:
    plotitem = plotaxes.new_plotitem(plot_type='1d_plot')
    plotitem.plot_var = 3
    plotitem.plotstyle = 'b-'

    #-----------------------------------------

    # 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 = [0, 1, 2, 3]  # list of figures to print
    plotdata.html_homelink = '../README.html'  # pointer for top of index
    plotdata.latex_figsperline = 2  # layout of plots
    plotdata.latex_framesperline = 1  # layout of plots
    plotdata.latex_makepdf = False  # also run pdflatex?

    plotdata.html = False  # create html files of plots?
    plotdata.latex = False  # create latex file of plots?
    plotdata.kml = True

    return plotdata