KSL resources

We have created a number of open-source statistical tools using Python. Access them through the GitHub repositories linked below.

Mann Kendall & Multipart Mann Kendall

Github repo: https://github.com/Komanawa-Solutions-Ltd/kendall_multipart_kendall

Problem(s):

  • Practitioners often use a Mann Kendall test to identify trends. Mann Kendall reduces the assumption that the data is parametric (normally distributed), but it assumes that the data is monotonically increasing.
  • A multipart Mann Kendall identifies breakpoints where the data matches an a priori set of trends with significance (via a Mann Kendall test); however this is time consuming to implement.
  • Mann Kendall tests can be time consuming to implement in python.

Solution:

A tool that can be used to calculate a Mann Kendall trend, seasonal Mann Kendall trend and multipart Mann Kendall trends. Time series data is passed in and the slope is calculated, with the data and trend plotted. The seasonal Mann Kendall class is the same as the Man Kendall class, but requires a column of seasons data. The multipart Mann Kendall trends allows multiple trends within one data set to be analysed. A seasonal multipart Mann Kendall class is also available. An example output of the Mann Kendall trend is shown below; see the GitHub repo for the full examples and figures.

This work was completed as part of the New Zealand National Science Challenge – Our Land and Water: Monitoring Freshwater Improvement Actions Program

Groundwater Age Tools

Github repo: https://github.com/Komanawa-Solutions-Ltd/gw_age_tools

Problem(s):

  • Exponential piston flow model and Binary exponential piston flow model is not readily avalible in python.
  • Predicting receptor concentration from source concentration and flow model is time consuming.

Solution:

This tool contains functions that calculate a cumulative distribution function & a probability density function for an exponential piston flow model and/or a binary piston flow model. A function that checks the inputs to a binary exponential piston flow model is also included.

The tool also allows historical and future source and receptor concentrations to be predicted – see the figure below for an example.

This work was completed as part of the New Zealand National Science Challenge – Our Land and Water: Monitoring Freshwater Improvement Actions Program

Groundwater Detection Power Calculator

Github repo: https://github.com/Komanawa-Solutions-Ltd/gw_detect_power

Problem:

Solution:

This package is designed to calculate the statistical power of detecting change in groundwater and/or surface water concentrations, depending on the sampling duration, sampling frequency, “true” receptor concentration and the noise in the receptor. Understanding statistical power in the context of groundwater travel times and temporal dispersion is also supported. This package is described in great detail within the GitHub repo.

This work was completed as part of the New Zealand National Science Challenge – Our Land and Water: Monitoring Freshwater Improvement Actions Program

The BASic GRAssland model (BASGRA NZ)

Github repo: https://github.com/Komanawa-Solutions-Ltd/BASGRA_NZ_PY

Problem(s):

  • Pasture growth models are often hard to implement in a programmatic fashion.
  • Models are often too complext to easily explore the impacts of climate shocks

Solution:

The BASGRA model is a simple pasture growth mode. This version has been specifically modified for use within New Zealand. This Python package is a wrapper for the BASGRA_NZ Fortran code. It contains several new features, and is the first version of BASGRA to have purpose built tests to ensure that all changes can be made in a backwards compatible fashion. This package is described in great detail within the GitHub repo.

This work was funded as part of a Sustainable Land Management and Climate Change (SLMACC) project