This repository contains supporting code and data for the publication "Unmixing river sediments for the elemental geochemistry of their source regions" (Under review; preprint).
This repository is archived at point of submission at Zenodo -
This repository contains 11 files.
inversion_mwe.ipynb
is a 'Jupyter Notebook' which contains an annotated minimum working example for the inversion procedure described in the manuscript written in python
. A compiled version of this .ipynb
is given as inversion_mwe.html
that displays the code and the outputs, and can be opened in any browser.
Alongside the above notebook that describes the procedure utilised in the manuscript I have also provided two modified versions, not discussed in the manuscript but potentially of general interest.
First, fast_inversion_mwe.ipynb
, which is broadly the same as the published version but significantly faster (> 10x). This speed-up is achieved by using a faster optimisation algorithm (Powell's method) and starting the inversion closer to the optimal solution. I strongly suggest using this faster version in further work.
Second, a multivariate extension of the univariate example is provided in multivariate_inversion_mwe.ipynb
. Instead of solving each element individually, multiple specified elements are all inverted simultaneously, all whilst obeying the constraints of compositional data, i.e. strictly positive variables that sum to a closure value (e.g. 100 %, 1000000 mg/kg etc). Whilst mathematically neat and self-contained, it is actually (at present...) computationally less efficient than running each element in parallel as it is quadratic w.r.t to the number of elements inverted. Making this multivariate implementation more efficient is left as an exercise to the reader...
topo.dat
is a 2D array of giving the elevations in metres for our study area. This was generated by downsampling the SRTM1s
dataset to a grid of 200x200 m resolution.
geochem.dat
contains the geochemical concentration for a range of elements (in mg/kg) in sediments gathered from our 67 sample sites. See also Lipp et al. 2020.
fitted_samp_locs.dat
contains the location (on the model grid) for the fitted sample sites.
samples.dat
gives further metadata for the samples as well as their full (projected) localities.
The supporting information containing results for all elements is provided in supp_info.pdf
.