Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions examples/storm-surge/ike/setplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,12 @@ def surge_afteraxes(cd):
kwargs={"markersize": 4})

# Color limits
surface_limits = [physics.sea_level - 5.0, physics.sea_level + 5.0]
surface_ticks = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
surface_labels = [str(value) for value in surface_ticks]
surface_limits = [-5.0, 5.0]
speed_limits = [0.0, 3.0]
speed_ticks = [0, 1, 2, 3]
speed_labels = [str(value) for value in speed_ticks]
wind_limits = [0, 64]
pressure_limits = [935, 1013]
friction_bounds = [0.01, 0.04]

def add_custom_colorbar_ticks_to_axes(axes, item_name, ticks,
tick_labels=None):
"""Adjust colorbar ticks and labels"""
axes.plotitem_dict[item_name].colorbar_ticks = ticks
axes.plotitem_dict[item_name].colorbar_tick_labels = tick_labels

def gulf_after_axes(cd):
# plt.subplots_adjust(left=0.08, bottom=0.04, right=0.97, top=0.96)
surge_afteraxes(cd)
Expand Down Expand Up @@ -113,8 +103,6 @@ def friction_after_axes(cd):
surgeplot.add_land(plotaxes)
plotaxes.plotitem_dict['surface'].amr_patchedges_show = [0] * 10
plotaxes.plotitem_dict['land'].amr_patchedges_show = [0] * 10
add_custom_colorbar_ticks_to_axes(plotaxes, 'surface', surface_ticks,
surface_labels)

# Speed Figure
plotfigure = plotdata.new_plotfigure(name="Currents - %s" % name)
Expand All @@ -129,9 +117,6 @@ def friction_after_axes(cd):
surgeplot.add_land(plotaxes)
plotaxes.plotitem_dict['speed'].amr_patchedges_show = [0] * 10
plotaxes.plotitem_dict['land'].amr_patchedges_show = [0] * 10
add_custom_colorbar_ticks_to_axes(plotaxes, 'speed', speed_ticks,
speed_labels)

#
# Friction field
#
Expand Down Expand Up @@ -235,8 +220,6 @@ def gauge_location_afteraxes(cd):
plotaxes.ylimits = [29.0, 30.0]
plotaxes.afteraxes = gauge_location_afteraxes
surgeplot.add_surface_elevation(plotaxes, bounds=surface_limits)
add_custom_colorbar_ticks_to_axes(plotaxes, 'surface', surface_ticks,
surface_labels)
surgeplot.add_land(plotaxes)
plotaxes.plotitem_dict['surface'].amr_patchedges_show = [0] * 10
plotaxes.plotitem_dict['land'].amr_patchedges_show = [0] * 10
Expand Down
10 changes: 5 additions & 5 deletions src/python/geoclaw/multilayer/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,16 @@ def add_y_velocity(plotaxes, layer, plot_type='pcolor', bounds=None):


# Land
def add_land(plotaxes, plot_type='pcolor'):
def add_land(plotaxes, plot_type='pcolor', bounds=[-10, 10]):
r"""Add plot item for land"""

if plot_type == 'pcolor':
plotitem = plotaxes.new_plotitem(plot_type='2d_imshow')
plotitem.show = True
plotitem.plot_var = geoplot.land
plotitem.imshow_cmap = land_cmap
plotitem.imshow_cmin = 0.0
plotitem.imshow_cmax = 80.0
plotitem.imshow_cmin = bounds[0]
plotitem.imshow_cmax = bounds[1]
plotitem.add_colorbar = False
plotitem.amr_celledges_show = [0] * 10
plotitem.amr_patchedges_show = [1] * 10
Expand All @@ -229,8 +229,8 @@ def add_land(plotaxes, plot_type='pcolor'):
plotitem = plotaxes.new_plotitem(plot_type='2d_contour')
plotitem.plot_var = geoplot.land
plotitem.contour_nlevels = 40
plotitem.contour_min = 0.0
plotitem.contour_max = 100.0
plotitem.contour_min = bounds[0]
plotitem.contour_max = bounds[1]
plotitem.amr_contour_colors = ['g'] # color on each level
plotitem.amr_patch_bgcolor = ['#ffeeee', '#eeeeff', '#eeffee']
plotitem.celledges_show = 0
Expand Down
15 changes: 8 additions & 7 deletions src/python/geoclaw/surge/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
wind_field = 4
pressure_field = 6

surface_cmap = colormaps.make_colormap({1.0: 'r', 0.5: 'w', 0.0: 'b'})
surface_cmap = plt.get_cmap("bwr")
speed_cmap = plt.get_cmap('PuBu')
friction_cmap = plt.get_cmap('YlOrRd')
velocity_cmap = plt.get_cmap('PiYG')
vorticity_cmap = plt.get_cmap('PRGn')
wind_cmap = plt.get_cmap('PuBu')
pressure_cmap = plt.get_cmap('PuBu')
land_cmap = geoplot.land_colors
Expand Down Expand Up @@ -375,17 +377,16 @@ def add_pressure(plotaxes, bounds=None, plot_type='pcolor', shrink=1.0):
pass


def add_land(plotaxes, plot_type='pcolor', bounds=None):
def add_land(plotaxes, plot_type='pcolor', bounds=[-10, 10]):
"""Add plotitem for land"""

if plot_type == 'pcolor':
plotitem = plotaxes.new_plotitem(name='land', plot_type='2d_pcolor')
plotitem.show = True
plotitem.plot_var = geoplot.land
plotitem.pcolor_cmap = land_cmap
if bounds is not None:
plotitem.pcolor_cmin = bounds[0]
plotitem.pcolor_cmax = bounds[1]
plotitem.pcolor_cmin = bounds[0]
plotitem.pcolor_cmax = bounds[1]
plotitem.add_colorbar = False
plotitem.amr_celledges_show = [0] * 10
plotitem.amr_patchedges_show = [1, 1, 1, 1, 1, 0, 0]
Expand All @@ -394,8 +395,8 @@ def add_land(plotaxes, plot_type='pcolor', bounds=None):
plotitem = plotaxes.new_plotitem(name="land", plot_type='2d_contour')
plotitem.plot_var = geoplot.land
plotitem.contour_nlevels = 40
plotitem.contour_min = 0.0
plotitem.contour_max = 100.0
plotitem.contour_min = bounds[0]
plotitem.contour_max = bounds[1]
plotitem.amr_contour_colors = ['g'] # color on each level
plotitem.amr_patch_bgcolor = ['#ffeeee', '#eeeeff', '#eeffee']
plotitem.celledges_show = 0
Expand Down