Volume 9, Issue 10
APPLICATION
Free Access

Monitoring ecosystem degradation using spatial data and the R package spatialwarnings

Alexandre Génin

Corresponding Author

E-mail address: alexandre.genin@umontpellier.fr

ISEM, CNRS, IRD, EPHE, Université de Montpellier, Montpellier, France

Correspondence

Alexandre Génin, Institut des Sciences de l’Evolution, CNRS, Université de Montpellier – CC 065, 34095 Montpellier Cedex 05, France.

Email: alexandre.genin@umontpellier.fr

Search for more papers by this author
Sabiha Majumder

Centre for Ecological Sciences, Indian Institute of Science, Bengaluru, India

Department of Physics, Indian Institute of Science, Bengaluru, India

Search for more papers by this author
Sumithra Sankaran

Centre for Ecological Sciences, Indian Institute of Science, Bengaluru, India

Search for more papers by this author
Alain Danet

ISEM, CNRS, IRD, EPHE, Université de Montpellier, Montpellier, France

Search for more papers by this author
Vishwesha Guttal

Centre for Ecological Sciences, Indian Institute of Science, Bengaluru, India

Search for more papers by this author
Florian D. Schneider

Institute of Linguistics and Literary Studies, Technische Universität Darmstadt, Darmstadt, Germany

Search for more papers by this author
Sonia Kéfi

ISEM, CNRS, IRD, EPHE, Université de Montpellier, Montpellier, France

Search for more papers by this author
First published: 02 July 2018
Citations: 3

Abstract

Abstract

  1. Some ecosystems show nonlinear responses to gradual changes in environmental conditions, once a threshold in conditions—or critical point—is passed. This can lead to wide shifts in ecosystem states, possibly with dramatic ecological and economic consequences. Such behaviours have been reported in drylands, savannas, coral reefs or shallow lakes for example. Important research effort of the last decade has been devoted to identifying indicators that would help anticipate such ecosystem shifts and avoid their negative consequences.
  2. Theoretical and empirical research has shown that, as an ecosystem approaches a critical point, specific signatures arise in its temporal and spatial dynamics; these changes can be quantified using relatively simple statistical metrics that have been referred to as “early warning signals” (EWS) in the literature. Although tests of those EWS on experiments are promising, empirical evidence from out‐of‐laboratory datasets is still scarce, in particular for spatial EWS. The recent proliferation of remote‐sensing data provides an opportunity to improve this situation and evaluate the reliability of spatial EWS in many ecological systems.
  3. Here, we present a step‐by‐step workflow along with code to compute spatial EWS from raster data such as aerial images, test their significance compared to permutation‐based null models, and display their trends, either at different time steps or along environmental gradients. We created the R‐package spatialwarnings (MIT license) to help achieve all these steps in a reliable and reproducible way, and thereby promote the application of spatial EWS to empirical data.
  4. This software package and associated documentation provides an easy entry point for researchers and managers into spatial EWS‐based analyses. By facilitating a broader application, it will leverage the evaluation of spatial EWS on real data, and eventually contribute to providing tools to map ecosystems’ fragility to perturbations and inform management decisions.

1 BACKGROUND

Many ecosystems appear to respond in a gradual way to changes in environmental drivers. In contrast, in other ecosystems, once a threshold in environmental condition—or critical point—is passed, just a small additional change can provoke an abrupt shift (Petraitis, 2013; Scheffer, Carpenter, Foley, Folke, & Walker, 2001) (Box 1). Examples of ecosystem shifts have been reported for a variety of ecosystems, such as drylands, savannas, coral reefs or shallow lakes (Scheffer et al., 2001).

BOX 1.   Three examples of ecological system responses where EWS can be useful

image image image

A behaviour of interest in ecological systems are discontinuous transitions via Fold bifurcations (May, 1977; Noy‐Meir, 1975), where the prediction of the proximity to a critical point is particularly relevant. In this case, the system of interest has alternative stable states over a range of values of the control parameter (upper and lower solid lines in panel a.1; e.g. high vs low vegetation cover in a rangeland), separated by an unstable equilibrium (dashed line in panel a.1). If a change in the control parameter (e.g. grazing intensity) pushes the system state across the critical point (black dot), the system exhibits a “catastrophic shift” (black arrow) and collapses from its current state (e.g. high cover) to the other one (e.g. low cover).

These transitions arise because of the presence of strong positive feedbacks. They can sometimes be present, driving the system close to Fold bifurcation‐type dynamics and leading to a nonlinear response, but not strong enough to produce a discontinuity (panel a.2) (Kéfi et al., 2013).

Other types of critical points exist without wide shifts in ecosystem states, such as in the case of transcritical bifurcation (panel b), for which the typical example in ecology would be the extinction of a species (Clements & Ozgul, 2016; Drake & Griffen, 2010).

In all these cases, EWS are expected to reflect the approach of critical points (panels a.1,c) or upcoming threshold of nonlinear response (panel a.2). See Boerlijst, Oudman, and de Roos 2013, Boettiger and Hastings (2012), Boettiger, Ross, and Hastings (2013), Dakos et al. (2012), Hastings and Wysham (2010), Kéfi et al. (2013, 2014) for further discussions about the use and interpretation of changes in EWS.

Because abrupt ecosystem responses can have strong and irreversible ecological and economical consequences (Scheffer et al., 2001), the possibility of shifts has been accounted for in ecosystem management (Briske, Fuhlendorf, & Smeins, 2005; Stein, Harpole, & Suding, 2016; Suding, Gross, & Houseman, 2004), and methods have been developed to try to anticipate them in empirical systems (Scheffer et al., 2009). In particular, theoretical and empirical studies have shown that ecological systems close to critical points should exhibit specific signatures in their temporal and spatial dynamics (Dakos et al., 2012; Kéfi et al., 2014; Scheffer et al., 2009), leading to the development of metrics, which have been referred to as early‐warning signals (hereafter EWS) in the literature (Scheffer et al., 2009). EWS provide a relative measure of the proximity to a critical point, and therefore of a possible ecosystem transition to a different state. Computing and monitoring them could therefore help detecting upcoming critical transitions in ecological systems (Scheffer et al., 2009).

Despite their promises, a number of studies have also stressed the weaknesses of EWS. EWS provide information about whether a system is degrading or not, but they do not inform on how far the studied system is from a critical point (but see D’Souza, Epureanu, & Pascual, 2015; Majumder, Tamma, Ramaswamy, & Guttal, 2017). Evaluation of EWS on empirical data has also proved to be challenging, and a number of studies have reported various limitations of EWS when evaluated on out‐of‐laboratory data, sometimes due to reasons such as a lack of sufficiently long and finely resolved datasets, or underlying stochasticity (Ashwin, Wieczorek, Vitolo, & Cox, 2012; Burthe et al., 2016; Chen, Jayaprakash, Yu, & Guttal, 2018; Gsell et al., 2016; Moreno‐de las Heras, Saco, Willgoose, & Tongway, 2011; Weerman et al., 2012). Successful tests on ecosystem data remain rare—especially so for spatial EWS—which questions the usefulness of these indicators as tools to assess ecosystem degradation. The recent increase in the availability and extensiveness of remote sensing data provides a timely opportunity to test spatial EWS outside of controlled experiments (e.g. Berdugo, Kéfi, Soliveres, & Maestre, 2017; Burthe et al., 2016; Butitta, Carpenter, Loken, Pace, & Stanley, 2017; Cline et al., 2014; Eby, Agrawal, Majumder, Dobson, & Guttal, 2017; Gsell et al., 2016; Ratajczak et al., 2017). In the context of the currently available and upcoming spatially extensive data, spatial EWS have been suggested to be particularly promising because they could allow the systematic monitoring of ecosystems’ degradation level based on a few spatial snapshots (Kéfi et al., 2014).

To help fuel investigations around spatial EWS, we suggest here a workflow to guide users of a new package for R (R Core Team, 2018), spatialwarnings, to facilitate their application to spatial data from ecological and other complex systems. The package can readily compute the spatial indicators from data, assess their significance, and display the results, all in a convenient format much similar to other usual R tasks (e.g. linear regression).

In the following sections, we first give the required background knowledge on spatial indicators. Using case studies, we then describe how they can be applied to real and model systems with spatialwarnings (version 1.1). For conciseness, we do not show all textual output in the article, but Appendix S2 presents the code used here in more details.

2 THE SPATIAL EWS AND THEIR EXPECTED TRENDS

Current spatial EWS available in the literature come mainly from two different theoretical backgrounds: some are based on the changes of dynamics before a critical point (namely “critical slowing down”; see below), while others derive from the characteristics of the patchiness of certain ecosystems.

As an ecological system approaches a critical point (Box 1), it is expected to take more time to recover from small perturbations (Scheffer et al., 2009), a phenomenon known as critical slowing down (CSD). This is expected to yield an increase in spatial heterogeneity (the spatial variance) of its state variables, as it stays longer away from its average state (Guttal & Jayaprakash, 2009). This deviation can sometimes be biased towards higher or lower values of the state variable, resulting in an additional rise of spatial skewness (Guttal & Jayaprakash, 2009). For example, a forest close to a transition towards a treeless state could exhibit higher spatial variance in tree cover and a bias towards low cover values (higher skewness) as external stress increases. In addition, because of CSD, a system close to a transition should exhibit higher near‐neighbour correlations (Dakos, van Nes, Donangelo, Fort, & Scheffer, 2010). These three metrics—spatial variance, skewness and autocorrelation—can, in principle, reflect an upcoming critical point in any dynamical system, hence their reference as “generic EWS” in the literature (Scheffer et al., 2009).

Later work has produced EWS based on spectral properties (Carpenter & Brock, 2010), hereafter referred to as “spectrum‐based EWS.” Because of the slowing down, two points at a given distance from each other should be more similar in systems close to critical points (Kéfi et al., 2014). This change in correlation length can be measured by computing the r‐spectrum of the data (Couteron, 2002). The r‐spectrum is based on the Discrete Fourier Transform and decomposes the spatial data into series of periodic sines and cosines of given wavelengths (the inverse of wave frequency) and amplitude. The amplitude coefficient associated to each wavelength characterizes the dominance of this scale in the spatial data. Close to a critical point, a relative increase in the amplitudes of long wavelengths (lower frequencies) is expected compared to short wavelengths (higher frequencies). To summarize this into a single value, one can use the ratio of the average amplitude of low frequencies over the average amplitude of high frequencies (Biggs, Carpenter, & Brock, 2009), the Spectral Density Ratio, which is expected to increase along degradation trends.

Additional EWS have been suggested for ecosystems that exhibit a clear spatial structure, such as drylands or savannas (Rietkerk, Dekker, de Ruiter, & de Koppel, 2004). Characteristics of these spatial patterns, and in particular the distribution of their patch sizes (Kéfi et al., 2007, 2011), have been suggested to be promising indicators of degradation (Berdugo et al., 2017; Kéfi et al., 2007; Lin, Han, Zhao, & Chang, 2010), hereafter referred to as “patch‐based EWS.” In these ecosystems, when stress is low, density is typically high and there can be a patch whose width or height equals the entire area considered, i.e. a spanning cluster. As density decreases, this spanning cluster breaks down into smaller ones until a barren ecosystem state is reached (Corrado, Cherubini, & Pennetta, 2014; Kéfi et al., 2011; Sankaran, Majumder, Viswanathan, & Guttal, 2017; Van Den Berg, 2011). When using spatio‐temporal data, this sequential process is reflected in changes of the patch size distribution (PSD) (Kéfi et al., 2011). More precisely, it is expected that, (1) under low or no stress, a spanning cluster of occupied (vegetated) cells is present. (2) As stress increases, this single patch breaks down and the PSD resembles a power‐law (xα). (3) As stress increases further, vegetation patches break down and the PSD fits best to a truncated power‐law (xαeβx). (4) In the final stages before reaching a fully empty state, only small patches persist and the patch size distribution is best‐described by an exponential distribution (eβx) with presence of a spanning cluster of empty cells. Identifying where in these four phases an ecological system lies could thus constitute an indicator of degradation level (Kéfi et al., 2011, but see Sankaran, Majumder, Viswanathan, et al., 2017; Schneider & Kéfi, 2016).

A recent study has further suggested that this gradual truncation of the patch size distribution could be simplified into a single metric (Berdugo et al., 2017). The idea relies on the fact that many empirical distributions resemble power‐laws only for patches above a certain size xmin. This power‐law range (PLR) can be expressed as
urn:x-wiley:2041210X:media:mee313058:mee313058-math-0001
where xsmallest represents the smallest and xmax the largest patch size observed in the dataset. This metric is expected to decrease as the ecosystem becomes degraded.

It is noteworthy that the interpretation of the expected trends in patch‐based EWS depends on the underlying ecological mechanisms generating the patterns; these have been particularly well studied in drylands (Kéfi et al., 2011; Manor & Shnerb, 2008; Rietkerk et al., 2004). Therefore, as for all the other EWS, their use without a good understanding of the ecological mechanisms driving spatial structure could lead to misinterpretations of the trends, since altered or even opposite trends can be observed, both in empirical (Weerman et al., 2012) or model systems (Pascual & Guichard, 2005; Schneider & Kéfi, 2016).

3 WORKFLOW AND EWS COMPUTATION

Because working with spatial EWS can be challenging and error‐prone, we provide a workflow for the R package spatialwarnings to make this type of analyses more accessible and reproducible. Our workflow allows computing EWS from raster data, typically from remote sensing imagery. All tools and example datasets are provided by the associated package spatialwarnings.

The package can compute three types of EWS as earlier defined: generic EWS, spectrum‐based EWS, and patch‐based EWS. For each one, a high‐level function returns a set of spatial indicators. Usual basic functions (plot(), summary(), etc.) can be used to display the results. Lower‐level functions, prefixed by indicator_ are also offered to compute raw values of individual indicators.

The workflow comprises four steps: (1) prepare the data and check for periodicity, (2) compute the EWS from a list of matrices, (3) assess their significance compared to a random spatial structure, and (4) display the results (Figure 1).

image
spatialwarnings workflow. Black headers indicate the relevant package functions for each step

In R, spatialwarnings can be installed from CRAN and loaded using the following commands:

image

3.1 Preparation of input data and periodicity checks

Typical raster data, e.g. from airborne or satellite‐based remote sensing imagery, often come as image files with multiple bands. These images can be read in R using standard packages (e.g. tiff jpeg) to obtain an array (a three‐dimensional set of values), or a more complex raster object (package raster). Indicator functions of the package work on matrix objects, the common denominator of all these data types. A conversion of a multiband raster object to a matrix object is often required before computing EWS, a procedure that depends on the type of data, the system of interest and the questions addressed (see Appendix S3 and e.g. Liu & Mason, 2016 for a more complete reference). In what follows, we assume that the data have been transformed into a matrix object, i.e. a raster surface of a single variable.

As with many spatial analyses, the resolution of the raster data should be such that it appropriately captures the scale of the changes in the spatial structure. For example, if the scale of the spatial structure is small, a coarse raster image may not be able to capture its variations. In general, using prior knowledge or carrying out preliminary analyses at different scales when the data is available (Lam & Quattrochi, 1992) can help guide the choice of resolution. In addition, the input raster image must be large enough so that the spatial characteristics measured by the indicators are accurate. Subsetting the input data, where possible, could provide a way of estimating measurement errors.

The indicator functions can also operate on lists of matrices to directly obtain trends. This can be the case when one does not only have a single image of the system under study but several ones corresponding to different moments in time or to different instances of a given ecosystems along an environmental gradient. All indicators can be computed on matrices containing binary (boolean, TRUE/FALSE) data, but some of them can also be computed on continuous (numerical) data (Figure 1). A continuous matrix can be transformed into a binary matrix by thresholding or classification. However, this transformation needs to be done carefully depending on the ecological context of the data and is therefore left to the user (but see Appendix S3).

Once a suitable matrix object is obtained, it is necessary to identify whether the spatial structures in the matrix are periodic or not (Kéfi et al., 2014). Some ecosystems, such as patterned bushes in the Sahel, show characteristic changes in spatial periodicity along degradation gradients (Rietkerk & Van de Koppel, 2008), which mask the expected increase in EWS before critical points (Dakos, Kéfi, Rietkerk, van Nes, & Scheffer, 2011). To identify whether an ecosystem shows periodic patterns, a solution is to detect possible modes in the r‐spectrum of the image (Appendix S2, Couteron, 2002). The absence of strong modes in the r‐spectrum of the input matrices means that the patterns are not periodic and that EWS provided by spatialwarnings can be computed (Kéfi et al., 2014). Specific indicators exist for periodic ecosystems (Deblauwe, Couteron, Lejeune, Bogaert, & Barbier, 2011) and may be part of a future spatialwarnings release.

3.2 Generic EWS

To illustrate the quantification of generic EWS using the spatialwarnings package, we reproduce here an analysis performed by Eby et al. (2017) on remote sensing imagery. In this study, the authors used remotely sensed images along gradients of increasing annual rainfall. The aerial images, stored in the R object serengeti were preliminarily classified so that TRUE values (pixels in the image) represent grassland areas and FALSE values represent woodland areas. The transects document the shift of the ecosystem from a grassland to a woodland state around an annual rainfall of 730 mm/year. The object serengeti.rain contains the rainfall values for each matrix.

Generic EWS—variance, skewness and near‐neighbour correlation (as measured by Moran's I)—can be computed using the generic_sews() function. However, the computation of these indicators differs depending on the data type.

When working with binary data (TRUE/FALSE values), variance and skewness only reflect the proportion of TRUE values in the data and do not depend on the spatial structure (Kéfi et al., 2014). Coarse‐graining has been shown to be a useful procedure to make these indicators actually reflect the spatial patterns (Sankaran, Majumder, Kéfi, & Guttal, 2017). This procedure divides the input matrix of size N × N (for a square matrix) into submatrices of size s × s. The average of the pixels is taken in each submatrix, thus producing a N/s × N/s matrix with continuous values. Even when a matrix already contains continuous values, in some cases, coarse‐graining may nevertheless be required to correctly compute EWS, and is therefore provided optionally. Sankaran, Majumder, Kéfi, et al. (2017) provides more details on the procedure and on the choice of coarse‐graining length.

Note that, in the package, coarse‐graining is only included by default in the computation of spatial variance and spatial skewness. Near‐neighbour correlation can be forced to be computed on coarse‐grained data using the moranI_coarse_grain option.

Using a subsize s = 5 as per Eby et al. (2017), we can reproduce their analysis using the following code:

image

The significance of generic EWS can be assessed by comparing the observed indicator value to a distribution of values obtained from matrices with a randomized spatial structure. The generic function indictest() can perform this operation by permuting the position of the cells in the matrix a great number of times (999 by default). To carry out this operation efficiently, much of the package is implemented in compiled code, and the package will use the global option mc.cores to carry out parallel processing.

image

Calling the plot() function on serengeti.test displays the results of the computation (Figure 2):

image
Generic EWS trends for the serengeti dataset (Eby et al., 2017) along an annual rainfall gradient. This figure is produced by calling the plot() function on the output of indictest(). First row: mean value of each input matrix (here average grassland cover); 2nd–4th rows: the three generic EWS—variance, skewness and near‐neighbour correlation (Moran's I). Black lines represent the observed values, and grey ribbons the 5%–95% quantiles of the null values (obtained by randomizing the spatial structure). The red line displays the value at which the ecosystem shifts from savannah to forest (added using ggplot2; see Appendix S1). The three indicators are found to increase prior to the shift

image

3.3 Spectrum‐based EWS

Using the same Serengeti dataset, we can compute spectrum‐based EWS using the spectral_sews() function:

image

Similarly, the generic function indictest() can be used to test whether the observed values depart significantly from the null expectation of a matrix with random spatial structure. Calling the plot() method on the result of indictest() displays the SDR trend with the null expectation (Figure 3):

image
Spectral density ratio (SDR) trend along the gradient of annual rainfall in the serengeti dataset. The null distribution of SDR values is invisible because it falls within the width of the zero grid line. The red dashed line indicates the value at which a shift in vegetation cover occurs. SDR exhibits a sharp increase before the threshold value in rainfall.

image

Additionally, individual r‐spectra can be displayed for each input matrix using plot_spectrum() (Supporting Information Figure S1):

image

All observed r‐spectra should show a near‐monotonic decrease: a spectrum with a nonzero mode implies the presence of a periodic pattern in the matrix (Appendix S2), in which case the use of the generic and spectrum‐based EWS can be unreliable (Dakos et al., 2011; Kéfi et al., 2014), while the shape and size of the patterns may provide more valuable information (Kéfi et al., 2014).

3.4 Patch‐based EWS

We showcase the use of the patch‐based EWS on model data from a Forest Gap model by Kubo, Iwasa, and Furumoto (1996). In this model of forest spatial dynamics, spatial patterns emerge because of near‐neighbour interactions between trees. The dataset, forestgap, contains the model outputs along several values of increasing stress, a list of a binary matrices in which TRUE values identify cells with trees. The data frame forestgap.pars contains the parameters used in the simulations (d, delta and alpha).

Early warning signals can be computed using the patchdistr_sews() high‐level function, for example using BIC as criterion to select the best‐fitting distribution:

image

The percolation status, patch distribution type and PLR can be displayed as text using summary(), or as a graph using plot() (Figure 4):

image
Outcome of the plot() function called on the output of patchdistr_sews(). The upper panel indicates the best fitted PSD and shows whether there is percolation (presence of a spanning cluster) of full (TRUE) or empty cells. Mean cover is displayed as a continuous line. As stress increases, best‐fit of PSD switches from a power‐law (pl) with percolation of full cells, followed by a truncated power‐law (tpl) and an exponential (exp) with percolation of empty cells. The bottom panel shows PLR decreasing along the stress gradient

image

The individual distribution fits can be shown using plot_distr() (Figure 5):

image
Individual PSD fitted to each matrix of the forestgap dataset. As stress increases (top to bottom and left to right), the truncation of the PSD increases and the shape of the best‐fitting distribution goes from a power‐law (pl), to a truncated power‐law (tpl) and an exponential (exp). Along the same gradient, the PLR decreases (represented by the blue double‐arrowed bar on top of each panel)

image

4 CONCLUSION

Remote‐sensing imagery now provides outstanding datasets for ecological analyses, both in terms of spatial and temporal coverage. Satellite imaging archives extend back several decades (e.g. Landsat archive since 1972), and newer programs bring improvements in spatial resolution (e.g. 0.31 cm for the commercial program WorldView), as well as temporal frequency (e.g. every 5 days for the freely available Sentinel archive). This data proliferation makes EWS‐based approaches essentially applicable to any ecosystem on the planet. Combined with a good understanding of the process scale and its ecological underpinnings, it could eventually allow mapping ecosystem degradation or recovery trends across large spatial extents.

The spatialwarnings package lowers the threshold for conducting state‐of‐the‐art spatial pattern analysis from spatial ecological data and enables a wide exploration of spatial metrics as predictive tools for critical transitions. It is released under a permissive open‐source MIT license and invites new indicators, bug reports and other contributions through its git repository https://github.com/spatial-ews/spatialwarnings. We hope that its publication will motivate further research to address the ground‐truthing of spatial EWS and contribute to the identification of robust measures of ecosystem degradation.

ACKNOWLEDGEMENTS

We thank the Indo‐French Centre for Applied Mathematics for support. S.K., F.D.S., A.D. and A.G. received funding from the European Union's Seventh Framework Programme (FP7/2007‐2013), under grant agreement no. 283068 (CASCADE). V.G. acknowledges support from a DBT Ramalingaswamy Fellowship and DBT‐IISc partnership program; S.S. and S.M. were supported by a fellowship by MHRD via IISc. This article is ISEM contribution 2018‐124.

AUTHORS’ CONTRIBUTIONS

A.G. contributed most to the package development, with significant contributions from all other authors. All authors contributed substantially to discussions and writing of the manuscript.

DATA ACCESSIBILITY

All data used in this article are distributed with the R package spatialwarnings, and can be accessed by installing the package or through its CRAN homepage https://cran.r-project.org/package=spatialwarnings. spatialwarnings v1.1 is available at https://doi.org/10.5281/zenodo.1258196

    Number of times cited according to CrossRef: 3

    • Clustering and correlations: Inferring resilience from spatial patterns in ecosystems, Methods in Ecology and Evolution, 10.1111/2041-210X.13304, 10, 12, (2079-2089), (2019).
    • Spatial early warning signals for impending regime shifts: A practical framework for application in real‐world landscapes, Global Change Biology, 10.1111/gcb.14591, 25, 6, (1905-1921), (2019).
    • Inferring critical thresholds of ecosystem transitions from spatial data, Ecology, 10.1002/ecy.2722, 100, 7, (2019).