Professional Documents
Culture Documents
1. INTRODUCTION:
Matlab plotting tool produces different maps from the bathymetry ASCII files. This tool is written by
Alexander Breugem and consist of two executable files. Matlab plotting tool in the first step converts
the data file of the bathymetry to the Matlab file. Then from the Matlab file different maps can be
produced. It should be mentioned that in order to work with this tool, Matlab knowledge and also a
Matlab licence is not needed. The protocol of this tool is divided in the followings 3 steps:
Step 1: Control the bathymetry ASCII files
Step 2: Data conversion
Step 3: Plotting the data
The above steps with illustrative figures are explained separately in the followings paragraphs. As an
example a series of data and the plots are also presented in the following address:
S:\in-house\programmas\Metingen\GUI\Differencemaps\Executable\Example for Protocol of Matlab
Plotting Tool.
2. SETUP
In order to run the Matlab plotting tools, the MRE (Matlab runtime environment) needs to be installed.
The MRE is a program that enables you to run compiled Matlab code. In this way, you can use
programs made in Matlab, without the need of a Matlab licence. The MRE is located in:
S:\commercial\Matlab_Software\Matlab_runtime_environment\win32_runtime_R2009\win32
Just run the file MCRInstaller.exe once, in order to install the MRE on your PC. After that, you will be
able to use the compiled programs.
I/QU/00099/15.057/ABR page 2
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
Figure 1: The windows for converting the data from xyz format to Matlab format
I/QU/00099/15.057/ABR page 3
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
The user should fill in the boxes of the Convertdata-window (see figure 2).
The directory of the xyz-files should be entered in the “Input directory:”. The same directory can be
entered in the “Output directory:” (user can also use the “Browse keys”).
By clicking on the “Data limits” the program find the 4 corners that contain all the point of the “Input
directory” (see Figure 2). It is better to round the corners. The values in the lower left should be
rounded down and in the upper right should be rounded up. This option also gives the ability of
zooming on a certain area.
The four corners can be rounded as follows:
545413.57 to 545000 335800.78 to 335500
548078.61 to 548500 339438.31 to 339500
So the area would be 3500 m × 4000 m. A mesh is generated for the entire area. The mesh consists of
the elements with the shape of rectangle Delta X × Delta Y (by the two boxes of “Delta” the area is
divided in to the rectangular elements). If 5 m be considered for both delta, the number of elements
I/QU/00099/15.057/ABR page 4
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
would be 700 × 800. This amount of elements is seems to give an acceptable results. However, by
increasing the elements (by decreasing the two deltas) the precision but also the calculation time
increases. It should be noticed that the number of elements of 2000 × 2000 is too much for this
executable file.
Optional settings are designed to filter out the anomalies. Three boxes in this part can be filled in.
- Minimum depth (shallower depths are eliminated): This will give the ability of removing the data
from sea level to a special depth. This option can only be used for the maritime chart
convention.
- Maximum distance to measurements (larger is eliminated): For all the rectangular elements a
data point in the centre of the element is produced (interpolated). Interpolated points further
than “maximum distance to measurements” from the closest measuring points will be
eliminated. If the two adjacent lines of the data points are 100 m far from each other, then
“maximum distance to measurements” can be considered as 55 m (or 60 m: more than half of
the distance). It is recommended to run the file without any filtering. Then by looking at the
produced maps, user can have the idea of limiting the interpolation in order to filter out the
anomalies (later, it is illustrated).
- Maximum length triangulation (larger is eliminated): A triangulation is made among each three
data points. If the distance between the two adjacent lines of the data points are 100 m, the
maximum length of the triangles is a bit more than 100 m (i.e. 105 or 110 m). So, by choosing
120 m (as an example) for this box, all the interpolated points in triangles with a maximum
length of the sides longer than 120 m, will be eliminated. The user should be aware of
enormous increase of the calculation time. Therefore, it is recommended to use “maximum
distance to measurements” rather than “maximum length triangulation".
By clicking on the “Convert files” key, Matlab files of the converted data are produced in a directory
“mat_files” (this directory is produced by the tool).
I/QU/00099/15.057/ABR page 5
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
- anyname. txt: this file (e.g. Polygons.txt) contains the coordinates of all the required polygons,
separately (see Figure 4, left)
- anynameText.txt : by this file (e.g. PolygonsText.txt) user can name each polygon (see Figure 4,
right). The coordinates of the polygon name can be roughly the centre of the polygon.
Both files of “anyname.txt” and “anynameText.txt” should be located in the same directory. The
address of the “anyname.txt” should be entered in box of “Contours file”. The tool itself, finds the
“anynameText.txt” in the same directory.
I/QU/00099/15.057/ABR page 6
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
I/QU/00099/15.057/ABR page 7
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
Left: Polygons.txt
Right : PolygonsText.txt
Figure 4: An example of the text files needed for introducing the polygons surrounding the measured
area. Left: a sample for Polygons.txt that presents the polygons. Right: a sample for PolygonsText.txt
that names the polygons (roughly in the middle of each polygon)
The table in the bottom of the Plotdata-window should be filled in, with the names of the xyz.files that
user needs their plots (attention, the xyz.files and not the converted Matlab files). This table is
designed to produce the difference chart between two bathymetries (oldest and newest) and the tool
works (only) when all the columns are filled. Therefore, if user needs only the bathymetries of several
files, the “First file and date” columns should be prepared and the “Last file and date” columns can be
just a copy of the “First two columns”. However, for difference charts, mentioned columns are different.
It is recommended to prepare an excel chart with the desired columns and then paste it in the table of
the Plotdata-window (using the right mouse button).
If the number of data files are too much and putting them in an excel sheet takes a lot of time, the user
can use a specific macro to compose a list of all the files in a specified directory. This macro can be
found in the file “Make_filelist_per_directory.xlsm”1 under:
S:\in-house\programmas\Metingen\GUI\Differencemaps\Executable\ Make_filelist_per_directory.xlsm
1
macro written by Kathleen De Wit
I/QU/00099/15.057/ABR page 8
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
It is recommended to copy “Make_filelist_per_directory.xlsm” to the folder where the working data has
been saved. By opening the file, a key of “Draw up filelist” appears (see Figure 5). By clicking the key
“Draw up filelist”, the user can choose the directory of which he would like to have a file list inventory.
Figure 5: View of the excel macro file that produces the list of the file names in a specified directory
I/QU/00099/15.057/ABR page 9
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
After completing the table at the bottom of the Plotdata-window, the desired plot can be chosen. Figure
6 presents the filled out form (empty in Figure3).
As presented in Figure 6, the user should select the chart convention (marine or land chart):
- If the convention is “Marine chart”, in the window of “Chart datum text” that will appear as text
at the top of the depth scale of the map, it is recommended to type “m CD (depth is +)”, which
means: meter Chart Datum, depth is considered positive (most common for marine charts).
- If the convention is “Land chart”, in the window of “Chart datum text” that will appear as text at
the top of the height scale of the map, it is recommended to type “m CD (height is +)”, which
means: meter Chart Datum, height is considered positive (most common for land charts).
Any other information, considered useful to add on the plot, can be entered in the box “Remarks added
to plot” (see Figure3). After the selection of the type of the map (see later), the user should click on the
key “Guess depth”. Then, the minimum and the maximum depth (in meter) are found and presented as
I/QU/00099/15.057/ABR page 10
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
show in Figure 6. These depths can be rounded. The presented data in Figure 6 can be rounded to -5
m and 12 m. Now, by selection of the map type everything is ready to click the “Plot data” key in order
to have the maps in the specified directory.
User can select the desired map between the 6 available maps as presented in Figure 6. The following
options are available:
- “Data points”: plots all the data points (see Figure 7) and puts these plots in a directory called
“transects”. In the mentioned directory a file called “TableBath.csv” gives a summary of the
depth information within all the polygons. TableBath.csv can be saved as an excel file. Per
polygon is summarised: the average depth with its standard deviation and the minimum and
maximum depth (see Figure 8).
Attention: CSV use comma as list separator and dot as decimal symbol. These can be
changed in:
- Control panel
- Region and language
- Formats (tab)
- Additional settings
I/QU/00099/15.057/ABR page 11
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
Figure 8: Example of the file presenting a summary of the depth information per polygon (average
depth with standard deviation, minimum and maximum depth)
- “Maps”: plots the bathymetry (see Figure 9) and puts these plots in a directory called
“bathymetry”. In the mentioned directory, a file called “TableBath.csv” summarises the depth
information per polygon.
I/QU/00099/15.057/ABR page 12
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
D4 -4
D3 -2
0 m CD Sedimentation: Erosion:
D2 +2
D1 - D2 > 0 D1 - D2 < 0
D1 +4
Z D3 – D4 > 0 D3 – D4 < 0
2
Date 1 < Date 2 < Date 3 < Date 4 are ordered chronologically.
I/QU/00099/15.057/ABR page 13
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
Figure 10: Verification example for difference chart in marine convention, CD stands for chart datum
and D for the date of bathymetry
Z (m)
D2 +3
+2
D1 +1
0 m CD
Sedimentation: Erosion:
D4 -1
-2 D2 – D1 > 0 D2 – D1 < 0
D3 -3
D4 – D3 > 0 D4 – D3 < 0
Figure 11: Verification example for difference chart in land convention, CD stands for chart datum and
D for the date of bathymetry
The following colour scale is chosen to present the processes of sedimentation and erosion (see Figure
12):
difference = positive value → fill → sedimentation ; presented in red
difference = negative value → cut → erosion ; presented in blue
Z (m)
Sedimentation +2
+1
0
-1
Erosion -2
I/QU/00099/15.057/ABR page 14
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
It should be noted that in this part “guess depth” gives the minimal and maximal difference in
depth between the 2 bathymetries. Based on the above explanation the “Differences” plots the
difference map between the two files located in each row of the table of the Plotdata-window
(see Figure 13) and put the plots in a directory called “diff”. A file (Table.csv) is also produced
(see Figure 14) and put in the “diff” directory for the difference calculations. The file Table.csv,
can be saved as an excel file. The mentioned file has 8 columns and the results of the
differentials are presented for each row of the filled table in Plotdata-window. The results are
presented per polygon. For the first difference and the first polygon presented in Figure 14, the
following columns are shown (numbers are rounded):
1- First file : The name of the oldest file (BL 2007-33 …)
2- Second file: The name of the newest file (BL 2008-35 …)
3- Volume Diff (Polygon 1) ) [m^3]: Sum of cut and fill volumes: 23244 + (-5647) = 17597 m³
4- Volume Diff Cut (Polygon 1) ) [m^3]: Cut volumes (always negative): -5647 m³
5- Volume Diff Fill (Polygon 1) [m^3]: Fill volumes (always positive): 23244 m³
6- Used Area (Polygon 1) [m^2]: The part of polygon 1 that is covered by data points: 239175
m² which in this example is 99.2% (239175/241092) of the complete surface of polygon 1.
In the case that the coverage percentage is too low (e.g. 25%), user should be aware of
the interpretations, as the result is not representative for the entire area.
7- Area complete polygon 1 [m^2]: Complete area (surface) of polygon1: 241092 m²
(calculated using surveyors equation)
8- Avg Difference (Polygon 1) [m]: This thickness corresponds to the difference volume (col
3) divided over the used area: 17597m³ / 239175m² = 0.07 m = 7 cm
I/QU/00099/15.057/ABR page 15
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
Figure 14: Example of an excel file produced for the difference chart
- “Data points +Maps”: plots the data points on the bathymetry (see Figure 15) and puts these
plots in a directory called “bathtrans”. Also in this directory the file TableBath.csv, (as before
introduced) presents a summary of the depth information per polygon.
I/QU/00099/15.057/ABR page 16
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
- “Data points (old) + Differences”: plots the data points of the oldest file on the difference map
and puts these plots in a directory called “difftransold”. The file Table.csv, introduced in
“Differences” is also presented in this directory.
- “Data points (new) + Differences”: plots the data points of the newest file on the difference map
and puts these plots in a directory called “difftransnew”. The file Table.csv, introduced in
“Differences” is also presented in this directory.
I/QU/00099/15.057/ABR page 17
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
6. USEFUL HINTS
This paragraph gives several hints to produce the desired maps with the least trial and error. The
following systematic approach is proposed:
I/QU/00099/15.057/ABR page 18
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
Figure 16: Example of a plot of the data points on the bathymetry with no filtering. White stars indicate
the areas where data points are missing, but still a depth interpolation is done.
Figure 17: Example of sample plot presented in Figure 16 with 50 m filtering. White areas indicate a
lack of data.
I/QU/00099/15.057/ABR page 19
versie 1.0 - 23/02/2015
Protocol of Matlab Plotting Tool
9- The “guess depth key” should be clicked for the differential charts. If the minimal and the maximal
depth difference values differ largely, (e.g. between -4 and +8 m), the user will observe only one
colour roughly over the entire area of the differential chart. This means that the two extremes (e.g. -
4 and 8 m) correspond to a tiny limited area or some boundaries which are not strait forward visible.
In this case the upper and lower limits should be chosen closer together by entering other values
manually. A minimal depth difference value set to -2 m and a maximal depth difference value set to
+2 m, usually gives a good result in case of maintenance dredging projects, where sedimentation
between dredging campaigns or realised dredging depth hardly ever exceed these values.
I/QU/00099/15.057/ABR page 20
versie 1.0 - 23/02/2015