diff --git a/geetools/ee_image_collection.py b/geetools/ee_image_collection.py index 7521c0c2..f9fd413b 100644 --- a/geetools/ee_image_collection.py +++ b/geetools/ee_image_collection.py @@ -1233,51 +1233,48 @@ def sortMany( ) -> ee.ImageCollection: """Sort an ImageCollection using more than 1 property. + The properties are set in the order of priority. The first property is the most important one, + in case of a tie, the second property is used to break the tie, and so on. + + Warning: + This method will raise an error if the 2 parameter are not the same size. + Args: properties: the list of properties to sort by. ascending: the list of order. If not passed all properties will be sorted ascending + + Examples: + .. jupyter-execute:: + + import ee, geetools + from geetools.utils import initialize_documentation + + initialize_documentation() + + # order the 500 first images of the NOAA forecast by forecasted date. in case of tie, + # order by creation date. We limit to 500 to not exceed GEE computation limits² + ic = ee.ImageCollection("NOAA/GFS0P25").limit(500) + icSorted = ic.geetools.sortMany(["forecast_time", "creation_time"]) + + # print the sorted list of images with forecast and creation time properties for the 10 first + icSorted = icSorted.limit(10) + info = icSorted.toList(icSorted.size()).map(lambda x: ee.Dictionary({ + "forecast_time": ee.Date(ee.Image(x).get("forecast_time")).format(), + "creation_time": ee.Date(ee.Image(x).get("creation_time")).format() + })) + for item in info.getInfo(): + print(f"Forecast Time: {item['forecast_time']}, Creation Time: {item['creation_time']}") """ - properties = ee.List(properties) - asc = ee.List(ascending or properties.map(lambda p: True)) - order_dict = ee.Dictionary.fromLists(properties.slice(0, asc.size()), asc) - # position order of each prop will be converted to string using this format - length = self._obj.size().toInt().format().length() - format = ee.String("%0").cat(length.format()).cat("d") - # suffix for temporal properties - pos_suffix = ee.String("_geetools_position") - - def compute_position(prop, cum): - """Add the order position of the property to each image.""" - cum = ee.ImageCollection(cum) - order = ee.Algorithms.If(order_dict.get(prop, True), True, False) - sorted_values = self._obj.sort(prop, order).aggregate_array(prop).distinct() - position_name = ee.String(prop).cat(pos_suffix) - - def add_position(img): - index = sorted_values.indexOf(img.get(prop)) - return img.set(position_name, index.format(format)) - - return cum.map(add_position) - - with_positions = ee.ImageCollection(properties.iterate(compute_position, self._obj)) - # put temp properties in a list to further remove them - position_properties = properties.map(lambda p: ee.String(p).cat(pos_suffix)) - final_order_property = "_geetools_sort_many_" - - def compute_final_prop(img): - """Join order position string of each property into a single number.""" - img = ee.Image(img) - # values = img.toDictionary(position_properties).values() # this should work but doesn't - values = position_properties.map(lambda p: img.get(p)) - return img.set(final_order_property, values.join("")) - - with_order = with_positions.map(compute_final_prop) - # add final property to properties to remove - prop_to_remove = position_properties.add(final_order_property) - # sort using the final property and remove temp properties - sorted = with_order.sort(final_order_property) - sorted = sorted.map(lambda i: ee.Image(i.copyProperties(i, exclude=prop_to_remove))) - return sorted + # sanity checks + props = ee.List(properties) + asc = ee.List(ascending or props.map(lambda _: True)) + + # Compute the sort chain in reverse order so that the first key is the primary one and so on. + ic = self._obj + propertiesIndex = ee.List.sequence(0, props.size().subtract(1)).reverse() + ic = propertiesIndex.iterate(lambda i, c: ee.ImageCollection(c).sort(props.get(i), asc.get(i)), ic) + + return ee.ImageCollection(ic) def datesByBands( self, diff --git a/tests/test_ImageCollection.py b/tests/test_ImageCollection.py index 46b8e40b..fa6fe11a 100644 --- a/tests/test_ImageCollection.py +++ b/tests/test_ImageCollection.py @@ -6,6 +6,7 @@ import ee import numpy as np import pytest +from ee.ee_exception import EEException from jsonschema import validate from matplotlib import pyplot as plt @@ -518,14 +519,12 @@ def test_sort_many_default(self, l8_toa, ee_list_regression): result = process.aggregate_array(prop1).zip(dates) ee_list_regression.check(result) - def test_sort_many_missing_asc(self, l8_toa, ee_list_regression): + def test_sort_many_missing_asc(self, l8_toa): l8_toa = l8_toa.map(self.adjust_cloud_cover) prop1 = "CLOUD_COVER" prop2 = "system:time_start" - process = l8_toa.geetools.sortMany([prop1, prop2], [False]) - dates = process.aggregate_array(prop2).map(lambda milli: ee.Date(milli).format()) - result = process.aggregate_array(prop1).zip(dates) - ee_list_regression.check(result) + with pytest.raises(EEException): + l8_toa.geetools.sortMany([prop1, prop2], [True]).getInfo() class TestPlotDatesByBands: diff --git a/tests/test_ImageCollection/serialized_test_sort_many_asc_asc.yml b/tests/test_ImageCollection/serialized_test_sort_many_asc_asc.yml index 439703b5..e368ee3e 100644 --- a/tests/test_ImageCollection/serialized_test_sort_many_asc_asc.yml +++ b/tests/test_ImageCollection/serialized_test_sort_many_asc_asc.yml @@ -9,7 +9,7 @@ values: collection: valueReference: '1' property: - valueReference: '9' + valueReference: '3' functionName: AggregateFeatureCollection.array other: functionInvocationValue: @@ -18,7 +18,7 @@ values: functionDefinitionValue: argumentNames: - _MAPPING_VAR_0_0 - body: '20' + body: '8' dropNulls: constantValue: false list: @@ -27,126 +27,51 @@ values: collection: valueReference: '1' property: - valueReference: '10' + valueReference: '5' functionName: AggregateFeatureCollection.array functionName: List.map functionName: List.zip '1': functionInvocationValue: arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_1_0 - body: '2' - collection: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_2_0 - body: '11' - collection: - functionInvocationValue: - arguments: - first: - valueReference: '13' - function: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_3_0 - - _MAPPING_VAR_3_1 - body: '16' - list: - valueReference: '8' - functionName: List.iterate - functionName: Collection.map - key: - valueReference: '3' - functionName: Collection.limit - functionName: Collection.map - '10': - constantValue: system:time_start - '11': - functionInvocationValue: - arguments: - key: - valueReference: '3' - object: - argumentReference: _MAPPING_VAR_2_0 - value: - functionInvocationValue: - arguments: - list: - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '12' - dropNulls: - constantValue: false - list: - valueReference: '4' - functionName: List.map - separator: - constantValue: '' - functionName: List.join - functionName: Element.set - '12': - functionInvocationValue: - arguments: - object: - argumentReference: _MAPPING_VAR_2_0 - property: - valueReference: '6' - functionName: Element.get - '13': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '14' - collection: + first: functionInvocationValue: arguments: + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + body: '2' collection: functionInvocationValue: arguments: collection: functionInvocationValue: arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '15' collection: functionInvocationValue: arguments: - id: - constantValue: LANDSAT/LC08/C02/T1_RT_TOA - functionName: ImageCollection.load - functionName: Collection.map - filter: - functionInvocationValue: - arguments: - leftField: - constantValue: .all - rightValue: + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + body: '4' + collection: + functionInvocationValue: + arguments: + id: + constantValue: LANDSAT/LC08/C02/T1_RT_TOA + functionName: ImageCollection.load + functionName: Collection.map + filter: functionInvocationValue: arguments: - geometry: + leftField: + constantValue: .all + rightValue: functionInvocationValue: arguments: - collection: + geometry: functionInvocationValue: arguments: collection: @@ -155,52 +80,84 @@ values: collection: functionInvocationValue: arguments: - tableId: - constantValue: FAO/GAUL/2015/level2 - functionName: Collection.loadTable + collection: + functionInvocationValue: + arguments: + tableId: + constantValue: FAO/GAUL/2015/level2 + functionName: Collection.loadTable + filter: + functionInvocationValue: + arguments: + leftField: + constantValue: ADM0_NAME + rightValue: + constantValue: Colombia + functionName: Filter.equals + functionName: Collection.filter filter: functionInvocationValue: arguments: leftField: - constantValue: ADM0_NAME + constantValue: ADM1_NAME rightValue: - constantValue: Colombia + constantValue: Amazonas functionName: Filter.equals functionName: Collection.filter - filter: - functionInvocationValue: - arguments: - leftField: - constantValue: ADM1_NAME - rightValue: - constantValue: Amazonas - functionName: Filter.equals - functionName: Collection.filter - functionName: Collection.geometry - functionName: Feature - functionName: Filter.intersects + functionName: Collection.geometry + functionName: Feature + functionName: Filter.intersects + functionName: Collection.filter + filter: + functionInvocationValue: + arguments: + leftValue: + functionInvocationValue: + arguments: + end: + constantValue: '2021-12-01' + start: + constantValue: '2021-01-01' + functionName: DateRange + rightField: + valueReference: '5' + functionName: Filter.dateRangeContains functionName: Collection.filter - filter: + functionName: Collection.map + function: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + - _MAPPING_VAR_0_1 + body: '6' + list: + functionInvocationValue: + arguments: + list: functionInvocationValue: arguments: - leftValue: + end: functionInvocationValue: arguments: - end: - constantValue: '2021-12-01' - start: - constantValue: '2021-01-01' - functionName: DateRange - rightField: - valueReference: '10' - functionName: Filter.dateRangeContains - functionName: Collection.filter - functionName: Collection.map - '14': + left: + functionInvocationValue: + arguments: + list: + valueReference: '7' + functionName: List.size + right: + constantValue: 1 + functionName: Number.subtract + start: + constantValue: 0 + functionName: List.sequence + functionName: List.reverse + functionName: List.iterate + '2': functionInvocationValue: arguments: key: - valueReference: '9' + valueReference: '3' object: argumentReference: _MAPPING_VAR_0_0 value: @@ -215,12 +172,14 @@ values: object: argumentReference: _MAPPING_VAR_0_0 property: - valueReference: '9' + valueReference: '3' functionName: Element.get functionName: Number.round functionName: Number.toInt functionName: Element.set - '15': + '3': + constantValue: CLOUD_COVER + '4': functionInvocationValue: arguments: bandSelectors: @@ -239,162 +198,42 @@ values: input: argumentReference: _MAPPING_VAR_0_0 functionName: Image.select - '16': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_2_0 - body: '17' - collection: - argumentReference: _MAPPING_VAR_3_1 - functionName: Collection.map - '17': + '5': + constantValue: system:time_start + '6': functionInvocationValue: arguments: - key: + ascending: functionInvocationValue: arguments: - string1: - valueReference: '18' - string2: - valueReference: '7' - functionName: String.cat - object: - argumentReference: _MAPPING_VAR_2_0 - value: + index: + argumentReference: _MAPPING_VAR_0_0 + list: + constantValue: + - true + - true + functionName: List.get + collection: + argumentReference: _MAPPING_VAR_0_1 + key: functionInvocationValue: arguments: - number: + input: functionInvocationValue: arguments: - element: - functionInvocationValue: - arguments: - object: - argumentReference: _MAPPING_VAR_2_0 - property: - valueReference: '18' - functionName: Element.get + index: + argumentReference: _MAPPING_VAR_0_0 list: - functionInvocationValue: - arguments: - list: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - ascending: - functionInvocationValue: - arguments: - condition: - functionInvocationValue: - arguments: - defaultValue: - constantValue: true - dictionary: - functionInvocationValue: - arguments: - keys: - functionInvocationValue: - arguments: - end: - functionInvocationValue: - arguments: - list: - valueReference: '19' - functionName: List.size - list: - valueReference: '8' - start: - constantValue: 0 - functionName: List.slice - values: - valueReference: '19' - functionName: Dictionary.fromLists - key: - valueReference: '18' - functionName: Dictionary.get - falseCase: - constantValue: false - trueCase: - constantValue: true - functionName: If - collection: - valueReference: '13' - key: - valueReference: '18' - functionName: Collection.limit - property: - valueReference: '18' - functionName: AggregateFeatureCollection.array - functionName: List.distinct - functionName: List.indexOf - pattern: - functionInvocationValue: - arguments: - string1: - functionInvocationValue: - arguments: - string1: - constantValue: '%0' - string2: - functionInvocationValue: - arguments: - number: - functionInvocationValue: - arguments: - string: - functionInvocationValue: - arguments: - number: - functionInvocationValue: - arguments: - input: - functionInvocationValue: - arguments: - collection: - valueReference: '13' - functionName: Collection.size - functionName: Number.toInt - functionName: Number.format - functionName: String.length - functionName: Number.format - functionName: String.cat - string2: - constantValue: d - functionName: String.cat - functionName: Number.format - functionName: Element.set - '18': - functionInvocationValue: - arguments: - input: - argumentReference: _MAPPING_VAR_3_0 - functionName: String - '19': - constantValue: - - true - - true - '2': - functionInvocationValue: - arguments: - destination: - argumentReference: _MAPPING_VAR_1_0 - exclude: - functionInvocationValue: - arguments: - element: - valueReference: '3' - list: - valueReference: '4' - functionName: List.add - source: - argumentReference: _MAPPING_VAR_1_0 - functionName: Image.copyProperties - '20': + valueReference: '7' + functionName: List.get + functionName: String + functionName: Collection.limit + '7': + arrayValue: + values: + - valueReference: '3' + - valueReference: '5' + '8': functionInvocationValue: arguments: date: @@ -404,41 +243,3 @@ values: argumentReference: _MAPPING_VAR_0_0 functionName: Date functionName: Date.format - '3': - constantValue: _geetools_sort_many_ - '4': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '5' - dropNulls: - constantValue: false - list: - valueReference: '8' - functionName: List.map - '5': - functionInvocationValue: - arguments: - string1: - valueReference: '6' - string2: - valueReference: '7' - functionName: String.cat - '6': - functionInvocationValue: - arguments: - input: - argumentReference: _MAPPING_VAR_0_0 - functionName: String - '7': - constantValue: _geetools_position - '8': - arrayValue: - values: - - valueReference: '9' - - valueReference: '10' - '9': - constantValue: CLOUD_COVER diff --git a/tests/test_ImageCollection/serialized_test_sort_many_asc_desc.yml b/tests/test_ImageCollection/serialized_test_sort_many_asc_desc.yml index d81f2df6..31c1374b 100644 --- a/tests/test_ImageCollection/serialized_test_sort_many_asc_desc.yml +++ b/tests/test_ImageCollection/serialized_test_sort_many_asc_desc.yml @@ -9,7 +9,7 @@ values: collection: valueReference: '1' property: - valueReference: '9' + valueReference: '3' functionName: AggregateFeatureCollection.array other: functionInvocationValue: @@ -18,7 +18,7 @@ values: functionDefinitionValue: argumentNames: - _MAPPING_VAR_0_0 - body: '20' + body: '8' dropNulls: constantValue: false list: @@ -27,126 +27,51 @@ values: collection: valueReference: '1' property: - valueReference: '10' + valueReference: '5' functionName: AggregateFeatureCollection.array functionName: List.map functionName: List.zip '1': functionInvocationValue: arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_1_0 - body: '2' - collection: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_2_0 - body: '11' - collection: - functionInvocationValue: - arguments: - first: - valueReference: '13' - function: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_3_0 - - _MAPPING_VAR_3_1 - body: '16' - list: - valueReference: '8' - functionName: List.iterate - functionName: Collection.map - key: - valueReference: '3' - functionName: Collection.limit - functionName: Collection.map - '10': - constantValue: system:time_start - '11': - functionInvocationValue: - arguments: - key: - valueReference: '3' - object: - argumentReference: _MAPPING_VAR_2_0 - value: - functionInvocationValue: - arguments: - list: - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '12' - dropNulls: - constantValue: false - list: - valueReference: '4' - functionName: List.map - separator: - constantValue: '' - functionName: List.join - functionName: Element.set - '12': - functionInvocationValue: - arguments: - object: - argumentReference: _MAPPING_VAR_2_0 - property: - valueReference: '6' - functionName: Element.get - '13': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '14' - collection: + first: functionInvocationValue: arguments: + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + body: '2' collection: functionInvocationValue: arguments: collection: functionInvocationValue: arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '15' collection: functionInvocationValue: arguments: - id: - constantValue: LANDSAT/LC08/C02/T1_RT_TOA - functionName: ImageCollection.load - functionName: Collection.map - filter: - functionInvocationValue: - arguments: - leftField: - constantValue: .all - rightValue: + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + body: '4' + collection: + functionInvocationValue: + arguments: + id: + constantValue: LANDSAT/LC08/C02/T1_RT_TOA + functionName: ImageCollection.load + functionName: Collection.map + filter: functionInvocationValue: arguments: - geometry: + leftField: + constantValue: .all + rightValue: functionInvocationValue: arguments: - collection: + geometry: functionInvocationValue: arguments: collection: @@ -155,52 +80,84 @@ values: collection: functionInvocationValue: arguments: - tableId: - constantValue: FAO/GAUL/2015/level2 - functionName: Collection.loadTable + collection: + functionInvocationValue: + arguments: + tableId: + constantValue: FAO/GAUL/2015/level2 + functionName: Collection.loadTable + filter: + functionInvocationValue: + arguments: + leftField: + constantValue: ADM0_NAME + rightValue: + constantValue: Colombia + functionName: Filter.equals + functionName: Collection.filter filter: functionInvocationValue: arguments: leftField: - constantValue: ADM0_NAME + constantValue: ADM1_NAME rightValue: - constantValue: Colombia + constantValue: Amazonas functionName: Filter.equals functionName: Collection.filter - filter: - functionInvocationValue: - arguments: - leftField: - constantValue: ADM1_NAME - rightValue: - constantValue: Amazonas - functionName: Filter.equals - functionName: Collection.filter - functionName: Collection.geometry - functionName: Feature - functionName: Filter.intersects + functionName: Collection.geometry + functionName: Feature + functionName: Filter.intersects + functionName: Collection.filter + filter: + functionInvocationValue: + arguments: + leftValue: + functionInvocationValue: + arguments: + end: + constantValue: '2021-12-01' + start: + constantValue: '2021-01-01' + functionName: DateRange + rightField: + valueReference: '5' + functionName: Filter.dateRangeContains functionName: Collection.filter - filter: + functionName: Collection.map + function: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + - _MAPPING_VAR_0_1 + body: '6' + list: + functionInvocationValue: + arguments: + list: functionInvocationValue: arguments: - leftValue: + end: functionInvocationValue: arguments: - end: - constantValue: '2021-12-01' - start: - constantValue: '2021-01-01' - functionName: DateRange - rightField: - valueReference: '10' - functionName: Filter.dateRangeContains - functionName: Collection.filter - functionName: Collection.map - '14': + left: + functionInvocationValue: + arguments: + list: + valueReference: '7' + functionName: List.size + right: + constantValue: 1 + functionName: Number.subtract + start: + constantValue: 0 + functionName: List.sequence + functionName: List.reverse + functionName: List.iterate + '2': functionInvocationValue: arguments: key: - valueReference: '9' + valueReference: '3' object: argumentReference: _MAPPING_VAR_0_0 value: @@ -215,12 +172,14 @@ values: object: argumentReference: _MAPPING_VAR_0_0 property: - valueReference: '9' + valueReference: '3' functionName: Element.get functionName: Number.round functionName: Number.toInt functionName: Element.set - '15': + '3': + constantValue: CLOUD_COVER + '4': functionInvocationValue: arguments: bandSelectors: @@ -239,162 +198,42 @@ values: input: argumentReference: _MAPPING_VAR_0_0 functionName: Image.select - '16': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_2_0 - body: '17' - collection: - argumentReference: _MAPPING_VAR_3_1 - functionName: Collection.map - '17': + '5': + constantValue: system:time_start + '6': functionInvocationValue: arguments: - key: + ascending: functionInvocationValue: arguments: - string1: - valueReference: '18' - string2: - valueReference: '7' - functionName: String.cat - object: - argumentReference: _MAPPING_VAR_2_0 - value: + index: + argumentReference: _MAPPING_VAR_0_0 + list: + constantValue: + - true + - false + functionName: List.get + collection: + argumentReference: _MAPPING_VAR_0_1 + key: functionInvocationValue: arguments: - number: + input: functionInvocationValue: arguments: - element: - functionInvocationValue: - arguments: - object: - argumentReference: _MAPPING_VAR_2_0 - property: - valueReference: '18' - functionName: Element.get + index: + argumentReference: _MAPPING_VAR_0_0 list: - functionInvocationValue: - arguments: - list: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - ascending: - functionInvocationValue: - arguments: - condition: - functionInvocationValue: - arguments: - defaultValue: - constantValue: true - dictionary: - functionInvocationValue: - arguments: - keys: - functionInvocationValue: - arguments: - end: - functionInvocationValue: - arguments: - list: - valueReference: '19' - functionName: List.size - list: - valueReference: '8' - start: - constantValue: 0 - functionName: List.slice - values: - valueReference: '19' - functionName: Dictionary.fromLists - key: - valueReference: '18' - functionName: Dictionary.get - falseCase: - constantValue: false - trueCase: - constantValue: true - functionName: If - collection: - valueReference: '13' - key: - valueReference: '18' - functionName: Collection.limit - property: - valueReference: '18' - functionName: AggregateFeatureCollection.array - functionName: List.distinct - functionName: List.indexOf - pattern: - functionInvocationValue: - arguments: - string1: - functionInvocationValue: - arguments: - string1: - constantValue: '%0' - string2: - functionInvocationValue: - arguments: - number: - functionInvocationValue: - arguments: - string: - functionInvocationValue: - arguments: - number: - functionInvocationValue: - arguments: - input: - functionInvocationValue: - arguments: - collection: - valueReference: '13' - functionName: Collection.size - functionName: Number.toInt - functionName: Number.format - functionName: String.length - functionName: Number.format - functionName: String.cat - string2: - constantValue: d - functionName: String.cat - functionName: Number.format - functionName: Element.set - '18': - functionInvocationValue: - arguments: - input: - argumentReference: _MAPPING_VAR_3_0 - functionName: String - '19': - constantValue: - - true - - false - '2': - functionInvocationValue: - arguments: - destination: - argumentReference: _MAPPING_VAR_1_0 - exclude: - functionInvocationValue: - arguments: - element: - valueReference: '3' - list: - valueReference: '4' - functionName: List.add - source: - argumentReference: _MAPPING_VAR_1_0 - functionName: Image.copyProperties - '20': + valueReference: '7' + functionName: List.get + functionName: String + functionName: Collection.limit + '7': + arrayValue: + values: + - valueReference: '3' + - valueReference: '5' + '8': functionInvocationValue: arguments: date: @@ -404,41 +243,3 @@ values: argumentReference: _MAPPING_VAR_0_0 functionName: Date functionName: Date.format - '3': - constantValue: _geetools_sort_many_ - '4': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '5' - dropNulls: - constantValue: false - list: - valueReference: '8' - functionName: List.map - '5': - functionInvocationValue: - arguments: - string1: - valueReference: '6' - string2: - valueReference: '7' - functionName: String.cat - '6': - functionInvocationValue: - arguments: - input: - argumentReference: _MAPPING_VAR_0_0 - functionName: String - '7': - constantValue: _geetools_position - '8': - arrayValue: - values: - - valueReference: '9' - - valueReference: '10' - '9': - constantValue: CLOUD_COVER diff --git a/tests/test_ImageCollection/serialized_test_sort_many_default.yml b/tests/test_ImageCollection/serialized_test_sort_many_default.yml index 052e6270..8a6467bc 100644 --- a/tests/test_ImageCollection/serialized_test_sort_many_default.yml +++ b/tests/test_ImageCollection/serialized_test_sort_many_default.yml @@ -9,7 +9,7 @@ values: collection: valueReference: '1' property: - valueReference: '9' + valueReference: '3' functionName: AggregateFeatureCollection.array other: functionInvocationValue: @@ -18,7 +18,7 @@ values: functionDefinitionValue: argumentNames: - _MAPPING_VAR_0_0 - body: '21' + body: '9' dropNulls: constantValue: false list: @@ -27,126 +27,51 @@ values: collection: valueReference: '1' property: - valueReference: '10' + valueReference: '5' functionName: AggregateFeatureCollection.array functionName: List.map functionName: List.zip '1': functionInvocationValue: arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_1_0 - body: '2' - collection: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_2_0 - body: '11' - collection: - functionInvocationValue: - arguments: - first: - valueReference: '13' - function: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_4_0 - - _MAPPING_VAR_4_1 - body: '16' - list: - valueReference: '8' - functionName: List.iterate - functionName: Collection.map - key: - valueReference: '3' - functionName: Collection.limit - functionName: Collection.map - '10': - constantValue: system:time_start - '11': - functionInvocationValue: - arguments: - key: - valueReference: '3' - object: - argumentReference: _MAPPING_VAR_2_0 - value: - functionInvocationValue: - arguments: - list: - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '12' - dropNulls: - constantValue: false - list: - valueReference: '4' - functionName: List.map - separator: - constantValue: '' - functionName: List.join - functionName: Element.set - '12': - functionInvocationValue: - arguments: - object: - argumentReference: _MAPPING_VAR_2_0 - property: - valueReference: '6' - functionName: Element.get - '13': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '14' - collection: + first: functionInvocationValue: arguments: + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + body: '2' collection: functionInvocationValue: arguments: collection: functionInvocationValue: arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '15' collection: functionInvocationValue: arguments: - id: - constantValue: LANDSAT/LC08/C02/T1_RT_TOA - functionName: ImageCollection.load - functionName: Collection.map - filter: - functionInvocationValue: - arguments: - leftField: - constantValue: .all - rightValue: + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + body: '4' + collection: + functionInvocationValue: + arguments: + id: + constantValue: LANDSAT/LC08/C02/T1_RT_TOA + functionName: ImageCollection.load + functionName: Collection.map + filter: functionInvocationValue: arguments: - geometry: + leftField: + constantValue: .all + rightValue: functionInvocationValue: arguments: - collection: + geometry: functionInvocationValue: arguments: collection: @@ -155,52 +80,84 @@ values: collection: functionInvocationValue: arguments: - tableId: - constantValue: FAO/GAUL/2015/level2 - functionName: Collection.loadTable + collection: + functionInvocationValue: + arguments: + tableId: + constantValue: FAO/GAUL/2015/level2 + functionName: Collection.loadTable + filter: + functionInvocationValue: + arguments: + leftField: + constantValue: ADM0_NAME + rightValue: + constantValue: Colombia + functionName: Filter.equals + functionName: Collection.filter filter: functionInvocationValue: arguments: leftField: - constantValue: ADM0_NAME + constantValue: ADM1_NAME rightValue: - constantValue: Colombia + constantValue: Amazonas functionName: Filter.equals functionName: Collection.filter - filter: - functionInvocationValue: - arguments: - leftField: - constantValue: ADM1_NAME - rightValue: - constantValue: Amazonas - functionName: Filter.equals - functionName: Collection.filter - functionName: Collection.geometry - functionName: Feature - functionName: Filter.intersects + functionName: Collection.geometry + functionName: Feature + functionName: Filter.intersects + functionName: Collection.filter + filter: + functionInvocationValue: + arguments: + leftValue: + functionInvocationValue: + arguments: + end: + constantValue: '2021-12-01' + start: + constantValue: '2021-01-01' + functionName: DateRange + rightField: + valueReference: '5' + functionName: Filter.dateRangeContains functionName: Collection.filter - filter: + functionName: Collection.map + function: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_1_0 + - _MAPPING_VAR_1_1 + body: '6' + list: + functionInvocationValue: + arguments: + list: functionInvocationValue: arguments: - leftValue: + end: functionInvocationValue: arguments: - end: - constantValue: '2021-12-01' - start: - constantValue: '2021-01-01' - functionName: DateRange - rightField: - valueReference: '10' - functionName: Filter.dateRangeContains - functionName: Collection.filter - functionName: Collection.map - '14': + left: + functionInvocationValue: + arguments: + list: + valueReference: '8' + functionName: List.size + right: + constantValue: 1 + functionName: Number.subtract + start: + constantValue: 0 + functionName: List.sequence + functionName: List.reverse + functionName: List.iterate + '2': functionInvocationValue: arguments: key: - valueReference: '9' + valueReference: '3' object: argumentReference: _MAPPING_VAR_0_0 value: @@ -215,12 +172,14 @@ values: object: argumentReference: _MAPPING_VAR_0_0 property: - valueReference: '9' + valueReference: '3' functionName: Element.get functionName: Number.round functionName: Number.toInt functionName: Element.set - '15': + '3': + constantValue: CLOUD_COVER + '4': functionInvocationValue: arguments: bandSelectors: @@ -239,173 +198,53 @@ values: input: argumentReference: _MAPPING_VAR_0_0 functionName: Image.select - '16': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_3_0 - body: '17' - collection: - argumentReference: _MAPPING_VAR_4_1 - functionName: Collection.map - '17': + '5': + constantValue: system:time_start + '6': functionInvocationValue: arguments: - key: - functionInvocationValue: - arguments: - string1: - valueReference: '18' - string2: - valueReference: '7' - functionName: String.cat - object: - argumentReference: _MAPPING_VAR_3_0 - value: + ascending: functionInvocationValue: arguments: - number: + index: + argumentReference: _MAPPING_VAR_1_0 + list: functionInvocationValue: arguments: - element: - functionInvocationValue: - arguments: - object: - argumentReference: _MAPPING_VAR_3_0 - property: - valueReference: '18' - functionName: Element.get + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + body: '7' + dropNulls: + constantValue: false list: - functionInvocationValue: - arguments: - list: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - ascending: - functionInvocationValue: - arguments: - condition: - functionInvocationValue: - arguments: - defaultValue: - constantValue: true - dictionary: - functionInvocationValue: - arguments: - keys: - functionInvocationValue: - arguments: - end: - functionInvocationValue: - arguments: - list: - valueReference: '19' - functionName: List.size - list: - valueReference: '8' - start: - constantValue: 0 - functionName: List.slice - values: - valueReference: '19' - functionName: Dictionary.fromLists - key: - valueReference: '18' - functionName: Dictionary.get - falseCase: - constantValue: false - trueCase: - constantValue: true - functionName: If - collection: - valueReference: '13' - key: - valueReference: '18' - functionName: Collection.limit - property: - valueReference: '18' - functionName: AggregateFeatureCollection.array - functionName: List.distinct - functionName: List.indexOf - pattern: - functionInvocationValue: - arguments: - string1: - functionInvocationValue: - arguments: - string1: - constantValue: '%0' - string2: - functionInvocationValue: - arguments: - number: - functionInvocationValue: - arguments: - string: - functionInvocationValue: - arguments: - number: - functionInvocationValue: - arguments: - input: - functionInvocationValue: - arguments: - collection: - valueReference: '13' - functionName: Collection.size - functionName: Number.toInt - functionName: Number.format - functionName: String.length - functionName: Number.format - functionName: String.cat - string2: - constantValue: d - functionName: String.cat - functionName: Number.format - functionName: Element.set - '18': - functionInvocationValue: - arguments: - input: - argumentReference: _MAPPING_VAR_4_0 - functionName: String - '19': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '20' - dropNulls: - constantValue: false - list: - valueReference: '8' - functionName: List.map - '2': - functionInvocationValue: - arguments: - destination: - argumentReference: _MAPPING_VAR_1_0 - exclude: + valueReference: '8' + functionName: List.map + functionName: List.get + collection: + argumentReference: _MAPPING_VAR_1_1 + key: functionInvocationValue: arguments: - element: - valueReference: '3' - list: - valueReference: '4' - functionName: List.add - source: - argumentReference: _MAPPING_VAR_1_0 - functionName: Image.copyProperties - '20': + input: + functionInvocationValue: + arguments: + index: + argumentReference: _MAPPING_VAR_1_0 + list: + valueReference: '8' + functionName: List.get + functionName: String + functionName: Collection.limit + '7': constantValue: true - '21': + '8': + arrayValue: + values: + - valueReference: '3' + - valueReference: '5' + '9': functionInvocationValue: arguments: date: @@ -415,41 +254,3 @@ values: argumentReference: _MAPPING_VAR_0_0 functionName: Date functionName: Date.format - '3': - constantValue: _geetools_sort_many_ - '4': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '5' - dropNulls: - constantValue: false - list: - valueReference: '8' - functionName: List.map - '5': - functionInvocationValue: - arguments: - string1: - valueReference: '6' - string2: - valueReference: '7' - functionName: String.cat - '6': - functionInvocationValue: - arguments: - input: - argumentReference: _MAPPING_VAR_0_0 - functionName: String - '7': - constantValue: _geetools_position - '8': - arrayValue: - values: - - valueReference: '9' - - valueReference: '10' - '9': - constantValue: CLOUD_COVER diff --git a/tests/test_ImageCollection/serialized_test_sort_many_desc_desc.yml b/tests/test_ImageCollection/serialized_test_sort_many_desc_desc.yml index d99d491b..7b669458 100644 --- a/tests/test_ImageCollection/serialized_test_sort_many_desc_desc.yml +++ b/tests/test_ImageCollection/serialized_test_sort_many_desc_desc.yml @@ -9,7 +9,7 @@ values: collection: valueReference: '1' property: - valueReference: '9' + valueReference: '3' functionName: AggregateFeatureCollection.array other: functionInvocationValue: @@ -18,7 +18,7 @@ values: functionDefinitionValue: argumentNames: - _MAPPING_VAR_0_0 - body: '20' + body: '8' dropNulls: constantValue: false list: @@ -27,126 +27,51 @@ values: collection: valueReference: '1' property: - valueReference: '10' + valueReference: '5' functionName: AggregateFeatureCollection.array functionName: List.map functionName: List.zip '1': functionInvocationValue: arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_1_0 - body: '2' - collection: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_2_0 - body: '11' - collection: - functionInvocationValue: - arguments: - first: - valueReference: '13' - function: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_3_0 - - _MAPPING_VAR_3_1 - body: '16' - list: - valueReference: '8' - functionName: List.iterate - functionName: Collection.map - key: - valueReference: '3' - functionName: Collection.limit - functionName: Collection.map - '10': - constantValue: system:time_start - '11': - functionInvocationValue: - arguments: - key: - valueReference: '3' - object: - argumentReference: _MAPPING_VAR_2_0 - value: - functionInvocationValue: - arguments: - list: - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '12' - dropNulls: - constantValue: false - list: - valueReference: '4' - functionName: List.map - separator: - constantValue: '' - functionName: List.join - functionName: Element.set - '12': - functionInvocationValue: - arguments: - object: - argumentReference: _MAPPING_VAR_2_0 - property: - valueReference: '6' - functionName: Element.get - '13': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '14' - collection: + first: functionInvocationValue: arguments: + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + body: '2' collection: functionInvocationValue: arguments: collection: functionInvocationValue: arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '15' collection: functionInvocationValue: arguments: - id: - constantValue: LANDSAT/LC08/C02/T1_RT_TOA - functionName: ImageCollection.load - functionName: Collection.map - filter: - functionInvocationValue: - arguments: - leftField: - constantValue: .all - rightValue: + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + body: '4' + collection: + functionInvocationValue: + arguments: + id: + constantValue: LANDSAT/LC08/C02/T1_RT_TOA + functionName: ImageCollection.load + functionName: Collection.map + filter: functionInvocationValue: arguments: - geometry: + leftField: + constantValue: .all + rightValue: functionInvocationValue: arguments: - collection: + geometry: functionInvocationValue: arguments: collection: @@ -155,52 +80,84 @@ values: collection: functionInvocationValue: arguments: - tableId: - constantValue: FAO/GAUL/2015/level2 - functionName: Collection.loadTable + collection: + functionInvocationValue: + arguments: + tableId: + constantValue: FAO/GAUL/2015/level2 + functionName: Collection.loadTable + filter: + functionInvocationValue: + arguments: + leftField: + constantValue: ADM0_NAME + rightValue: + constantValue: Colombia + functionName: Filter.equals + functionName: Collection.filter filter: functionInvocationValue: arguments: leftField: - constantValue: ADM0_NAME + constantValue: ADM1_NAME rightValue: - constantValue: Colombia + constantValue: Amazonas functionName: Filter.equals functionName: Collection.filter - filter: - functionInvocationValue: - arguments: - leftField: - constantValue: ADM1_NAME - rightValue: - constantValue: Amazonas - functionName: Filter.equals - functionName: Collection.filter - functionName: Collection.geometry - functionName: Feature - functionName: Filter.intersects + functionName: Collection.geometry + functionName: Feature + functionName: Filter.intersects + functionName: Collection.filter + filter: + functionInvocationValue: + arguments: + leftValue: + functionInvocationValue: + arguments: + end: + constantValue: '2021-12-01' + start: + constantValue: '2021-01-01' + functionName: DateRange + rightField: + valueReference: '5' + functionName: Filter.dateRangeContains functionName: Collection.filter - filter: + functionName: Collection.map + function: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + - _MAPPING_VAR_0_1 + body: '6' + list: + functionInvocationValue: + arguments: + list: functionInvocationValue: arguments: - leftValue: + end: functionInvocationValue: arguments: - end: - constantValue: '2021-12-01' - start: - constantValue: '2021-01-01' - functionName: DateRange - rightField: - valueReference: '10' - functionName: Filter.dateRangeContains - functionName: Collection.filter - functionName: Collection.map - '14': + left: + functionInvocationValue: + arguments: + list: + valueReference: '7' + functionName: List.size + right: + constantValue: 1 + functionName: Number.subtract + start: + constantValue: 0 + functionName: List.sequence + functionName: List.reverse + functionName: List.iterate + '2': functionInvocationValue: arguments: key: - valueReference: '9' + valueReference: '3' object: argumentReference: _MAPPING_VAR_0_0 value: @@ -215,12 +172,14 @@ values: object: argumentReference: _MAPPING_VAR_0_0 property: - valueReference: '9' + valueReference: '3' functionName: Element.get functionName: Number.round functionName: Number.toInt functionName: Element.set - '15': + '3': + constantValue: CLOUD_COVER + '4': functionInvocationValue: arguments: bandSelectors: @@ -239,162 +198,42 @@ values: input: argumentReference: _MAPPING_VAR_0_0 functionName: Image.select - '16': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_2_0 - body: '17' - collection: - argumentReference: _MAPPING_VAR_3_1 - functionName: Collection.map - '17': + '5': + constantValue: system:time_start + '6': functionInvocationValue: arguments: - key: + ascending: functionInvocationValue: arguments: - string1: - valueReference: '18' - string2: - valueReference: '7' - functionName: String.cat - object: - argumentReference: _MAPPING_VAR_2_0 - value: + index: + argumentReference: _MAPPING_VAR_0_0 + list: + constantValue: + - false + - false + functionName: List.get + collection: + argumentReference: _MAPPING_VAR_0_1 + key: functionInvocationValue: arguments: - number: + input: functionInvocationValue: arguments: - element: - functionInvocationValue: - arguments: - object: - argumentReference: _MAPPING_VAR_2_0 - property: - valueReference: '18' - functionName: Element.get + index: + argumentReference: _MAPPING_VAR_0_0 list: - functionInvocationValue: - arguments: - list: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - ascending: - functionInvocationValue: - arguments: - condition: - functionInvocationValue: - arguments: - defaultValue: - constantValue: true - dictionary: - functionInvocationValue: - arguments: - keys: - functionInvocationValue: - arguments: - end: - functionInvocationValue: - arguments: - list: - valueReference: '19' - functionName: List.size - list: - valueReference: '8' - start: - constantValue: 0 - functionName: List.slice - values: - valueReference: '19' - functionName: Dictionary.fromLists - key: - valueReference: '18' - functionName: Dictionary.get - falseCase: - constantValue: false - trueCase: - constantValue: true - functionName: If - collection: - valueReference: '13' - key: - valueReference: '18' - functionName: Collection.limit - property: - valueReference: '18' - functionName: AggregateFeatureCollection.array - functionName: List.distinct - functionName: List.indexOf - pattern: - functionInvocationValue: - arguments: - string1: - functionInvocationValue: - arguments: - string1: - constantValue: '%0' - string2: - functionInvocationValue: - arguments: - number: - functionInvocationValue: - arguments: - string: - functionInvocationValue: - arguments: - number: - functionInvocationValue: - arguments: - input: - functionInvocationValue: - arguments: - collection: - valueReference: '13' - functionName: Collection.size - functionName: Number.toInt - functionName: Number.format - functionName: String.length - functionName: Number.format - functionName: String.cat - string2: - constantValue: d - functionName: String.cat - functionName: Number.format - functionName: Element.set - '18': - functionInvocationValue: - arguments: - input: - argumentReference: _MAPPING_VAR_3_0 - functionName: String - '19': - constantValue: - - false - - false - '2': - functionInvocationValue: - arguments: - destination: - argumentReference: _MAPPING_VAR_1_0 - exclude: - functionInvocationValue: - arguments: - element: - valueReference: '3' - list: - valueReference: '4' - functionName: List.add - source: - argumentReference: _MAPPING_VAR_1_0 - functionName: Image.copyProperties - '20': + valueReference: '7' + functionName: List.get + functionName: String + functionName: Collection.limit + '7': + arrayValue: + values: + - valueReference: '3' + - valueReference: '5' + '8': functionInvocationValue: arguments: date: @@ -404,41 +243,3 @@ values: argumentReference: _MAPPING_VAR_0_0 functionName: Date functionName: Date.format - '3': - constantValue: _geetools_sort_many_ - '4': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '5' - dropNulls: - constantValue: false - list: - valueReference: '8' - functionName: List.map - '5': - functionInvocationValue: - arguments: - string1: - valueReference: '6' - string2: - valueReference: '7' - functionName: String.cat - '6': - functionInvocationValue: - arguments: - input: - argumentReference: _MAPPING_VAR_0_0 - functionName: String - '7': - constantValue: _geetools_position - '8': - arrayValue: - values: - - valueReference: '9' - - valueReference: '10' - '9': - constantValue: CLOUD_COVER diff --git a/tests/test_ImageCollection/serialized_test_sort_many_missing_asc.yml b/tests/test_ImageCollection/serialized_test_sort_many_missing_asc.yml deleted file mode 100644 index 06e183bf..00000000 --- a/tests/test_ImageCollection/serialized_test_sort_many_missing_asc.yml +++ /dev/null @@ -1,443 +0,0 @@ -result: '0' -values: - '0': - functionInvocationValue: - arguments: - list: - functionInvocationValue: - arguments: - collection: - valueReference: '1' - property: - valueReference: '9' - functionName: AggregateFeatureCollection.array - other: - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '20' - dropNulls: - constantValue: false - list: - functionInvocationValue: - arguments: - collection: - valueReference: '1' - property: - valueReference: '10' - functionName: AggregateFeatureCollection.array - functionName: List.map - functionName: List.zip - '1': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_1_0 - body: '2' - collection: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_2_0 - body: '11' - collection: - functionInvocationValue: - arguments: - first: - valueReference: '13' - function: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_3_0 - - _MAPPING_VAR_3_1 - body: '16' - list: - valueReference: '8' - functionName: List.iterate - functionName: Collection.map - key: - valueReference: '3' - functionName: Collection.limit - functionName: Collection.map - '10': - constantValue: system:time_start - '11': - functionInvocationValue: - arguments: - key: - valueReference: '3' - object: - argumentReference: _MAPPING_VAR_2_0 - value: - functionInvocationValue: - arguments: - list: - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '12' - dropNulls: - constantValue: false - list: - valueReference: '4' - functionName: List.map - separator: - constantValue: '' - functionName: List.join - functionName: Element.set - '12': - functionInvocationValue: - arguments: - object: - argumentReference: _MAPPING_VAR_2_0 - property: - valueReference: '6' - functionName: Element.get - '13': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '14' - collection: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '15' - collection: - functionInvocationValue: - arguments: - id: - constantValue: LANDSAT/LC08/C02/T1_RT_TOA - functionName: ImageCollection.load - functionName: Collection.map - filter: - functionInvocationValue: - arguments: - leftField: - constantValue: .all - rightValue: - functionInvocationValue: - arguments: - geometry: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - tableId: - constantValue: FAO/GAUL/2015/level2 - functionName: Collection.loadTable - filter: - functionInvocationValue: - arguments: - leftField: - constantValue: ADM0_NAME - rightValue: - constantValue: Colombia - functionName: Filter.equals - functionName: Collection.filter - filter: - functionInvocationValue: - arguments: - leftField: - constantValue: ADM1_NAME - rightValue: - constantValue: Amazonas - functionName: Filter.equals - functionName: Collection.filter - functionName: Collection.geometry - functionName: Feature - functionName: Filter.intersects - functionName: Collection.filter - filter: - functionInvocationValue: - arguments: - leftValue: - functionInvocationValue: - arguments: - end: - constantValue: '2021-12-01' - start: - constantValue: '2021-01-01' - functionName: DateRange - rightField: - valueReference: '10' - functionName: Filter.dateRangeContains - functionName: Collection.filter - functionName: Collection.map - '14': - functionInvocationValue: - arguments: - key: - valueReference: '9' - object: - argumentReference: _MAPPING_VAR_0_0 - value: - functionInvocationValue: - arguments: - input: - functionInvocationValue: - arguments: - input: - functionInvocationValue: - arguments: - object: - argumentReference: _MAPPING_VAR_0_0 - property: - valueReference: '9' - functionName: Element.get - functionName: Number.round - functionName: Number.toInt - functionName: Element.set - '15': - functionInvocationValue: - arguments: - bandSelectors: - constantValue: - - B1 - - B2 - - B3 - - B4 - - B5 - - B6 - - B7 - - B8 - - B9 - - B10 - - B11 - input: - argumentReference: _MAPPING_VAR_0_0 - functionName: Image.select - '16': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_2_0 - body: '17' - collection: - argumentReference: _MAPPING_VAR_3_1 - functionName: Collection.map - '17': - functionInvocationValue: - arguments: - key: - functionInvocationValue: - arguments: - string1: - valueReference: '18' - string2: - valueReference: '7' - functionName: String.cat - object: - argumentReference: _MAPPING_VAR_2_0 - value: - functionInvocationValue: - arguments: - number: - functionInvocationValue: - arguments: - element: - functionInvocationValue: - arguments: - object: - argumentReference: _MAPPING_VAR_2_0 - property: - valueReference: '18' - functionName: Element.get - list: - functionInvocationValue: - arguments: - list: - functionInvocationValue: - arguments: - collection: - functionInvocationValue: - arguments: - ascending: - functionInvocationValue: - arguments: - condition: - functionInvocationValue: - arguments: - defaultValue: - constantValue: true - dictionary: - functionInvocationValue: - arguments: - keys: - functionInvocationValue: - arguments: - end: - functionInvocationValue: - arguments: - list: - valueReference: '19' - functionName: List.size - list: - valueReference: '8' - start: - constantValue: 0 - functionName: List.slice - values: - valueReference: '19' - functionName: Dictionary.fromLists - key: - valueReference: '18' - functionName: Dictionary.get - falseCase: - constantValue: false - trueCase: - constantValue: true - functionName: If - collection: - valueReference: '13' - key: - valueReference: '18' - functionName: Collection.limit - property: - valueReference: '18' - functionName: AggregateFeatureCollection.array - functionName: List.distinct - functionName: List.indexOf - pattern: - functionInvocationValue: - arguments: - string1: - functionInvocationValue: - arguments: - string1: - constantValue: '%0' - string2: - functionInvocationValue: - arguments: - number: - functionInvocationValue: - arguments: - string: - functionInvocationValue: - arguments: - number: - functionInvocationValue: - arguments: - input: - functionInvocationValue: - arguments: - collection: - valueReference: '13' - functionName: Collection.size - functionName: Number.toInt - functionName: Number.format - functionName: String.length - functionName: Number.format - functionName: String.cat - string2: - constantValue: d - functionName: String.cat - functionName: Number.format - functionName: Element.set - '18': - functionInvocationValue: - arguments: - input: - argumentReference: _MAPPING_VAR_3_0 - functionName: String - '19': - constantValue: - - false - '2': - functionInvocationValue: - arguments: - destination: - argumentReference: _MAPPING_VAR_1_0 - exclude: - functionInvocationValue: - arguments: - element: - valueReference: '3' - list: - valueReference: '4' - functionName: List.add - source: - argumentReference: _MAPPING_VAR_1_0 - functionName: Image.copyProperties - '20': - functionInvocationValue: - arguments: - date: - functionInvocationValue: - arguments: - value: - argumentReference: _MAPPING_VAR_0_0 - functionName: Date - functionName: Date.format - '3': - constantValue: _geetools_sort_many_ - '4': - functionInvocationValue: - arguments: - baseAlgorithm: - functionDefinitionValue: - argumentNames: - - _MAPPING_VAR_0_0 - body: '5' - dropNulls: - constantValue: false - list: - valueReference: '8' - functionName: List.map - '5': - functionInvocationValue: - arguments: - string1: - valueReference: '6' - string2: - valueReference: '7' - functionName: String.cat - '6': - functionInvocationValue: - arguments: - input: - argumentReference: _MAPPING_VAR_0_0 - functionName: String - '7': - constantValue: _geetools_position - '8': - arrayValue: - values: - - valueReference: '9' - - valueReference: '10' - '9': - constantValue: CLOUD_COVER diff --git a/tests/test_ImageCollection/test_sort_many_missing_asc.yml b/tests/test_ImageCollection/test_sort_many_missing_asc.yml deleted file mode 100644 index 56e72d1b..00000000 --- a/tests/test_ImageCollection/test_sort_many_missing_asc.yml +++ /dev/null @@ -1,282 +0,0 @@ -- - 100 - - '2021-11-24T14:50:46' -- - 98 - - '2021-02-25T14:50:25' -- - 97 - - '2021-09-03T15:01:49' -- - 96 - - '2021-02-09T14:50:07' -- - 95 - - '2021-02-14T15:08:14' -- - 94 - - '2021-04-12T15:01:17' -- - 94 - - '2021-05-21T15:07:48' -- - 93 - - '2021-11-24T14:50:22' -- - 92 - - '2021-10-12T15:08:34' -- - 91 - - '2021-04-14T14:50:06' -- - 90 - - '2021-01-06T15:02:13' -- - 90 - - '2021-04-03T15:07:31' -- - 88 - - '2021-03-27T15:01:46' -- - 88 - - '2021-08-09T15:08:16' -- - 88 - - '2021-09-10T15:08:25' -- - 87 - - '2021-03-04T14:56:09' -- - 87 - - '2021-05-14T15:01:33' -- - 87 - - '2021-09-03T15:02:13' -- - 86 - - '2021-01-13T15:08:21' -- - 86 - - '2021-02-14T15:07:50' -- - 86 - - '2021-02-16T14:56:16' -- - 86 - - '2021-03-13T14:49:29' -- - 86 - - '2021-04-03T15:07:55' -- - 86 - - '2021-05-07T14:55:41' -- - 86 - - '2021-10-23T14:50:51' -- - 85 - - '2021-08-02T15:02:26' -- - 85 - - '2021-08-11T14:56:43' -- - 85 - - '2021-08-18T15:02:32' -- - 85 - - '2021-09-12T14:55:40' -- - 84 - - '2021-05-07T14:56:05' -- - 83 - - '2021-03-27T15:02:10' -- - 83 - - '2021-08-04T14:49:42' -- - 82 - - '2021-06-17T14:49:52' -- - 81 - - '2021-08-18T15:02:08' -- - 81 - - '2021-09-10T15:08:02' -- - 81 - - '2021-11-29T15:08:07' -- - 80 - - '2021-03-02T15:07:44' -- - 80 - - '2021-06-24T14:55:16' -- - 80 - - '2021-10-07T14:50:24' -- - 79 - - '2021-02-07T15:02:29' -- - 79 - - '2021-11-06T15:02:47' -- - 78 - - '2021-08-11T14:55:55' -- - 78 - - '2021-10-07T14:50:48' -- - 77 - - '2021-05-30T15:01:18' -- - 77 - - '2021-06-22T15:08:01' -- - 77 - - '2021-11-08T14:50:48' -- - 76 - - '2021-02-07T15:01:41' -- - 76 - - '2021-11-22T15:02:43' -- - 75 - - '2021-07-19T14:49:34' -- - 74 - - '2021-04-14T14:49:18' -- - 73 - - '2021-01-24T14:50:33' -- - 73 - - '2021-05-30T15:02:06' -- - 73 - - '2021-08-11T14:55:31' -- - 73 - - '2021-10-05T15:02:45' -- - 72 - - '2021-01-06T15:01:49' -- - 71 - - '2021-05-07T14:54:53' -- - 71 - - '2021-06-17T14:50:15' -- - 71 - - '2021-08-27T14:56:00' -- - 70 - - '2021-04-21T14:55:50' -- - 69 - - '2021-03-04T14:55:21' -- - 69 - - '2021-03-20T14:56:00' -- - 69 - - '2021-05-30T15:01:42' -- - 69 - - '2021-09-21T14:49:55' -- - 68 - - '2021-04-14T14:49:42' -- - 68 - - '2021-07-26T14:56:36' -- - 68 - - '2021-08-09T15:07:52' -- - 68 - - '2021-10-12T15:08:10' -- - 67 - - '2021-03-18T15:07:58' -- - 65 - - '2021-11-15T14:56:08' -- - 64 - - '2021-01-15T14:55:58' -- - 64 - - '2021-06-17T14:49:28' -- - 62 - - '2021-09-05T14:49:52' -- - 61 - - '2021-08-04T14:50:30' -- - 61 - - '2021-09-28T14:56:56' -- - 61 - - '2021-10-21T15:02:24' -- - 61 - - '2021-11-22T15:01:55' -- - 60 - - '2021-05-07T14:55:17' -- - 60 - - '2021-10-30T14:57:01' -- - 59 - - '2021-02-07T15:02:05' -- - 59 - - '2021-10-21T15:02:00' -- - 58 - - '2021-05-05T15:07:39' -- - 57 - - '2021-04-12T15:02:05' -- - 57 - - '2021-11-15T14:55:44' -- - 56 - - '2021-09-03T15:02:37' -- - 56 - - '2021-11-06T15:02:23' -- - 55 - - '2021-03-20T14:55:36' -- - 55 - - '2021-08-27T14:56:47' -- - 53 - - '2021-10-05T15:01:58' -- - 52 - - '2021-06-22T15:07:37' -- - 51 - - '2021-03-20T14:56:24' -- - 51 - - '2021-10-30T14:55:49' -- - 50 - - '2021-09-28T14:55:44' -- - 50 - - '2021-10-05T15:02:21' -- - 48 - - '2021-04-05T14:55:09' -- - 48 - - '2021-08-25T15:08:21' -- - 48 - - '2021-10-14T14:55:49' -- - 45 - - '2021-11-22T15:02:19' -- - 44 - - '2021-01-15T14:55:34' -- - 44 - - '2021-03-13T14:49:53' -- - 44 - - '2021-08-20T14:50:11' -- - 44 - - '2021-11-15T14:56:32' -- - 43 - - '2021-08-04T14:50:06' -- - 43 - - '2021-11-15T14:56:56' -- - 41 - - '2021-06-24T14:56:04' -- - 41 - - '2021-10-30T14:56:37' -- - 40 - - '2021-08-20T14:49:47' -- - 39 - - '2021-08-27T14:56:24' -- - 38 - - '2021-01-13T15:07:57' -- - 38 - - '2021-09-05T14:50:16' -- - 38 - - '2021-09-05T14:50:40' -- - 35 - - '2021-06-08T14:55:35' -- - 34 - - '2021-11-08T14:50:00' -- - 33 - - '2021-06-08T14:55:59' -- - 33 - - '2021-06-24T14:55:40' -- - 33 - - '2021-09-21T14:50:18' -- - 33 - - '2021-10-30T14:56:13' -- - 32 - - '2021-02-16T14:55:52' -- - 32 - - '2021-11-08T14:50:24' -- - 31 - - '2021-06-24T14:56:28' -- - 31 - - '2021-10-21T15:02:48' -- - 30 - - '2021-03-13T14:50:17' -- - 29 - - '2021-09-12T14:56:52' -- - 28 - - '2021-08-25T15:07:57' -- - 28 - - '2021-11-06T15:01:59' -- - 23 - - '2021-06-08T14:55:12' -- - 22 - - '2021-10-14T14:56:37' -- - 20 - - '2021-03-20T14:55:13' -- - 18 - - '2021-10-14T14:56:13' -- - 17 - - '2021-02-16T14:55:28' -- - 16 - - '2021-10-14T14:57:01' -- - 11 - - '2021-09-21T14:50:42' -- - 9 - - '2021-09-28T14:56:32' -- - 8 - - '2021-08-20T14:50:35' -- - 6 - - '2021-09-26T15:08:29' -- - 5 - - '2021-09-19T15:02:16' -- - 4 - - '2021-09-19T15:02:40' -- - 4 - - '2021-09-28T14:56:08' -- - 2 - - '2021-01-29T15:08:17' -- - 1 - - '2021-09-19T15:01:52' -- - 1 - - '2021-09-26T15:08:05' -- - 0 - - '2021-01-29T15:07:53'