From e7e620877c8484c668d061ffa79acbfdbe5ef364 Mon Sep 17 00:00:00 2001 From: Kyle Mandli Date: Tue, 27 Jun 2017 13:55:29 -0400 Subject: [PATCH 1/3] Add back default land bounds --- src/python/geoclaw/multilayer/plot.py | 10 +++++----- src/python/geoclaw/surge/plot.py | 11 +++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/python/geoclaw/multilayer/plot.py b/src/python/geoclaw/multilayer/plot.py index 36b142e7d..fbfa04321 100644 --- a/src/python/geoclaw/multilayer/plot.py +++ b/src/python/geoclaw/multilayer/plot.py @@ -211,7 +211,7 @@ 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': @@ -219,8 +219,8 @@ def add_land(plotaxes, plot_type='pcolor'): 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 @@ -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 diff --git a/src/python/geoclaw/surge/plot.py b/src/python/geoclaw/surge/plot.py index f9a1b21d8..22888c272 100755 --- a/src/python/geoclaw/surge/plot.py +++ b/src/python/geoclaw/surge/plot.py @@ -375,7 +375,7 @@ 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': @@ -383,9 +383,8 @@ def add_land(plotaxes, plot_type='pcolor', bounds=None): 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] @@ -394,8 +393,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 From 9b02e11afbef55b1c61e31715ccffb8ce7cf17e2 Mon Sep 17 00:00:00 2001 From: Kyle Mandli Date: Tue, 27 Jun 2017 13:57:48 -0400 Subject: [PATCH 2/3] Use default colormap --- src/python/geoclaw/surge/plot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/python/geoclaw/surge/plot.py b/src/python/geoclaw/surge/plot.py index 22888c272..a0884b995 100755 --- a/src/python/geoclaw/surge/plot.py +++ b/src/python/geoclaw/surge/plot.py @@ -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 From c0961d856945575b20d336ea7af51b6c55beeae3 Mon Sep 17 00:00:00 2001 From: Kyle Mandli Date: Thu, 29 Jun 2017 20:10:32 -0400 Subject: [PATCH 3/3] Add changes to correct for colorbar problem --- examples/storm-surge/ike/setplot.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/examples/storm-surge/ike/setplot.py b/examples/storm-surge/ike/setplot.py index 0cd8a1441..6e9828a05 100644 --- a/examples/storm-surge/ike/setplot.py +++ b/examples/storm-surge/ike/setplot.py @@ -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) @@ -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) @@ -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 # @@ -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