Environmental Geoinformatics Laboratory


Links to Matlab, Python, Julia Code

Below is a list of software that we have developed or are developing. Several items listed below have are not yet finished and therefore not publicly available yet, but depending on your needs, we may be able to provide early versions. Once published, all will be freely available as open souce software. Much of this is Matlab code, but several of these have been ported to Python or Julia. There is also the possibility of generating C, C++, or CUDA code from the Matlab functions.
Much of the code available here is interrelated and deeply integrated with our research projects. For example, The Namahage core image scanner and CoreAlign can be used to acquire sediment core images in the field. The images can be subsequently processed with our AI before using CoreLab to calculate color reflectance values and transform the images to age by applying an age-depth model obtained from Undatable.

On this page:
  • Undatable for age-depth modeling in Matlab
  • MatCal for 14C Calibration in Matlab or Julia
  • DepthCorrect for non-linear depth scale correction of IODP Site M0063 cores in Matlab
  • G2N for converting GISP2 ages to the North GRIP GICC05 ice core chronology in Matlab or Python
  • CoreAlign for stiching together core photographs in Python or Matlab
  • CoreLab for calculating color reflectance (L*, a*, b*) from core images in Matlab


Undatable is an age-depth model that considers depth-scale uncertainty. This is important because the sediment-coring process deforms the extracted material, and layers may move in the core liner, particularly when recovery is poor. If sediment accumulation rate is critical for proper interpretation, depth-scale uncertainty should not be ignored. Undatable also assumes that accumulation rate is not constant between age-determinations.
Undatable is extremely fast. This allows for the rapid production (in a matter of seconds in many cases) of age-depth models for multiple types of geological archives, as well as for obtaining better-informed priors for Bayesian modeling. Similar to popular Bayesian models such as Bacon, Undatable produces a probability density cloud, but unlike other age models, it allows for selective weighting of age determinations. This is useful when the reliability of age determinations is variable. For example, the radiocarbon age of a leaf fragment is likely more representative of the age of deposition that the age of bulk organic matter. Undatable also accepts both calendar ages (events, U/Th, tephras, etc.) and has so far been successfully applied not only to sediment archives from estuarine, lacustrine and deep-sea environments, but also to coral archives.
The figure above shows the difference in modeled age between Bacon and Undatable for a Lake Motosu sediment core. Aside from the upper- and lower-most intervals, where the Bacon median age is anomalously young, maximum medium age difference is less than 100 years and typical under 50 years.

Download the latest version of Undatable for Matlab on Github or the archive hosted at CERN

Read the manuscript:
Lougheed, B.C., and Obrochta, S.P., 2019. A Rapid, Deterministic Age-Depth Modeling Routine for Geological Sequences With Inherent Depth Uncertainty. Paleoceanography and Paleoclimatology 34(1) 122–133. 10.1029/2018PA003457

MatCal and JuliaCal

Matcal is a function providing for radiocarbon (14C) age calibration in Matlab using Bayesian highest posterior density [HPD]. There is version for Julia. The function produces a probability distribution function (PDF) of calibrated ages, as well as 1 sigma (68.27%) and 2 sigma (95.45%) probability calibrated age intervals calculated using HPD. Publication-ready calibration plots are also produced, with the option to save to disk. Calibration output can be in either Cal BP or BCE/CE (BC/AD), and a reservoir age can be specified if necessary. The user can choose from a number of calibration curves, including the latest version of IntCal. This calibration program produces very similar results as OxCal or Calib. If your workflow uses either MatCal or Julia, you'll benefit from not needing a separate environment for calibration. MatCal is also included with Undatable, but located in a "private" folder and will therefore needed to be added to your Matlab path separately.

Download for Matlab or Julia

(JuliaCal) Read the manuscript:
Lougheed, B.C., and Obrochta, S.P., 2016. MatCal: Open source Bayesian 14C age calibration in MatLab. Journal of Open Research Software 4(1). 10.5334/jors.130


DepthCorrect is a Matlab function for non-linearly correcting the depth scales of cores from IODP Site M0063 in the Landsort Deep of the Baltic Sea. The sediments at the site are organic-rich silts and clays (gyttja) with high dissolved gas content that caused significant, non-linear expansion that was apparent in down-core density profiles. A logarithmic function was fit to the mean of these profiles for the purpose of depth correction. DepthCorrect assumes that the unexpanded density can be considered constant and uses a derived equation to recompact the depth scale of each expanded core by integration (i.e., area under the curve).
This method is highly dependent on the drilling strategy used at Site M0063, which was to not fully penetrate each core, leaving an empty head space to accommodate expansion. Referring to the figure, a 3.3-meter core (1) was penetrated only ~2 meters (2). During decompression as the core was raised from the sea floor, degassing caused expansion (3). The recovered core was typically fully filled (4). The method we presented with DepthCorrect will be generally applicable to other locations where a similar coring process was employed, though appropriate fit parameters will likely need to be empirically determined.

Download DepthCorrect for Matlab on Github

Read the manuscript:
Obrochta, S.P., Andrén, T., Fazekas, S.Z., Lougheed, B. C., Snowball, I., Yokoyama, Y., Miyairi, Y., Kondo, R., Kotilainen, A.T., Hyttinen, O., and Fehr, A., 2017. The undatables: Quantifying uncertainty in a highly expanded Late Glacial - Holocene sediment sequence recovered from the deepest Baltic Sea basin - IODP Site M0063. Geochemistry, Geophysics, Geosystems 18. 10.1002/2016GC006697


G2N is a function that updates sediment core age models from the GISP2 ice core chronology to the GICC05 chronology used by the North GRIP (NGRIP) ice core.
Aligning sediment core data, such as sea surface temperature, to an "event stratigraphy" is a common practice because of limitations in the available radionuclide dating methods. In general, when the chronology of the event stratigraphy is changed, it is preferable to realign the target dataset to the latest source, in this case the NGRIP ice core. However, this may not be an option for datasets that lack down-core depth information.
In this case, G2N may be used to create a new age model based on the published alignment of the GISP2 and NGRIP ice cores (shown in the figure as the pink lines). There is an option to specify the interval to be aligned. G2N uses the original authors' own alignment points, and the only thing that is changed are the absolute ages of those points. Originally written for Matlab, Jan Moren produced a python version that also works as the target for a web form if the file extension is changed from .py to .cgi.
Prior to using G2N, we recommend exploring whether recent geochronological advances provide a better way of creating an age model.

Download G2N for Matlab or Python from the Japanese Paleosciences Society

Read the manuscript:
Obrochta, S.P., Yokoyama, Y., Morén, J., and Crowley, T.J., 2014. Conversion of GISP2-based sediment core age models to the GICC05 extended chronology. Quaternary Geochronology 20(0) 1–7.


CoreAlign is a function that assembles a series of overlapping photographs of the split surface of a sediment core into a single image with minimal distortion or misalignment. CoreAlign was originally written in Python by Jan Moren specifically for the Namahage core image scanner. We are working on a version for matlab that works with a much wider range of hardware.
CoreAlign works similar to software for creating a landscape panorama from individual images. A higher precision is need than can be typically obtained with panorama software, but fortunately we have restrictions that simplifies the task. While a panorama needs to compute a full homography, we can assume the absence of shear and scaling. We also have a well-defined horizontal direction across all images. CoreAlign assumes the distance between the camera and core surface is relatively constant for all images and that the camera is pointing approximately 90˚ down at the core. Under those assumptions, only minor tilt correction and rotation are needed to produce an extremely high-quality, low-distortion image composite. (It is difficult to position the camera precisely.)
The above-mentioned corrections require both moving and stationary portions in each image. Takeshi Nakagawa of Ritumeikan University attaches a tray that moves with the camera and can hold a color chart and sample ID label. The pixels locations of these features should change very little between images. The amount by which they do defines the needed tilt and rotation correction. The figure shows two overlain, adjacent images taken with the Namahage core image scanner and with the cluster of SURF (Speeded Up Robust Features) points that are largely stationary between each image. CoreAlign uses these for correction.

CoreAlign is currently under development. Contact us if interested in using a developmental version.


CoreLab is a utility for working with sediment core images, such as ones obtained from traditional linescanners, acquired by the portable Namahage stitched together using CoreAlign, or in a single shot by a camera. CoreLab has four primary functions:

  • Calculation of color reflectance (L*, a*, b*) from the image
  • Exclusion of disturbed pixels from the color reflectance calculation
  • Correction of parallax, (particularly useful for cores images in a single frame)
  • Application of an age-depth model to transform the images into age to display in a figure with a time axis

The most powerful feature of CoreLab is the ability to, either manually or with the assistance of our AI, exclude disturbed areas from color reflection calculation. This produces a color reflectance record that more closely represents the sediment color at the time of deposition. If the image of the sediment core was captured as a single photograph, a user-specified mapping of pixels to distance can be used to correct for parallax caused by the ends of the core being farther from the lens than the center. This is necessary to precisely align the color data to the other datasets from the sediment core. CoreLab also allows for production of figures, with data plotted in age and the sediment core image precisely transformed to match.
The accompanying figure was produced with CoreLab using data from Deep Sea Drilling Program Site 609. The sediment core image, shown on the bottom, is taken from a single photograph and corrected for parallax. (The photograph was taken in 1983.) Sediment lightness values (L*; red, middle) were calculated from the image after removing disturbed pixels. TAbove this is the percentage of the left-coiling variety of the polar planktic foraminifer N. pachyderma (green, top), which was determined by counting sediment grains under a microscope. Note that the x-axis is time and that the plotted sediment color values precisely correspond to visible changes is sediment brightness.

Corelab is currently under development. Contact us if interested in using a developmental version.