0

I am using ERA5-Land Monthly Averaged - ECMWF Climate Reanalysis to calculate the annual potential evaporation globally. However, I cannot visualize the colour palette in my final output. The problem seems to be in the max and min palette values as there is no error in the code. Here is the code I am using-

//Evaporation ERA5 var era5 = ee.ImageCollection("ECMWF/ERA5_LAND/MONTHLY").select(38); var year = 2017; var startDate = ee.Date.fromYMD(year, 1, 1); var endDate = startDate.advance(1, 'year'); var fil_new = era5 .filter(ee.Filter.date('startDate', 'endDate')); var total = fil_new.reduce(ee.Reducer.mean()); print(total); var palette = ['000096','0064ff', '00b4ff', '33db80', '9beb4a','ffeb00', 'ffb300', 'ff6400', 'eb1e00', 'af0000']; var visParams = { min:0, max: 0.5, palette: palette}; Map.addLayer(total, visParams, 'Annual PET'); 
1
  • 1
    startDate and endDate in your ee.Filter.date should not be enclosed in quotes, they are variable names. Commented Jan 21, 2022 at 19:18

1 Answer 1

2

After changing your script according to Matt's comments, it looks like your min and max ranges are set incorrectly. In the "Layer" menu on your map visualization, you can set the symbology range to "Stretch: 100%" to see the full range of the data. From there, you can "Import" the new visualization parameters into your script, or just copy paste the min/max values that are calculated there for you. In your case, the actual range of values is approximately (-0.04,-0).

Code Link: https://code.earthengine.google.com/afa4969997581c26ce421d4ff6c466f5

Code:

//Evaporation ERA5 var era5 = ee.ImageCollection("ECMWF/ERA5_LAND/MONTHLY").select(38); var year = 2017; var startDate = ee.Date.fromYMD(year, 1, 1); var endDate = startDate.advance(1, 'year'); var fil_new = era5 .filter(ee.Filter.date(startDate,endDate)); var total = fil_new.reduce(ee.Reducer.mean()); print(total); var palette = ['000096','0064ff', '00b4ff', '33db80', '9beb4a','ffeb00', 'ffb300', 'ff6400', 'eb1e00', 'af0000']; var visParams = { min: -0.04, max: 0, palette: palette}; Map.addLayer(total, visParams, 'Annual PET'); 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.