Visualizing sedflux output with MATLAB

There are two main sedflux output files: the property file and the measuring station file. Both are binary files that can be read and visualized through MATLAB.

Reading and visualizing a property file

The plot_property and read_property MATLAB functions are used to visualize and read data from a sedflux property file, respectively.

plot_property

The MATLAB function used to plot a property file is plot_property. The same function is used for output generated with sedflux run in either 2D or 3D mode. However, some of the options vary defending on the mode.

plot_property for 2D mode

For our first example, we consided a property file of average grain size that was generated by sedflux run in 2D-mode. For the simulation called, 'sedflux_2D_simulation', we can use the following to look at some output,

>> plot_property( 'sedflux_2D_Simulation0001.grain' );

If all goes well, MATLAB should generate an image of the average grain size over the profile.

adriatic-x-section.jpg

Cross section of the Adriatic

Following the name of the file, the user can specify a series of parameter/value pairs that control how the image is displayed. For instance, the following parameter/value pairs print the time (in years), scale the data between 2 and 10 (phe units), and remove the colorbar.

>> plot_property( 'sedflux_2D_Simulation0001.grain' , 'time' , 21000 , 'clim' , [2 10] , 'colorbar' , false );

adriatic-x-section-time.jpg

Cross section of the Adriatic

Other parameters are 'func', and 'mask'. Use func to specify a function handle that will operate on the property data. The function should take a matrix as its only input parameter. Continuing with the previous example, we can plot grain size in millimeters rather than phe units using the func parameter.

>> plot_property( 'sedflux_2D_Simulation0001.grain' , 'func' , @(f)(2.^(-f)) );

A data mask is a matrix of logical values that is the same size as the data to be plotted. To create a mask, one usually reads in the data and then creates the mask based on those data values. This requires the MATLAB function read_property (explained later). In the following example, we wish to only plot those data between 2 and 6 phe units.

>> [f,h] = read_property( 'sedflux_2D_Simulation0001.grain' );
>> plot_property( 'sedflux_2D_Simulation0001.grain' , 'mask' , f>2 & f<6 );

adriatic-x-section-mask.jpg

Cross section of the Adriatic

plot_property for 3D mode

The following MATLAB command plots a slice of sedflux 3D cube. In this example we plot a slice of grain size along the plane at x=3.2km. One can also specify a slice of constant y or z (use 'yslice' or 'zslice', respectively).

>> plot_property( 'sedflux_3D_Simulation0001.grain' , 'xslice' , 3.2 );

x-section-3d-property.jpg

Cross section of a sedflux 3D property cube

read_property

Reading and visualizing a measuring station file

To create a surface plot from a measuring station file use plot_measuring_station_surface. The following command plots the last record from a sedflux measuring station file of bathymetric elevation.

>> plot_measuring_station_surface( 'KL-elevation.bin' , 'zdir' , 'norm' )
>> set( gca , 'dataaspectratio' , [1 1 20] )

The 'zdir' parameter is set to 'norm' to ensure the data are plotted right-side up. The aspect ratio is changed to better visualize the surface.

elevation-3d.jpg

Measuring station surface for a sedflux 3D simulation


Generated on Fri Jan 4 18:04:19 2008 for sedflux by  doxygen 1.5.2