def add_surface_elevation(plotaxes,surface,bounds=None,plot_type='pcolor'): if plot_type == 'pcolor' or plot_type == 'imshow': plotitem = plotaxes.new_plotitem(plot_type='2d_imshow') # plotitem.plot_var = geoplot.surface if surface == 1: plotitem.plot_var = eta1 elif surface == 2: plotitem.plot_var = eta2 if bounds is not None: plotitem.imshow_cmin = bounds[0] plotitem.imshow_cmax = bounds[1] # plotitem.pcolor_cmap = geoplot.tsunami_colormap plotitem.imshow_cmap = colormaps.make_colormap({1.0:'r',0.5:'w',0.0:'b'}) plotitem.add_colorbar = True plotitem.amr_gridlines_show = [0,0,0] plotitem.amr_gridedges_show = [1,1,1] elif plot_type == 'contour': plotitem = plotaxes.new_plotitem(plot_type='2d_contour') plotitem.plot_var = surface + 5 if bounds is not None: plotitem.contour_levels = bounds plotitem.amr_contour_show = [1,1,1] plotitem.amr_gridlines_show = [0,0,0] plotitem.amr_gridedges_show = [1,1,1] plotitem.amr_contour_colors = 'k' else: raise NotImplementedError("Plot type %s not implemented" % plot_type)
def add_layer_depth(plotaxes,layer,bounds=None,plot_type='pcolor'): if plot_type == 'pcolor' or plot_type == 'imshow': plotitem = plotaxes.new_plotitem(plot_type='2d_imshow') if layer == 1: plotitem.plot_var = 0 elif layer == 2: plotitem.plot_var = 3 if bounds is not None: plotitem.imshow_cmin = bounds[0] plotitem.imshow_cmax = bounds[1] plotitem.imshow_cmap = colormaps.make_colormap({1.0:'r',0.5:'w',0.0:'b'}) plotitem.add_colorbar = True plotitem.amr_gridlines_show = [0,0,0] plotitem.amr_gridedges_show = [1,1,1]
def add_layer_depth(plotaxes, layer, bounds=None, plot_type='pcolor'): if plot_type == 'pcolor' or plot_type == 'imshow': plotitem = plotaxes.new_plotitem(plot_type='2d_imshow') if layer == 1: plotitem.plot_var = 0 elif layer == 2: plotitem.plot_var = 3 if bounds is not None: plotitem.imshow_cmin = bounds[0] plotitem.imshow_cmax = bounds[1] plotitem.imshow_cmap = colormaps.make_colormap({ 1.0: 'r', 0.5: 'w', 0.0: 'b' }) plotitem.add_colorbar = True plotitem.amr_gridlines_show = [0, 0, 0] plotitem.amr_gridedges_show = [1, 1, 1]
def add_surface_elevation(plotaxes, surface, bounds=None, plot_type='pcolor'): if plot_type == 'pcolor' or plot_type == 'imshow': plotitem = plotaxes.new_plotitem(plot_type='2d_imshow') # plotitem.plot_var = geoplot.surface if surface == 1: plotitem.plot_var = eta1 elif surface == 2: plotitem.plot_var = eta2 if bounds is not None: plotitem.imshow_cmin = bounds[0] plotitem.imshow_cmax = bounds[1] # plotitem.pcolor_cmap = geoplot.tsunami_colormap plotitem.imshow_cmap = colormaps.make_colormap({ 1.0: 'r', 0.5: 'w', 0.0: 'b' }) plotitem.add_colorbar = True plotitem.amr_gridlines_show = [0, 0, 0] plotitem.amr_gridedges_show = [1, 1, 1] elif plot_type == 'contour': plotitem = plotaxes.new_plotitem(plot_type='2d_contour') plotitem.plot_var = surface + 5 if bounds is not None: plotitem.contour_levels = bounds plotitem.amr_contour_show = [1, 1, 1] plotitem.amr_gridlines_show = [0, 0, 0] plotitem.amr_gridedges_show = [1, 1, 1] plotitem.amr_contour_colors = 'k' else: raise NotImplementedError("Plot type %s not implemented" % plot_type)
light_green = [0.8, 1.0, 0.5] blue = [0.0, 0.0, 1.0] dark_blue = [0.2, 0.2, 0.7] light_blue = [0.5, 0.5, 1.0] blue_green = [0.0, 1.0, 1.0] tan = [0.9, 0.8, 0.2] tan = [0.8, 0.5, 0.2] brown = [0.9, 0.8, 0.2] gray8 = [0.8, 0.8, 0.8] purple = [0.8, 0.3, 0.8] # Colormaps TSUNAMI_MAX_AMPLITUDE = 0.6 tsunami_colormap = colormaps.make_colormap({ -TSUNAMI_MAX_AMPLITUDE: blue, 0.0: blue_green, TSUNAMI_MAX_AMPLITUDE: red }) land1_colormap = colormaps.make_colormap({ 0.0: dark_green, 1000.0: green, 2000.0: light_green, 4000.0: tan }) land2_colormap = colormaps.make_colormap({ 0: dark_green, 50: green, 100: light_green, 200: tan