Measuring crop health

Background

During a normal year, sugar cane in Queensland typically flowers early May through June; July to November is typically cane harvesting season.

While sugar is growing, fields may look visually similar. However, health or growth rates from these fields can be quite different, leading to variability and unpredictability in revenue. Identifying underperforming crops can have two benefits:

  • Ability to scout for frost or disease damage.

  • Ability to investigate poor performing paddocks and undertake management action such as soil testing or targeted fertilising to improve yield.

Sentinel-2 use case

Satellite imagery can be used to measure pasture health over time and identify any changes in growth patterns between otherwise similar paddocks. Sentinel-2’s 10 metre resolution makes it ideal for understanding the health of paddocks.

The Normalised Difference Vegetation Index (NDVI) describes the difference between visible and near-infrared reflectance of vegetation cover. This index estimates the density of green on an area of land and can be used to track the health and growth of sugar as it matures. Comparing the NDVI of two similar paddocks will help to identify any anomalies in growth patterns.

Description

In this example, data from the European Sentinel-2 satellites is used to assess crop growing patterns for the last year. This data is made available through the Copernicus Regional Data Hub and Digital Earth Australia within 1-2 days of capture. The worked example below takes users through the code required to:

  1. Create a time series data cube over a farming property.

  2. Select multiple paddocks for comparison.

  3. Create graphs to identify crop performance trends over the last year.

  4. Interpret the results.


Getting started

To run this analysis, run all the cells in the notebook, starting with the “Load packages and apps” cell.

Load packages and apps

This notebook works via two functions, which are referred to as apps: load_crophealth_data and run_crophealth_app. The apps allow the majority of the analysis code to be stored in another file, making the notebook easy to use and run. To view the code behind the apps, open the notebookapp_crophealth.py file.

[1]:
%matplotlib inline

import sys
import datacube

sys.path.append("../Scripts")
from notebookapp_crophealth import load_crophealth_data
from notebookapp_crophealth import run_crophealth_app

Load the data

The load_crophealth_data() command performs several key steps:

  • identify all available Sentinel-2 near real time data in the case-study area over the last year

  • remove any bad quality pixels

  • keep images where more than half of the image contains good quality pixels

  • collate images from Sentinel-2A and Sentinel-2B into a single data-set

  • calculate the NDVI from the red and near infrared bands

  • return the collated data for analysis

The cleaned and collated data is stored in the dataset_sentinel2 object. As the command runs, feedback will be provided below the cell, including information on the number of cleaned images loaded from each satellite.

Please be patient. The load is complete when the cell status goes from [*] to [number].

[2]:
dataset_sentinel2 = load_crophealth_data()
Loading s2a_ard_granule data
    Filtering to 18 out of 30 observations
    Applying pixel quality mask
Loading s2b_ard_granule data
    Filtering to 21 out of 32 observations
    Applying pixel quality mask
Combining and sorting data
Masking out invalid values
    Returning 39 observations

Run the crop health app

The run_crophealth_app() command launches an interactive map. Drawing polygons within the boundary (which represents the area covered by the loaded data) will result in plots of the average NDVI in that area. Draw polygons by clicking the ⬟ symbol in the app.

The app works by taking the loaded data dataset_sentinel2 as an argument.

Note: data points will only appear for images where more than 50% of the pixels were classified as good quality. This may cause trend lines on the average NDVI plot to appear disconnected. Available data points will be marked with the * symbol.

[3]:
run_crophealth_app(dataset_sentinel2)

Drawing conclusions

Here are some questions to think about:

  • What are some factors that might explain differences between fields?

  • From the NDVI value, can you tell when fields were harvested?


Additional information

License: The code in this notebook is licensed under the Apache License, Version 2.0. Digital Earth Australia data is licensed under the Creative Commons by Attribution 4.0 license.

Contact: If you need assistance, please post a question on the Open Data Cube Slack channel or on the GIS Stack Exchange using the open-data-cube tag (you can view previously asked questions here). If you would like to report an issue with this notebook, you can file one on Github.

Last modified: January 2020

Compatible datacube version:

[4]:
print(datacube.__version__)
1.7

Tags

Browse all available tags on the DEA User Guide’s Tags Index

Tags: sandbox compatible, NCI compatible, sentinel 2, NDVI, real world, agriculture, time series, interactive, widgets