Create list of strings that repeats first element and adds _1 _2 up to _n in Google Earth Engine's java editor

Viewed 87

In order to rename the bands of a stacked image, I need a list of the stack's bands, and a list of what I want them to be named. I have made the latter but not the former. It needs to work with stacks containing various numbers of images.

What I need - a list that is HH, HH_1, HH_2 etc up to HH_n-1 of n length.

I've created a list of n length, by the following:

var HHlist = ee.List.repeat('HH', n)

but that just gives HH x the desired number.

I've also made a list of 1 to n, which I thought could somehow be combined.

var sequence = ee.List.sequence(1, n);
0 Answers
Related