I am attributing an image collection with a value, I want to select the image with the median value of that image collection.
Currently I am doing this by creating a list of images with the value clientside, padding the list to be odd then using median to get the Id and value I want then filtering the collection by that ID. This works but I am having to make calls get values clientside to work out the median ID then filter the collection. I feel like this should be possible without having to make a clientside list.
So my question is can I do this without getting a client side list, all server side in EE, and how do I do this?
'''
# returns a list of image data scores
client_list = get_attribute_and_id_client_side_list(ts_collection, 'datascore')
# padding so we always get a value rather than an average of 2
if len(client_list) % 2 == 0:
client_list.append(['padding', 0])
median_datscore = np.median([item[1] for item in client_list])
median_score_coll = ts_collection.filterMetadata('data_score', 'equals', median_datscore)
'''
So essentially for a collection of images with a value in the metadata, I want to select just the image with the medain value without using any client side getInfo()