Skip to content

Commit a8c7a28

Browse files
authored
Merge pull request #275 from mandli/add-land-bounds
Add back default land bounds
2 parents 3afbf4c + c0961d8 commit a8c7a28

File tree

3 files changed

+14
-30
lines changed

3 files changed

+14
-30
lines changed

examples/storm-surge/ike/setplot.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,12 @@ def surge_afteraxes(cd):
5959
kwargs={"markersize": 4})
6060

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

72-
def add_custom_colorbar_ticks_to_axes(axes, item_name, ticks,
73-
tick_labels=None):
74-
"""Adjust colorbar ticks and labels"""
75-
axes.plotitem_dict[item_name].colorbar_ticks = ticks
76-
axes.plotitem_dict[item_name].colorbar_tick_labels = tick_labels
77-
7868
def gulf_after_axes(cd):
7969
# plt.subplots_adjust(left=0.08, bottom=0.04, right=0.97, top=0.96)
8070
surge_afteraxes(cd)
@@ -113,8 +103,6 @@ def friction_after_axes(cd):
113103
surgeplot.add_land(plotaxes)
114104
plotaxes.plotitem_dict['surface'].amr_patchedges_show = [0] * 10
115105
plotaxes.plotitem_dict['land'].amr_patchedges_show = [0] * 10
116-
add_custom_colorbar_ticks_to_axes(plotaxes, 'surface', surface_ticks,
117-
surface_labels)
118106

119107
# Speed Figure
120108
plotfigure = plotdata.new_plotfigure(name="Currents - %s" % name)
@@ -129,9 +117,6 @@ def friction_after_axes(cd):
129117
surgeplot.add_land(plotaxes)
130118
plotaxes.plotitem_dict['speed'].amr_patchedges_show = [0] * 10
131119
plotaxes.plotitem_dict['land'].amr_patchedges_show = [0] * 10
132-
add_custom_colorbar_ticks_to_axes(plotaxes, 'speed', speed_ticks,
133-
speed_labels)
134-
135120
#
136121
# Friction field
137122
#
@@ -235,8 +220,6 @@ def gauge_location_afteraxes(cd):
235220
plotaxes.ylimits = [29.0, 30.0]
236221
plotaxes.afteraxes = gauge_location_afteraxes
237222
surgeplot.add_surface_elevation(plotaxes, bounds=surface_limits)
238-
add_custom_colorbar_ticks_to_axes(plotaxes, 'surface', surface_ticks,
239-
surface_labels)
240223
surgeplot.add_land(plotaxes)
241224
plotaxes.plotitem_dict['surface'].amr_patchedges_show = [0] * 10
242225
plotaxes.plotitem_dict['land'].amr_patchedges_show = [0] * 10

src/python/geoclaw/multilayer/plot.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,16 @@ def add_y_velocity(plotaxes, layer, plot_type='pcolor', bounds=None):
211211

212212

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

217217
if plot_type == 'pcolor':
218218
plotitem = plotaxes.new_plotitem(plot_type='2d_imshow')
219219
plotitem.show = True
220220
plotitem.plot_var = geoplot.land
221221
plotitem.imshow_cmap = land_cmap
222-
plotitem.imshow_cmin = 0.0
223-
plotitem.imshow_cmax = 80.0
222+
plotitem.imshow_cmin = bounds[0]
223+
plotitem.imshow_cmax = bounds[1]
224224
plotitem.add_colorbar = False
225225
plotitem.amr_celledges_show = [0] * 10
226226
plotitem.amr_patchedges_show = [1] * 10
@@ -229,8 +229,8 @@ def add_land(plotaxes, plot_type='pcolor'):
229229
plotitem = plotaxes.new_plotitem(plot_type='2d_contour')
230230
plotitem.plot_var = geoplot.land
231231
plotitem.contour_nlevels = 40
232-
plotitem.contour_min = 0.0
233-
plotitem.contour_max = 100.0
232+
plotitem.contour_min = bounds[0]
233+
plotitem.contour_max = bounds[1]
234234
plotitem.amr_contour_colors = ['g'] # color on each level
235235
plotitem.amr_patch_bgcolor = ['#ffeeee', '#eeeeff', '#eeffee']
236236
plotitem.celledges_show = 0

src/python/geoclaw/surge/plot.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@
2727
wind_field = 4
2828
pressure_field = 6
2929

30-
surface_cmap = colormaps.make_colormap({1.0: 'r', 0.5: 'w', 0.0: 'b'})
30+
surface_cmap = plt.get_cmap("bwr")
3131
speed_cmap = plt.get_cmap('PuBu')
3232
friction_cmap = plt.get_cmap('YlOrRd')
33+
velocity_cmap = plt.get_cmap('PiYG')
34+
vorticity_cmap = plt.get_cmap('PRGn')
3335
wind_cmap = plt.get_cmap('PuBu')
3436
pressure_cmap = plt.get_cmap('PuBu')
3537
land_cmap = geoplot.land_colors
@@ -375,17 +377,16 @@ def add_pressure(plotaxes, bounds=None, plot_type='pcolor', shrink=1.0):
375377
pass
376378

377379

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

381383
if plot_type == 'pcolor':
382384
plotitem = plotaxes.new_plotitem(name='land', plot_type='2d_pcolor')
383385
plotitem.show = True
384386
plotitem.plot_var = geoplot.land
385387
plotitem.pcolor_cmap = land_cmap
386-
if bounds is not None:
387-
plotitem.pcolor_cmin = bounds[0]
388-
plotitem.pcolor_cmax = bounds[1]
388+
plotitem.pcolor_cmin = bounds[0]
389+
plotitem.pcolor_cmax = bounds[1]
389390
plotitem.add_colorbar = False
390391
plotitem.amr_celledges_show = [0] * 10
391392
plotitem.amr_patchedges_show = [1, 1, 1, 1, 1, 0, 0]
@@ -394,8 +395,8 @@ def add_land(plotaxes, plot_type='pcolor', bounds=None):
394395
plotitem = plotaxes.new_plotitem(name="land", plot_type='2d_contour')
395396
plotitem.plot_var = geoplot.land
396397
plotitem.contour_nlevels = 40
397-
plotitem.contour_min = 0.0
398-
plotitem.contour_max = 100.0
398+
plotitem.contour_min = bounds[0]
399+
plotitem.contour_max = bounds[1]
399400
plotitem.amr_contour_colors = ['g'] # color on each level
400401
plotitem.amr_patch_bgcolor = ['#ffeeee', '#eeeeff', '#eeffee']
401402
plotitem.celledges_show = 0

0 commit comments

Comments
 (0)