diff --git a/.github/workflows/unit.yaml b/.github/workflows/unit.yaml index 003a1ab3..967e1a0b 100644 --- a/.github/workflows/unit.yaml +++ b/.github/workflows/unit.yaml @@ -53,7 +53,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13"] include: - os: macos-latest # macos test python-version: "3.12" diff --git a/docs/conf.py b/docs/conf.py index 022afff0..3f1a3a7f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,7 +20,7 @@ project = "geetools" author = "Rodrigo E. Principe" copyright = f"2017-{datetime.now().year}, {author}" -release = "1.17.2" +release = "1.18.0" # -- General configuration ----------------------------------------------------- extensions = [ diff --git a/geetools/__init__.py b/geetools/__init__.py index 4f3de2f6..941c8756 100644 --- a/geetools/__init__.py +++ b/geetools/__init__.py @@ -37,7 +37,7 @@ __title__ = "geetools" __summary__ = "A set of useful tools to use with Google Earth Engine Python" "API" __uri__ = "http://geetools.readthedocs.io" -__version__ = "1.17.2" +__version__ = "1.18.0" __author__ = "Rodrigo E. Principe" __email__ = "fitoprincipe82@gmail.com" diff --git a/geetools/ee_asset.py b/geetools/ee_asset.py index 6960966c..5c3d7ccc 100644 --- a/geetools/ee_asset.py +++ b/geetools/ee_asset.py @@ -8,6 +8,7 @@ import ee import ee.data +from ee._state import get_state from .accessors import _register_extention from .utils import format_description @@ -24,7 +25,7 @@ def __init__(self, *args): An asset cannot be an absolute path like in a normal filesystem and thus any trailing "/" will be removed. """ if len(args) == 0: - self._path = f"projects/{ee.data._cloud_api_user_project}/assets/" + self._path = f"projects/{get_state().cloud_api_user_project}/assets/" else: self._path = args[0]._path if isinstance(args[0], Asset) else PurePosixPath(*args) project_assets = PurePosixPath(str(self._path)[1:]) @@ -90,7 +91,7 @@ def home(cls) -> Asset: ee.Asset.home() """ - return cls(f"projects/{ee.data._cloud_api_user_project}/assets/") + return cls(f"projects/{get_state().cloud_api_user_project}/assets/") def as_posix(self) -> str: """Return the asset id as a posix path. @@ -162,7 +163,7 @@ def is_user_project(self, raised: bool = False) -> bool: return True else: if raised is True: - user_project = ee.data._cloud_api_user_project + user_project = get_state().cloud_api_user_project msg = f"Asset {self.as_posix()} is not in the same project as the user ({user_project})" raise ValueError(msg) else: @@ -541,7 +542,7 @@ def owner(self): self.is_absolute(raised=True) return self.parts[1] - def move(self, new_asset: Asset, overwrite: bool = False) -> Asset: + def move(self, new_asset: os.PathLike, overwrite: bool = False) -> Asset: """Move the asset to a target destination. Move this asset (any type) to the given target, and return a new ``Asset`` instance @@ -564,6 +565,7 @@ def move(self, new_asset: Asset, overwrite: bool = False) -> Asset: asset.move(new_asset, overwrite=False) """ # copy the assets + new_asset = new_asset if isinstance(new_asset, Asset) else ee.Asset(str(new_asset)) self.copy(new_asset, overwrite=overwrite) # delete the original @@ -648,7 +650,7 @@ def rmdir(self, recursive: bool = False, dry_run: bool | None = None) -> list: self.exists(raised=True) return self.delete(recursive, dry_run) - def copy(self, new_asset: Asset, overwrite: bool = False) -> Asset: + def copy(self, new_asset: os.PathLike, overwrite: bool = False) -> Asset: """Copy the asset to a target destination. Copy this asset (any type) to the given target, and return a new ``Asset`` instance @@ -671,6 +673,7 @@ def copy(self, new_asset: Asset, overwrite: bool = False) -> Asset: asset.copy(new_asset, overwrite=False) """ # exit if the destination asset exist and overwrite is False + new_asset = new_asset if isinstance(new_asset, Asset) else ee.Asset(str(new_asset)) if new_asset.exists() and overwrite is False: raise ValueError(f"Asset {new_asset.as_posix()} already exists.") @@ -782,6 +785,11 @@ def date_in_str(d: str | int | float | datetime | date) -> str: d = datetime.fromtimestamp(int(d) / 1000).isoformat() + "Z" return str(d) # if any other format is used, we will simply return it as a string + # early exit if kwargs is empty + if len(kwargs) == 0: + return self + + # Convert the system properties to the correct format if "system:time_start" in kwargs: kwargs["system:time_start"] = date_in_str(kwargs.pop("system:time_start")) if "system:time_end" in kwargs: diff --git a/geetools/ee_authenticate.py b/geetools/ee_authenticate.py index 350558e0..3f8f6b9c 100644 --- a/geetools/ee_authenticate.py +++ b/geetools/ee_authenticate.py @@ -1,6 +1,7 @@ """Toolbox for the :py:func:`ee.Authenticate` function.""" from __future__ import annotations +import json import os from contextlib import suppress from pathlib import Path @@ -17,7 +18,7 @@ class AuthenticateAccessor: """Create an accessor for the :py:func:`ee.Authenticate` function.""" @staticmethod - def new_user(name: str = "", credential_pathname: str | os.PathLike = ""): + def new_user(name: str = "", credential_pathname: str | os.PathLike = "", key_data: dict | None = None): """Authenticate the user and save the credentials in a specific folder. Equivalent to :py:func:`ee.Authenticate` but where the registered user will not be the default one (the one you get when running :py:func:`ee.Initialize`). @@ -25,6 +26,7 @@ def new_user(name: str = "", credential_pathname: str | os.PathLike = ""): Args: name: The name of the user. If not set, it will reauthenticate default. credential_pathname: The path to the folder where the credentials are stored. If not set, it uses the default path. + key_data: The json private key of the service account as a dict object. If not set, it will use the web-based authentication. Example: .. code-block:: python @@ -48,10 +50,22 @@ def new_user(name: str = "", credential_pathname: str | os.PathLike = ""): default = Path(ee.oauth.get_credentials_path()) with TemporaryDirectory() as dir: + + # move the existing credentials to a safe place with suppress(FileNotFoundError): move(default, Path(dir) / default.name) - ee.Authenticate() + + # save the credentials passed to key_data or alternatively run the + # web-based authentication that will write the credentials to the same file + if key_data is not None: + default.write_text(json.dumps(key_data)) + else: + ee.Authenticate() + + # move the new credentials to the desired name move(default, credential_path / name) + + # restore the previous default credentials with suppress(FileNotFoundError): move(Path(dir) / default.name, default) diff --git a/geetools/ee_export.py b/geetools/ee_export.py index d6b58344..5dc8e52d 100644 --- a/geetools/ee_export.py +++ b/geetools/ee_export.py @@ -72,12 +72,11 @@ def toAsset( ee.data.createAsset({"type": "IMAGE_COLLECTION"}, aid.as_posix()) # loop over the collection and export each image - nb_images = imagecollection.size().getInfo() - imageList = imagecollection.toList(nb_images) + system_indices = imagecollection.aggregate_array("system:index").getInfo() task_list = [] - for i in range(nb_images): + for sys_idx in system_indices: # extract image information - locImage = ee.Image(imageList.get(i)) + locImage = imagecollection.filter(ee.Filter.eq(index_property, sys_idx)).first() loc_id = locImage.get(index_property).getInfo() # override the parameters related to the image itself @@ -135,12 +134,11 @@ def toDrive( fid = folder if folder else description # loop over the collection and export each image - nb_images = imagecollection.size().getInfo() - imageList = imagecollection.toList(nb_images) + system_indices = imagecollection.aggregate_array("system:index").getInfo() task_list = [] - for i in range(nb_images): + for sys_idx in system_indices: # extract image information - locImage = ee.Image(imageList.get(i)) + locImage = imagecollection.filter(ee.Filter.eq(index_property, sys_idx)).first() loc_id = locImage.get(index_property).getInfo() # override the parameters related to the image itself @@ -199,12 +197,11 @@ def toCloudStorage( fid = folder if folder else description # loop over the collection and export each image - nb_images = imagecollection.size().getInfo() - imageList = imagecollection.toList(nb_images) + system_indices = imagecollection.aggregate_array("system:index").getInfo() task_list = [] - for i in range(nb_images): + for sys_idx in system_indices: # extract image information - locImage = ee.Image(imageList.get(i)) + locImage = imagecollection.filter(ee.Filter.eq(index_property, sys_idx)).first() loc_id = locImage.get(index_property).getInfo() # override the parameters related to the image itself diff --git a/geetools/ee_feature_collection.py b/geetools/ee_feature_collection.py index 8498833a..1338f06d 100644 --- a/geetools/ee_feature_collection.py +++ b/geetools/ee_feature_collection.py @@ -5,6 +5,7 @@ import ee import geopandas as gpd +import shapely from matplotlib import pyplot as plt from matplotlib.axes import Axes @@ -711,7 +712,11 @@ def plot( gdf.plot(column=property, ax=ax, cmap=cmap) @classmethod - def fromGeoInterface(cls, data: dict | GeoInterface) -> ee.FeatureCollection: + def fromGeoInterface( + cls, + data: dict | GeoInterface, + crs: str = "EPSG:4326", + ) -> ee.FeatureCollection: """Create a :py:class:`ee.FeatureCollection` from a geo interface. The ``geo_interface`` is a protocol representing a vector collection as a python GeoJSON-like dictionary structure. @@ -723,7 +728,7 @@ def fromGeoInterface(cls, data: dict | GeoInterface) -> ee.FeatureCollection: Parameters: data: The geo_interface to create the :py:class:`ee.FeatureCollection` from. - crs: The CRS to use for the FeatureCollection. Default to ``EPSG:4326``. + crs: The CRS of the input data. Defaults to "EPSG:4326". Returns: The created :py:class:`ee.FeatureCollection` from the geo_interface. @@ -755,5 +760,109 @@ def fromGeoInterface(cls, data: dict | GeoInterface) -> ee.FeatureCollection: elif not isinstance(data, dict): raise ValueError("The data must be a geo_interface or a dictionary") + # ensure the geometries are 2D + gdf = gpd.GeoDataFrame.from_features(data["features"], crs=crs) + gdf.geometry = shapely.force_2d(gdf.geometry.values) + data = gdf.__geo_interface__ + # create the feature collection return ee.FeatureCollection(data) + + def areaSort(self, ascending: bool = True) -> ee.FeatureCollection: + """Sort the features in the collection by area. + + Args: + ascending: Whether to sort in ascending order. + + Returns: + The sorted collection. + + Examples: + .. jupyter-execute:: + + import ee, geetools + from geetools.utils import initialize_documentation + + initialize_documentation() + + fc = ee.FeatureCollection("FAO/GAUL/2015/level0").limit(5) + fc = fc.geetools.areaSort() + fc.aggregate_array("ADM0_NAME").getInfo() + """ + # generate an area property + name = "__geetools_area__" + fc = self._obj.map(lambda feat: feat.set(name, feat.geometry().area(1))) + + # sort by area and remove the property from the output + properties = fc.first().propertyNames().remove(name) + return fc.sort(name, ascending).map(lambda feat: feat.select(properties)) + + def filterGeometryType(self, type_: str | ee.String) -> ee.FeatureCollection: + """Filter the collection by geometry type. + + Only keep in the Final featureCollection the Feature with the specified geometry type. + Can be combined with ``breakGeometries`` to filter out multi geometries. + + Args: + type_: The geometry type to filter on. Must be one of the `GEE compatible types `__ + + Returns: + The filtered collection + + Examples: + .. jupyter-execute:: + + import ee, geetools + from geetools.utils import initialize_documentation + + initialize_documentation() + + geoms = [ee.Geometry.Point([0, 0]), ee.Geometry.Point([0, 0]).buffer(1)] + fc = ee.FeatureCollection([ee.Feature(g, {"test": "test"}) for g in geoms]) + fc = fc.geetools.breakGeometries().geetools.filterGeometryType("Point") + fc.aggregate_array("test").getInfo() + """ + # extract the properties of the features before filtering + # and create an extra column with the geometry type + type_, name = ee.String(type_), "__geetools_type__" + properties = self._obj.first().propertyNames() + fc = self._obj.map(lambda feat: feat.set(name, feat.geometry().type())) + + # filter the collection and remove the extra column + fc = fc.filter(ee.Filter.eq(name, type_)).select(properties) + + return ee.FeatureCollection(fc) + + def breakGeometries(self) -> ee.FeatureCollection: + """Break every feature using geometries into it's constituents. + + Each Geometry that is using a multi parts geometry type will be duplicated + into multiple features with each one carrying one of the constituent of the multiPolygon. + + Returns: + ee.FeatureCollection: The collection with the broken down geometries + + Examples: + .. code-block:: python + + import ee, geetools + from geetools.utils import initialize_documentation + + initialize_documentation() + + multipoint = ee.Geometry.MultiPoint([ee.Geometry.Point([0, 0]), ee.Geometry.Point([1, 0])]) + fc = ee.FeatureCollection([ee.Feature(multipoint, {"test": "test"})]) + fc = fc.geetools.breakGeometries() + fc.aggregate_array("test").getInfo() + """ + # helper function to break the geometry of a feature + def split(feat): + feat = ee.Feature(feat) + geometries = feat.geometry().geometries() + return geometries.map(lambda g: ee.Feature(ee.Geometry(g), feat.toDictionary())) + + # apply the function to the collection and flatten the list as each feature + # can have multiple geometries (thus list of list) and we want a single list + list = self._obj.toList(self._obj.size()).map(split).flatten() + + return ee.FeatureCollection(list) diff --git a/geetools/ee_image.py b/geetools/ee_image.py index 05ddcc32..ce9b0892 100644 --- a/geetools/ee_image.py +++ b/geetools/ee_image.py @@ -21,7 +21,7 @@ from xee.ext import REQUEST_BYTE_LIMIT from .accessors import register_class_accessor -from .utils import format_class_info, plot_data +from .utils import area_units_to_m2, format_class_info, plot_data @register_class_accessor(ee.Image, "geetools") @@ -2287,3 +2287,34 @@ def plot_hist( ax.legend(bbox_to_anchor=(1.02, 1), loc="upper left") return ax + + @classmethod + def pixelArea(cls, area_unit: str = "m2", rename_to_units: bool = False) -> ee.Image: + """Extend the :py:method:`ee.Image.pixelArea` method by setting the unit of the output. + + Args: + area_unit: the unit of the output area. can be one of "m2", "ha", "kha", "km2" or "acres". + rename_to_units: if ``True``, the output image will be renamed to the given unit. + + Returns: + the area ``ee.Image`` using the given unit. + + Examples: + .. jupyter-execute:: + + import ee, geetools + from geetools.utils import initialize_documentation + + initialize_documentation() + + hectares = ee.Image.geetools.pixelArea("ha").rename("ha") + acres = ee.Image.geetools.pixelArea("acres").rename("acres") + total = hectares.addBands(acres) + + buffer = ee.Geometry.Point(0,0).buffer(100) + values = total.reduceRegion(ee.Reducer.mean(), buffer, 1) + values.getInfo() + """ + name = area_unit if rename_to_units is True else "area" + divisor = area_units_to_m2(area_unit) + return ee.Image.pixelArea().divide(divisor).rename(name) diff --git a/geetools/ee_image_collection.py b/geetools/ee_image_collection.py index 42eb9e0b..c30abcc8 100644 --- a/geetools/ee_image_collection.py +++ b/geetools/ee_image_collection.py @@ -1208,51 +1208,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/geetools/ee_initialize.py b/geetools/ee_initialize.py index 5feb398b..37079ffe 100644 --- a/geetools/ee_initialize.py +++ b/geetools/ee_initialize.py @@ -6,14 +6,12 @@ from pathlib import Path import ee -import httplib2 +from deprecated.sphinx import deprecated +from ee._state import get_state from google.oauth2.credentials import Credentials from .accessors import register_function_accessor -_project_id: str | None = None -"The project Id used by the current user." - @register_function_accessor(ee.Initialize, "geetools") class InitializeAccessor: @@ -40,9 +38,6 @@ def from_user(name: str = "", credential_pathname: str | os.PathLike = "", proje ee.Initialize.from_user("") """ - # gather global variable to be modified - global _project_id - # set the user profile information name = f"credentials{name}" credential_pathname = credential_pathname or ee.oauth.get_credentials_path() @@ -54,21 +49,25 @@ def from_user(name: str = "", credential_pathname: str | os.PathLike = "", proje msg = "Please register this user first by using geetools.User.create first" raise ee.EEException(msg) - # Set the credential object and Init GEE API - tokens = json.loads((credential_path / name).read_text()) - credentials = Credentials( - None, - refresh_token=tokens["refresh_token"], - token_uri=ee.oauth.TOKEN_URI, - client_id=tokens["client_id"], - client_secret=tokens["client_secret"], - scopes=ee.oauth.SCOPES, - ) - ee.Initialize(credentials) - - # save the project_id in a dedicated global variable as it's not saved - # from GEE side - _project_id = project or tokens["project_id"] + # Set the credential object + tokens = json.loads(credential_path.read_text()) + + # init the credential object and identify if the saved json is a service account or a user account + if "gserviceaccount" in tokens.get("client_email", ""): + ee_user = tokens["client_email"] + credentials = ee.ServiceAccountCredentials(ee_user, key_data=json.dumps(tokens)) + project = credentials.project_id + else: + credentials = Credentials( + None, + refresh_token=tokens["refresh_token"], + token_uri=ee.oauth.TOKEN_URI, + client_id=tokens["client_id"], + client_secret=tokens["client_secret"], + scopes=ee.oauth.SCOPES, + ) + + ee.Initialize(credentials, project=project) @staticmethod def from_service_account(private_key: str): @@ -89,24 +88,18 @@ def from_service_account(private_key: str): ee.Initialize.from_service_account(private_key) """ - # gather global variable to be modified - global _project_id - # connect to GEE using a ServiceAccountCredential object ee_user = json.loads(private_key)["client_email"] credentials = ee.ServiceAccountCredentials(ee_user, key_data=private_key) - _project_id = credentials.project_id - ee.Initialize(credentials=credentials, project=_project_id, http_transport=httplib2.Http()) + ee.Initialize(credentials=credentials, project=credentials.project_id) @staticmethod + @deprecated(version="1.18.0", reason="Use the state object from vanilla earth engine instead.") def project_id() -> str: """Get the project_id of the current account. Returns: - The project_id of the connected profile - - Raises: - RuntimeError: If the account is not initialized. + The project_id of the connected profile. Examples: .. code-block:: @@ -115,6 +108,4 @@ def project_id() -> str: ee.Initialize.geetools.project_id() """ - if _project_id is None: - raise RuntimeError("The GEE account is not initialized") - return _project_id + return get_state().cloud_api_user_project diff --git a/geetools/utils.py b/geetools/utils.py index f9829361..deadfd47 100644 --- a/geetools/utils.py +++ b/geetools/utils.py @@ -282,3 +282,26 @@ def format_class_info(class_info: dict) -> dict: # make sure class value is an int, but store as str final[str(int(class_value))] = format_bandname(class_name) return final + + +def area_units_to_m2(area_units: str) -> float: + """Convert area units to m2. + + Args: + area_units (str): Area units to convert to m2. + + Returns: + float: The conversion factor. + """ + areas = { + "m2": 1, + "ha": 1e4, + "km2": 1e6, + "kha": 1e7, + "acres": 4046.86, + } + + if area_units not in areas: + raise ValueError(f"Area units '{area_units}' not supported. Use one of {list(areas.keys())}") + + return areas.get(area_units, 1) diff --git a/pyproject.toml b/pyproject.toml index a17e0d16..6e803196 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "geetools" -version = "1.17.2" +version = "1.18.0" description = "A collection of tools to work with Google Earth Engine Python API" keywords = [ "python", @@ -18,15 +18,14 @@ classifiers = [ "Intended Audience :: Developers", "Topic :: Software Development :: Build Tools", "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ - "earthengine-api>=1", # fully static implementation + "earthengine-api>=1.6.12", # _state module "requests", "pandas", "geopandas", @@ -128,7 +127,7 @@ branch = true [tool.commitizen] tag_format = "v$major.$minor.$patch$prerelease" update_changelog_on_bump = false -version = "1.17.2" +version = "1.18.0" version_files = [ "pyproject.toml:version", "geetools/__init__.py:__version__", diff --git a/tests/conftest.py b/tests/conftest.py index a08ea407..402ac756 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,10 +3,13 @@ import string import ee +import matplotlib import pytest import pytest_gee import requests +matplotlib.use("Agg") # Use a non-interactive backend for matplotlib + S2_BAND_COMBO = ["B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B8A", "B9", "B11", "B12", "SCL"] """Sentinel-2 band combination.""" diff --git a/tests/test_Asset.py b/tests/test_Asset.py index e3955a16..4c8759f9 100644 --- a/tests/test_Asset.py +++ b/tests/test_Asset.py @@ -1,6 +1,5 @@ """Test cases for the Asset class.""" import os -from unittest.mock import patch import ee import pytest @@ -9,11 +8,13 @@ EARTHENGINE_PROJECT = os.environ.get("EARTHENGINE_PROJECT") +# comment when needed +pytestmark = pytest.mark.skip(reason="The tests are way to slow") + class TestConstructors: """Test the constructors of the Asset class.""" - @patch("ee.data._cloud_api_user_project", EARTHENGINE_PROJECT) def test_home(self): asset = ee.Asset.home() assert asset == f"projects/{EARTHENGINE_PROJECT}/assets" @@ -101,14 +102,12 @@ def test_is_absolute(self): with pytest.raises(ValueError): ee.Asset("projects/bar").is_absolute(raised=True) - @patch("ee.data._cloud_api_user_project", EARTHENGINE_PROJECT) def test_is_user_project(self): assert ee.Asset(f"projects/{EARTHENGINE_PROJECT}/assets/foo").is_user_project() is True assert ee.Asset("projects/foo").is_user_project() is False with pytest.raises(ValueError): ee.Asset("projects/foo").is_user_project(raised=True) - @patch("ee.data._cloud_api_user_project", EARTHENGINE_PROJECT) def test_expanduser(self): asset = ee.Asset("~/foo").expanduser() assert asset == f"projects/{EARTHENGINE_PROJECT}/assets/foo" @@ -354,3 +353,8 @@ def test_set_properties(self, gee_test_folder): asset = ee.Asset(gee_test_folder) / "folder" / "image" asset.setProperties(foo="bar") assert ee.Image(asset.as_posix()).get("foo").getInfo() == "bar" + + def test_set_properties_no_kwargs(self, gee_test_folder): + asset = ee.Asset(gee_test_folder) / "folder" / "image" + asset.setProperties() + assert asset.exists() diff --git a/tests/test_FeatureCollection.py b/tests/test_FeatureCollection.py index 88414a52..fd9903f5 100644 --- a/tests/test_FeatureCollection.py +++ b/tests/test_FeatureCollection.py @@ -331,6 +331,10 @@ def test_error_from_geo_interface_(self): with pytest.raises(ValueError): ee.FeatureCollection.geetools.fromGeoInterface("toto") + def test_from_geo_interface_z(self, gdfZ, ee_feature_collection_regression): + fc = ee.FeatureCollection.geetools.fromGeoInterface(gdfZ) + ee_feature_collection_regression.check(fc, prescision=4) + @pytest.fixture def gdf(self): data = { @@ -344,3 +348,52 @@ def gdf(self): ], } return gpd.GeoDataFrame.from_features(data["features"]) + + @pytest.fixture + def gdfZ(self): + data = { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {"name": "Coors Field"}, + "geometry": {"type": "Point", "coordinates": [-104.99404, 39.75621, 1000]}, + } + ], + } + return gpd.GeoDataFrame.from_features(data["features"]) + + +class TestAreaSort: + """Test the ``areaSort`` method.""" + + def test_area_sort(self, ee_list_regression): + fc = ee.FeatureCollection("FAO/GAUL/2015/level0").limit(5) + fc = fc.geetools.areaSort() + property = fc.aggregate_array("ADM0_NAME") + ee_list_regression.check(property) + + +class TestFilterGeometryType: + """Test the ``filterGeometryType`` method.""" + + def test_filter_geometry_type(self, ee_feature_collection_regression): + geometries = [ee.Geometry.Point([0, 0]), ee.Geometry.Point([0, 0]).buffer(1)] + fc = ee.FeatureCollection([ee.Feature(g, {"test": "test"}) for g in geometries]) + fc = fc.geetools.filterGeometryType("Point") + ee_feature_collection_regression.check(fc) + + +class TestBreakGeometries: + """Test the ``breakGeometries`` method.""" + + def test_break_geometries(self, fc, ee_feature_collection_regression): + fc = fc.geetools.breakGeometries() + ee_feature_collection_regression.check(fc) + + @pytest.fixture + def fc(self): + point0 = ee.Geometry.Point([0, 0]) + point1 = ee.Geometry.Point([1, 0]) + multipoint = ee.Geometry.MultiPoint([point0, point1]) + return ee.FeatureCollection([ee.Feature(multipoint, {"test": "test"})]) diff --git a/tests/test_FeatureCollection/serialized_test_area_sort.yml b/tests/test_FeatureCollection/serialized_test_area_sort.yml new file mode 100644 index 00000000..2e0a3544 --- /dev/null +++ b/tests/test_FeatureCollection/serialized_test_area_sort.yml @@ -0,0 +1,96 @@ +result: '0' +values: + '0': + functionInvocationValue: + arguments: + collection: + functionInvocationValue: + arguments: + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_1_0 + body: '1' + collection: + functionInvocationValue: + arguments: + ascending: + constantValue: true + collection: + valueReference: '3' + key: + valueReference: '2' + functionName: Collection.limit + functionName: Collection.map + property: + constantValue: ADM0_NAME + functionName: AggregateFeatureCollection.array + '1': + functionInvocationValue: + arguments: + input: + argumentReference: _MAPPING_VAR_1_0 + propertySelectors: + functionInvocationValue: + arguments: + element: + valueReference: '2' + list: + functionInvocationValue: + arguments: + element: + functionInvocationValue: + arguments: + collection: + valueReference: '3' + functionName: Collection.first + functionName: Element.propertyNames + functionName: List.remove + functionName: Feature.select + '2': + constantValue: __geetools_area__ + '3': + functionInvocationValue: + arguments: + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + body: '4' + collection: + functionInvocationValue: + arguments: + collection: + functionInvocationValue: + arguments: + tableId: + constantValue: FAO/GAUL/2015/level0 + functionName: Collection.loadTable + limit: + constantValue: 5 + functionName: Collection.limit + functionName: Collection.map + '4': + functionInvocationValue: + arguments: + key: + valueReference: '2' + object: + argumentReference: _MAPPING_VAR_0_0 + value: + functionInvocationValue: + arguments: + geometry: + functionInvocationValue: + arguments: + feature: + argumentReference: _MAPPING_VAR_0_0 + functionName: Feature.geometry + maxError: + functionInvocationValue: + arguments: + value: + constantValue: 1 + functionName: ErrorMargin + functionName: Geometry.area + functionName: Element.set diff --git a/tests/test_FeatureCollection/serialized_test_break_geometries.yml b/tests/test_FeatureCollection/serialized_test_break_geometries.yml new file mode 100644 index 00000000..fc8f2057 --- /dev/null +++ b/tests/test_FeatureCollection/serialized_test_break_geometries.yml @@ -0,0 +1,100 @@ +result: '0' +values: + '0': + functionInvocationValue: + arguments: + features: + functionInvocationValue: + arguments: + list: + functionInvocationValue: + arguments: + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_1_0 + body: '1' + dropNulls: + constantValue: false + list: + functionInvocationValue: + arguments: + collection: + valueReference: '3' + count: + functionInvocationValue: + arguments: + collection: + valueReference: '3' + functionName: Collection.size + functionName: Collection.toList + functionName: List.map + functionName: List.flatten + functionName: Collection + '1': + functionInvocationValue: + arguments: + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + body: '2' + dropNulls: + constantValue: false + list: + functionInvocationValue: + arguments: + geometry: + functionInvocationValue: + arguments: + feature: + argumentReference: _MAPPING_VAR_1_0 + functionName: Feature.geometry + functionName: Geometry.geometries + functionName: List.map + '2': + functionInvocationValue: + arguments: + geometry: + argumentReference: _MAPPING_VAR_0_0 + metadata: + functionInvocationValue: + arguments: + element: + argumentReference: _MAPPING_VAR_1_0 + functionName: Element.toDictionary + functionName: Feature + '3': + functionInvocationValue: + arguments: + features: + arrayValue: + values: + - functionInvocationValue: + arguments: + geometry: + functionInvocationValue: + arguments: + coordinates: + arrayValue: + values: + - functionInvocationValue: + arguments: + coordinates: + constantValue: + - 0 + - 0 + functionName: GeometryConstructors.Point + - functionInvocationValue: + arguments: + coordinates: + constantValue: + - 1 + - 0 + functionName: GeometryConstructors.Point + functionName: GeometryConstructors.MultiPoint + metadata: + constantValue: + test: test + functionName: Feature + functionName: Collection diff --git a/tests/test_FeatureCollection/serialized_test_filter_geometry_type.yml b/tests/test_FeatureCollection/serialized_test_filter_geometry_type.yml new file mode 100644 index 00000000..5ea0beab --- /dev/null +++ b/tests/test_FeatureCollection/serialized_test_filter_geometry_type.yml @@ -0,0 +1,110 @@ +result: '0' +values: + '0': + functionInvocationValue: + arguments: + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + body: '1' + collection: + functionInvocationValue: + arguments: + collection: + functionInvocationValue: + arguments: + baseAlgorithm: + functionDefinitionValue: + argumentNames: + - _MAPPING_VAR_0_0 + body: '5' + collection: + valueReference: '2' + functionName: Collection.map + filter: + functionInvocationValue: + arguments: + leftField: + valueReference: '6' + rightValue: + constantValue: Point + functionName: Filter.equals + functionName: Collection.filter + functionName: Collection.map + '1': + functionInvocationValue: + arguments: + input: + argumentReference: _MAPPING_VAR_0_0 + propertySelectors: + functionInvocationValue: + arguments: + element: + functionInvocationValue: + arguments: + collection: + valueReference: '2' + functionName: Collection.first + functionName: Element.propertyNames + retainGeometry: + constantValue: true + functionName: Feature.select + '2': + functionInvocationValue: + arguments: + features: + arrayValue: + values: + - functionInvocationValue: + arguments: + geometry: + valueReference: '3' + metadata: + valueReference: '4' + functionName: Feature + - functionInvocationValue: + arguments: + geometry: + functionInvocationValue: + arguments: + distance: + constantValue: 1 + geometry: + valueReference: '3' + functionName: Geometry.buffer + metadata: + valueReference: '4' + functionName: Feature + functionName: Collection + '3': + functionInvocationValue: + arguments: + coordinates: + constantValue: + - 0 + - 0 + functionName: GeometryConstructors.Point + '4': + constantValue: + test: test + '5': + functionInvocationValue: + arguments: + key: + valueReference: '6' + object: + argumentReference: _MAPPING_VAR_0_0 + value: + functionInvocationValue: + arguments: + geometry: + functionInvocationValue: + arguments: + feature: + argumentReference: _MAPPING_VAR_0_0 + functionName: Feature.geometry + functionName: Geometry.type + functionName: Element.set + '6': + constantValue: __geetools_type__ diff --git a/tests/test_FeatureCollection/serialized_test_from_geo_interface_z.yml b/tests/test_FeatureCollection/serialized_test_from_geo_interface_z.yml new file mode 100644 index 00000000..50b50f01 --- /dev/null +++ b/tests/test_FeatureCollection/serialized_test_from_geo_interface_z.yml @@ -0,0 +1,24 @@ +result: '0' +values: + '0': + functionInvocationValue: + arguments: + features: + arrayValue: + values: + - functionInvocationValue: + arguments: + geometry: + functionInvocationValue: + arguments: + coordinates: + constantValue: + - -104.99404 + - 39.75621 + functionName: GeometryConstructors.Point + metadata: + constantValue: + name: Coors Field + system:index: '0' + functionName: Feature + functionName: Collection diff --git a/tests/test_FeatureCollection/test_area_sort.yml b/tests/test_FeatureCollection/test_area_sort.yml new file mode 100644 index 00000000..732f3230 --- /dev/null +++ b/tests/test_FeatureCollection/test_area_sort.yml @@ -0,0 +1,5 @@ +- Montenegro +- Taiwan +- Serbia +- South Sudan +- Sudan diff --git a/tests/test_FeatureCollection/test_break_geometries.yml b/tests/test_FeatureCollection/test_break_geometries.yml new file mode 100644 index 00000000..61f921d5 --- /dev/null +++ b/tests/test_FeatureCollection/test_break_geometries.yml @@ -0,0 +1,20 @@ +features: +- geometry: + coordinates: + - 0.0 + - 0.0 + type: Point + id: '0' + properties: + test: test + type: Feature +- geometry: + coordinates: + - 1.0 + - 0.0 + type: Point + id: '1' + properties: + test: test + type: Feature +type: FeatureCollection diff --git a/tests/test_FeatureCollection/test_filter_geometry_type.yml b/tests/test_FeatureCollection/test_filter_geometry_type.yml new file mode 100644 index 00000000..c5eebfba --- /dev/null +++ b/tests/test_FeatureCollection/test_filter_geometry_type.yml @@ -0,0 +1,11 @@ +features: +- geometry: + coordinates: + - 0.0 + - 0.0 + type: Point + id: '0' + properties: + test: test + type: Feature +type: FeatureCollection diff --git a/tests/test_FeatureCollection/test_from_geo_interface_z.yml b/tests/test_FeatureCollection/test_from_geo_interface_z.yml new file mode 100644 index 00000000..19fb9377 --- /dev/null +++ b/tests/test_FeatureCollection/test_from_geo_interface_z.yml @@ -0,0 +1,11 @@ +features: +- geometry: + coordinates: + - -104.994 + - 39.7562 + type: Point + id: '0' + properties: + name: Coors Field + type: Feature +type: FeatureCollection diff --git a/tests/test_Image.py b/tests/test_Image.py index 8e15a5d3..e4e45c22 100644 --- a/tests/test_Image.py +++ b/tests/test_Image.py @@ -917,3 +917,34 @@ def image(self): @property def region(self): return ee.Geometry.Rectangle([-112.60, 40.60, -111.18, 41.22]) + + +class TestPixelArea: + """Test the ``pixelArea`` method.""" + + def test_pixel_area_default(self): + surface = ee.Image.pixelArea().reduceRegion(ee.Reducer.mean(), self.buffer, 1) + ldcSurface = ee.Image.geetools.pixelArea().reduceRegion(ee.Reducer.mean(), self.buffer, 1) + isClose = ee.Number(surface.get("area")).subtract(ldcSurface.get("area")).abs().lte(1e-6) + assert bool(isClose.getInfo()) is True + + def test_pixel_area(self, ee_dictionary_regression): + hectares = ee.Image.geetools.pixelArea("ha") + total = ee.Image.geetools.pixelArea("acres").addBands(hectares) + dict = total.reduceRegion(ee.Reducer.mean(), self.buffer, 1) + ee_dictionary_regression.check(dict) + + def test_pixel_area_rename(self, ee_dictionary_regression): + hectares = ee.Image.geetools.pixelArea("ha", True) + acres = ee.Image.geetools.pixelArea("acres", True) + total = hectares.addBands(acres) + dict = total.reduceRegion(ee.Reducer.mean(), self.buffer, 1) + ee_dictionary_regression.check(dict) + + def test_pixel_area_error(self): + with pytest.raises(ValueError): + ee.Image.geetools.pixelArea("not_a_unit") + + @property + def buffer(self) -> ee.Geometry: + return ee.Geometry.Point(0, 0).buffer(100) diff --git a/tests/test_Image/serialized_test_pixel_area.yml b/tests/test_Image/serialized_test_pixel_area.yml new file mode 100644 index 00000000..42c00dc2 --- /dev/null +++ b/tests/test_Image/serialized_test_pixel_area.yml @@ -0,0 +1,73 @@ +result: '0' +values: + '0': + functionInvocationValue: + arguments: + geometry: + functionInvocationValue: + arguments: + distance: + constantValue: 100 + geometry: + functionInvocationValue: + arguments: + coordinates: + constantValue: + - 0 + - 0 + functionName: GeometryConstructors.Point + functionName: Geometry.buffer + image: + functionInvocationValue: + arguments: + dstImg: + functionInvocationValue: + arguments: + input: + functionInvocationValue: + arguments: + image1: + valueReference: '1' + image2: + functionInvocationValue: + arguments: + value: + constantValue: 4046.86 + functionName: Image.constant + functionName: Image.divide + names: + valueReference: '2' + functionName: Image.rename + srcImg: + functionInvocationValue: + arguments: + input: + functionInvocationValue: + arguments: + image1: + valueReference: '1' + image2: + functionInvocationValue: + arguments: + value: + constantValue: 10000.0 + functionName: Image.constant + functionName: Image.divide + names: + valueReference: '2' + functionName: Image.rename + functionName: Image.addBands + reducer: + functionInvocationValue: + arguments: {} + functionName: Reducer.mean + scale: + constantValue: 1 + functionName: Image.reduceRegion + '1': + functionInvocationValue: + arguments: {} + functionName: Image.pixelArea + '2': + constantValue: + - area diff --git a/tests/test_Image/serialized_test_pixel_area_rename.yml b/tests/test_Image/serialized_test_pixel_area_rename.yml new file mode 100644 index 00000000..32e0fbac --- /dev/null +++ b/tests/test_Image/serialized_test_pixel_area_rename.yml @@ -0,0 +1,72 @@ +result: '0' +values: + '0': + functionInvocationValue: + arguments: + geometry: + functionInvocationValue: + arguments: + distance: + constantValue: 100 + geometry: + functionInvocationValue: + arguments: + coordinates: + constantValue: + - 0 + - 0 + functionName: GeometryConstructors.Point + functionName: Geometry.buffer + image: + functionInvocationValue: + arguments: + dstImg: + functionInvocationValue: + arguments: + input: + functionInvocationValue: + arguments: + image1: + valueReference: '1' + image2: + functionInvocationValue: + arguments: + value: + constantValue: 10000.0 + functionName: Image.constant + functionName: Image.divide + names: + constantValue: + - ha + functionName: Image.rename + srcImg: + functionInvocationValue: + arguments: + input: + functionInvocationValue: + arguments: + image1: + valueReference: '1' + image2: + functionInvocationValue: + arguments: + value: + constantValue: 4046.86 + functionName: Image.constant + functionName: Image.divide + names: + constantValue: + - acres + functionName: Image.rename + functionName: Image.addBands + reducer: + functionInvocationValue: + arguments: {} + functionName: Reducer.mean + scale: + constantValue: 1 + functionName: Image.reduceRegion + '1': + functionInvocationValue: + arguments: {} + functionName: Image.pixelArea diff --git a/tests/test_Image/test_add_date.csv b/tests/test_Image/test_add_date.csv index c29eacba..2df09d96 100644 --- a/tests/test_Image/test_add_date.csv +++ b/tests/test_Image/test_add_date.csv @@ -1,2 +1,2 @@ -,AOT,B1,B11,B12,B2,B3,B4,B5,B6,B7,B8,B8A,B9,MSK_CLASSI_CIRRUS,MSK_CLASSI_OPAQUE,MSK_CLASSI_SNOW_ICE,MSK_CLDPRB,MSK_SNWPRB,QA10,QA20,QA60,SCL,TCI_B,TCI_G,TCI_R,WVP,date -0,72,214,1175,958,188,366,285,910,1232,1328,1216,1431,2104,,,,2,0,0,0,0,5,21,38,29,588,1577873347042 +,B1,B11,B12,B2,B3,B4,B5,B6,B7,B8,B8A,B9,SCL,date +0,247,1438,1167,238,466,369,1130,1525,1652,1568,1774,2440,5,1577873347042 diff --git a/tests/test_Image/test_add_date_format.csv b/tests/test_Image/test_add_date_format.csv index 81f8da1c..3b21b7ca 100644 --- a/tests/test_Image/test_add_date_format.csv +++ b/tests/test_Image/test_add_date_format.csv @@ -1,2 +1,2 @@ -,AOT,B1,B11,B12,B2,B3,B4,B5,B6,B7,B8,B8A,B9,MSK_CLDPRB,MSK_SNWPRB,QA10,QA20,QA60,SCL,TCI_B,TCI_G,TCI_R,WVP,date -0,72,214,1175,958,188,366,285,910,1232,1328,1216,1431,2104,2,0,0,0,0,5,21,38,29,588,20200101 +,B1,B11,B12,B2,B3,B4,B5,B6,B7,B8,B8A,B9,SCL,date +0,247,1438,1167,238,466,369,1130,1525,1652,1568,1774,2440,5,20200101 diff --git a/tests/test_Image/test_clip_on_collection_property.yml b/tests/test_Image/test_clip_on_collection_property.yml index 6db17f8d..150bf62e 100644 --- a/tests/test_Image/test_clip_on_collection_property.yml +++ b/tests/test_Image/test_clip_on_collection_property.yml @@ -3,49 +3,73 @@ - system:id - Id - system:index -- DATATAKE_IDENTIFIER -- AOT_RETRIEVAL_ACCURACY - SPACECRAFT_NAME - SATURATED_DEFECTIVE_PIXEL_PERCENTAGE -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B8A +- BOA_ADD_OFFSET_B12 - CLOUD_SHADOW_PERCENTAGE +- SENSOR_QUALITY +- GENERATION_TIME +- CLOUDY_PIXEL_OVER_LAND_PERCENTAGE +- CLOUD_COVERAGE_ASSESSMENT +- THIN_CIRRUS_PERCENTAGE +- GRANULE_MEAN_WV +- BOA_ADD_OFFSET_B1 +- BOA_ADD_OFFSET_B2 +- DATASTRIP_ID +- BOA_ADD_OFFSET_B5 +- BOA_ADD_OFFSET_B6 +- BOA_ADD_OFFSET_B3 +- BOA_ADD_OFFSET_B4 +- BOA_ADD_OFFSET_B9 +- BOA_ADD_OFFSET_B7 +- BOA_ADD_OFFSET_B8 +- GRANULE_ID +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B8 +- DATATAKE_TYPE +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B9 +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B6 +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B7 +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B4 +- NOT_VEGETATED_PERCENTAGE +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B5 +- RADIOMETRIC_QUALITY +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B2 +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B3 +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B1 +- HIGH_PROBA_CLOUDS_PERCENTAGE +- UNCLASSIFIED_PERCENTAGE +- OZONE_SOURCE +- GRANULE_MEAN_AOT +- BOA_ADD_OFFSET_B8A +- SNOW_ICE_PERCENTAGE +- BOA_ADD_OFFSET_B11 +- BOA_ADD_OFFSET_B10 +- GEOMETRIC_QUALITY +- system:asset_size +- DATATAKE_IDENTIFIER +- AOT_RETRIEVAL_ACCURACY +- AOT_RETRIEVAL_METHOD +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B8A - MEAN_SOLAR_AZIMUTH_ANGLE - VEGETATION_PERCENTAGE - SOLAR_IRRADIANCE_B12 - SOLAR_IRRADIANCE_B10 -- SENSOR_QUALITY - SOLAR_IRRADIANCE_B11 -- GENERATION_TIME - SOLAR_IRRADIANCE_B8A - FORMAT_CORRECTNESS -- CLOUD_COVERAGE_ASSESSMENT -- THIN_CIRRUS_PERCENTAGE - system:time_end - WATER_VAPOUR_RETRIEVAL_ACCURACY +- OZONE_VALUE - system:time_start -- DATASTRIP_ID - PROCESSING_BASELINE - SENSING_ORBIT_NUMBER - NODATA_PIXEL_PERCENTAGE - SENSING_ORBIT_DIRECTION - GENERAL_QUALITY -- GRANULE_ID - REFLECTANCE_CONVERSION_CORRECTION - MEDIUM_PROBA_CLOUDS_PERCENTAGE -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B8 -- DATATAKE_TYPE -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B9 -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B6 -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B7 -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B4 - MEAN_INCIDENCE_ZENITH_ANGLE_B1 -- NOT_VEGETATED_PERCENTAGE -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B5 -- RADIOMETRIC_QUALITY -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B2 -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B3 - MEAN_INCIDENCE_ZENITH_ANGLE_B5 -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B1 - MEAN_INCIDENCE_ZENITH_ANGLE_B4 - MEAN_INCIDENCE_ZENITH_ANGLE_B3 - MEAN_INCIDENCE_ZENITH_ANGLE_B2 @@ -53,9 +77,7 @@ - MEAN_INCIDENCE_ZENITH_ANGLE_B8 - MEAN_INCIDENCE_ZENITH_ANGLE_B7 - DARK_FEATURES_PERCENTAGE -- HIGH_PROBA_CLOUDS_PERCENTAGE - MEAN_INCIDENCE_ZENITH_ANGLE_B6 -- UNCLASSIFIED_PERCENTAGE - MEAN_SOLAR_ZENITH_ANGLE - MEAN_INCIDENCE_ZENITH_ANGLE_B8A - RADIATIVE_TRANSFER_ACCURACY @@ -64,9 +86,9 @@ - PRODUCT_ID - MEAN_INCIDENCE_ZENITH_ANGLE_B10 - SOLAR_IRRADIANCE_B9 -- SNOW_ICE_PERCENTAGE - DEGRADED_MSI_DATA_PERCENTAGE - MEAN_INCIDENCE_ZENITH_ANGLE_B11 +- L2A_QUALITY - MEAN_INCIDENCE_ZENITH_ANGLE_B12 - SOLAR_IRRADIANCE_B6 - MEAN_INCIDENCE_AZIMUTH_ANGLE_B10 @@ -78,9 +100,7 @@ - SOLAR_IRRADIANCE_B2 - SOLAR_IRRADIANCE_B1 - SOLAR_IRRADIANCE_B4 -- GEOMETRIC_QUALITY - SOLAR_IRRADIANCE_B3 -- system:asset_size - WATER_PERCENTAGE - system:bands - system:band_names diff --git a/tests/test_Image/test_clip_on_collection_without_properties_property.yml b/tests/test_Image/test_clip_on_collection_without_properties_property.yml index b6dadcb9..fda7c360 100644 --- a/tests/test_Image/test_clip_on_collection_without_properties_property.yml +++ b/tests/test_Image/test_clip_on_collection_without_properties_property.yml @@ -2,49 +2,73 @@ - system:version - system:id - system:index -- DATATAKE_IDENTIFIER -- AOT_RETRIEVAL_ACCURACY - SPACECRAFT_NAME - SATURATED_DEFECTIVE_PIXEL_PERCENTAGE -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B8A +- BOA_ADD_OFFSET_B12 - CLOUD_SHADOW_PERCENTAGE +- SENSOR_QUALITY +- GENERATION_TIME +- CLOUDY_PIXEL_OVER_LAND_PERCENTAGE +- CLOUD_COVERAGE_ASSESSMENT +- THIN_CIRRUS_PERCENTAGE +- GRANULE_MEAN_WV +- BOA_ADD_OFFSET_B1 +- BOA_ADD_OFFSET_B2 +- DATASTRIP_ID +- BOA_ADD_OFFSET_B5 +- BOA_ADD_OFFSET_B6 +- BOA_ADD_OFFSET_B3 +- BOA_ADD_OFFSET_B4 +- BOA_ADD_OFFSET_B9 +- BOA_ADD_OFFSET_B7 +- BOA_ADD_OFFSET_B8 +- GRANULE_ID +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B8 +- DATATAKE_TYPE +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B9 +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B6 +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B7 +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B4 +- NOT_VEGETATED_PERCENTAGE +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B5 +- RADIOMETRIC_QUALITY +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B2 +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B3 +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B1 +- HIGH_PROBA_CLOUDS_PERCENTAGE +- UNCLASSIFIED_PERCENTAGE +- OZONE_SOURCE +- GRANULE_MEAN_AOT +- BOA_ADD_OFFSET_B8A +- SNOW_ICE_PERCENTAGE +- BOA_ADD_OFFSET_B11 +- BOA_ADD_OFFSET_B10 +- GEOMETRIC_QUALITY +- system:asset_size +- DATATAKE_IDENTIFIER +- AOT_RETRIEVAL_ACCURACY +- AOT_RETRIEVAL_METHOD +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B8A - MEAN_SOLAR_AZIMUTH_ANGLE - VEGETATION_PERCENTAGE - SOLAR_IRRADIANCE_B12 - SOLAR_IRRADIANCE_B10 -- SENSOR_QUALITY - SOLAR_IRRADIANCE_B11 -- GENERATION_TIME - SOLAR_IRRADIANCE_B8A - FORMAT_CORRECTNESS -- CLOUD_COVERAGE_ASSESSMENT -- THIN_CIRRUS_PERCENTAGE - system:time_end - WATER_VAPOUR_RETRIEVAL_ACCURACY +- OZONE_VALUE - system:time_start -- DATASTRIP_ID - PROCESSING_BASELINE - SENSING_ORBIT_NUMBER - NODATA_PIXEL_PERCENTAGE - SENSING_ORBIT_DIRECTION - GENERAL_QUALITY -- GRANULE_ID - REFLECTANCE_CONVERSION_CORRECTION - MEDIUM_PROBA_CLOUDS_PERCENTAGE -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B8 -- DATATAKE_TYPE -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B9 -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B6 -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B7 -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B4 - MEAN_INCIDENCE_ZENITH_ANGLE_B1 -- NOT_VEGETATED_PERCENTAGE -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B5 -- RADIOMETRIC_QUALITY -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B2 -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B3 - MEAN_INCIDENCE_ZENITH_ANGLE_B5 -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B1 - MEAN_INCIDENCE_ZENITH_ANGLE_B4 - MEAN_INCIDENCE_ZENITH_ANGLE_B3 - MEAN_INCIDENCE_ZENITH_ANGLE_B2 @@ -52,9 +76,7 @@ - MEAN_INCIDENCE_ZENITH_ANGLE_B8 - MEAN_INCIDENCE_ZENITH_ANGLE_B7 - DARK_FEATURES_PERCENTAGE -- HIGH_PROBA_CLOUDS_PERCENTAGE - MEAN_INCIDENCE_ZENITH_ANGLE_B6 -- UNCLASSIFIED_PERCENTAGE - MEAN_SOLAR_ZENITH_ANGLE - MEAN_INCIDENCE_ZENITH_ANGLE_B8A - RADIATIVE_TRANSFER_ACCURACY @@ -63,9 +85,9 @@ - PRODUCT_ID - MEAN_INCIDENCE_ZENITH_ANGLE_B10 - SOLAR_IRRADIANCE_B9 -- SNOW_ICE_PERCENTAGE - DEGRADED_MSI_DATA_PERCENTAGE - MEAN_INCIDENCE_ZENITH_ANGLE_B11 +- L2A_QUALITY - MEAN_INCIDENCE_ZENITH_ANGLE_B12 - SOLAR_IRRADIANCE_B6 - MEAN_INCIDENCE_AZIMUTH_ANGLE_B10 @@ -77,9 +99,7 @@ - SOLAR_IRRADIANCE_B2 - SOLAR_IRRADIANCE_B1 - SOLAR_IRRADIANCE_B4 -- GEOMETRIC_QUALITY - SOLAR_IRRADIANCE_B3 -- system:asset_size - WATER_PERCENTAGE - system:bands - system:band_names diff --git a/tests/test_Image/test_distance_to_mask.csv b/tests/test_Image/test_distance_to_mask.csv index a7c4d6cb..78f4c9a1 100644 --- a/tests/test_Image/test_distance_to_mask.csv +++ b/tests/test_Image/test_distance_to_mask.csv @@ -1,2 +1,2 @@ ,B1,B11,B12,B2,B3,B4,B5,B6,B7,B8,B8A,B9,SCL,distance_to_mask -0,238.7171666246534,948.66361230148675,750.75646584320634,320.95785228132081,415.14734055961685,426.16661204940726,604.81486009578975,1007.6004411393997,1140.2466599445429,1217.7626543987888,1200.1272498109399,1389.4672800604985,3.3245021426770851,1000 +0,184.91138139652122,757.02859843710587,584.90854550037807,235.32171666246529,316.66567935467583,313.57853541719169,479.29521048651361,848.1934333249302,970.15790269725198,1051.9516007058226,1023.5374716410383,1170.6954499621881,4.8100201663725723,1000 diff --git a/tests/test_Image/test_gauss.csv b/tests/test_Image/test_gauss.csv index 2597d3a7..8492696c 100644 --- a/tests/test_Image/test_gauss.csv +++ b/tests/test_Image/test_gauss.csv @@ -1,2 +1,2 @@ ,B1_gauss -0,0.66461378242572766 +0,0.56481993831291988 diff --git a/tests/test_Image/test_gauss_with_band.csv b/tests/test_Image/test_gauss_with_band.csv index 41577224..4a87809f 100644 --- a/tests/test_Image/test_gauss_with_band.csv +++ b/tests/test_Image/test_gauss_with_band.csv @@ -1,2 +1,2 @@ ,B2_gauss -0,0.50929481299884138 +0,0.45751450418840084 diff --git a/tests/test_Image/test_get_values.csv b/tests/test_Image/test_get_values.csv index 1c5c1dc8..970a56ce 100644 --- a/tests/test_Image/test_get_values.csv +++ b/tests/test_Image/test_get_values.csv @@ -1,2 +1,2 @@ -,AOT,B1,B11,B12,B2,B3,B4,B5,B6,B7,B8,B8A,B9,MSK_CLASSI_CIRRUS,MSK_CLASSI_OPAQUE,MSK_CLASSI_SNOW_ICE,MSK_CLDPRB,MSK_SNWPRB,QA10,QA20,QA60,SCL,TCI_B,TCI_G,TCI_R,WVP -0,72,159,1341,1105,487,641,714,861,1356,1538,1622,1617,1298,,,,0,0,0,0,0,4,50,66,73,789 +,B1,B11,B12,B2,B3,B4,B5,B6,B7,B8,B8A,B9,SCL +0,85,885,727,300,398,434,569,930,1063,1087,1118,918,4 diff --git a/tests/test_Image/test_get_values_with_scale.csv b/tests/test_Image/test_get_values_with_scale.csv index 17592770..9ac62e97 100644 --- a/tests/test_Image/test_get_values_with_scale.csv +++ b/tests/test_Image/test_get_values_with_scale.csv @@ -1,2 +1,2 @@ -,AOT,B1,B11,B12,B2,B3,B4,B5,B6,B7,B8,B8A,B9,MSK_CLASSI_CIRRUS,MSK_CLASSI_OPAQUE,MSK_CLASSI_SNOW_ICE,MSK_CLDPRB,MSK_SNWPRB,QA10,QA20,QA60,SCL,TCI_B,TCI_G,TCI_R,WVP -0,72,117,553,332,161,247,175,384,952,1071,1168,1145,1523,,,,0,0,0,0,0,4,18,26,19,693 +,B1,B11,B12,B2,B3,B4,B5,B6,B7,B8,B8A,B9,SCL +0,82,453,273,104,180,121,306,777,879,962,941,1301,4 diff --git a/tests/test_Image/test_interpolate_bands.csv b/tests/test_Image/test_interpolate_bands.csv index 24364761..4ab1430a 100644 --- a/tests/test_Image/test_interpolate_bands.csv +++ b/tests/test_Image/test_interpolate_bands.csv @@ -1,2 +1,2 @@ ,B2,B4 -0,4.5200000000000005,5.8399999999999999 +0,5.9800000000000004,8.4199999999999999 diff --git a/tests/test_Image/test_pixel_area.yml b/tests/test_Image/test_pixel_area.yml new file mode 100644 index 00000000..cb2f8563 --- /dev/null +++ b/tests/test_Image/test_pixel_area.yml @@ -0,0 +1,2 @@ +area: 0.000245 +area_1: 9.9e-05 diff --git a/tests/test_Image/test_pixel_area_rename.yml b/tests/test_Image/test_pixel_area_rename.yml new file mode 100644 index 00000000..54ec722b --- /dev/null +++ b/tests/test_Image/test_pixel_area_rename.yml @@ -0,0 +1,2 @@ +acres: 0.000245 +ha: 9.9e-05 diff --git a/tests/test_Image/test_plot.png b/tests/test_Image/test_plot.png index 7b7e2951..ecf007fe 100644 Binary files a/tests/test_Image/test_plot.png and b/tests/test_Image/test_plot.png differ diff --git a/tests/test_Image/test_plot_one_band.png b/tests/test_Image/test_plot_one_band.png index b0415bef..a26d871c 100644 Binary files a/tests/test_Image/test_plot_one_band.png and b/tests/test_Image/test_plot_one_band.png differ diff --git a/tests/test_Image/test_plot_one_band_cmap.png b/tests/test_Image/test_plot_one_band_cmap.png index 6907ce9b..eac8e1ef 100644 Binary files a/tests/test_Image/test_plot_one_band_cmap.png and b/tests/test_Image/test_plot_one_band_cmap.png differ diff --git a/tests/test_Image/test_plot_with_crs.png b/tests/test_Image/test_plot_with_crs.png index 3b5596f0..68c976ce 100644 Binary files a/tests/test_Image/test_plot_with_crs.png and b/tests/test_Image/test_plot_with_crs.png differ diff --git a/tests/test_Image/test_plot_with_fc.png b/tests/test_Image/test_plot_with_fc.png index d2ddb7e9..75b7f013 100644 Binary files a/tests/test_Image/test_plot_with_fc.png and b/tests/test_Image/test_plot_with_fc.png differ diff --git a/tests/test_Image/test_reduce_bands.csv b/tests/test_Image/test_reduce_bands.csv index bc976728..6d60d38d 100644 --- a/tests/test_Image/test_reduce_bands.csv +++ b/tests/test_Image/test_reduce_bands.csv @@ -1,2 +1,2 @@ ,sum -0,9663.7526972523283 +0,7941.0555457524588 diff --git a/tests/test_Image/test_reduce_bands_with_bands.csv b/tests/test_Image/test_reduce_bands_with_bands.csv index 2789621d..a5aecc9f 100644 --- a/tests/test_Image/test_reduce_bands_with_bands.csv +++ b/tests/test_Image/test_reduce_bands_with_bands.csv @@ -1,2 +1,2 @@ ,sum -0,559.67501890597396 +0,420.23309805898646 diff --git a/tests/test_Image/test_reduce_bands_with_name.csv b/tests/test_Image/test_reduce_bands_with_name.csv index 86046fc0..2e4d4350 100644 --- a/tests/test_Image/test_reduce_bands_with_name.csv +++ b/tests/test_Image/test_reduce_bands_with_name.csv @@ -1,2 +1,2 @@ ,toto -0,9663.7526972523283 +0,7941.0555457524588 diff --git a/tests/test_Image/test_remove_properties.yml b/tests/test_Image/test_remove_properties.yml index 23712e77..61950c9b 100644 --- a/tests/test_Image/test_remove_properties.yml +++ b/tests/test_Image/test_remove_properties.yml @@ -1,21 +1,35 @@ -- MEAN_INCIDENCE_AZIMUTH_ANGLE_B8A +- BOA_ADD_OFFSET_B12 +- AOT_RETRIEVAL_METHOD - CLOUD_SHADOW_PERCENTAGE +- MEAN_INCIDENCE_AZIMUTH_ANGLE_B8A - MEAN_SOLAR_AZIMUTH_ANGLE - VEGETATION_PERCENTAGE - SOLAR_IRRADIANCE_B12 -- SOLAR_IRRADIANCE_B10 - SENSOR_QUALITY +- SOLAR_IRRADIANCE_B10 - SOLAR_IRRADIANCE_B11 - GENERATION_TIME +- CLOUDY_PIXEL_OVER_LAND_PERCENTAGE - SOLAR_IRRADIANCE_B8A - FORMAT_CORRECTNESS - CLOUD_COVERAGE_ASSESSMENT - THIN_CIRRUS_PERCENTAGE - WATER_VAPOUR_RETRIEVAL_ACCURACY +- OZONE_VALUE +- GRANULE_MEAN_WV +- BOA_ADD_OFFSET_B1 +- BOA_ADD_OFFSET_B2 - DATASTRIP_ID +- BOA_ADD_OFFSET_B5 +- BOA_ADD_OFFSET_B6 +- BOA_ADD_OFFSET_B3 - PROCESSING_BASELINE - SENSING_ORBIT_NUMBER +- BOA_ADD_OFFSET_B4 +- BOA_ADD_OFFSET_B9 +- BOA_ADD_OFFSET_B7 - NODATA_PIXEL_PERCENTAGE +- BOA_ADD_OFFSET_B8 - SENSING_ORBIT_DIRECTION - GENERAL_QUALITY - GRANULE_ID @@ -27,8 +41,8 @@ - MEAN_INCIDENCE_AZIMUTH_ANGLE_B6 - MEAN_INCIDENCE_AZIMUTH_ANGLE_B7 - MEAN_INCIDENCE_AZIMUTH_ANGLE_B4 -- MEAN_INCIDENCE_ZENITH_ANGLE_B1 - NOT_VEGETATED_PERCENTAGE +- MEAN_INCIDENCE_ZENITH_ANGLE_B1 - MEAN_INCIDENCE_AZIMUTH_ANGLE_B5 - RADIOMETRIC_QUALITY - MEAN_INCIDENCE_AZIMUTH_ANGLE_B2 @@ -40,24 +54,30 @@ - MEAN_INCIDENCE_ZENITH_ANGLE_B2 - MEAN_INCIDENCE_ZENITH_ANGLE_B9 - MEAN_INCIDENCE_ZENITH_ANGLE_B8 +- HIGH_PROBA_CLOUDS_PERCENTAGE - MEAN_INCIDENCE_ZENITH_ANGLE_B7 - DARK_FEATURES_PERCENTAGE -- HIGH_PROBA_CLOUDS_PERCENTAGE - MEAN_INCIDENCE_ZENITH_ANGLE_B6 - UNCLASSIFIED_PERCENTAGE - MEAN_SOLAR_ZENITH_ANGLE - MEAN_INCIDENCE_ZENITH_ANGLE_B8A - RADIATIVE_TRANSFER_ACCURACY +- OZONE_SOURCE - MGRS_TILE +- GRANULE_MEAN_AOT +- BOA_ADD_OFFSET_B8A - CLOUDY_PIXEL_PERCENTAGE - PRODUCT_ID +- SNOW_ICE_PERCENTAGE - MEAN_INCIDENCE_ZENITH_ANGLE_B10 - SOLAR_IRRADIANCE_B9 -- SNOW_ICE_PERCENTAGE - DEGRADED_MSI_DATA_PERCENTAGE - MEAN_INCIDENCE_ZENITH_ANGLE_B11 +- L2A_QUALITY - MEAN_INCIDENCE_ZENITH_ANGLE_B12 +- BOA_ADD_OFFSET_B11 - SOLAR_IRRADIANCE_B6 +- BOA_ADD_OFFSET_B10 - MEAN_INCIDENCE_AZIMUTH_ANGLE_B10 - SOLAR_IRRADIANCE_B5 - MEAN_INCIDENCE_AZIMUTH_ANGLE_B11 @@ -66,8 +86,8 @@ - SOLAR_IRRADIANCE_B7 - SOLAR_IRRADIANCE_B2 - SOLAR_IRRADIANCE_B1 -- SOLAR_IRRADIANCE_B4 - GEOMETRIC_QUALITY +- SOLAR_IRRADIANCE_B4 - SOLAR_IRRADIANCE_B3 - WATER_PERCENTAGE - DATATAKE_IDENTIFIER diff --git a/tests/test_ImageCollection.py b/tests/test_ImageCollection.py index 7e1009d4..6bdc48b5 100644 --- a/tests/test_ImageCollection.py +++ b/tests/test_ImageCollection.py @@ -2,10 +2,12 @@ from __future__ import annotations import io +import sys import ee import numpy as np import pytest +from ee.ee_exception import EEException from jsonschema import validate from matplotlib import pyplot as plt @@ -195,6 +197,7 @@ def test_outliers_with_drop(self, s2_sr, amazonas, num_regression): class TestToXarray: """Test the ``toXarray`` method.""" + @pytest.mark.skipif(sys.version_info < (3, 11), reason="dtype changes in python 3.11 onwards.") def test_to_xarray(self, s2_sr, data_regression): ds = s2_sr.geetools.to_xarray() @@ -438,14 +441,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_deprecated_composite_by_month.yml b/tests/test_ImageCollection/serialized_test_deprecated_composite_by_month.yml index d5b6b0ad..a757a177 100644 --- a/tests/test_ImageCollection/serialized_test_deprecated_composite_by_month.yml +++ b/tests/test_ImageCollection/serialized_test_deprecated_composite_by_month.yml @@ -602,7 +602,7 @@ values: valueReference: '24' functionName: String.cat '4': - constantValue: bed5ed9e6d8240ef8a9e7da3c4d4bae9 + constantValue: aa357a2c1ed94d89ace8fd9df72a194b '5': functionInvocationValue: arguments: diff --git a/tests/test_ImageCollection/serialized_test_deprecated_composite_regular_intervals.yml b/tests/test_ImageCollection/serialized_test_deprecated_composite_regular_intervals.yml index 2ff81d7b..614ab5c8 100644 --- a/tests/test_ImageCollection/serialized_test_deprecated_composite_regular_intervals.yml +++ b/tests/test_ImageCollection/serialized_test_deprecated_composite_regular_intervals.yml @@ -602,7 +602,7 @@ values: valueReference: '24' functionName: String.cat '4': - constantValue: db430ab6181e4bd8ae782d54f8298ee8 + constantValue: 1929b220a31045588235d28322edfffc '5': functionInvocationValue: arguments: diff --git a/tests/test_ImageCollection/serialized_test_deprecated_reduce_day_intervals.yml b/tests/test_ImageCollection/serialized_test_deprecated_reduce_day_intervals.yml index e0d48736..9e9e710e 100644 --- a/tests/test_ImageCollection/serialized_test_deprecated_reduce_day_intervals.yml +++ b/tests/test_ImageCollection/serialized_test_deprecated_reduce_day_intervals.yml @@ -602,7 +602,7 @@ values: valueReference: '24' functionName: String.cat '4': - constantValue: df0161b6eb1f487abe32aa9f5c9e573c + constantValue: 7fc0194a21ec4f159ce49a4944c01c2c '5': functionInvocationValue: arguments: diff --git a/tests/test_ImageCollection/serialized_test_deprecated_reduce_equal_interval.yml b/tests/test_ImageCollection/serialized_test_deprecated_reduce_equal_interval.yml index f05f9368..46c7b955 100644 --- a/tests/test_ImageCollection/serialized_test_deprecated_reduce_equal_interval.yml +++ b/tests/test_ImageCollection/serialized_test_deprecated_reduce_equal_interval.yml @@ -602,7 +602,7 @@ values: valueReference: '24' functionName: String.cat '4': - constantValue: e020f9e5e07d4f79acb203db7184c85a + constantValue: 61765dc2248c4c26be316aa2436828d4 '5': functionInvocationValue: arguments: diff --git a/tests/test_ImageCollection/serialized_test_reduce_interval.yml b/tests/test_ImageCollection/serialized_test_reduce_interval.yml index e05bbe06..a0fc6423 100644 --- a/tests/test_ImageCollection/serialized_test_reduce_interval.yml +++ b/tests/test_ImageCollection/serialized_test_reduce_interval.yml @@ -602,7 +602,7 @@ values: valueReference: '24' functionName: String.cat '4': - constantValue: e1912082f1694dc0ab8d27c4dbddfaa6 + constantValue: da1cbb74f3334b598c512e29451dd8e8 '5': functionInvocationValue: arguments: diff --git a/tests/test_ImageCollection/serialized_test_reduce_interval_properties.yml b/tests/test_ImageCollection/serialized_test_reduce_interval_properties.yml index c74276c5..00c4fca7 100644 --- a/tests/test_ImageCollection/serialized_test_reduce_interval_properties.yml +++ b/tests/test_ImageCollection/serialized_test_reduce_interval_properties.yml @@ -602,7 +602,7 @@ values: valueReference: '24' functionName: String.cat '4': - constantValue: b921ced98cff4366988ce922ae2866dc + constantValue: 559148b2c5634e518fabdd8b816b1580 '5': functionInvocationValue: arguments: diff --git a/tests/test_ImageCollection/serialized_test_reduce_interval_with_multi_output_reducer.yml b/tests/test_ImageCollection/serialized_test_reduce_interval_with_multi_output_reducer.yml index 4745d495..21c85915 100644 --- a/tests/test_ImageCollection/serialized_test_reduce_interval_with_multi_output_reducer.yml +++ b/tests/test_ImageCollection/serialized_test_reduce_interval_with_multi_output_reducer.yml @@ -630,7 +630,7 @@ values: valueReference: '12' functionName: String.cat '4': - constantValue: a7b9cb986c564bb28c187a20d195297c + constantValue: 7e31ed9377544e4daae5de452a856eff '5': functionInvocationValue: arguments: diff --git a/tests/test_ImageCollection/serialized_test_reduce_interval_with_reducer.yml b/tests/test_ImageCollection/serialized_test_reduce_interval_with_reducer.yml index cb0831a8..bcd3781d 100644 --- a/tests/test_ImageCollection/serialized_test_reduce_interval_with_reducer.yml +++ b/tests/test_ImageCollection/serialized_test_reduce_interval_with_reducer.yml @@ -580,7 +580,7 @@ values: valueReference: '23' functionName: String.cat '4': - constantValue: f8f28166fadc413cb2dca4c73e00701f + constantValue: ff481e85e8204b0a8bb4f29556fe496f '5': functionInvocationValue: arguments: diff --git a/tests/test_ImageCollection/serialized_test_reduce_interval_without_original_names.yml b/tests/test_ImageCollection/serialized_test_reduce_interval_without_original_names.yml index 06a8929d..c6479b00 100644 --- a/tests/test_ImageCollection/serialized_test_reduce_interval_without_original_names.yml +++ b/tests/test_ImageCollection/serialized_test_reduce_interval_without_original_names.yml @@ -628,7 +628,7 @@ values: valueReference: '12' functionName: String.cat '4': - constantValue: 00b9dd0a85a54c53a594290f84ac64f9 + constantValue: e9ff3a6e43be4c1a826b403e980d152b '5': functionInvocationValue: arguments: diff --git a/tests/test_ImageCollection/serialized_test_reduce_regions_by_date_property.yml b/tests/test_ImageCollection/serialized_test_reduce_regions_by_date_property.yml index ebab10d6..49b67c82 100644 --- a/tests/test_ImageCollection/serialized_test_reduce_regions_by_date_property.yml +++ b/tests/test_ImageCollection/serialized_test_reduce_regions_by_date_property.yml @@ -183,7 +183,7 @@ values: functionName: Date.format functionName: Element.set '16': - constantValue: 9070e18c9add46c78509133bf53df05e + constantValue: 7611f16ad1be428298bd6bfc6501488a '17': constantValue: system:time_start '18': diff --git a/tests/test_ImageCollection/serialized_test_reduce_regions_by_dates.yml b/tests/test_ImageCollection/serialized_test_reduce_regions_by_dates.yml index 8b62f7ca..e8f97c66 100644 --- a/tests/test_ImageCollection/serialized_test_reduce_regions_by_dates.yml +++ b/tests/test_ImageCollection/serialized_test_reduce_regions_by_dates.yml @@ -183,7 +183,7 @@ values: functionName: Date.format functionName: Element.set '16': - constantValue: 289b8d0ffec84bdfb420ca1e8b5532c8 + constantValue: 6b6455876d2f4a718a88089238522ec8 '17': constantValue: system:time_start '18': diff --git a/tests/test_ImageCollection/serialized_test_reduce_regions_by_doy.yml b/tests/test_ImageCollection/serialized_test_reduce_regions_by_doy.yml index 5783a1e3..cc0daf9f 100644 --- a/tests/test_ImageCollection/serialized_test_reduce_regions_by_doy.yml +++ b/tests/test_ImageCollection/serialized_test_reduce_regions_by_doy.yml @@ -202,7 +202,7 @@ values: functionName: Date.format functionName: Element.set '16': - constantValue: c19b6b6af0604502ad4a5bd640e25f9e + constantValue: 259e4b9943d948a290d6e00844977ed9 '17': constantValue: system:time_start '18': 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' diff --git a/tests/test_ImageCollection/test_to_xarray.yml b/tests/test_ImageCollection/test_to_xarray.yml index aaf97ad7..0c73e431 100644 --- a/tests/test_ImageCollection/test_to_xarray.yml +++ b/tests/test_ImageCollection/test_to_xarray.yml @@ -217,7 +217,7 @@ coords: attrs: {} dims: - time - dtype: datetime64[ns] + dtype: datetime64[ms] shape: - 2449 data_vars: