×
Search

 

    Plot the output of Tephra2 in Matlab

    This function plots the output of Tephra2 runs on a map. Output files generated by Tephra2 are in a column format (i.e. easting, northing, elevation and mass accumulation), with the number of rows equal to the total number of points in the grid. For some obscure reason, most of Matlab’s plotting functions only accept inputs in a matrix format, i.e. separate m x n matrices for easting, northing, elevation and mass accumulation, where m and n are the numbers of northing and easting values, respectively. Matlab, unlike other plotting tools (e.g. GMT, Python), therefore requires a transformation the data.

    Additionally, Tephra works with UTM coordinates. This function accepts optional arguments to convert the output of Tephra2 to lat/lon coordinates. For this, two additional functions published on the Matlab File Exchange are required:

    1. utm2ll by François Beauducel
    2. plot_google_map by Zohar Bar-Yehuda

    The function

    The function plotT2 can be downloaded here. One argument is required, which is a string containing the path to the file. Outputs are then matrices of easting (E), northing (N) and mass accumulation (M):

    [E,N,M,Carea,Pmass,cont,varargout] = plotT2(pathToFile, varargin)

    Required argument

    Argument Description
    pathToFile Path to Tephra2 output file

    Optional name-value pairs of arguments

    The optional pairs of name-value arguments are summarised below:

    Argument Description
    'zone' UTM zone of the Tephra2 output, used to convert projected to geographic coordinates and plot a Google Map background if both utm2ll and plot_google_map are available. Should be a double, positive in the N hemisphere, negative in the S hemisphere
    'plot' Defines if accumulation is plotted as log10 ('log10', default) or linear ('linear')
    'contours' Vector containing the values (kg/m2) of accumulation to contour. By default set to [1,10,100,1000]</td>
    'minVal' Minimum value to be represented on the continuous color surface (kg/m2)
    'vent' Plot the vent, entered as [easting, northing] coordinates.
    'points' Additional points to plot, entered as a 2-columns [easting,northing] matrix. If entered as a 3-columns [easting,northing,value] matrix, value is used as a label

    Output arguments

    Argument Description
    E Easting matrix (m)
    N Northing matrix (m)
    M Mass accumulation matrix (kg/m2)
    Carea Area of each isomass contour (km2)
    Pmass Mass contained within each contour (kg)
    contour Contours (kg/m2)
    lat Optional - latitude matrix, if 'zone' is specified
    lon Optional - longitude matrix, if 'zone' is specified

    Examples

    When the argument 'zone' is passed, it is possible to request the matrix versions of latitude and longitude:

    plotT2('example.out');
    plotT2('example.out', 'zone', 18);
    plotT2('example.out', 'plot', 'linear');
    plotT2('example.out', 'contours', [10, 50, 100]);