I have a multiband image with the bands labelled t1 to t12 representing 12 timesteps. I want to know the timestep (band) of the minimum and maximum values for each pixel and convert this timestep to an integer e.g. t7 = 7. Some timesteps have masked values.

Link to the code is here https://code.earthengine.google.com/c9e145f1be528339e1b96d03da12b3ab

2 Answers 2


You would probably like to do something similar to this question: Question Gianca

For your case, this might what you want to do:

link to Script. As an example I added a 'time' band (from 1-12) and used your "median_ndvi" band. You could write a function to do this for all your bands.

  • The code works great for the "median_ndvi" band, but per your suggestion I'm struggling to then map this across all the bands Commented Jan 30, 2019 at 16:23

There is an easier way to achieve this if you have an ImageCollection with each Image having two bands one being the value and the second being a constant representing the timestep.

Using the ee.Reducer.max() reducer

{ImageCollection}.reduce(ee.Reducer.max(2)).rename('max', 'max_t_step') 

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.