Calculating CIredEdge from Sentinel 2 composite image and adding as Band in Google Earth Explorer?Seeking...

How do I reattach a shelf to the wall when it ripped out of the wall?

Is the claim "Employers won't employ people with no 'social media presence'" realistic?

Does tea made with boiling water cool faster than tea made with boiled (but still hot) water?

Why do games have consumables?

Why was the Spitfire's elliptical wing almost uncopied by other aircraft of World War 2?

Critique of timeline aesthetic

How to write a column outside the braces in a matrix?

Pre-plastic human skin alternative

Why did C use the -> operator instead of reusing the . operator?

Dynamic SOQL query relationship with field visibility for Users

Can I criticise the more senior developers around me for not writing clean code?

What does the integral of a function times a function of a random variable represent, conceptually?

How does Captain America channel this power?

Checks user level and limit the data before saving it to mongoDB

What is the most expensive material in the world that could be used to create Pun-Pun's lute?

How could Tony Stark make this in Endgame?

Like totally amazing interchangeable sister outfits II: The Revenge

Is there really no use for MD5 anymore?

Do I have an "anti-research" personality?

How come there are so many candidates for the 2020 Democratic party presidential nomination?

What's the polite way to say "I need to urinate"?

Betweenness centrality formula

Rivers without rain

How to limit Drive Letters Windows assigns to new removable USB drives



Calculating CIredEdge from Sentinel 2 composite image and adding as Band in Google Earth Explorer?


Seeking Function to calculate red-edgeNDVI in Google Earth Engine?Selecting bands of image collection in google earth engine?Sentinel Cloud-free Collection Google Earth Engine Code EditorGEE cloud-free Sentinel2 and linear RegressionHow to apply a Cloud Mask in Google Earth Engine? (Landsat 5 TM 8-Day NDVI Composite)Obtain percentiles from an image in Google Earth EngineExtracting pixel values by points from multi-band image and converting to table in Google Earth Engine?Google Earth Engine, how to distinguish between rivers/streams and ponds/lakes in a water maskGoogle Engine - Make a greenest pixel composite for Sentinel 2Linear Regression on single image with multiple bands in Google Earth EngineData organization in Google Earth Engine image collection?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















This is a follow-up question to Seeking Function to calculate red-edgeNDVI in Google Earth Engine?



I’ve added the redEdgeNDVI band to the image collection by mapping the function over the collection as suggested in the previous post. I’ve then created a composite image based on the maximum redEdgeNDVI for each pixel across all the images in the collection (S2_max_reNDVI). I’ve then split this image in two based on the value of the redEdgeNDVI creating two images, one with max redEdgeNDVI < 0.6 (S2_reNDVI_0_59) and one with max redEdgeNDVI >=0.6 S2_reNDVI_6). My code works fine up to this point.



What I then want to do is take the image S2_reNDVI_6 and calculate a new chlorophyll index called CIredEdge ((NIR/redEdge)-1) and add this as a band to S2_reNDVI_6, just like I did with redEdgeNDVI. However this time the object S2_reNDVI_6 is an Image and not a Collection.



I’ve tried writing this as a function:



//Function to calculate CIredEdge
var add_CIredEdge = function(image){
//Create band variables
var redEdge = image.select('B5');
var NIR = image.select('B8');
var CIredEdge = NIR.divide(redEdge).subtract(1);
return image.addBands(CIredEdge);
};

//Map image to CIre
var S2_CIredEdge = S2_reNDVI_6.map(add_CIredEdge);


As an expression:



var CIre = S2_reNDVI_6.expression(
'(NIR / redEdge) -1', {
'redEdge': S2_reNDVI_6.select('B5'),
'NIR': S2_reNDVI_6.select('B8')
});


And by computing it the hard way:



var CIre = S2_reNDVI_6.select('B8').divide(S2_reNDVI_6.select('B5')).subtract(1);

var S2_CIredEdge = S2_reNDVI_6.addBands(CIre);

Map.addLayer(S2_CIredEdge, {palette: ['ffeda0', 'feb24c', 'f03b20']}, 'CIrededge pixel composite');
//Map.addLayer(S2_CIredEdge, {bands:['CIre'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'CIrededge pixel composite');


But none of these methods work. Using the function I get the error message “S2_reNDVI_6.map is not a function” when trying to map the image.



With the expression and by doing it the hard way the result returns a 1 band (float) image but the band is ‘B8’ and the layer does not display even though the layers dialogue does. When I stretch to 100% the ranges given are 0 to 0. If I add the band to S2_reNDVI_6 there are 11 bands with the new band being named ‘B8_1’.



I suspect that there is something wrong with way I input the formula for the calculation.



I am new to GEE.



The object 'aoi' is a polygon shapefile.



Here is my code that works:



/**
* Function to mask clouds using the Sentinel-2 QA band
* @param {ee.Image} image Sentinel-2 image
* @return {ee.Image} cloud masked Sentinel-2 image
*/
function maskS2clouds(image) {
var qa = image.select('QA60');

// Bits 10 and 11 are clouds and cirrus, respectively.
var cloudBitMask = 1 << 10;
var cirrusBitMask = 1 << 11;

// Both flags should be set to zero, indicating clear conditions.
var mask = qa.bitwiseAnd(cloudBitMask).eq(0)
.and(qa.bitwiseAnd(cirrusBitMask).eq(0));

return image.updateMask(mask)
.divide(10000);
}
//-----------------------------------------------------------------------------------
//Section 2
// Load Sentinel-2 TOA reflectance data.
var S2 = ee.ImageCollection('COPERNICUS/S2')
.filterDate('2017-06-01', '2017-09-30')
// Pre-filter to get less cloudy granules.
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20))
//Select required bands only
.select('B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B8A', 'QA60')
//Apply cloud mask
.map(maskS2clouds);

// Create clipping function
var clipper = function(image){
return image.clip(aoi); // Add the table or shapefile to clip to here
};

//Clip images
var S2Clip = S2.map(clipper);

//Function to calculate redEdgeNDVI
var add_reNDVI = function(image){
//Create band variables
var redEdge = image.select('B5');
var NIR = image.select('B8');
var redEdgeNDVI = NIR.subtract(redEdge).divide(NIR.add(redEdge)).rename('reNDVI');
return image.addBands(redEdgeNDVI);
};

//Map collection to reNDVI
var S2_reNDVI = S2Clip.map(add_reNDVI);

// Make a "max redEdgeNDVI" pixel composite taking max reNDVI from all images
var S2_max_reNDVI = S2_reNDVI.qualityMosaic('reNDVI');

// Display the result.
//Map.addLayer(S2_max_reNDVI, {bands:['reNDVI'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'Max reNDVI pixel composite');

//Split image in 2
//Set threshold for using redEdgeNDVI
var reNDVI_threshold = S2_max_reNDVI.lt(0.6);

//Set threshold for using CIredEdge
var CIre_threshold = S2_max_reNDVI.gte(0.6);

//Extract pixels with max reNDVI < 0.6 for redEdgeNDVI - LAI conversion
var S2_reNDVI_0_59 = S2_max_reNDVI.updateMask(reNDVI_threshold);

//Extract pixels with max reNDVI >= 0.6 for CIredEdge - LAI conversion
var S2_reNDVI_6 = S2_max_reNDVI.updateMask(CIre_threshold);

// Display the results < 0.6.
//Map.addLayer(S2_reNDVI_0_59, {bands:['reNDVI'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'Pixels Max reNDVI pixel composite');

// Display the results >= 0.6.
//Map.addLayer(S2_reNDVI_6, {bands:['reNDVI'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'Pixels Max reNDVI CIredEdge pixel composite');









share|improve this question































    1















    This is a follow-up question to Seeking Function to calculate red-edgeNDVI in Google Earth Engine?



    I’ve added the redEdgeNDVI band to the image collection by mapping the function over the collection as suggested in the previous post. I’ve then created a composite image based on the maximum redEdgeNDVI for each pixel across all the images in the collection (S2_max_reNDVI). I’ve then split this image in two based on the value of the redEdgeNDVI creating two images, one with max redEdgeNDVI < 0.6 (S2_reNDVI_0_59) and one with max redEdgeNDVI >=0.6 S2_reNDVI_6). My code works fine up to this point.



    What I then want to do is take the image S2_reNDVI_6 and calculate a new chlorophyll index called CIredEdge ((NIR/redEdge)-1) and add this as a band to S2_reNDVI_6, just like I did with redEdgeNDVI. However this time the object S2_reNDVI_6 is an Image and not a Collection.



    I’ve tried writing this as a function:



    //Function to calculate CIredEdge
    var add_CIredEdge = function(image){
    //Create band variables
    var redEdge = image.select('B5');
    var NIR = image.select('B8');
    var CIredEdge = NIR.divide(redEdge).subtract(1);
    return image.addBands(CIredEdge);
    };

    //Map image to CIre
    var S2_CIredEdge = S2_reNDVI_6.map(add_CIredEdge);


    As an expression:



    var CIre = S2_reNDVI_6.expression(
    '(NIR / redEdge) -1', {
    'redEdge': S2_reNDVI_6.select('B5'),
    'NIR': S2_reNDVI_6.select('B8')
    });


    And by computing it the hard way:



    var CIre = S2_reNDVI_6.select('B8').divide(S2_reNDVI_6.select('B5')).subtract(1);

    var S2_CIredEdge = S2_reNDVI_6.addBands(CIre);

    Map.addLayer(S2_CIredEdge, {palette: ['ffeda0', 'feb24c', 'f03b20']}, 'CIrededge pixel composite');
    //Map.addLayer(S2_CIredEdge, {bands:['CIre'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'CIrededge pixel composite');


    But none of these methods work. Using the function I get the error message “S2_reNDVI_6.map is not a function” when trying to map the image.



    With the expression and by doing it the hard way the result returns a 1 band (float) image but the band is ‘B8’ and the layer does not display even though the layers dialogue does. When I stretch to 100% the ranges given are 0 to 0. If I add the band to S2_reNDVI_6 there are 11 bands with the new band being named ‘B8_1’.



    I suspect that there is something wrong with way I input the formula for the calculation.



    I am new to GEE.



    The object 'aoi' is a polygon shapefile.



    Here is my code that works:



    /**
    * Function to mask clouds using the Sentinel-2 QA band
    * @param {ee.Image} image Sentinel-2 image
    * @return {ee.Image} cloud masked Sentinel-2 image
    */
    function maskS2clouds(image) {
    var qa = image.select('QA60');

    // Bits 10 and 11 are clouds and cirrus, respectively.
    var cloudBitMask = 1 << 10;
    var cirrusBitMask = 1 << 11;

    // Both flags should be set to zero, indicating clear conditions.
    var mask = qa.bitwiseAnd(cloudBitMask).eq(0)
    .and(qa.bitwiseAnd(cirrusBitMask).eq(0));

    return image.updateMask(mask)
    .divide(10000);
    }
    //-----------------------------------------------------------------------------------
    //Section 2
    // Load Sentinel-2 TOA reflectance data.
    var S2 = ee.ImageCollection('COPERNICUS/S2')
    .filterDate('2017-06-01', '2017-09-30')
    // Pre-filter to get less cloudy granules.
    .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20))
    //Select required bands only
    .select('B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B8A', 'QA60')
    //Apply cloud mask
    .map(maskS2clouds);

    // Create clipping function
    var clipper = function(image){
    return image.clip(aoi); // Add the table or shapefile to clip to here
    };

    //Clip images
    var S2Clip = S2.map(clipper);

    //Function to calculate redEdgeNDVI
    var add_reNDVI = function(image){
    //Create band variables
    var redEdge = image.select('B5');
    var NIR = image.select('B8');
    var redEdgeNDVI = NIR.subtract(redEdge).divide(NIR.add(redEdge)).rename('reNDVI');
    return image.addBands(redEdgeNDVI);
    };

    //Map collection to reNDVI
    var S2_reNDVI = S2Clip.map(add_reNDVI);

    // Make a "max redEdgeNDVI" pixel composite taking max reNDVI from all images
    var S2_max_reNDVI = S2_reNDVI.qualityMosaic('reNDVI');

    // Display the result.
    //Map.addLayer(S2_max_reNDVI, {bands:['reNDVI'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'Max reNDVI pixel composite');

    //Split image in 2
    //Set threshold for using redEdgeNDVI
    var reNDVI_threshold = S2_max_reNDVI.lt(0.6);

    //Set threshold for using CIredEdge
    var CIre_threshold = S2_max_reNDVI.gte(0.6);

    //Extract pixels with max reNDVI < 0.6 for redEdgeNDVI - LAI conversion
    var S2_reNDVI_0_59 = S2_max_reNDVI.updateMask(reNDVI_threshold);

    //Extract pixels with max reNDVI >= 0.6 for CIredEdge - LAI conversion
    var S2_reNDVI_6 = S2_max_reNDVI.updateMask(CIre_threshold);

    // Display the results < 0.6.
    //Map.addLayer(S2_reNDVI_0_59, {bands:['reNDVI'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'Pixels Max reNDVI pixel composite');

    // Display the results >= 0.6.
    //Map.addLayer(S2_reNDVI_6, {bands:['reNDVI'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'Pixels Max reNDVI CIredEdge pixel composite');









    share|improve this question



























      1












      1








      1








      This is a follow-up question to Seeking Function to calculate red-edgeNDVI in Google Earth Engine?



      I’ve added the redEdgeNDVI band to the image collection by mapping the function over the collection as suggested in the previous post. I’ve then created a composite image based on the maximum redEdgeNDVI for each pixel across all the images in the collection (S2_max_reNDVI). I’ve then split this image in two based on the value of the redEdgeNDVI creating two images, one with max redEdgeNDVI < 0.6 (S2_reNDVI_0_59) and one with max redEdgeNDVI >=0.6 S2_reNDVI_6). My code works fine up to this point.



      What I then want to do is take the image S2_reNDVI_6 and calculate a new chlorophyll index called CIredEdge ((NIR/redEdge)-1) and add this as a band to S2_reNDVI_6, just like I did with redEdgeNDVI. However this time the object S2_reNDVI_6 is an Image and not a Collection.



      I’ve tried writing this as a function:



      //Function to calculate CIredEdge
      var add_CIredEdge = function(image){
      //Create band variables
      var redEdge = image.select('B5');
      var NIR = image.select('B8');
      var CIredEdge = NIR.divide(redEdge).subtract(1);
      return image.addBands(CIredEdge);
      };

      //Map image to CIre
      var S2_CIredEdge = S2_reNDVI_6.map(add_CIredEdge);


      As an expression:



      var CIre = S2_reNDVI_6.expression(
      '(NIR / redEdge) -1', {
      'redEdge': S2_reNDVI_6.select('B5'),
      'NIR': S2_reNDVI_6.select('B8')
      });


      And by computing it the hard way:



      var CIre = S2_reNDVI_6.select('B8').divide(S2_reNDVI_6.select('B5')).subtract(1);

      var S2_CIredEdge = S2_reNDVI_6.addBands(CIre);

      Map.addLayer(S2_CIredEdge, {palette: ['ffeda0', 'feb24c', 'f03b20']}, 'CIrededge pixel composite');
      //Map.addLayer(S2_CIredEdge, {bands:['CIre'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'CIrededge pixel composite');


      But none of these methods work. Using the function I get the error message “S2_reNDVI_6.map is not a function” when trying to map the image.



      With the expression and by doing it the hard way the result returns a 1 band (float) image but the band is ‘B8’ and the layer does not display even though the layers dialogue does. When I stretch to 100% the ranges given are 0 to 0. If I add the band to S2_reNDVI_6 there are 11 bands with the new band being named ‘B8_1’.



      I suspect that there is something wrong with way I input the formula for the calculation.



      I am new to GEE.



      The object 'aoi' is a polygon shapefile.



      Here is my code that works:



      /**
      * Function to mask clouds using the Sentinel-2 QA band
      * @param {ee.Image} image Sentinel-2 image
      * @return {ee.Image} cloud masked Sentinel-2 image
      */
      function maskS2clouds(image) {
      var qa = image.select('QA60');

      // Bits 10 and 11 are clouds and cirrus, respectively.
      var cloudBitMask = 1 << 10;
      var cirrusBitMask = 1 << 11;

      // Both flags should be set to zero, indicating clear conditions.
      var mask = qa.bitwiseAnd(cloudBitMask).eq(0)
      .and(qa.bitwiseAnd(cirrusBitMask).eq(0));

      return image.updateMask(mask)
      .divide(10000);
      }
      //-----------------------------------------------------------------------------------
      //Section 2
      // Load Sentinel-2 TOA reflectance data.
      var S2 = ee.ImageCollection('COPERNICUS/S2')
      .filterDate('2017-06-01', '2017-09-30')
      // Pre-filter to get less cloudy granules.
      .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20))
      //Select required bands only
      .select('B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B8A', 'QA60')
      //Apply cloud mask
      .map(maskS2clouds);

      // Create clipping function
      var clipper = function(image){
      return image.clip(aoi); // Add the table or shapefile to clip to here
      };

      //Clip images
      var S2Clip = S2.map(clipper);

      //Function to calculate redEdgeNDVI
      var add_reNDVI = function(image){
      //Create band variables
      var redEdge = image.select('B5');
      var NIR = image.select('B8');
      var redEdgeNDVI = NIR.subtract(redEdge).divide(NIR.add(redEdge)).rename('reNDVI');
      return image.addBands(redEdgeNDVI);
      };

      //Map collection to reNDVI
      var S2_reNDVI = S2Clip.map(add_reNDVI);

      // Make a "max redEdgeNDVI" pixel composite taking max reNDVI from all images
      var S2_max_reNDVI = S2_reNDVI.qualityMosaic('reNDVI');

      // Display the result.
      //Map.addLayer(S2_max_reNDVI, {bands:['reNDVI'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'Max reNDVI pixel composite');

      //Split image in 2
      //Set threshold for using redEdgeNDVI
      var reNDVI_threshold = S2_max_reNDVI.lt(0.6);

      //Set threshold for using CIredEdge
      var CIre_threshold = S2_max_reNDVI.gte(0.6);

      //Extract pixels with max reNDVI < 0.6 for redEdgeNDVI - LAI conversion
      var S2_reNDVI_0_59 = S2_max_reNDVI.updateMask(reNDVI_threshold);

      //Extract pixels with max reNDVI >= 0.6 for CIredEdge - LAI conversion
      var S2_reNDVI_6 = S2_max_reNDVI.updateMask(CIre_threshold);

      // Display the results < 0.6.
      //Map.addLayer(S2_reNDVI_0_59, {bands:['reNDVI'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'Pixels Max reNDVI pixel composite');

      // Display the results >= 0.6.
      //Map.addLayer(S2_reNDVI_6, {bands:['reNDVI'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'Pixels Max reNDVI CIredEdge pixel composite');









      share|improve this question
















      This is a follow-up question to Seeking Function to calculate red-edgeNDVI in Google Earth Engine?



      I’ve added the redEdgeNDVI band to the image collection by mapping the function over the collection as suggested in the previous post. I’ve then created a composite image based on the maximum redEdgeNDVI for each pixel across all the images in the collection (S2_max_reNDVI). I’ve then split this image in two based on the value of the redEdgeNDVI creating two images, one with max redEdgeNDVI < 0.6 (S2_reNDVI_0_59) and one with max redEdgeNDVI >=0.6 S2_reNDVI_6). My code works fine up to this point.



      What I then want to do is take the image S2_reNDVI_6 and calculate a new chlorophyll index called CIredEdge ((NIR/redEdge)-1) and add this as a band to S2_reNDVI_6, just like I did with redEdgeNDVI. However this time the object S2_reNDVI_6 is an Image and not a Collection.



      I’ve tried writing this as a function:



      //Function to calculate CIredEdge
      var add_CIredEdge = function(image){
      //Create band variables
      var redEdge = image.select('B5');
      var NIR = image.select('B8');
      var CIredEdge = NIR.divide(redEdge).subtract(1);
      return image.addBands(CIredEdge);
      };

      //Map image to CIre
      var S2_CIredEdge = S2_reNDVI_6.map(add_CIredEdge);


      As an expression:



      var CIre = S2_reNDVI_6.expression(
      '(NIR / redEdge) -1', {
      'redEdge': S2_reNDVI_6.select('B5'),
      'NIR': S2_reNDVI_6.select('B8')
      });


      And by computing it the hard way:



      var CIre = S2_reNDVI_6.select('B8').divide(S2_reNDVI_6.select('B5')).subtract(1);

      var S2_CIredEdge = S2_reNDVI_6.addBands(CIre);

      Map.addLayer(S2_CIredEdge, {palette: ['ffeda0', 'feb24c', 'f03b20']}, 'CIrededge pixel composite');
      //Map.addLayer(S2_CIredEdge, {bands:['CIre'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'CIrededge pixel composite');


      But none of these methods work. Using the function I get the error message “S2_reNDVI_6.map is not a function” when trying to map the image.



      With the expression and by doing it the hard way the result returns a 1 band (float) image but the band is ‘B8’ and the layer does not display even though the layers dialogue does. When I stretch to 100% the ranges given are 0 to 0. If I add the band to S2_reNDVI_6 there are 11 bands with the new band being named ‘B8_1’.



      I suspect that there is something wrong with way I input the formula for the calculation.



      I am new to GEE.



      The object 'aoi' is a polygon shapefile.



      Here is my code that works:



      /**
      * Function to mask clouds using the Sentinel-2 QA band
      * @param {ee.Image} image Sentinel-2 image
      * @return {ee.Image} cloud masked Sentinel-2 image
      */
      function maskS2clouds(image) {
      var qa = image.select('QA60');

      // Bits 10 and 11 are clouds and cirrus, respectively.
      var cloudBitMask = 1 << 10;
      var cirrusBitMask = 1 << 11;

      // Both flags should be set to zero, indicating clear conditions.
      var mask = qa.bitwiseAnd(cloudBitMask).eq(0)
      .and(qa.bitwiseAnd(cirrusBitMask).eq(0));

      return image.updateMask(mask)
      .divide(10000);
      }
      //-----------------------------------------------------------------------------------
      //Section 2
      // Load Sentinel-2 TOA reflectance data.
      var S2 = ee.ImageCollection('COPERNICUS/S2')
      .filterDate('2017-06-01', '2017-09-30')
      // Pre-filter to get less cloudy granules.
      .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20))
      //Select required bands only
      .select('B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B8A', 'QA60')
      //Apply cloud mask
      .map(maskS2clouds);

      // Create clipping function
      var clipper = function(image){
      return image.clip(aoi); // Add the table or shapefile to clip to here
      };

      //Clip images
      var S2Clip = S2.map(clipper);

      //Function to calculate redEdgeNDVI
      var add_reNDVI = function(image){
      //Create band variables
      var redEdge = image.select('B5');
      var NIR = image.select('B8');
      var redEdgeNDVI = NIR.subtract(redEdge).divide(NIR.add(redEdge)).rename('reNDVI');
      return image.addBands(redEdgeNDVI);
      };

      //Map collection to reNDVI
      var S2_reNDVI = S2Clip.map(add_reNDVI);

      // Make a "max redEdgeNDVI" pixel composite taking max reNDVI from all images
      var S2_max_reNDVI = S2_reNDVI.qualityMosaic('reNDVI');

      // Display the result.
      //Map.addLayer(S2_max_reNDVI, {bands:['reNDVI'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'Max reNDVI pixel composite');

      //Split image in 2
      //Set threshold for using redEdgeNDVI
      var reNDVI_threshold = S2_max_reNDVI.lt(0.6);

      //Set threshold for using CIredEdge
      var CIre_threshold = S2_max_reNDVI.gte(0.6);

      //Extract pixels with max reNDVI < 0.6 for redEdgeNDVI - LAI conversion
      var S2_reNDVI_0_59 = S2_max_reNDVI.updateMask(reNDVI_threshold);

      //Extract pixels with max reNDVI >= 0.6 for CIredEdge - LAI conversion
      var S2_reNDVI_6 = S2_max_reNDVI.updateMask(CIre_threshold);

      // Display the results < 0.6.
      //Map.addLayer(S2_reNDVI_0_59, {bands:['reNDVI'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'Pixels Max reNDVI pixel composite');

      // Display the results >= 0.6.
      //Map.addLayer(S2_reNDVI_6, {bands:['reNDVI'], palette: ['ffeda0', 'feb24c', 'f03b20']}, 'Pixels Max reNDVI CIredEdge pixel composite');






      google-earth-engine sentinel-2 image-mosaic multi-band






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 16 mins ago









      PolyGeo

      54.1k1782247




      54.1k1782247










      asked 10 hours ago









      Adam GAdam G

      406




      406






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "79"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f320967%2fcalculating-cirededge-from-sentinel-2-composite-image-and-adding-as-band-in-goog%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f320967%2fcalculating-cirededge-from-sentinel-2-composite-image-and-adding-as-band-in-goog%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Щит и меч (фильм) Содержание Названия серий | Сюжет |...

          Венесуэла на летних Олимпийских играх 2000 Содержание Состав...

          Meter-Bus Содержание Параметры шины | Стандартизация |...