当前位置: 首页>>代码示例>>Python>>正文


Python ClawPlotData.save_frames方法代码示例

本文整理汇总了Python中clawpack.visclaw.data.ClawPlotData.save_frames方法的典型用法代码示例。如果您正苦于以下问题:Python ClawPlotData.save_frames方法的具体用法?Python ClawPlotData.save_frames怎么用?Python ClawPlotData.save_frames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在clawpack.visclaw.data.ClawPlotData的用法示例。


在下文中一共展示了ClawPlotData.save_frames方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setplot

# 需要导入模块: from clawpack.visclaw.data import ClawPlotData [as 别名]
# 或者: from clawpack.visclaw.data.ClawPlotData import save_frames [as 别名]
def setplot(plotdata=None):
#--------------------------
    
    """ 
    Specify what is to be plotted at each frame.
    Input:  plotdata, an instance of pyclaw.plotters.data.ClawPlotData.
    Output: a modified version of plotdata.
    
    """ 

    import os

    import numpy as np
    import matplotlib.pyplot as plt

    from clawpack.visclaw import geoplot, gaugetools, colormaps

    import clawpack.clawutil.data as clawutil
    import clawpack.amrclaw.data as amrclaw
    import clawpack.geoclaw.data

    import clawpack.geoclaw.multilayer.plot as ml_plot

    if plotdata is None:
        from clawpack.visclaw.data import ClawPlotData
        plotdata = ClawPlotData()

    from numpy import linspace



    plotdata.clearfigures()  # clear any old figures,axes,items data
    plotdata.save_frames = False

    # 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'))
    geodata = clawpack.geoclaw.data.GeoClawData()
    geodata.read(os.path.join(plotdata.outdir,'geoclaw.data'))
    multilayer_data = clawpack.geoclaw.data.MultilayerData()
    multilayer_data.read(os.path.join(plotdata.outdir,'multilayer.data'))

    # To plot gauge locations on pcolor or contour plot, use this as
    # an afteraxis function:

    def addgauges(current_data):
        from clawpack.visclaw import gaugetools
        gaugetools.plot_gauge_locations(current_data.plotdata, \
             gaugenos='all', format_string='ko', add_labels=True)

    # ========================================================================
    #  Generic helper functions
    # ========================================================================
    def pcolor_afteraxes(current_data):
        # bathy_ref_lines(current_data)
        gauge_locations(current_data)
        
    def contour_afteraxes(current_data):
        # gauge_locations(current_data)
        # m_to_km_labels()
        plt.hold(True)
        pos = -80.0 * (23e3 / 180) + 500e3 - 5e3
        plt.plot([pos,pos],[-300e3,300e3],'b',[pos-5e3,pos-5e3],[-300e3,300e3],'y')
        plt.hold(False)
        wind_contours(current_data)
        bathy_ref_lines(current_data)
        
    def profile_afteraxes(current_data):
        pass
        
    def gauge_locations(current_data,gaugenos='all'):
        plt.hold(True)
        gaugetools.plot_gauge_locations(current_data.plotdata, \
             gaugenos=gaugenos, format_string='kx', add_labels=True)
        plt.hold(False)
    
    # ========================================================================
    # Axis limits
    # xlimits = [amrdata.xlower,amrdata.xupper]
    xlimits = [-100.0, 100.0]

    # ylimits = [amrdata.ylower,amrdata.yupper]
    ylimits = [-100.0, 100.0]
    
    eta = [multilayer_data.eta[0],multilayer_data.eta[1]]

    top_surface_limits = [eta[0]-10,eta[0]+10]
    internal_surface_limits = [eta[1]-5,eta[1]+5]
    depth_limits = [0.0, 0.4]
    top_speed_limits = [0.0,0.1]
    internal_speed_limits = [0.0,0.03]
    

    # ========================================================================
    #  Surface Elevations
    # ========================================================================
    plotfigure = plotdata.new_plotfigure(name='Surface', figno=0)
    plotfigure.show = True
#.........这里部分代码省略.........
开发者ID:aks2203,项目名称:geoclaw,代码行数:103,代码来源:setplot.py


注:本文中的clawpack.visclaw.data.ClawPlotData.save_frames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。