2

Using Google Earth Engine (GEE), I am trying to download yearly median NDVI data from PROBA-V. The output image has range 20-145.5.

ndvi

From here, it says:

The reflectances provided in this dataset are presented as Digital Count Numbers (DN) and must be converted according to the guidelines in Section 4.6.1 of the user manual.

According to the user manual, the equation to convert the DN to reflectance is:

PV = (DN - OFFSET) / SCALE

where:

table DN to reflectance

From my code, it seems that I am doing wrong the equation because I am getting an error: Line 25: median1.reproject is not a function

Here is the code:

var table = ee.FeatureCollection("users/nikostziokas/tehran_54009");

var dataset = ee.ImageCollection('VITO/PROBAV/C1/S1_TOC_100M')
                  .filter(ee.Filter.date('2018-01-01', '2018-12-31'))
                  .select('NDVI');
                  
var median1 = dataset.select('NDVI').reduce(ee.Reducer.median()).clip(table);

var median1 = (median1 - 20.0)/250.0;
                  
// Project the image to Mollweide.
var wkt = ' \
  PROJCS["World_Mollweide", \
    GEOGCS["GCS_WGS_1984", \
      DATUM["WGS_1984", \
        SPHEROID["WGS_1984",6378137,298.257223563]], \
      PRIMEM["Greenwich",0], \
      UNIT["Degree",0.017453292519943295]], \
    PROJECTION["Mollweide"], \
    PARAMETER["False_Easting",0], \
    PARAMETER["False_Northing",0], \
    PARAMETER["Central_Meridian",0], \
    UNIT["Meter",1], \
    AUTHORITY["EPSG","54009"]]';

var proj_mollweide = ee.Projection(wkt);
var image_mollweide = median1.reproject({
  crs: proj_mollweide,
  scale: 100
});

Export.image.toDrive({
image: image_mollweide,
description: 'ndvi',
scale: 100, //100 for Band10
maxPixels: 1000000000000,
region: table,
folder: 'Landsat-5'});
2
  • The script you link to and the pasted code doesn't match. There's an obvious error in the pasted code where you're using client-side operations (- and /) on the image. The linked code runs, except for table, which you didn't share. After picking some random area for table, image_mollweide renders on the map. An unrelated note - you take the effort to reproject your image, only to override that projection when exporting. You probably don't want to do that. Feb 22, 2023 at 9:24
  • Sorry, because I tried many thinks I must have pasted the wrong code. I edited the question.
    – Nikos
    Feb 22, 2023 at 9:41

1 Answer 1

1

You cannot do client-side operations on server-side objects like an image. You can read up on it here. Something like this would do it:

var median1 = dataset.select('NDVI').reduce(ee.Reducer.median()).clip(table)
  .subtract(20).divide(250)
           

https://code.earthengine.google.com/c9a40dab0a2bf698b5b7729937612c5f

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.