Development of an automatic delineation of cliff top and toe on very irregular planform coastlines (CliffMetrics v1.0)

. We describe a new algorithm that automatically delineates the cliff top and toe of a cliffed coastline from a Digital Elevation Model (DEM). The algorithm builds upon existing methods but is specifically designed to resolve very irregular 15 planform coastlines with many bays and capes, such as parts of the coastline of Great Britain. The algorithm automatically and sequentially delineates and smooth shoreline vectors, generates orthogonal transects and elevation profiles with a minimum spacing equal to the DEM resolution, and extracts the position and elevation of the cliff top and toe. Outputs include the non-smoothed-raster and smoothed-vector coastline, normals to the coastline-(as vector shapefiles), xyz profiles (as comma-separated-value files), and the cliff top and toe (as point shape files). The algorithm also automatically assesses the quality of 20 the profile and omits low-quality profiles (i.e. extraction of cliff top and toe is not possible). The performance of the proposed algorithm is compared with an existing method, which was not specifically designed for very irregular coastlines, and to hand-digitized boundaries by numerous professionals. Also we assess the reproducibility of the results using different DEM resolutions (5 m, 10 m and 50 m), different user defined parameter-sets related to the degree of coastline smoothing, and the threshold used to identify the cliff top and toe. The model output sensitivity is found to be smaller than hand-digitized 25 uncertainty. Code and a manual are publicly available on a github repository

Abstract. We describe a new algorithm that automatically delineates the cliff top and toe of a cliffed coastline from a digital elevation model (DEM). The algorithm builds upon existing methods but is specifically designed to resolve very irregular planform coastlines with many bays and capes, such as parts of the coastline of Great Britain. The algorithm automatically and sequentially delineates and smooths shoreline vectors, generates orthogonal transects and elevation profiles with a minimum spacing equal to the DEM resolution, and extracts the position and elevation of the cliff top and toe. Outputs include the non-smoothed raster and smoothed vector coastlines, normals to the coastline (as vector shape files), xyz profiles (as comma-separated-value, CSV, files), and the cliff top and toe (as point shape files). The algorithm also automatically assesses the quality of the profile and omits lowquality profiles (i.e. extraction of cliff top and toe is not possible). The performance of the proposed algorithm is compared with an existing method, which was not specifically designed for very irregular coastlines, and to manually digitized boundaries by numerous professionals. Also, we assess the reproducibility of the results using different DEM resolutions (5, 10 and 50 m), different user-defined parameter sets related to the degree of coastline smoothing, and the threshold used to identify the cliff top and toe. The model output sensitivity is found to be smaller than the manually digitized uncertainty. The code and a manual are publicly available on a GitHub repository.

Introduction
Coastal cliff erosion is a worldwide hazard with impacts on coastal management, infrastructure, safety, coastal resilience, and the local and national economies. Various types of cliffed and rocky coasts are estimated to represent about 80 % of the world's shorelines (Doody and Rooney, 2015;Emery and Kuhn, 1982): these include plunging sea cliffs, bluffs backing beaches and cliffs fronted by rocky shore platforms. The increasing population of coastal zones has led to the accelerating occupation of cliff tops and faces by buildings and infrastructure, including areas that are seriously threatened by shoreline retreat (Del Río and Gracia, 2009). The impact of this increased human presence has exacerbated erosion problems in some places. As a consequence, conflicts between human occupation and the inherent instability of cliffed coasts have become a problem of increasing magnitude (Moore and Griggs, 2002). Quantification of cliff retreat rates is vital for stakeholders who manage coastal protection and land use. An essential component of this quantification is a reliable delineation of cliff location. Automating the extraction of cliff top and cliff toe positions from topographic data will provide valuable constraints on coastal dynamics that will aid planning decisions, particularly where multitemporal data are available, and thus will facilitate better predictions of coastal change. Cliff metric delineation has traditionally been done by manually digitizing cliffs. Although efforts were made to standardize and eliminate subjectivity during manual digitization (i.e. Hapke et al., 2009), the de-lineation of cliffs and other shoreline features remains timeconsuming and somewhat dependant on the analyst's interpretation.

The problem of defining the top and bottom of a cliff
Defining a cliff is a difficult problem. The top and bottom of a cliff are often readily apparent and implicitly defined along stretches of the coast with iconic vertical cliffs, e.g. those composed of chalk or massively bedded and indurate sedimentary rocks (Fig. 1a). In less favourable circumstances, however, the relatively slow and sporadic erosion of cliffs may leave a compound surface that (in profile and in plan view) is composed of partly concave and convex shapes. These compound surfaces may be further complicated by the occurrence of pre-existing and uplifted marine terraces, intervening coastal rivers (some of which may be hanging), and anthropogenic structures such as transport corridors (usually roads). These complications make the top of such a compound cliff profile difficult to define. The situation is made more complex still when it is recognized that cliff erosion is, on a human timescale, episodic. Cliff erosion occurs typically by land-sliding. Landslides are well known to be of a variety of types and, in general, their frequency and magnitude follow a power-law distribution (Hurst et al., 2013). This means that larger landslides occur much less frequently than smaller ones. An obvious and clearly visible "top" of the cliff may simply be the top of more frequent but relatively small landslides. Earlier and larger landslides may be visible in a topographic analysis of the sort described here, but they may also be subsumed into anthropogenic landforms that form the boundaries of transport infrastructure (Fig. 1b).
At present, cliffs are eroding in response to a relatively stable late Holocene sea-level, established between 7 and 6 kyr BCE, but the extent to which cliff erosion is accelerating or has reached a dynamic steady state is also a function of the tectonic setting (e.g. whether land is actively uplifting or subsiding) and the form of the near shore, which modulates wave energy as it propagates to the cliff line. Thus, the cliff top, if considered as the upper moving boundary of a dynamic process of cliff failure, is by no means easy to define: it may not always be the topographic high along the coastnormal profile. Still, more complexity arises from the observation that cliffed coastlines are often interrupted by other non-cliffed coastal landforms such as estuaries and beaches (Fig. 1c, d). For example, based on the European Commission (1998 -the CORINE project érosion cotière), the 14 321 km of coastline of the British coast can be classified morpho-sedimentologically as cliffs (67 %: 56 % hard rock and 11 % soft rock), sand beaches (11 %), shingle beaches (7 %), heterogeneous beaches (4 %) and muddy and estuarine coasts (10 %) (May and Hansom, 2003).
The main advantage of an automatic algorithm for cliff top and toe delineation is that the uncertainty associated with manual digitization, which is subject to human error and subjective judgement, can be quantified and reduced. However, given the complexity of the problem, we acknowledge that this delineation will inevitably involve some ambiguity, which will only be resolved by human screening of the outputs. Therefore, a major requirement of any automatic cliff toe and top delineation procedure is some means of readily screening the outputs.

Review of automatic delineation procedures
Since cliff edges are linear features which are detectable in digital elevation models (DEMs), automated and wellknown methods used to extract break lines can potentially be adapted to extract cliff edges. The automated methods of break line extraction can be grouped into four major categories (Palaseanu-Lovejoy et al., 2016): (1) deriving lines from intersecting planes (i.e. Briese, 2004;Brzank et al., 2008;Choung et al., 2013), (2) extracting lines through a neighbourhood analysis of DEM elevation values (i.e. Rutzinger et al., 2012;Hardin et al., 2012;Mitasova et al., 2011), (3) applying edge detection filters and segmentation methods developed for image processing (Sui, 2002;Richter et al., 2013;Lee et al., 2009) and (4) automatic elevation profile elevation extraction analysis (Liu et al., 2009;Palaseanu-Lovejoy et al., 2016). The method that we present here belongs to the last category and its rationale is described below. Liu et al. (2009) developed a method based on elevation profile extraction across the cliffs and the observation that generally the variation in the slope along the elevation profile is greater at the top and the toe of the cliff than anywhere else along the profile. However, this may not be the case for complex cliffs with roads or terraces cut through the cliff gradient, cliffs with different erosional profiles or slope gradients, or cliffs formed at the base of hills. Palaseanu-Lovejoy et al. (2016 proposed an alternative method based also on profile extraction from high-resolution DEMs but that does not involve variation in slopes between the profile point (i.e. cliff top and toe are delineated as the maximum and minimum, respectively, of the detrended profile). The PL2016 automatic delineation method has proven useful in resolving a range of types, from almost-vertical cliffs with sharply defined top and toe inflection points to complex cliff profiles. The PL2016 method relies on the user being able to generate a reference generalized vector shoreline which is free from tight bends and, as much as possible, is parallel to the general direction of the cliffs. The generation of the reference shoreline is, however, not part of the automatic delineation method itself. Such a generalized vector shoreline is not always possible to achieve for very irregular coastlines (i.e. sequences of small bays and capes) such as parts of the northern and western coastlines of Great Britain. Also, the length of the profile is a key parameter in Figure 1. The problem of defining the top and bottom of a cliff is not trivial. For example, most of Britain's coastline is made of cliffs (hard and soft) but also beaches and estuarine environments. (a) Cliff top and toe are readily apparent for the hard rock coast of Saint Bees but not as clear at the soft-cliffed coastline of the Isle of Sheppey where landslides are ubiquitous (b). Cliffed coastlines are often interrupted by other landforms such as estuaries (c) and beaches (d).
this approach, but as shown by PL2016, the method is robust enough that the position of the top and toe of the cliff does not change with the length of the profile, as long as the cliff is the most prominent geomorphic feature present. Ensuring that the cliff is the most prominent feature can be achieved by shortening and/or lengthening the profile length along the different coastline segments as done by PL2016 during preprocessing. But even if the pre-processing is done carefully, it is likely that -due to natural variability in geomorphic features -the cliff is not the most prominent feature in some locations. Thus this need to fine-tune the profile length for different coastal segments during the pre-processing stage detracts from the benefits of having an automatic delineation procedure. It remains unclear how the results might differ by using a fixed coastline normal versus a fine-tuned normal length for each coastal segment.
Here, we present an automatic cliff toe/top delineation algorithm based on profile elevation extraction from a DEM, using a fixed profile length, and an automatic generation of a generalized coastline that is suitable for very irregular coastline shapes. The proposed method is demonstrated at several study locations along the British coastline using a DEM with national coverage. We compare the outputs of the proposed method with the outputs produced by the PL2016 method. We also explore the reproducibility of the results using differ-ent DEM resolutions and user-defined parameter settings (explained in detail below). Model outputs are compared with the uncertainty in manually digitized cliff toe and top as part of a sensitivity analysis of our approach.
Our software and documentation are available under the Open Government Licence (see code availability section).
2 Study site and methods

Digital elevation model source and study sites
Our automated procedure requires a bare-earth DEM. The only requirement of the proposed method regarding the DEM is that it should include the cliff toe and top (i.e. cover from the shoreline to sufficiently far inland to capture the cliff top). The algorithm is agnostic regarding the method used to collect the data (i.e. airborne radar, terrestrial or unmanned aerial vehicle (UAV), lidar, etc.). We have used several DEMs from the UK as an example of very irregular planform coastline but the method is in principle transferable to any other DEM. Here, we have used different resolutions of the NEXTMap DEM for Britain. NEXTMap for Britain is a 5 m resolution DEM derived by airborne radar technology by Intermap Technologies. The elevation data were cap- tured during 2002-2003 and provide elevation point data on a 5 m grid, which has subsequently been interpolated using a bespoke algorithm to derive the underlying "bare earth" terrain model i.e. removing surface features such as buildings and trees. NEXTMap height data have a vertical accuracy of around 1 m ± RMSE and a horizontal accuracy of 2.5 m ± RMSE on slopes less than 20 • . NEXTMap uses the OSGB36 horizontal datum and all elevations are relative to the ordnance datum Newlyn vertical datum. Radar cannot penetrate water and therefore the DEM records the elevation of the water surface at the time of image acquisition. Higher resolution DEMs of 10 and 50 m were obtained by averaging the elevation of the 5 m DEM.
The aims of the sensitivity, model-to-model comparison and manually digitized cliff analyses are different and therefore the places selected to conduct each analysis are different too. Our sensitivity analysis and model-to-model comparison investigates the way in which the variation in the output can be attributed to variations in the different input factors (Pianosi et al., 2016) or different automatic delineation procedures, respectively. The manually digitized cliffs analysis illustrates the importance of the data output screening and algorithm behaviour. For the sensitivity analysis and modelto-model comparison, we have focused on a coastal cliffdominated region with irregular plan shape to make our findings more transferable to other similar cliffed coastlines elsewhere. For the manually digitized cliffs analysis, we have selected a challenging coastal region (i.e. very irregular shape, complex cliff profile sections intercalated with non-cliffed sections) to highlight the importance of screening the results and running the algorithm iteratively until the manually digitized and automatically delineated cliff top and toe locations converge.
For our sensitivity analysis, we selected a 30 km coastal stretch centred at St Bees Head in northwest England. This study area, which is part of the coast of the county of Cumbria, contains an assortment of different coastal morphologies but it is mostly dominated by high cliffs (Fig. 2a). The southern section of the study area, south of St Bees Head, is fully exposed to the sea conditions from the Irish Sea, while the northern section is dissected by more sheltered estuarine environments. The rock has been eroded by wave action to produce the spectacular 80 m high vertical cliffs stretching from the Seacote foreshore to Saltom Bay. At Fleswick Bay, Line vector with the non-valid coastline normals line shape file coast_nCoast_profile_nProf_XX.csv CSV file with the elevation profile for profile number "nProf" on coast number "nCoast" and DEM named XX. Each file contains the chainage (i.e. horizontal distance from seaward limit), absolute (x, y) location, elevation above vertical datum and detrended elevation.
ASCII cliff_toe_XX.shp Point vector with cliff toe position and four attributes; nCoast is the coast number, nProf is the profile number which is unique for each coastline segment, bisOK is a Boolean flag that will be 1 if the profile is valid or 0 otherwise, CliffToeEl is the elevation in metres of the cliff toe, and chainage of the toe point.
point shape file cliff_top_XX.shp Point vector with cliff-top position and four attributes; nCoast is the coast number, nProf is the profile number which is unique for each coastline segment, bisOK is a Boolean flag that will be 1 if the profile is valid or 0 otherwise, CliffTopEl is the elevation of the cliff top, and chainage of the top point.
point shape file XX is the user-defined main output and log files name. All elevations are in metres. a shingle beach lies on large sandstone platforms. At the west end of the St Bees Valley, terminal moraines dating from the last glacial period (∼ 12-14 000 BP) are exposed at the coast as bluffs. The west pier at Whitehaven Harbour forms a significant barrier to the movement of beach material further north. A small beach exists to the south of west pier, formed by trapped beach material. The coastline for about 100 m immediately to the north of Whitehaven Harbour is protected by an armoured stone bank. A railway embankment fronts the natural cliffs along the coastline between Whitehaven and Harrington. At the northern limit of the study region is the port city of Workington. Around Workington slag banks from blast furnace plants cover large sections of the coast, which also contains alluvial deposits from the River Derwent.
For the manually digitized cliffs analysis, we selected three 1 km sections that represent active cliffed coastlines of different height and plan shape (Flamborough Head, north and south sections; and one section that represents a non-active, i.e. Holocene, cliff: Sandhead; Fig. 2b, c). The first cliffed section (FH1) was located on the south side of Flamborough Head, Yorkshire (UK), within highly erodible glacial tills deposited during Devensian glaciations (ca. 35 to 11.5 ka BP). The second cliffed section (FM2) was located on the north face of Flamborough Head on the chalk cliffs, which are overlain by the glacial till deposits. On both sections, FH1 and FH2, cliff heights are of the order of 20 m but the coastline has a more irregular shape on FH2 than FH1. Section 3 (DG) is located near Sandhead, Dumfries and Galloway (UK) and is an inactive cliffed coastline. At section DG, maximum profile elevations are of the order of 20 m.

Automatic delineation of cliff metrics
The automatic delineation procedure quantifies cliff top and cliff toe position, and cliff height, following the steps shown as a flow chart in Fig. 3, illustrated further in Fig. 4 and described in detail below. All the resulting geospatial outputs produced by the proposed method are listed in Table 1.
-Extracting the coastline from a DEM. Figure 4a shows the input DEM that we use to illustrate the methodology. The first step is to delineate the shoreline at a user-defined elevation. Coastline cells are delineated using a wall-follower algorithm (Sedgewick, 2002). The wall is at the interface between cells above and below the user-defined elevation. Raster cells "on" the shoreline are marked (Fig. 4b); the coastline is also stored as a vector object. Depending on the coastal geomorphology and extent of each DEM tile, more than one coastline segment may be traced on the DEM. Each coastline segment is given an ID number (N coast ). The wall-follower algorithm used to delineate the coastline searches the tile edges to find the start of any coastline. The coastline of islands (i.e. land topography that does not cross the edges of the DEM) is not delineated ( Figure 5). To resolve the islands, the tile needs to be zoomed-in to ensure that the edges of the land topography intersect any of the tile edges.
The resulting coastline is then smoothed to eliminate artefacts resulting from the resolution of the DEM, due to local geomorphic variability associated with the heterogeneity of natural landscapes, and the presence of artificial features at the coast, in order to produce a generalized coastline. This is done either by running a moving-average window across the positional x-y coordinates or by Savitzky and Golay (1964) smoothing, which involves fitting successive subsets of adjacent data points with a low order polynomial using least squares regression. The user needs to decide which method better fit their perception of a generalized coastline. The resulting smoothed coastline comprises a compound vector object. This is made up of two sets of consecutive points: a set holding the location of each smoothed coastline point and a set holding the orig- inal non-smoothed cell location of the coastline point (Fig. 4c).
-Extract transects normal to the coast.
We then generate cross-shore transects, from which we extract the coastal topography. These cross-shore transects are located perpendicular to the smoothed coastline, extending inland from each coastline cell for a user-defined distance (Fig. 4d). Normals that intersect the coastline more than once (e.g. barrier beaches, headlands) are flagged as "hitting the coast" profiles; their length is reduced (i.e. the profile is shortened to the segment between the first and the second shoreline inter-section). Coastline normal transects that are too short (i.e. extend for only two raster cells) are considered invalid for the delineation of the cliff metrics: these are flagged as "non-valid". Intersecting coastline normals are flagged as "intersecting but not truncated".
-Morphometric identification of the cliff top and toe.
Coastline-normal elevation profiles are then sampled from the DEM cells under each valid coastal normal. The elevation of each point of the coastline normal is determined using the elevation of the centroid of the closest raster cell (thus coarser resolution DEMs will produce more jagged elevation profiles). A topographic Figure 5. The algorithm used to delineate the coastline searches the edges of the tiles to find the start point of the coastline. The solid grey line represent the coastline over the coloured DEM (i.e. the warmer the colour the higher the elevation). The coastline cuts the edges of the DEM at the locations indicated by the solid black circles. The coastline of the Isle of Wight does not cut the edges of the DEM and therefore the user needs to define two smaller DEM domains (represented as dashed black and blue rectangles for the west and east side of the isle). The isle coastline now cuts the smaller domains at the locations indicated by the blue and black dashed circles. It is recommended to allow some overlap between the smaller domains to ensure that the cliff metrics are well resolved near the edges.  trend line is then calculated as the elevation difference between the start and end points on the profile, divided by the horizontal profile length (Fig. 4e). The detrended profile elevation is then calculated as the residual when the topography is compared with the trend line. Finally, the cliff top and cliff toe are identified as the maximum and minimum detrended elevations (Fig. 4f). All cliff toe and top points for the input DEM, as identified using this procedure, are shown as a 3-D model in Fig. 4. Note that an optional user-defined elevation threshold may be used to avoid false peaks. If the absolute value of the peak elevation (depression) is lower than the threshold elevation, it is assumed that the points at the end (start) of the profile are the cliff top (toe). This "elevation sanity check" is required to avoid small bumps on rather slope-uniform profiles (i.e. non-cliffed coastlines) being picked up as cliff tops or toes.

Sensitivity analysis and model vs. model comparison
We assessed output sensitivity to (1) the DEM resolution, using DEMs of 5, 10 and 50 m of the same study region; (2) the degree of smoothing of the generalized coastline; and (3) the threshold used to avoid false cliff top/toe locations. Table 2 summarizes results from these sensitivity analyses. As a ref-erence, we used the cliff metrics outputs for the DEM of 5 m resolution, a 61-cell moving-average window for coastline smoothing, and 0.5 m as the vertical threshold. This distance seems to be large enough to produce a smooth coastline and small enough to resolve the numerous headlands and bays along this part of the British coastline. To explore the local sensitivity to coastline smoothing, we have also used 31-cell and 7-cell moving-average window sizes that are equivalent to ∼ 165-220 and ∼ 35-50 m windows, respectively. We selected the vertical threshold of 0.5 m as the reference threshold because it is of the same order of magnitude as the vertical accuracy of the radar elevation data used by NEXTMap. The reference threshold elevation is relative to the detrended elevation and it can be smaller than the DEM resolution. To explore the local sensitivity to vertical threshold value, we also used vertical thresholds of 0.01 and 1.5 m. Figure 6 shows the smoothed coastline obtained, using these different DEM resolutions and different smoothing window sizes, for six different coastal morphological environments: (a) estuarine, (b) bay with harbour, (c) uninterrupted high-cliffed coastline, (d) pocket beach surrounded by high cliffs, (e) beach at the seafront of a relic valley, and (f) low-cliff coastline (i.e. eroding moraines).
When the number of points for the window size is chosen to make the window length similar under different DEM res- Table 3. Differences and commonalities of proposed method versus PL2016 method.

Proposed method PL2016
Differences -it is compiled so it is quicker (C++) -less pre-processing -computes only cliff top and toe -process concave short profiles (i.e. incomplete cliff profiles look like a check mark) -can deal with very long and narrow promontory by adjusting the normal length automatically -transects start at a user-defined level and projected inland perpendicularly to an automatically delineated smoothed coastline -the code is readable so profile extraction function from the DEM along transects is slower (R) -pre-processing work to set up the buffers for generating transects is necessary -computes secondary inflections on the face of the cliff and if desired identifies the top and 2 toes of a sand bar in front of the cliff (one toe on each side of the sand bar top) -reject completely concave profiles (profiles that look like a check mark) -cannot deal with long and narrow promontory, unless more involved pre-processing is done. par -transects are projected seaward and inland perpendicularly to a externally delineated coastline Commonalities -after the profile is extracted the 2 codes to extract top and toe are similar using the same logic -both methods output the profile elevation for further processing -rejects short profiles with N min or less elevation points on land, where N min = 3 and 5 for proposed method and PL2016 (there is nothing preventing the methods to be set up for the same N min ) olutions, the resulting smoothed coastlines are very similar. In particular, the smoothed coastlines for the 5 m DEM and 61 points and the 10 m DEM and 31 points are almost identical. In all cases, the smoothed coastline differs from the highwater line, which is expected when using a still-water level of 1.0 m above the ordinance datum (OD) to delineate the coastline. By choosing a water level of 1.0 m above OD, we have avoided delineating artificial coastal infrastructure, such as the Whitehaven Harbour, where elevation has not been fully removed from the DEM. Around the Workington harbour, the estuary cuts the edges of the DEM and the model automatically creates two coastlines (a short one to the north side of the Workington harbour, and a longer one to the south).
Choosing metrics to compare model outputs is not straightforward. The number of cliff-top/toe points varies with the DEM resolution (because the method delineates one coastline normal through every coastal cell point) making a profile-to-profile comparison infeasible (because profile elevation and orientation will also vary with DEM resolution and selected coastline smoothing). Thus, we chose a point-toline-distance approach. Points are the cliff-top/toe location outputs; as a reference line, we converted the cliff-toe/top points into a cliff-top/toe line for the reference model setup. The minimum distance between the cliff toe/top locations and the reference line was calculated using the Quantum geographic information system (QGIS) 2.18.3 "Distance to nearest hub" tool. Given a layer with source points (i.e. cliff toe/top points) and another layer representing destination points or lines (i.e. reference cliff toe/top line), this "Distance to nearest hub" tool computes the distance between each source point and the closest destination one. The shortest distance between any point and a line is the length of the line segment that joins the point to the line and is perpendicular to the line. We calculated the average, standard deviation, maximum and minimum shortest distances for all source points.
For the model-to-model comparison, we compared the model outputs for the reference set-up with the PL2016 model outputs. Both methods differ regarding the preprocessing that is required ( Table 3). The PL2016 method requires more pre-processing than our approach since PL2016 needs to create a generalized coastline, split the coast into segments and then associate a buffer width with each segment. For the St Bees study region of circa 30 km, the coastline was divided into 25 segments; buffer width ranged from 20 to 400 m (Fig. 7). Our method delineates the smoothed coastline automatically and does not require the coastline to be divided into segments. However, coastline segments will be created if the delineated coastline cuts the edges of the DEM domain. We used the smoothed coastline produced by our algorithm, using the reference set-up, as the generalized line required for the PL2016 method. Both methods are therefore quite similar with regard to coastline selection. The main difference concerns the way that the coastline normals are defined. After some trial and error, we chose a profile length of 500 m as our user-defined fixed length. As a metric of the differences in outputs, we again use the QGIS "Distance to nearest hub" to calculate the differences in the cliff top and toe locations outputs produced by the method proposed here and in PL2016.

Manually digitized profile analysis and iterative output screening method
As outlined in the Introduction section, a major requirement of any automatic cliff toe/top delineation procedure is some means of readily screening the outputs. In this section, we describe how we have developed a methodology to iteratively screen over the model results and run the automatic delineation algorithm to achieve a desired model behaviour or identify any bias on the target lines. The target cliff top and cliff toe locations are obtained from a cluster of 24 manually digitized lines from aerial photography. A group of 24 participants with a range of geological expertise participated in the experiment, each interpreting data for three 1 km sections (FH1, FH2 and DG; see Fig. 2b, c). Using a geographic information system (GIS; Google Earth Pro 7. 1.8.3036, 32-bit), participants attempted to delineate cliff top and toe lines without any prior knowledge of their location. As with the sensitivity analysis, we used a pointto-line metric to calculate the main statistics of the manually digitized results. As a reference line, we generated a mean cliff top and toe line for each of the study sections from the participant data. We extracted the cliff top and toe points from each one of the manually digitized lines and calculated the average, standard deviation, maximum and mini-mum shortest distances for all source points. This provides us with both a quantitative assessment of the uncertainty in human interpretation of cliff top and toe lines from aerial photography as well as a number of target cliff and top and toe lines to test the proposed algorithm behaviour.
Building on (1) the uncertainty in the human interpretation of cliff top and toe lines from aerial photography, (2) sensitivity analysis results and (3) model outputs (see Table 1) we developed an iterative output screening method to achieve the desired model behaviour and identify bias on the target lines. We clustered the manually digitized lines to broadly capture the different interpretation of coastal cliff toe and top. The different clusters were then linked to the different model setup parameters. We then illustrate a model output screening method and iterative parameter selection for users to achieve desired model behaviour.    Figure 9 shows the cliff metrics for all six regions and the 3-D model derived from the 5 m DEM. While our approach is designed to resolve cliffed coastlines, it also seems to be able to resolve very irregular coastline shapes such as a pocket beach between high cliffs (Fig. 9d), a bay (Fig. 9b), and estuarine environments (Fig. 9a). Table 4 shows the results for the cliff-toe sensitivity analysis for the St Bees study case. The average difference between the cliff-toe location outputs and the reference outcome varies between 1 and 26 m. It is most sensitive to changes in DEM resolution (i.e. average differences of 4 and 25 m for the 10 and 50 m DEM resolutions, respectively). Cliff-toe location is less sensitive to changes in the size of the smoothing window and the vertical threshold (i.e. differences always smaller than 2 m). Standard deviation is largest (about 40 m) for the DEM of 50 m resolution, and is about 10 m for the outputs from the DEM of 5 and 10 m resolutions. The maximum difference is 368 m for the DEM of 50 m and vertical threshold of 1.5 m. Table 5 shows the results for the cliff-top sensitivity analysis. Average differences between the cliff-top location outputs and the reference outcome vary between 0 and 37 m, again being most sensitive to changes in DEM resolution (i.e. average differences of 6 and 32 m for the 10 and 50 m DEM resolutions, respectively). Cliff-top location is (again) less sensitive to changes in the size of the smoothing window and the vertical threshold (i.e. differences always smaller than 8 m). Standard deviation is largest (about 60 m) for the DEM of 50 m resolution, and is about 10-20 m for the outputs from the DEM of 5 and 10 m resolutions. The maximum difference is 502 m for the DEM of 50 m and 7-point smoothing window Table 5. Cliff top average, standard deviation, maximum difference and number of samples for the sensitivity analysis to DEM resolution, window size for coastline smoothing and vertical threshold. size. There are about 6500, 3200 and 600 coastal points for the DEMs of 5, 10 and 50 m resolutions, respectively. Since model outputs are most sensitive to DEM resolution, we extended the sensitivity analysis to DEM resolutions of 15, 20, and 35 m. To keep the window size to a similar magnitude, we chose the window size for smoothing the coastline to be 21, 15 and 9 points for the 15, 20 and 35 m resolution DEMs, respectively. We kept the vertical threshold unchanged (0.5 m). Figure 10 shows average differences decreasing as the DEM resolution decreases. To estimate the trend in average differences, we fitted and extrapolated a polynomial line of order 3 to the cliff top and toe calculated differences. This fitted trend line suggests that the minimum differences (i.e. for the smallest DEM resolution) are 1 and 5 m for the cliff toe and top, respectively.

Model-to-model comparison
Our results show that the two automatically delineated cliff top and toe locations are, generally, in good agreement (i.e. distances are less than one cell diagonal). Toe locations are anticipated to be different since the proposed method uses a user-defined elevation (e.g. 1.0 m: chosen to avoid delineating the artificial infrastructure near the coast, which had not been removed from the DEM) to begin its coastline profiles, while the PL2016 method begins its transects from the lowest elevation (i.e. 0 m for the DEM used here). Distances between cliff metrics of less than one cell diagonal length (i.e. 7.07 m for a 5 m cell size) are considered within the DEM resolution limit and thus, for model-to-model comparison purposes, identical outputs. The PL2016 method applied to the St Bees study site produced a set of 6655 toe points and 6324 top points (i.e. top points are less than toe points because concave profiles are not used to delineate the cliff top but the profile is still been used to delineate cliff toe). Our  approach produced a data set of 6598 top and toe points, of which 68 were flagged as poor-quality points. The minimum distance between the line formed by the proposed method's cliff top and toe outputs and the PL2016 outputs was calculated: the frequency distribution of the minimum distance between the cliff top and toe locations is shown in Fig. 11. The cliff toe locations are in good agreement (i.e. minimum distance less than one cell diagonal) for 78 % of the data, and the cliff top locations are in good agreement for 68 % of the locations. The median distance for both top and toe locations Figure 11. The proposed method and the PL2016 method outputs are in good agreement. Panels shows the distribution of the minimum distances between cliff toe and top output locations (for a 5 m grid cell, the cell diagonal is 7.07 m or the length of the hypotenuse of the square triangle made by two connected sides of the grid cell).   are always inferior to a cell diagonal. To understand where the outputs from the two methods differ between each other, it is necessary to look at the spatial distribution of the differences. Figure 12 shows the spatial differences between the cliff metric results using the PL2016 algorithm and our approach.
The maximum differences in toe (236 m) and top location (206 m) are either in segments, where the coastline makes sharp bends and the cliff is not the dominant feature (Fig. 12a), or where the cliff has a steep face with a talus at the toe (Fig. 12b). Both methods were able to delineate the cliff metrics along the eroding moraines, but our approach Figure 15. manually digitized cliff top and toe lines (coloured lines) over the DEM for the FH1 site. DEM colours represent slope (darker colours represent higher slopes). The vertical dimension has been exaggerated 10 times. The roman number represents the main cluster of manually digitized lines.
was also able to trace a welded sandbar at the southern end of St Bees beach (Fig. 12c). The sandbar crest elevation is of the order of 2 m height. It lays parallel to the coastline with eroding moraines of approximately 15 m height. Most of the sea-facing cliff toes, and toes along the bar, were flagged as non-valid. At the inland-facing side of the bar, most cliff toe and tops were flagged as valid (i.e. long enough and top elevation higher than toe).

Manually digitized uncertainty
Analysis of the resulting violin plots for each location (Fig. 13) reveal that there is less variance in defining cliff toes when compared to the cliff tops, and the results are skewed towards the seaward side of the mean delineations. The lowest range in cliff top delineation comes from the FH1 site, where there is a 32.16 m spread between the 25th and 75th percentiles. The largest spread in cliff tops comes from the DG site, where there is a 166.97 m spread in the same percentiles. Further analysis of each section shows that two distinct peaks, separated by over 100 m, are present in the de-rived histograms for each cliff-top site. The spread of delineations around these peaks is similar to those for the cliff toes. The smaller range in cliff-toe-line variance suggests that there is greater certainty in participants defining those lines from aerial photography. The negative skew within the violin plot analysis is likely due to tide lines, beach and platform being readily identifiable in the images and therefore less prone to be misinterpreted as cliff-line features. The bimodal nature of the cliff top delineation can be attributed to participants' personal definition of what constitutes a cliff top. This dilemma is highlighted in the FH1 and DG sites. In the former there are two distinct breaks in slope and participants tended to follow either a higher or lower cliff top line (Fig. 14). This dilemma is not present on the FH2 site were only one distinct break in slope exists (Fig. 15). Within the DG site there is a very low cliff (< 1 m) at the top of the beach and a much more pronounced Holocene cliff line set back around 100 m from the coastline (Fig. 16). Participants tended to prefer either one cliff line or the other. Interestingly for the DG site, even if participants selected the Holocene cliff-top, they were unlikely to use the Holocene toe line. This is highlighted by the lack of bimodal response in the DG toe-line histogram. Figure 17 shows the automatically delineated cliff top and toe for the DG and FH sites using different input model setups. Starting with the same model set-up used as a reference for the sensitivity analysis (DEM of 5 m resolution, a 61-cell moving-average window for coastline smoothing, and 0.5 m as the vertical threshold) -and simply changing the stillwater level used to delineate the coastline from 0.01 to 6 m and changing the profile length from 105 to 500 m -the algorithm is able to differentiate between the active cliff profile (still-water level = 1 m and profile length = 105 m, Fig. 17a) and the Holocene cliff (still-water level = 6 m and profile length = 500 m, Fig. 17b). By rising the still-water level, we obtain generalized coastlines that represent current mean sea level and raised historical sea levels. By using a smaller profile length for the active profile we ensure that the active cliff is the dominant feature captured. At the location where the Holocene cliff is very close to the active cliff, the algorithm picks up the highest Holocene cliff as the dominant cliff feature but at the right and left sides picked up the active cliff. The reference model input (DEM of 5 m resolution, a 61-cell moving-average window for coastline smoothing, and 0.5 m as the vertical threshold, still-water level 1 m, profile length 500 m) seems to provide reasonable locations of cliff top and toe at the FH1 and FH2 sites (Fig. 17c, d). From the FH sites, it seems clear that the automatically delineated cliff top does not corresponds with an abrupt change of slope everywhere.

Discussion and conclusion
Cliff metric delineation has traditionally been done by manually digitizing cliffs. Although efforts were made to stan- Figure 16. manually digitized cliff top and toe lines (coloured lines) over the DEM for the DG site. DEM colours represent slope (darker colours represent higher slopes). The vertical dimension has been exaggerated 10 times. The roman numbers represent the main clusters of manually digitized lines. Figure 17. Automatically delineated cliff top and toe locations (green cone and blue spheres) over the DEM for the DG and FH sites; (a) results using current still-water level to delineate the coastline for the DG site; (b) results using a still-water level 6 m above current level to delineate the Holocene coastline for the DG site; (c) and (d) results using default model set-up for FH1 and FH2, respectively. DEM colours represent slope (darker colours represent higher slopes). The vertical dimension has been exaggerated 10 times. Table 6. ASCII input file with the user-defined delineation parameters.  ; If user wants to use a given shoreline vector instead of extracting it from the DTM proposed method based on profile extraction from highresolution DEMs has proven useful in resolving a range of cliff types, from almost-vertical cliffs with sharply defined top and toe inflection points to complex cliff profiles. However, the PL2016 method relies on the user being able to generate a reference generalized vector shoreline which is free from tight bends and, as much as possible, is parallel to the general direction of the cliffs. The generation of the reference shoreline is not part of the PL2016 automatic delineation method itself. Such a generalized vector shoreline is not always possible to achieve for very irregular coastlines (i.e. sequences of small bays and capes) such as parts of the northern and western coastlines of Great Britain. Also the length of the profile is a key parameter in this approach, but as shown by PL2016, the method is robust enough that the position of the top and toe of the cliff does not change with the length of the profile, as long as the cliff is the most prominent geomorphic feature present. Ensuring that the cliff is the most prominent feature can be achieved by shortening/lengthening the profile length along the different coastline segments as done by PL2016 during pre-processing. But even if the pre-processing is done carefully, it is likely that -due to natural variability of geomorphic features -the cliff is not the most prominent feature in some locations. Thus this need to fine-tune the profile length for different coastal segments during the pre-processing stage detracts from the benefits of having an automatic delineation procedure. Until now, it was unclear how the results might differ by using a fixed coastline normal (Fig. 6c) versus a fine-tuned normal length for each coastal segment. Here, we have presented an automatic cliff toe/top delineation algorithm based on profile elevation extraction from a DEM, using a fixed profile length, and an automatic generation of a generalized coastline that is suitable for very irregular coastline shapes. The proposed method is demonstrated at several study locations along the British coastline using an airborne radar DEM with national coverage at different resolutions. The algorithm is agnostic regarding the method used to collect the DEM and therefore it could be applied to other methods such as UAV/drone or terrestrial elevation data collection procedures. The main differences and similarities between the two methods are summarized in Table 3. Fine-tuning the profile length, as proposed by PL2016, makes an appreciable but small difference to cliff toe and top automatic delineation when using a fixed profile length. The comparison of the outputs produced by the proposed method, which uses a fixed profile length, and the PL2016 method, which fine-tunes the profile length for each segment along the coastline, suggest that cliff toe and top locations are virtually the same for more than two-thirds of the cases. For those cases where output locations do differ, neither method seems to outperform the other. By avoiding the need for finetuning the profile length, the proposed method speeds up the delineation process but does not eliminate the need for the screening of the model outputs.
To facilitate the screening of the model outputs, our approach produces a set of shape and ASCII files (Table 1). These output files are therefore in a format that is readable by most GIS and spreadsheet software (i.e. QGIS, Excel, etc.). These outputs are an important requirement of any automatic delineation procedure. They are labelled in a self-explanatory fashion to allow the user to explore the underlying data of any delineated cliff top/toe location. manually digitized cliff top and toe locations spread between participants are of the order of 4 to 23 diagonal cells (i.e. for a DEM of 5 m cell size). These large differences seems to be driven by the bias towards using changes in slope as the preferred cliff top and toe locations when manually digitizing over an aerial photography. This bias prevented a more in-depth comparison of model to manually digitized methods. We have shown how the input parameters can be modified to resolve both active and Holocene cliff lines. The algorithm reference set-up seems to be robust enough for the two FH sites despite the difference in the plan shape at both sites. Our algorithm delineates the cliff top and toe and produce all model outputs for a 1 km section of coast in less than 1 second while manually digitizing the same length of coast took around 10 min. Thus our algorithm is about 5 orders of magnitude faster than manually digitizing.
To conclude, we developed and demonstrated a new automatic delineation procedure of cliff toe and top locations based on the extraction of profile elevations from a DEM. This approach requires less pre-processing than other existing automatic methods, and it facilitates the screening of the delineated locations by outputting key supporting information. Our approach will be of great value in tracking changes in cliff metrics along coastlines of irregular shape.
Code availability. The code for the proposed automatic delineation of the generalized coastline and cliff metrics has been coded in C++ and the source code is available at https://doi.org/10.5281/zenodo.1412486 (Payo, 2018). See https: //github.com/coastalme/CliffMetrics (last access: 18 October 2018) for the latest version of the source code. CliffMetrics builds easily using Linux. The CliffMetrics code uses the open-source GDAL package (version 2.1.3) to read and write the shape files and raster files. For this study, CliffMetrics was compiled using gcc 4.8.4.
To install and run CliffMetrics under Linux: