FracL: A Tool for Characterizing the Fractality of Landscape Gradients from a New Perspective

: The past several years have witnessed much progress in landscape ecology and fractal analysis. In landscape ecology, the gradient model of landscape patterns (i.e., landscape gradient) has emerged as a new operating paradigm, where most landscape metrics do not apply because they were developed for the patch mosaic model. In the fractal analysis, a new deﬁnition of fractal has been proposed, and various new fractal metrics have been developed. This technical note aims to provide an intersection of these two lines of advance, which will further present an opportunity to advance geo-informatics by considering the latest progress in both landscape ecology and fractal analysis. We ﬁrst present an overview of the new deﬁnition of fractal and all the fractal metrics developed under this new deﬁnition. Since the chief obstacle to geographers and landscape ecologists in applying these metrics is the lack of readily accessible methods for their easy computation, we then develop an integrated tool to compute them on landscape gradients. The developed tool facilitates the computation of these new fractal metrics. A case study was carried out with real-life landscape gradients, namely a digital terrain model. These new fractal metrics and the developed tool can be expected to facilitate the fractal characterization of the patterns of gradient landscapes and the understanding of landscape dynamics from a new perspective.


Introduction
Recent years have seen substantial innovation in both landscape ecology [1,2] and fractal analysis. For example, in landscape ecology, the operating paradigm has been extended from patch mosaics [3] to landscape gradients [4,5]. In the patch-mosaic paradigm, a landscape is modelled as a mosaic of discrete patches by either subjectively or objectively categorizing the environmental attribute of interest (e.g., forest community types, ground temperature, and biodiversity). By contrast, in the gradient paradigm, a landscape is modelled as a continuous surface or a series of surfaces of an environmental attribute, usually represented as a matrix of quantitative value. This gradient paradigm turns out to be more appropriate in analyzing continuously varying landscape patterns because there is no need to transform a continuous (or quantitative) attribute of interest into categorical (or qualitative) and thus no loss of information caused by the transformation. For example, Evans and Cushman [6]

The New Definition of Fractal
The new definition of a fractal can be summarized as follows: "a feature is thought to be fractal if the scaling pattern of 'far more small things than large ones' can be observed multiple times" [30]. There are three keys to understanding this new definition: the notion of and the scaling pattern of "far more small things than large ones", and how this pattern can be observed multiple times.
The notion of "far more small things than large ones" was first clearly formulated by Jiang [31] and has become widely used in recent years, e.g., [32][33][34][35][36]. The terms "small things" and "large ones" of this notion can be understood broadly. For example, there are far more small earthquakes than large ones on Earth [37], and there are far more low-mass stars than massive ones in the Universe [38]. In practice, "small things" and "large ones" are distinguished according to a quantitative attribute of these things by using a classification method called head/tail breaks [22]. The head/tail breaks method divides the values of the attribute into a head part and a tail part, according to the average of these values. The head part consists of those values that are greater than the average, and the corresponding things are referred to as "large ones". By contrast, the tail part contains the rest of the values and corresponds to "small things". For instance, if the average magnitude of earthquakes worldwide is 5.0, then the earthquakes with a magnitude of 5.0 or less are the "small things" and the rest are the "large ones".
When it comes to the scaling pattern of "far more small things than large ones", a range of scales should be used in measuring a feature (a scaling pattern is sometimes referred to as a scaling relation) [39,40]. Let us take the classical Koch [14] curve, as shown in Figure 1, as an example and assume that the length of its shortest segment is 1/9 unit. In this example, one can observe as many as 16 line segments (referred to as Segments A) when measuring the Koch curve using a scale of 1/9 unit, or a total of 4 line segments (Segments B) using a scale of 1/3 unit, or only 1 line segment (Segment C) using a scale of 1 unit. All these 21 line segments exhibit a typical scaling pattern of "far more small things than large ones", which can be stated as follows: there are far more short line segments than long ones. The scaling pattern of "far more small things than large ones" can sometimes be observed multiple times, by iteratively removing "small things". For instance, this pattern can be observed twice with the 21 line segments ( Figure 1). The first observation has been described in the preceding paragraph, where the "small things" (i.e., short line segments) refer to the 16 Segments A and the "large ones" (i.e., long line segments) contains both the 4 Segments B and the Segment C. When the 16 Segments A are removed from the 21 line segments, the scaling pattern of "far more small things than large ones" can still be observed: The new "small things" refer to 4 Segments B, while the new "large one" is the Segment C.
It should be noted that this new definition of a fractal is focused on the attributes of a feature, rather than the spatial pattern or geometric shape. For example, the focus has been placed on the lengths of line segments in Figure 1, rather than the spatial pattern formed by these line segments. In this sense, it seems more suitable to refer to such a definition as fractal attribute. By contrast, the conventional definition of fractal is focused on the spatial pattern or geometric shape of a feature. This is why it is also widely referred to as fractal geometry [41,42].

Overview of Metrics under the Latest Definition of Fractal
Six metrics have been proposed for characterizing a fractal under this new definition. These fractal metrics are ht-index, the cumulative rate of growth (CRG index), the ratio of areas in a rank-size plot (RA index), two unified metrics (UM1 and UM2), and the fractional ht-index (fht-index).

Ht-Index
Ht-index [19] was the first metric proposed under the new definition of fractal, and it is straightforward. The ht-index of a fractal equals one plus the number of observations of the scaling pattern of "far more small things than large ones", or, in other words, it equals one plus the maximum number of times that the head/tail breaks method can be iteratively applied. As such, ht-index is also called "head/tail breaks index" by Chen [34] and Huang [43].
In practical computation, the value of ht-index is affected by how one confirms an observation of "far more small things than large ones" or, more precisely, by the threshold percentage of "small things" therein. Scholars have used different threshold percentages of small things, such as 33% [44], 40% [45], and 50% [46,47], but it is important to note that a comparison between two ht-indexes is meaningful only if they are computed based on the same threshold.
The essence of the ht-index of a fractal is the number of levels of the fractal's underlying hierarchy, which is formed by iteratively applying the head/tail breaks method. Note that the term "hierarchy" here does not have the same meaning as that in the hierarchy theory [48,49]. For example, the ht-index of the Koch curve in Figure 1 is three, revealing that there are three levels: a bottom level of 16 Segments A, a medium level of 4 Segments B, and a top level of 1 Segment C. These three levels form a hierarchy.
The advantage of ht-index is that it is easy to interpret. This is because it indicates the number of observations of the scaling pattern of "far more small things than large ones". Note that this number of observations is the key to evaluate the fractality of a feature [19]. However, the problem of ht-index is that it is not sensitive in capturing the evolution of a fractal. In other words, ht-index is not capable of distinguishing two similar fractals if only the two fractals have the same number of underlying hierarchical levels. For example, both curves in Figure 2 have a ht-index of three.

CRG Index
To address the insensitivity issue of ht-index, Gao, et al. [50] developed an improved index called the cumulative rate of growth (CRG index). Its formula is as follows: where m i denotes the i-th average calculated in performing the head/tail breaks method.
To illustrate the core idea of the CRG index, let us consider again the two curves shown in Figure 2. For the first curve, one can observe 14 Segments A, or 4 Segments B, or 1 Segment C. The head/tail breaks method can be performed twice on these segments, using an average of 35/9 (i.e., the average length of all segments) for the first time and an average of 7/3 (i.e., the average length of Segments B and C) for the second time. By contrast, when dealing with the second curve, the numbers of Segments A, B, and C are 15, 4, and 1, respectively. The two averages for performing the head/tail breaks method are 4 and 7/3. Although the averages used when dealing with the two curves are different, these two curves have the same ht-index, namely 3. However, the CRG index is capable of distinguishing the fractalities of the two curves: The CRG index of the first curve is (35/9)/(7/3) = 5/3, whereas that of the second curve is (4)/(7/3) = 12/7.
Compared with ht-index, the advantage of the CRG index is that it captures fractal evolution in a more sensitive way, as demonstrated by the two curves in Figure 2. In other words, the CRG index is capable of distinguishing two similar fractals. This advantage means that the CRG index should be more applicable to landscape ecology in reflecting the dynamics of landscape patterns. However, the disadvantage of CRG index is that its value no longer indicates the number of levels of the fractal's underlying hierarchy, which is a meaningful interpretation of fractal.

RA Index
RA index [51] is an alternative to the CRG index in addressing the insensitivity issue of ht-index. Its core idea is to measure how heavy-tailed the scaling pattern of "far more small things than large ones" is. Essentially two steps are involved in computing the RA index of a feature.
The first step is to display all the "things" (i.e., small things and large ones) in a plot where the y-axis represents a quantitative attribute of these things and the x-axis is the rank of a thing according to its value of the attribute. For example, the resultant plot of the Koch curve is shown in Figure 3. Such a plot of scatter points is commonly referred to as a rank-size plot. The second step is to compute the areas of two polygons constructed in the rank-size plot. One polygon, as shown by S 1 in Figure 4, is constructed by firstly drawing a parallel line to the y-axis (i.e., size-axis) through the first scatter point, then a parallel line to the x-axis (i.e., rank-axis) through the last scatter point, and finally a polyline to connect each scatter point. The other is constructed by drawing a straight line to connect the first and the last scatter point, as shown by S 2 in Figure 4. The value of the RA index is computed as a ratio of areas: where Area() is a function that returns the area of a polygon. Take the two curves in Figure 2 as examples again. For the first curve, its Area(S 1 ) and Area(S 2 ) are 1.3332 and 6.6669, respectively, so its RA index is computed as 1.3332/6.6669 = 0.1666. For the second curve, its Area(S 1 ) and Area(S 2 ) are 1.3332 and 7.1113, respectively, so its RA index is computed as 1.3332/7.1113 = 0.1579.
RA index has the same advantages and disadvantages as the CRG index. However, its unique characteristic is that it is not computed by performing the head/tail breaks method. Instead, its computation relies on the pattern displayed in a rank-size plot.

Unified Metrics
Unified metrics [30] were proposed to combine the advantages of both the ht-index and CRG/RA index. Such a combination was achieved by answering the following two questions: • "I know there are far more small things than large ones, but how small (or large)?" • "I know there are far more small things than large ones, but how many more?" The answers to these two questions are shown in Formulas (3) and (4), respectively.
y 2 = n tail /n all , n tail n all 0, n tail = n all (4) where m all and m head are the average size of all "things" and that of "things" which are classified as the head, respectively. The parameters n all and n tail denote the total number of all things and that of the things which are classified as the tail, respectively. Then, ht-index was redefined as a decimal number, of which the whole-number part equals the original ht-index to indicate the number of observations of the scaling pattern of "far more small things than large ones". The decimal part equals the result of either Formula (3) or (4), resulting in two different unified metrics, referred to as UM1 and UM2, respectively. For example, the (UM1)s for the first and the second curve in Figure 2

Fht-Index
Fht-index [52] is an alternative to unified metrics. In developing fht-index, two new concepts were introduced, namely whole and sub-whole. A whole is defined as a group of numbers whose ht-index will decrease by one if the smallest number (or one of the smallest numbers, if there is more than one) is removed from the group. A sub-whole is defined as a group of n (n ∈ Z + ) numbers that satisfy the following conditions: the group itself is a whole, and it consists of the largest n numbers of another whole. A typical whole and its sub-wholes are shown in Table 1. In this case, the ht-index of the whole equals four, and it will decrease to three if the smallest number (i.e., 1/39) is removed. Similarly, if the smallest number is removed from either of the sub-wholes, the ht-index of that sub-whole will also decrease by one. Table 1. A typical whole, the sub-wholes belonging to the whole, and their ht-indices.

Numbers
Ht-Index Note that 50% was used as the threshold in computing ht-index.
Fht-index is computed according to the following rules. First, the fht-index of a whole equals the ht-index of the whole. Second, for a data set that is not a whole, its fht-index is interpolated between the ht-index of the whole to which the data set belongs and that of the largest sub-whole (i.e., the sub-whole which has the most members) belonging to the data set. To concretely illustrate this idea, let us consider the four data sets shown in Table 2. All these data sets have the same whole and the same largest sub-whole. In this case, their fht-indices are derived by linear interpolation between the ht-indices of the whole and the largest sub-whole. It is worth noting that Jiang and Ma [52] utilized a power interpolation instead. Take the two curves in Figure 2 for another example. The first curve has an ft-index of 3.0625, while the second has an ft-index of 3.0681. Table 2. Four data sets and their whole, largest sub-whole, ht-index, fht-index.

Numbers
Ht-Index Fht-Index

Development of a Software Tool: FracL
A practical challenge to implementing fractal analysis from this new perspective lies in the lack of tools to readily compute the fractal metrics summarized in the previous section. To address this need, we developed a software tool (referred to as FracL) in this study to facilitate the computation of these fractal metrics on landscape gradients ( Figure 5). The functional design, algorithmic considerations, and technical implementation of the software tool are described in this section. The software tool is designed to perform the following functions. The first is an input-output function. The tool should be capable of (a) reading a landscape gradient from the standard input (i.e., the keyboard), (b) reading a series of landscape gradients from data files, and (c) writing results to the standard output. The data files can be prepared in a format of either text or GeoTIFF, which is a widely used format in dealing with spatial raster data such as a landscape gradient. Note if the standard input or text file is chosen, one needs to prepare the landscape gradient in question as a matrix of numbers, as shown in Figure 5. The separator between two numbers can be a comma, space, or Tab. The second function is to compute all the fractal metrics of a landscape gradient. The last function is to compute the fractal metrics of a large number of landscape gradients in parallel.
There are three algorithmic considerations. First, the terms "small things" and "large ones" are interpreted as cells having a small value and the cells having a large value, respectively, when deriving a scaling pattern with landscape gradients. Second, the algorithms for computing fractal metrics should be capable of functioning based on different threshold percentages of small things. Third, the practical recommendations by Jiang and Ma [52] for computing the fht-index of a data set are followed in this study. The recommendations include (a) to determine the whole of a data set by appending small values that are computed based on the trend line of the data set and (b) to estimate the fht-index using a power interpolation between the ht-index of the whole of the data set and the ht-index of the largest sub-whole of the data set. Note that all these fractal metrics are theoretically computable even if a landscape gradient contains null values or is irregular in shape. This is because, as explained at the end of the second section, the new definition of fractal is focused on (non-null) values only.
The software tool was implemented with Microsoft Visual Studio 2015 Update 3 with Tools for Universal Windows Apps. The parallel computation of fractal metrics was carried out by using the Task Parallel Library in the "System.Threading.Tasks" namespace of NET Framework 4.5. The curve fitting (for the trend line of a data set) in computing fht-index was performed using the "Math.NET Numerics" (Available online: https://numerics.mathdotnet.com/), which is an open-source numerical library for applications developed in NET 4.0 and higher frameworks. The "read GeoTIFF" function was implemented using the Geospatial Data Abstraction Library (GDAL. Available online: https://gdal.org/). It can also be implemented using libraries such as LibTiff.Net (Available online: https://bitmiracle.com/libtiff/) and Global Mapper SDK (Available online: https://www.bluemarblegeo.com/products/global-mapper-sdk.php). This software tool can be found in Supplementary Materials.

Case Study and Analysis
To illustrate how to use the developed tool, we present a case study of terrain analysis. Such analysis can be performed from diverse aspects, such as correlation [53] and disorder [54,55]. In this case study, we aimed to characterize the fractality of digital terrain data. Digital terrain data are widely used gradients in landscape ecology e.g., [56,57] and are usually represented as digital elevation models (DEMs). In this case study, we obtained four pairs of DEMs from Gao, et al. [58], as shown in Figure 6. These DEMs were originally derived from NASA Shuttle Radar Topography Mission data (Available online: http://srtm.csi.cgiar.org/). The statistics of these DEMs were listed in Table 3. Figure 6. Four pairs of digital elevation models (DEMs) [51], namely A1 and A2, B1 and B2, C1 and C2, and D1 and D2. Before using the FracL, we derived the elevations of each DEM as a text file. Then, we opened FracL and read a text file by clicking on the button "Read text file". Last, we computed all the fractal metrics by clicking on the button "Compute metrics". The computation results are shown in Table 4. Note that all the text files can be found in Supplementary Materials. The previous study [58] has demonstrated that in each pair, the first DEM is more disorderly (has a greater Boltzmann entropy) than the second one in terms of the disorder. However, in terms of fractality, not all the first DEMs are more fractal than the second one, as shown in Table 4. Specifically, according to Ht/CRG/UM1/UM2, DEM A1 is less fractal than A2, B1 is more fractal than B2, C1 is less fractal than C2, and D1 is more fractal than D2. According to the RA index, the first DEM of each pair is more fractal than the second one. Fht-index is not computable with all DEMs. In summary, in this case, Ht-index, CRG, UM1, and UM2 are consistent with each other. None of them is consistent with the order/disorder of a DEM, indicating their difference from entropic measures.
Careful readers may note that the results shown by the RA index are not consistent with that by Ht/CRG/UM1/UM2. This is because, as explained in Section 3.3, the RA index is not computed by performing the head/tail breaks method, while all the other metrics are. We argue that the RA index is not a suitable metric of the fractal under the new definition because it does not capture the similarity among different scales (i.e., hierarchical levels). It is only an indicator of the geometric shape of the pattern displayed by a dataset in a rank-size plot. Fht-index is not computable because the "whole" cannot be derived. This fact suggests that fht-index is theoretically appealing but experimentally difficult to compute.

Discussion
Several comparative and analytical studies immediately come to mind in thinking about the next steps in utilizing this new tool to explore fractality. First, it would be very interesting to compare the predictions of these new approaches with those produced by traditional fractal metrics in landscape ecology. The traditional fractal metrics widely used in landscape ecology are implemented on categorical patch mosaics, and the methods presented here are applied to gradient surfaces. However, modification of the definition of small and large objects could enable this tool to be applied to patch mosaics. Specifically, defining small and large objects in terms of the size distribution of patches in a landscape would enable the computation of these metrics and direct comparison to traditional landscape metrics like perimeter-area fractal dimension, PAFRAC [7]. This kind of direct comparison of the new fractal metrics with the existing ones across ranges of landscape pattern and complexity would help to understand both the behavior e.g., [59] and parsimony e.g., [60] of fractal measures of landscape structure.
Second, these new measures of fractal structure of surfaces provide a potentially important advance in the contemporary challenge of developing quantitative tools for analysis of the structure and complexity of surfaces. The gradient paradigm in landscape ecology depends on the maturation of such methods for its advancement. Few papers have been produced to date evaluating and comparing surface-based metrics for analyzing landscapes e.g., [10]. As such, a second important project would be to apply these gradient measures to a wide range of landscape gradients with different structures and compare them to the behavior and parsimony of the families of existing surface metrics e.g., [10]. In this context, it would also be informative to vary the criteria used to define small vs large objects. In the current conception presented in this paper, we use the value of a cell on a surface as a measure of "size". However, this has some apparent limitations in the context of the many small and few large objects theory behind this measure of fractality. Specifically, a highly concave landscape, such as one with peaks above generally lower values on the surface meets the expectation of many small and few large values. However, in the converse case, such as pits and valleys on a plateau surface, there will be many large values and relatively few small values. It will be important to see how these methods perform across this range of convexity vs. concavity of landscape gradient surfaces. This might also suggest reformulations using different definitions of large vs small objects on surfaces, such as the size of peaks in terms of their breadth rather than the value of cells per se.
It is of interest to note one recent approach to interpret the fractal metrics. The value of these fractal metrics has been interpreted as the degree of wholeness [61], which is conceptualized by the architect Christopher Alexander as a kind of structure of physical space [62]. It has been argued that the greater the fractal metric of a structure has, the more sustainable the structure is [63].

Conclusions
Fractal analysis is among the most widely used methods for characterizing landscape patterns and understand landscape dynamics. It is commonly performed based on the Mandelbrot [18] definition of fractal, which is "too strict for many geographic features" [19] and thus limits the potential of fractal analysis in landscape ecology. This study presents a software tool to facilitate the computation of metrics developed under a new definition of fractal. We hope this software tool will contribute to the understanding of landscape dynamics from a new perspective and help advance the development of the new gradient paradigm in landscape ecology.

Conflicts of Interest:
The authors declare no conflict of interest.