Visualizing Ocean Data on Reconstructed pH and Coral Bleaching Reports

By: Stephen Tennyson


Introduction

When we think of coral reefs we are reminded of some of our planet’s most beautiful yet delicate creatures, the coral. Capable of creating immense 3D structures in the water column, coral reefs support huge ecosystems for marine life with their calcium carbonate skeletons. However, these coral reefs are highly sensitive to our changing climate and according to past data presented here, our coral reefs are in trouble.

In this tutorial I will run publicly available data collected from coral reefs through a data science pipeline, applying principles such as linear regression, polynomial regression, multivariate regression, correlation, and machine learning. In the end I hope to draw conclusions on the importance of water parameters on coral health and make predictions about where our oceans are headed.


Background

What is a Coral?

A coral is actually not a plant, it is an animal. Coral are marine invertebrates which are usually colonial but can also be solitary specimens. Coral have fleshy bodies and (aside from soft coral) will build a hard skeleton that helps them filter food from the water column. Colonial coral are composed of several individual "coral units" called polyps, which have tentacles and a mouth to hunt for food items. There is a wide variety of coral, which can generally be classified into the following types:

What is Ocean pH and why is it so important to coral?

pH is a chemical measurement of how acidic a solution is; So when we are talking about declining ocean pH, we are referring to ocean acidification. The pH scale ranges from 0 – 14 and is logarithmic, so a change of pH by 1 unit results in a relatively large change in the acidity of a solution. For this reason, we measure pH with precision to the hundredths place, for example 8.03.

In general, reef aquariums and ocean pH should be kept between 8.0 to 8.3. When pH dips below 8.0, the coral’s ability to calcify and create its carbonate skeleton become compromised. For a more detailed look on pH check out the video below by Bulk Reef Supply discussing pH in growing reef in a captive environment.

What is Coral Bleaching and why is it bad?

Reef-building coral rely on a symbiotic relationship they have with algae living inside their flesh called zooxanthellae. Zooxanthellae give coral the brown coloration of a healthy specimen and provide nutrients to the coral through photosynthesis. The algae gets a safe haven and protection by living inside the coral, the coral in return gets nutrients from the zooxanthellae.

When water parameters such as temperature and pH go out of wack, this symbiotic bond between the coral and its zooxanthellae is broken. The zooxanthellae are expelled from the coral, leaving nothing behind but a bleached-white coral unable to feed off of sunlight. Bleached coral are still alive and can recover, but they can just as easily die due to being starved by the deprivation of their symbiotic algae.


Getting Started

Python 3 is used along with the following imports and libraries, grouped by the task for which they were intended.

Sources of Data Used in this Tutorial

(1) Evidence for ocean acidification in the Great Barrier Reef of Australia

The first dataset by Wei et. al, 2009 (1) analyzed reconstructed ocean pH dating back to 1807 up until 2004. This was done by using isotopic analysis on the coral skeletons of Porites collected from the Great Barrier Reef of Australia. Although these reconstructed water parameters are mere predictors of what our oceans were like back then, these coral skeletons serve as an indispensable tool in defining how our oceans were before human activity impacted our planet.

Isotopes and Minerals Analyzed

The highlight of this study are the d11B and d13C isotopic data. By using mathematical formulas, scientists were able to predict with high precision what the oceanic pH was during a specific year, dating back up to 200 years. The d13C value, while not described in much detail from the source, is likely a measure of the carbon density within the coral. Since coral base their skeleton from carbonate (HCO3-), the assumption I made here is that d13C is a measure of carbonate density of the coral skeleton for the predicted year. The researchers assert that d13C is a measure of the predicted oceanic CO2, but whether the C13 within the coral skeleton accurately predicts atmospheric CO2 levels lies outside the scope of this tutorial. The other values predicted are for Magnesium, strontium, and barium, which are common components of coral skeletons and also provide a window into what our ocean chemistry was like through the years.

(2) A new, high-resolution global mass coral bleaching database.

The second dataset by Donner et al., 2017 (2) collected over 7000 coral reef bleaching events around the globe, creating one of the largest reef bleaching databases ever created. This exhaustive record of bleaching events tracks the location, coordinates, month, year, depth and severity of reports made by research institutions or submitted voluntarily. This database rates the severity of each report from -1 to 3 following the key below.

Severity key


Data Preprocessing

Data from both sources (1) and (2) are publically available for download, citations given at the bottom of this page. On the source page you can find download links for the data as an Excle file.

Data Extraction - (1) Wei et al., 2009

For the first study I demonstrated python's ability to extract text from the data in html format using web scraping and parsing in Python.

In the above dataframe using pandas we display the first 5 rows for ease of viewing. The data we will be looking at for this analysis are

Data Extraction - (2) Donner et al., 2017

For the second study the data was uploaded directly from an excel file and transferred into a pandas dataframe.


Visualizing the Data

Coral Bleaching Reports

Briefly we will show the number of mass coral bleaching reports from the second dataset before exploring reconstructed water chemistry levels.

Notice a considerable increase in the number of coral bleaching reports in year 1998 and 2005. The data here is displayed both as a line graph showing yearly number of reports, and a bar graph for an aggregate (sum) across 12 years.


Mapping Coral Bleaching Reports

Plotting All Coordinates as a Heatmap (1963 - 2005)


Plotting coordinates of coral bleaching reports prior to 1987

Coral bleaching reports prior to 1987


Layered Map Grouped by 12 Years

The map below displays coral bleaching events with a severity code of 3 (over 50% coral reported bleached). There are a total of 1407 reports between 1963 to 2011. These reports are grouped into twelve year buckets, and are stored in map layers that can be navigated in the top right corner of the map.

Interactive map: Select layer (top right) to view reports within a time frame

Coral bleaching events with severity code 3 (over 50% coral bleached). There are approximately 1400 reports plotted in total.

Warning:

Performance issues may arise with this map due to the large amount of data present in each map marker.


Reconstructed Ocean pH and Other Parameters

Below are figures showing the raw data of reconstructed pH, Magnesium, Strontium, Barium ratios, and Carbon composition


Visualizing Both Datasets Together

To give us a better idea on the precision of the reconstructed pH values, lets see how the pH data aligns with world events by plotting it against the number of mass coral bleaching reports across years.

The above figure demonstrates the precision of (1)'s dataset in predicting ocean pH. It appears that the two large dips in ocean pH during 1988 and 2004 (dataset (1), blue) align with the large spikes in Coral bleaching reports in 1988 and 2005 (dataset (2), red)

Exploratory Analysis on pH and Other Parameters

The following sections take the analysis on the raw data a step further by performing a series of regression modeling and correlations on the data for pH, strontium, magnesium, barium and carbon. Here we will do linear regression, polynomial regression, correlation, and machine learning for multivariate regression.

Linear Regression

The Code

Linear Regression Results


Polynomial Regression

The code

Polynomial Regression Results


Correlations between pH and other parameters

The Code

Correlation Results


Machine Learning for Multivariate Regression

For machine learning we are going to use gradient descent to develop a multivariate formula used to predict pH values. The way this work is we run our algorithm a set amount of times (in this case either 200 or 1000 iterations) and it finds coefficients for the parameters that predict pH with the lowest cost.

After 200 Iterations

Machine Learning Results After 200 Iterations


After 1000 Iterations

Machine Learning Results After 1000 Iterations


Concluding Remarks

In this tutorial we explored various methods of regression modeling, correlations and plotting of coordinate data on a world map. By working with dataset (1) on reconstructed ocean pH, and dataset (2) of coral bleaching events, we were able to visualize both the extent of damage that reefs are experiencing as well as the temporal precision of reconstructed pH in predicting these bleaching events.

Through various regression models we are able to predict pH based on year (linear regression and polynomial regression) as well as multivariate regression (Mg, Sr, Ba, d13C). We demonstrated that with polynomial regression we generated a model that fit the oscillations of the data quite well. The model predicts that in the year 2020 our ocean pH will be 7.59, which is still well below 8.0 and unfavorable to coral reefs. Whether this is actually the case is cause for further investigation.

We showed that with multivariate regression modeling we were able to get an accurate formula that predicted pH values with residual of less than +/- 0.5 after 1000 iterations using the algorithm. Given that we have input values for Magnesium, skeletal carbon, Barium, and Strontium, we would be able to estimate the pH value given these parameters. This gives us useful applications in predicting dependent variables from multiple independent variables. If we have a similar dataset in future years we can test the validity of these models.

It is important to note the limitations of these studies. Isotropic data may lose its precision as the number of years we look back increases. The water parameters are only predictions of what our oceans and coral were like back then. With regards to the bleaching report data, it is difficult to objectively collect data on the extent of coral bleaching with standardized methods of data collection. Furthermore, there are oceanic phenomena that are not accounted for in these models, such as interdacadal and yearly oscillations in ocean parameters, and coral reefs adaptability that allows them to recover from mass bleaching events and adapt to declining pH.

References

(1) Wei, G., M.T. McCulloch, G. Mortimer, W. Deng, and L. Xie. 2009. Evidence for ocean acidification in the Great Barrier Reef of Australia. Geochimica et Cosmochimica Acta, vol. 73, pp. 2332-2346. doi:10.1016/j.gca.2009.02.009

(2) Donner SD, Rickbeil GJM, Heron SF (2017) A new, high-resolution global mass coral bleaching database. PLoS ONE 12(4): e0175490. https://doi.org/10.1371/journal.pone.0175490