MCCN Case Study 2 - Spatial projection via modelled data
The MCCN project is to deliver tools to assist the agricultural sector to understand crop-environment relationships, specifically by facilitating generation of data cubes for spatiotemporal data. This repository contains Jupyter notebooks to demonstrate the functionality of the MCCN data cube components.
The dataset contains input files for the case study (source_data), RO-Crate metadata (ro-crate-metadata.json), results from the case study (results), and Jupyter Notebook (MCCN-CASE 2.ipynb)
Research Activity Identifier (RAiD)
RAiD: https://doi.org/10.26292/8679d473
Case Studies
This repository contains code and sample data for the following case studies. Note that the analyses here are to demonstrate the software and result should not be considered scientifically or statistically meaningful. No effort has been made to address bias in samples, and sample data may not be available at sufficient density to warrant analysis. All case studies end with generation of an RO-Crate data package including the source data, the notebook and generated outputs, including netcdf exports of the datacubes themselves.
Case Study 2 - Spatial projection via modelled data
Description
Estimate soil pH and electrical conductivity at 45 cm depth across a farm based on values collected from soil samples. This study demonstrates: 1) Description of spatial assets using STAC, 2) Loading heterogeneous data sources into a cube, 3) Spatial projection in xarray using different algorithms offered by the pykrige and rioxarray packages.
Data sources
- BradGinns_SOIL2004_SoilData.csv - Soil measurements from the University of Sydney Llara Campey farm site from 2004, corresponding to sites L1, L3 and L4 describing mid-depth, soil apparent electrical conductivity (ECa), GammaK, Clay, Silt, Sand, pH and soil electrical conductivity (EC)
- Llara_Campey_field_boundaries_poly.shp - Field boundary shapes for the University of Sydney Llara Campey farm site
Dependencies
- This notebook requires Python 3.10 or higher
- Install relevant Python libraries with: pip install mccn-engine rocrate rioxarray pykrige
- Installing mccn-engine will install other dependencies
Overview
- Select soil sample measurements for pH or EC at 45 cm depth
- Split sample measurements into 80% subset to model interpolated layers and 20% to test interpolated layers
- Generate STAC metadata for layers
- Load data cube
- Interpolate pH and EC across site using the 80% subset and three different 2D interpolation methods from rioxarray (nearest, linear and cubic) and one from pykrige (linear)
- Calculate the error between each layer of interpolated values and measured values for the 20% setaside for testing
- Compare the mean and standard deviation of the errors for each interpolation method
- Clean up and package results as RO-Crate
Notes
- The granularity of variability in soil data significantly compromises all methods
- Depending on the 80/20 split, different methods may appear more reliable, but the pykrige linear method is most often best