Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
naming; English usage
Source Link
Vince
  • 20.3k
  • 16
  • 48
  • 65

Increasing decimal in table chart google earth engineGoogle Earth Engine

I have a code that generates NDVI times series chart. The values a get are with 3 decimal places. I want to increase the decimal places to 4 or 5. Is there a way of doing that?

myMy code:

Increasing decimal in table chart google earth engine

I have a code that generates NDVI times series chart. The values a get are with 3 decimal places. I want to increase the decimal places to 4 or 5. Is there a way of doing that?

my code:

Increasing decimal in table chart Google Earth Engine

I have code that generates NDVI times series chart. The values are with 3 decimal places. I want to increase the decimal places to 4 or 5. Is there a way of doing that?

My code:

Source Link

Increasing decimal in table chart google earth engine

I have a code that generates NDVI times series chart. The values a get are with 3 decimal places. I want to increase the decimal places to 4 or 5. Is there a way of doing that?

my code:

// Load raster data (COPERNICUS/S2_SR).
// Load vector data (shapefile).
var fc = ee.FeatureCollection(user_account+folder+shpfile_name).sort('Group');
var S2 = ee.ImageCollection(image_collection)
        .filterDate(first_date, last_date)
        .filterBounds(fc)
        .filterMetadata('CLOUDY_PIXEL_PERCENTAGE', 'less_than', 18);

//-----------------------------------------------------------------------------------
print(S2)
print(fc)           // CRS must be WGS84 (for the shapefile)          

//-----------------------------------------------------------------------------------
//Image Expression for calculating NDVI----------------------------------------------
var band_1 = 'B4'
var band_2 = 'B8'

var addNDVI = function(image) {
  var NDVI = image.expression(
  '(B8-B4)/(B8+B4)',
  {
    'B4': image.select('B4'),
    'B8': image.select('B8'),

  }).rename('NDVI');
  //NDVI index
  return image.addBands(NDVI.add(ee.Image(0.0)));
  //Add 0.0 value to NDVI (currently not in use)
};

// Calculate NDVIfor images in the Image collection 
var S2_withNDVI = ee.ImageCollection(S2).map(addNDVI);          
print(S2_withNDVI)

//Export NDVI Time Series into a Scatter Chart and a CSV format              
TimeSeries = Chart.image.seriesByRegion(
S2_withNDVI, fc, ee.Reducer.mean(), 'NDVI', 3, 'system:time_start', fc_ID)
    .setChartType('ScatterChart')
    .setOptions({
      title: 'NDVI Time Series For '+ Name,
      vAxis: {title: 'NDVI', format: 'Decimal'},
      hAxis: {title: 'Date'},
      lineWidth: 1,
      pointSize: 4,
      series: {
}});
/ Display.
print(TimeSeries); 
// Compute 3X3 standard deviation kernel (SD) as texture of the NDVI.
var addTexture_3X3_stdDev = function(image) {
var texture = image.select('NDVI').reduceNeighborhood({
reducer: ee.Reducer.stdDev(),
kernel: ee.Kernel.square(1),
}).rename('NDVI_3X3_stdDev')
return image.addBands(texture.add(ee.Image(0.0)));
};
var S2_Analysis = ee.ImageCollection(S2_withNDVI).map(addTexture_3X3_stdDev);
print(S2_Analysis)

//Export 3X3 kernel NDVI stdDev Time Series into a Scatter Chart and a CSV format              
var TimeSeries = Chart.image.seriesByRegion(
S2_Analysis, fc, ee.Reducer.mean(), 'NDVI_3X3_stdDev', 3, 'system:time_start', fc_ID)
    .setChartType('Table')
    .setOptions({
      title: 'NDVI 3X3 stdDev kernel Time Series For Corn Field'+ Name,
      vAxis: {title: 'stdDev', format: 'Decimal'},
      hAxis: {title: 'Date'},
      lineWidth: 1,
      pointSize: 4,
      series: {
}});
// Display.
print(TimeSeries);