johnmays / bathymetric-data-vis

Approximately visualizing the Messinian salinity crisis w/ geospatial data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What:

The code in this repo approximately maps how the Mediterranean Sea shrunk during the Messinian salinity crisis with modern bathymetric data. Also, if you're curious, "bathymetry" means "depth measurement", so it is sort of like topography for the bottom of the ocean.

Why:

I'd like to learn R, and to learn a bit more about geospatial data. If I'm a data scientist, it's about time I learn some R, and if I'd like to do work concerning the environment, then it's about time I learn how to work with geospatial data. I'd also like to have some high-resolution images of the Mediterranean sinking for the logo for another project (@Salinity-Crisis-Interactive).

Code Information:

The real work of this project exists in the notebook ./wcs_contour_functions.ipynb and ./contour_funnctions.r. Also, there are some post-processing functions in ./util/.

The rest of the scripts in ./r_tutorial/ and ./r_development/ were just used to explore tools and create some interesting figures.

Stack:

  • R
  • Python
  • Jupyter

Libraries:

I've included an R script, installs.r, which you may just run in your REPL with

source("installs.r")

if you'd like to install the libraries required to run my code. Ι'm also working on publishing an R package with GitHub packages.

Data:

Bathymetric data collected by many organizations & provided over the web by the European Commission's European Marine Observation and Data Network (EMODnet).

Terminology & Definitions:

Embarking on this project forced me to learn what a lot of this stuff is, and I don't want anyone to get confused, so here is my brief overview:

The European Commission (a governing body in the European Union) funds/organizes a network of different oceanographic entities called European Marine Observation and Data Network (EMODnet). EMODnet has central hub of web services, called the Online Web Services (OWS). It hosts all sorts of geospatial marine data, like Plankton density, bathymetry (sea basin topography), and geologic surveys, often in several different data formats and protocols.

The EMODnet OWS has quite a few different types of data download services available. This repository takes advantage of just two:

Web Coverage Service (WCS):

The **Web Coverage Service (WCS) is an implementation of data accessible over the internet. It is called WCS because it complies with the Open Geospatial Consortium (OGC)'s extremely complicated requirements to be a WCS. The OGC is some kind of cooperative entity that is supposed to create standards to make geospatial data more accessible. EMODnet has some data that is only available through their WCS, like raster data. See link.

Example:

Example of figure made with WCS data

Web Feature Service (WFS):

The **Web Feature Service (WFS) is different implementation of data accessible over the internet. It is called WFS because it complies with the OGC's extremely complicated requirements to be a WFS. Again, certain data is only accessible through the WFS, like features and vector data. See link.

Example:

Example of figure made with WFS data

Fetching Data:

Using WFS and WCS are very similar. You pass all of the input data to the service via a URL. This is data such as coordinates to specify the area you'd like the data for, resolution, service type, file format, etc. Here is an example WCS request:

https://ows.emodnet-bathymetry.eu/wcs?service=wcs&version=1.0.0&request=getcoverage&coverage=emodnet:mean&crs=EPSG:4326&BBOX=22,39,24.5,41&format=image/tiff&interpolation=nearest&resx=0.001&resy=0.001

A server on their end will do some work, and then you should have a JSON, or a TIFF, or some kind of file returned to you by that call.

How do you know how to fetch data?

On the OWS page I keep referencing, they list a bunch of calls you can make to the server to show capabilities in an XML metadata format for some reason. BUT, these example R notebooks that EMODnet compiled give a lot of guidance as well.

Difficulties with that tutorial and modern R:

Several of the spatial data packages used in the EMODnet OWS tutorial, such as rgdal and maptools are out-of-maintenance or not on C.R.A.N. anymore. Some of their functionality has been absorbed into terra (kind of a master geospatial library) and sf. Most of the functionality seems to remain, but switching over from the methods they used is somewhat difficult because they just handle data with different R objects, etc. Just be warned that certain functions like rgdal::readOGR() are no longer maintained, and spiritually replaced by methods like terra::vect().

Results:

Stitched-together tiles of WCS bathymetry raster data: Mediterranean Data Raw

Contours from sea-level to 1500m, colored accordingly, with non-Mediterranean bodies of water removed: Colored Contours of Mediterranean

Same contour shapes arranged to create a logo: Contours

Resources:

  1. EMODnet OWS R Tutorial
  2. Paradis' R Tutorial

About

Approximately visualizing the Messinian salinity crisis w/ geospatial data.


Languages

Language:R 81.4%Language:Python 18.6%