| Home |


Sunday 28 July 2019 at 09:06 am.

This section presents some examples of the command line capabilities of TerraceM outside the Graphic user interface.

Loading TerraceM-2 Maptools outputs

 TerraceM-2 Maptools creates several Matlab® files used for data exchange between the other TerraceM-2 modules. These files can be called independently to create customized plots. In this example, we load the main output files containing the shoreline angles and swath profiles.

%Load swath profiles


%Load shoreline angles


The shoreline-angle file (.mat) is a structure containing several fields that define: a) method (met) used to map the shoreline angles, including the linear regression coefficients and points used for mapping, and b) the shoreline angle level (level), which includes the profile, elevation, error, map coordinates, location along profile and the station or mapping site name. 

Displaying swath profiles and shorelines angles mapped in TerraceM-2

This excercise follows the previous example.

Here we present an example plotting swath profiles and shoreline angles using the output files of TerraceM-2 Maptools.

 i=2; %profile number

j=1; %marine terrace level

%these values can be eventually looped to plot all mapped shoreline angles

 %extract the linear regressions for platform and cliff




%extract the shoreline angle




 %plot the result


hold on; plot(swath(i).x,swath(i).z_max,'-k',swath(i).x,swath(i).z_min,...

    '-k',swath(i).x,swath(i).z_mean,'-k');%plot the swath profile

 plot(cliff(:,1),cliff(:,2),'--r'); plot(cliff(:,1),cliff(:,4),'--r');%cliff points

plot(cliff(:,1),cliff(:,3),'-r');plot(plat(:,1),plat(:,2),'--r');%platform points


errorbar(SH(1),SH(2),SH(3),'ok'); plot(SH(1),SH(2),'ok',...  %shoreline angle


xlabel('Distance along profile (m)');ylabel('Elevation (m)');%axis labels

Creating swath profiles from shapefile polygons outside the GUI environment

Swath profiles can be generated using the TerraceM_makeswath.m function and Topotoolbox. The inputs are a DEM in geotiff (.tif) or Esri grid format (.asc) and a shapefile containing the swath profiles boxes, which may be created using the rectangle tool. The output is a structure containing the distance, minimum, mean, maximum and slope of a swath profile.

%Add path to topotoolbox folder, TerraceM-2 Maptools, and dem and shapefile.

addpath /Users/TerraceM_2018/Stations/HUEVO

addpath /Users/TerraceM_2018/topotoolbox-master

addpath /Users/TerraceM_2018/TerraceM_Maptools

Box=shaperead('Huevo_clip.shp'); %Shapefile containing the profiles boxes

DEM=GRIDobj('DEM_huevo.tif'); %DEM generated using Topotoolbox

profnum=2; %Profile number to process

%Create swath function


%Display swath profile


plot(swat.x,swat.z_min,'-c',swat.x,swat.z_mean,'-b',swat.x,swat.z_max,'-k');%plot the swath lines

xlabel('Distance along profile (m)'); ylabel('Elevation (m)');

legend('Min elevation','Mean elevation','Max elevation')

Mapping shoreline angles outside the GUI environment

This excercise follows the swath profile plot excercise presented before.

We can directly map shoreline angles calling the function TerraceM_staircase.m, which displays an interactive window to map the shoreline angle by selecting the paleo-platform and paleo-cliff. Outputs include the shoreline angle elevation and its associated error (shoreline), the points used to fit the linear regressions (points), and the linear regression coefficients and 95% confidence bounds (regr).

%Mapping a single shoreline angle


More scripts related to LEM and DIM are comming soon...