Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Agricultural Crop Monitoring from Space Script

//VERSION=3 (auto-converted from 1)


//Author of the script: Maryam Salehi 
// Website: https://www.researchgate.net/profile/Maryam_Salehi13


// Date Definition 
//var master_date = "2018-04-20"; var slave_date = "2018-04-24"; // Comacchio, Ferrara, Italy 
//var master_date = "2018-04-20"; var slave_date = "2018-05-06";    
//var master_date = "2018-04-20"; var slave_date = "2018-05-18";    
//var master_date = "2018-04-20"; var slave_date = "2018-05-30";     
//var master_date = "2018-04-20"; var slave_date = "2018-06-17";    
//var master_date = "2018-04-20"; var slave_date = "2018-07-17";   
//var master_date = "2018-04-20"; var slave_date = "2018-08-04"; 

var master_date = "2018-04-20"; var slave_date = "2018-08-22"; 

var master_date = "2018-04-20"; var slave_date = "2018-08-22"; // Comacchio, Ferrara, Italy   

// Selection of polarizations 
function setup() {
  return {
    input: [{
      bands: [
          "VV",
          "VH"
      ]
    }],
    output: { bands: 3 },
    mosaicking: "ORBIT"
  }
}

function preProcessScenes (collections) {
  var allowedDates = [master_date,slave_date]; // set dates for master and slave images
  collections.scenes.orbits = collections.scenes.orbits.filter(function (orbit) {
      var orbitDateFrom = orbit.dateFrom.split("T")[0];
      return allowedDates.includes(orbitDateFrom);
  })
  return collections
}

// Crop Monitoring
function calcB(sample) {
  var outB = (.5*(sample.VV));
  return [outB];
}
function calcG(sample) {
  var outG = (8*(sample.VH));
  return [outG];
}
function calcR(sample) {
  var outR = (1.5*(sample.VV));
  return [outR];
}

function dateformat(d){  
  var dd = d.getDate();
  var mm = d.getMonth()+1;
  var yyyy = d.getFullYear();
  if(dd<10){dd='0'+dd}
  if(mm<10){mm='0'+mm}
  var isodate = yyyy+'-'+mm+'-'+dd;
  return isodate;
}
function evaluatePixel(samples,scenes) {  
  var Rmaster = 0;var Rslave = 0;
  var Gmaster = 0;var Gslave = 0;
  var Bmaster = 0;var Bslave = 0;
  Rmaster = calcR(samples[1]);
  Rslave = calcR(samples[0]);  
  Gmaster = calcG(samples[1]);
  Gslave = calcG(samples[0]);  
  Bmaster = calcB(samples[1]);
  Bslave = calcB(samples[0]);
  Rdif=Rslave-Rmaster;
  Gdif=Gslave-Gmaster;
  Bdif=Bslave-Bmaster;
  return [Rslave,Gdif,Bslave]
}

Evaluate and Visualize

General description of the script

In agriculture, remote sensing images provide information of damaged crop, crop extent, crop productivity. These images can be also used to distinguish crops from other land classes, evaluate the effects of rainfall, irrigation systems, droughts, floods, fertilizer, pesticide, and Ö . The provided information would be useful to farmers, governments, and agricultural insurance companies.

In order to provide the state of agricultural fields, we need to multi-temporal remote sensing images. The script is based on the time series of Sentinel-1 radar data. Using multi-temporal information from radar images makes it possible to improve the outputs of optical images. In the script, a time series of nine Sentinel-1 IW GRD images with VV and VH polarizations in a selected timeline is used as an input.

Details of the script

The images were acquired during the period from 2018/04/20 to 2018/08/22, in the region of Ferrara, Italy. The image of 2018/04/20 was used as the master image.

The output of the script gives a good view of where crops are growing well, or where crops are not growing, and identifies the surrounding water bodies and urban areas. The different colours in the crop fields display the growth stage variations between the crops. The results of the script are consistent with the Normalized Difference Vegetation Index (NDVI).

See more details about the script in the supplementary material .

Author of the script

Maryam Salehi

Description of representative images

The acquired images during the period from 2018/04/20 to 2018/08/22, in the region of Ferrara, Italy. The image of 2018/04/20 was used as the master image.

        R=?1.5◊VV?_slave, G=?8◊(VH?_slave-?VH?_master), B=?0.5◊VV?_slave.

1) Ferrara, Italy on April 24th, 2018

The script example 1

2) Ferrara, Italy on May 5th, 2018

The script example 2

3) Ferrara, Italy on June 17th, 2018

The script example 3

4) Ferrara, Italy on July 7th, 2018

The script example 3

5) Ferrara, Italy on August 22nd, 2018

The script example 3