From d04fcf4e4b464868a77a0a58d3569c54e3350499 Mon Sep 17 00:00:00 2001 From: Emile Sonneveld Date: Fri, 28 Jun 2024 13:25:40 +0200 Subject: [PATCH] Fix to make tests run on Jenkins. https://github.com/Open-EO/openeo-geotrellis-extensions/issues/279 --- .../geotrellis/layers/FileLayerProvider.scala | 10 +- .../geotrellis/testMissingS2DateLine.json | 569 ++++++++++++++++++ .../org/openeo/geotrellis/LayerFixtures.scala | 31 + .../layers/FileLayerProviderTest.scala | 18 +- pom.xml | 2 +- 5 files changed, 617 insertions(+), 13 deletions(-) create mode 100644 openeo-geotrellis/src/test/resources/org/openeo/geotrellis/testMissingS2DateLine.json diff --git a/openeo-geotrellis/src/main/scala/org/openeo/geotrellis/layers/FileLayerProvider.scala b/openeo-geotrellis/src/main/scala/org/openeo/geotrellis/layers/FileLayerProvider.scala index e9febc48..9ab0332d 100644 --- a/openeo-geotrellis/src/main/scala/org/openeo/geotrellis/layers/FileLayerProvider.scala +++ b/openeo-geotrellis/src/main/scala/org/openeo/geotrellis/layers/FileLayerProvider.scala @@ -1243,13 +1243,11 @@ class FileLayerProvider private(openSearch: OpenSearchClient, openSearchCollecti * - if feature is in utm, target extent may be invalid in feature crs * this is why we take intersection */ - val commonCRS = targetExtent.crs - val targetExtentInCommonCRS = targetExtent.reproject(commonCRS) - val featureExtentInCommonCRS = feature.rasterExtent.get.reproject(feature.crs.get, commonCRS) + val featureExtentInTargetCRS = feature.rasterExtent.get.reproject(feature.crs.get, targetExtent.crs) - val intersection = featureExtentInCommonCRS.intersection(targetExtentInCommonCRS).map(_.buffer(1.0)) - .getOrElse(featureExtentInCommonCRS) - val tmp = expandToCellSize(intersection.reproject(commonCRS, targetExtent.crs), theResolution) + val intersection = featureExtentInTargetCRS.intersection(targetExtent.extent).map(_.buffer(1.0)) + .getOrElse(featureExtentInTargetCRS) + val tmp = expandToCellSize(intersection, theResolution) val alignedToTargetExtent = re.createAlignedRasterExtent(tmp) Some(alignedToTargetExtent.toGridType[Long]) diff --git a/openeo-geotrellis/src/test/resources/org/openeo/geotrellis/testMissingS2DateLine.json b/openeo-geotrellis/src/test/resources/org/openeo/geotrellis/testMissingS2DateLine.json new file mode 100644 index 00000000..5e72a6ca --- /dev/null +++ b/openeo-geotrellis/src/test/resources/org/openeo/geotrellis/testMissingS2DateLine.json @@ -0,0 +1,569 @@ +{ + "type": "FeatureCollection", + "properties": { + "id": "7c6f676b-ea06-5f51-bd17-70a38f7ff1d2", + "totalResults": null, + "exactCount": 0, + "startIndex": 1, + "itemsPerPage": 1000, + "query": { + "originalFilters": { + "box": "178.72633867329634,70.76628200377719,178.866724486903,70.82813491803448", + "status": "ONLINE", + "dataset": "ESA-DATASET", + "startDate": "2024-04-02T00:00:00Z", + "completionDate": "2024-04-03T00:00:00Z", + "collection": "SENTINEL-2" + }, + "appliedFilters": { + "box": "178.72633867329634,70.76628200377719,178.866724486903,70.82813491803448", + "status": "ONLINE", + "dataset": "ESA-DATASET", + "startDate": "2024-04-02T00:00:00Z", + "completionDate": "2024-04-03T00:00:00Z", + "collection": "SENTINEL-2" + }, + "processingTime": 0.118192746 + }, + "links": [ + { + "rel": "self", + "type": "application/json", + "title": "self", + "href": "https://catalogue.dataspace.copernicus.eu/resto/api/collections/Sentinel2/search.json?box=178.72633867329634%2C70.76628200377719%2C178.866724486903%2C70.82813491803448&page=1&maxRecords=1000&status=ONLINE&dataset=ESA-DATASET&startDate=2024-04-02T00%3A00%3A00Z&completionDate=2024-04-03T00%3A00%3A00Z" + }, + { + "rel": "search", + "type": "application/opensearchdescription+xml", + "title": "OpenSearch Description Document", + "href": "https://catalogue.dataspace.copernicus.eu/resto/api/collections/Sentinel2/describe.xml" + } + ] + }, + "features": [ + { + "type": "Feature", + "id": "a6cdb338-1ab4-447b-abdd-78cde56927a4", + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + 180, + 70.8418254254962 + ], + [ + 179.9040632080704, + 70.19484288998889 + ], + [ + 176.9994705028295, + 70.21832076563753 + ], + [ + 176.9994518989893, + 70.90607981912203 + ], + [ + 177.0133971094673, + 70.91645944454088 + ], + [ + 177.199839761927, + 71.05302740049166 + ], + [ + 177.2061930151708, + 71.05760818625669 + ], + [ + 177.3903933490624, + 71.19021030698168 + ], + [ + 177.4035927539655, + 71.19955639631998 + ], + [ + 180, + 71.17844481285532 + ], + [ + 180, + 70.8418254254962 + ] + ] + ], + [ + [ + [ + -180, + 71.17844481285532 + ], + [ + -179.95015, + 71.1780394383418 + ], + [ + -180, + 70.8418254254962 + ], + [ + -180, + 71.17844481285532 + ] + ] + ] + ] + }, + "properties": { + "collection": "SENTINEL-2", + "status": "ONLINE", + "license": { + "licenseId": "unlicensed", + "hasToBeSigned": "never", + "grantedCountries": null, + "grantedOrganizationCountries": null, + "grantedFlags": null, + "viewService": "public", + "signatureQuota": -1, + "description": { + "shortName": "No license" + } + }, + "parentIdentifier": null, + "title": "S2B_MSIL1C_20240402T000609_N0510_R016_T60WWD_20240402T001958.SAFE", + "description": "The Copernicus Sentinel-2 mission consists of two polar-orbiting satellites that are positioned in the same sun-synchronous orbit, with a phase difference of 180. It aims to monitor changes in land surface conditions. The satellites have a wide swath width (290 km) and a high revisit time. Sentinel-2 is equipped with an optical instrument payload that samples 13 spectral bands: four bands at 10 m, six bands at 20 m and three bands at 60 m spatial resolution [https://dataspace.copernicus.eu/explore-data/data-collections/sentinel-data/sentinel-2].", + "organisationName": null, + "startDate": "2024-04-02T00:06:09.024Z", + "completionDate": "2024-04-02T00:06:09.024Z", + "productType": "S2MSI1C", + "processingLevel": "S2MSI1C", + "platform": "S2B", + "instrument": "MSI", + "resolution": 0, + "sensorMode": "INS-NOBS", + "orbitNumber": 36936, + "quicklook": null, + "thumbnail": "https://catalogue.dataspace.copernicus.eu/get-object?path=/Sentinel-2/MSI/L1C/2024/04/02/S2B_MSIL1C_20240402T000609_N0510_R016_T60WWD_20240402T001958.SAFE/S2B_MSIL1C_20240402T000609_N0510_R016_T60WWD_20240402T001958-ql.jpg", + "updated": "2024-04-02T01:07:35.742Z", + "published": "2024-04-02T01:05:49.640Z", + "snowCover": 0, + "cloudCover": 79.515270411362, + "gmlgeometry": "180.0,70.8418254254962 179.90406320807,70.1948428899889 176.999470502829,70.2183207656375 176.999451898989,70.906079819122 177.013397109467,70.9164594445409 177.199839761927,71.0530274004917 177.206193015171,71.0576081862567 177.390393349062,71.1902103069817 177.403592753966,71.19955639632 180.0,71.1784448128553 180.0,70.8418254254962-180,71.1784448128553 -179.95015,71.1780394383418 -180,70.8418254254962 -180,71.1784448128553", + "centroid": { + "type": "Point", + "coordinates": [ + 177.464743426394, + 70.6942065367668 + ] + }, + "productIdentifier": "/eodata/Sentinel-2/MSI/L1C/2024/04/02/S2B_MSIL1C_20240402T000609_N0510_R016_T60WWD_20240402T001958.SAFE", + "orbitDirection": null, + "timeliness": null, + "relativeOrbitNumber": 16, + "processingBaseline": 5.1, + "missionTakeId": "GS2B_20240402T000609_036936_N05.10", + "services": { + "download": { + "url": "https://catalogue.dataspace.copernicus.eu/download/a6cdb338-1ab4-447b-abdd-78cde56927a4", + "mimeType": "application/octet-stream", + "size": 748892301 + } + }, + "links": [ + { + "rel": "self", + "type": "application/json", + "title": "GeoJSON link for a6cdb338-1ab4-447b-abdd-78cde56927a4", + "href": "https://catalogue.dataspace.copernicus.eu/resto/collections/SENTINEL-2/a6cdb338-1ab4-447b-abdd-78cde56927a4.json" + } + ] + } + }, + { + "type": "Feature", + "id": "4fe42670-54fb-4e66-8ea5-f13ed74c394d", + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -180, + 71.1754685740731 + ], + [ + -179.50662, + 71.18609391597852 + ], + [ + -179.38673, + 70.20246735196007 + ], + [ + -180, + 70.1893406780604 + ], + [ + -180, + 71.1754685740731 + ] + ] + ], + [ + [ + [ + 180, + 70.1893406780604 + ], + [ + 177.7191700376, + 70.14052089926992 + ], + [ + 177.4551847198166, + 71.12066368510631 + ], + [ + 180, + 71.1754685740731 + ], + [ + 180, + 70.1893406780604 + ] + ] + ] + ] + }, + "properties": { + "collection": "SENTINEL-2", + "status": "ONLINE", + "license": { + "licenseId": "unlicensed", + "hasToBeSigned": "never", + "grantedCountries": null, + "grantedOrganizationCountries": null, + "grantedFlags": null, + "viewService": "public", + "signatureQuota": -1, + "description": { + "shortName": "No license" + } + }, + "parentIdentifier": null, + "title": "S2B_MSIL1C_20240402T000609_N0510_R016_T01WCU_20240402T001958.SAFE", + "description": "The Copernicus Sentinel-2 mission consists of two polar-orbiting satellites that are positioned in the same sun-synchronous orbit, with a phase difference of 180. It aims to monitor changes in land surface conditions. The satellites have a wide swath width (290 km) and a high revisit time. Sentinel-2 is equipped with an optical instrument payload that samples 13 spectral bands: four bands at 10 m, six bands at 20 m and three bands at 60 m spatial resolution [https://dataspace.copernicus.eu/explore-data/data-collections/sentinel-data/sentinel-2].", + "organisationName": null, + "startDate": "2024-04-02T00:06:09.024Z", + "completionDate": "2024-04-02T00:06:09.024Z", + "productType": "S2MSI1C", + "processingLevel": "S2MSI1C", + "platform": "S2B", + "instrument": "MSI", + "resolution": 0, + "sensorMode": "INS-NOBS", + "orbitNumber": 36936, + "quicklook": null, + "thumbnail": "https://catalogue.dataspace.copernicus.eu/get-object?path=/Sentinel-2/MSI/L1C/2024/04/02/S2B_MSIL1C_20240402T000609_N0510_R016_T01WCU_20240402T001958.SAFE/S2B_MSIL1C_20240402T000609_N0510_R016_T01WCU_20240402T001958-ql.jpg", + "updated": "2024-04-02T01:09:53.787Z", + "published": "2024-04-02T01:08:08.468Z", + "snowCover": 0, + "cloudCover": 84.510346681, + "gmlgeometry": "-180,71.1754685740731 -179.50662,71.1860939159785 -179.38673,70.2024673519601 -180,70.1893406780604 -180,71.1754685740731180.0,70.1893406780604 177.7191700376,70.1405208992699 177.455184719817,71.1206636851063 180.0,71.1754685740731 180.0,70.1893406780604", + "centroid": { + "type": "Point", + "coordinates": [ + 111.902011001716, + 70.6664156555398 + ] + }, + "productIdentifier": "/eodata/Sentinel-2/MSI/L1C/2024/04/02/S2B_MSIL1C_20240402T000609_N0510_R016_T01WCU_20240402T001958.SAFE", + "orbitDirection": null, + "timeliness": null, + "relativeOrbitNumber": 16, + "processingBaseline": 5.1, + "missionTakeId": "GS2B_20240402T000609_036936_N05.10", + "services": { + "download": { + "url": "https://catalogue.dataspace.copernicus.eu/download/4fe42670-54fb-4e66-8ea5-f13ed74c394d", + "mimeType": "application/octet-stream", + "size": 762837400 + } + }, + "links": [ + { + "rel": "self", + "type": "application/json", + "title": "GeoJSON link for 4fe42670-54fb-4e66-8ea5-f13ed74c394d", + "href": "https://catalogue.dataspace.copernicus.eu/resto/collections/SENTINEL-2/4fe42670-54fb-4e66-8ea5-f13ed74c394d.json" + } + ] + } + }, + { + "type": "Feature", + "id": "b25acc88-80ce-49b7-b625-6ac6688275a5", + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + 180, + 70.8418254254962 + ], + [ + 179.9040632080704, + 70.19484288998889 + ], + [ + 176.9994705028295, + 70.21832076563753 + ], + [ + 176.9994518989893, + 70.90607981912203 + ], + [ + 177.0133971094673, + 70.91645944454088 + ], + [ + 177.199839761927, + 71.05302740049166 + ], + [ + 177.2061930151708, + 71.05760818625669 + ], + [ + 177.3903933490624, + 71.19021030698168 + ], + [ + 177.4035927539655, + 71.19955639631998 + ], + [ + 180, + 71.17844481285532 + ], + [ + 180, + 70.8418254254962 + ] + ] + ], + [ + [ + [ + -180, + 71.17844481285532 + ], + [ + -179.95015, + 71.1780394383418 + ], + [ + -180, + 70.8418254254962 + ], + [ + -180, + 71.17844481285532 + ] + ] + ] + ] + }, + "properties": { + "collection": "SENTINEL-2", + "status": "ONLINE", + "license": { + "licenseId": "unlicensed", + "hasToBeSigned": "never", + "grantedCountries": null, + "grantedOrganizationCountries": null, + "grantedFlags": null, + "viewService": "public", + "signatureQuota": -1, + "description": { + "shortName": "No license" + } + }, + "parentIdentifier": null, + "title": "S2B_MSIL2A_20240402T000609_N0510_R016_T60WWD_20240402T003652.SAFE", + "description": "The Copernicus Sentinel-2 mission consists of two polar-orbiting satellites that are positioned in the same sun-synchronous orbit, with a phase difference of 180. It aims to monitor changes in land surface conditions. The satellites have a wide swath width (290 km) and a high revisit time. Sentinel-2 is equipped with an optical instrument payload that samples 13 spectral bands: four bands at 10 m, six bands at 20 m and three bands at 60 m spatial resolution [https://dataspace.copernicus.eu/explore-data/data-collections/sentinel-data/sentinel-2].", + "organisationName": null, + "startDate": "2024-04-02T00:06:09.024Z", + "completionDate": "2024-04-02T00:06:09.024Z", + "productType": "S2MSI2A", + "processingLevel": "S2MSI2A", + "platform": "S2B", + "instrument": "MSI", + "resolution": 0, + "sensorMode": "INS-NOBS", + "orbitNumber": 36936, + "quicklook": null, + "thumbnail": "https://catalogue.dataspace.copernicus.eu/get-object?path=/Sentinel-2/MSI/L2A/2024/04/02/S2B_MSIL2A_20240402T000609_N0510_R016_T60WWD_20240402T003652.SAFE/S2B_MSIL2A_20240402T000609_N0510_R016_T60WWD_20240402T003652-ql.jpg", + "updated": "2024-04-02T01:53:23.144Z", + "published": "2024-04-02T01:52:55.925Z", + "snowCover": 0, + "cloudCover": 82.784283, + "gmlgeometry": "180.0,70.8418254254962 179.90406320807,70.1948428899889 176.999470502829,70.2183207656375 176.999451898989,70.906079819122 177.013397109467,70.9164594445409 177.199839761927,71.0530274004917 177.206193015171,71.0576081862567 177.390393349062,71.1902103069817 177.403592753966,71.19955639632 180.0,71.1784448128553 180.0,70.8418254254962-180,71.1784448128553 -179.95015,71.1780394383418 -180,70.8418254254962 -180,71.1784448128553", + "centroid": { + "type": "Point", + "coordinates": [ + 177.464743426394, + 70.6942065367668 + ] + }, + "productIdentifier": "/eodata/Sentinel-2/MSI/L2A/2024/04/02/S2B_MSIL2A_20240402T000609_N0510_R016_T60WWD_20240402T003652.SAFE", + "orbitDirection": null, + "timeliness": null, + "relativeOrbitNumber": 16, + "processingBaseline": 5.1, + "missionTakeId": "GS2B_20240402T000609_036936_N05.10", + "services": { + "download": { + "url": "https://catalogue.dataspace.copernicus.eu/download/b25acc88-80ce-49b7-b625-6ac6688275a5", + "mimeType": "application/octet-stream", + "size": 940045162 + } + }, + "links": [ + { + "rel": "self", + "type": "application/json", + "title": "GeoJSON link for b25acc88-80ce-49b7-b625-6ac6688275a5", + "href": "https://catalogue.dataspace.copernicus.eu/resto/collections/SENTINEL-2/b25acc88-80ce-49b7-b625-6ac6688275a5.json" + } + ] + } + }, + { + "type": "Feature", + "id": "c164d927-d2a6-4a4f-a432-8f5b451b5f06", + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -180, + 71.1754685740731 + ], + [ + -179.50662, + 71.18609391597852 + ], + [ + -179.38673, + 70.20246735196007 + ], + [ + -180, + 70.1893406780604 + ], + [ + -180, + 71.1754685740731 + ] + ] + ], + [ + [ + [ + 180, + 70.1893406780604 + ], + [ + 177.7191700376, + 70.14052089926992 + ], + [ + 177.4551847198166, + 71.12066368510631 + ], + [ + 180, + 71.1754685740731 + ], + [ + 180, + 70.1893406780604 + ] + ] + ] + ] + }, + "properties": { + "collection": "SENTINEL-2", + "status": "ONLINE", + "license": { + "licenseId": "unlicensed", + "hasToBeSigned": "never", + "grantedCountries": null, + "grantedOrganizationCountries": null, + "grantedFlags": null, + "viewService": "public", + "signatureQuota": -1, + "description": { + "shortName": "No license" + } + }, + "parentIdentifier": null, + "title": "S2B_MSIL2A_20240402T000609_N0510_R016_T01WCU_20240402T003652.SAFE", + "description": "The Copernicus Sentinel-2 mission consists of two polar-orbiting satellites that are positioned in the same sun-synchronous orbit, with a phase difference of 180. It aims to monitor changes in land surface conditions. The satellites have a wide swath width (290 km) and a high revisit time. Sentinel-2 is equipped with an optical instrument payload that samples 13 spectral bands: four bands at 10 m, six bands at 20 m and three bands at 60 m spatial resolution [https://dataspace.copernicus.eu/explore-data/data-collections/sentinel-data/sentinel-2].", + "organisationName": null, + "startDate": "2024-04-02T00:06:09.024Z", + "completionDate": "2024-04-02T00:06:09.024Z", + "productType": "S2MSI2A", + "processingLevel": "S2MSI2A", + "platform": "S2B", + "instrument": "MSI", + "resolution": 0, + "sensorMode": "INS-NOBS", + "orbitNumber": 36936, + "quicklook": null, + "thumbnail": "https://catalogue.dataspace.copernicus.eu/get-object?path=/Sentinel-2/MSI/L2A/2024/04/02/S2B_MSIL2A_20240402T000609_N0510_R016_T01WCU_20240402T003652.SAFE/S2B_MSIL2A_20240402T000609_N0510_R016_T01WCU_20240402T003652-ql.jpg", + "updated": "2024-04-02T01:53:17.222Z", + "published": "2024-04-02T01:52:50.903Z", + "snowCover": 0, + "cloudCover": 88.21907, + "gmlgeometry": "-180,71.1754685740731 -179.50662,71.1860939159785 -179.38673,70.2024673519601 -180,70.1893406780604 -180,71.1754685740731180.0,70.1893406780604 177.7191700376,70.1405208992699 177.455184719817,71.1206636851063 180.0,71.1754685740731 180.0,70.1893406780604", + "centroid": { + "type": "Point", + "coordinates": [ + 111.902011001716, + 70.6664156555398 + ] + }, + "productIdentifier": "/eodata/Sentinel-2/MSI/L2A/2024/04/02/S2B_MSIL2A_20240402T000609_N0510_R016_T01WCU_20240402T003652.SAFE", + "orbitDirection": null, + "timeliness": null, + "relativeOrbitNumber": 16, + "processingBaseline": 5.1, + "missionTakeId": "GS2B_20240402T000609_036936_N05.10", + "services": { + "download": { + "url": "https://catalogue.dataspace.copernicus.eu/download/c164d927-d2a6-4a4f-a432-8f5b451b5f06", + "mimeType": "application/octet-stream", + "size": 938587592 + } + }, + "links": [ + { + "rel": "self", + "type": "application/json", + "title": "GeoJSON link for c164d927-d2a6-4a4f-a432-8f5b451b5f06", + "href": "https://catalogue.dataspace.copernicus.eu/resto/collections/SENTINEL-2/c164d927-d2a6-4a4f-a432-8f5b451b5f06.json" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/openeo-geotrellis/src/test/scala/org/openeo/geotrellis/LayerFixtures.scala b/openeo-geotrellis/src/test/scala/org/openeo/geotrellis/LayerFixtures.scala index 53738852..f055b02a 100644 --- a/openeo-geotrellis/src/test/scala/org/openeo/geotrellis/LayerFixtures.scala +++ b/openeo-geotrellis/src/test/scala/org/openeo/geotrellis/LayerFixtures.scala @@ -372,6 +372,26 @@ object LayerFixtures { // Use artifactory to avoid heavy git repo val basePathArtifactory = "https://artifactory.vgt.vito.be/artifactory/testdata-public" + /* + To upload new files; + - mount /eodata + - change openeo-opensearch-client to use fs instead of s3 + - run this Python script, and copy the printed paths here: +root = Path("/tmp/EODATA/") +l = set(filter(lambda p: p.is_file(), root.rglob("*.*"))) +l = {f for f in l if os.stat(f).st_size > 0} +l = set(map(lambda p: os.path.relpath(p, root), l)) +for p in l: + cmd = f'curl -uemile.sonneveld:AP3jM7RGcG15i7FWdZC2WN2ynp3 -T {root / p} "https://artifactory.vgt.vito.be/artifactory/testdata-public/eodata/{p}"' + print(cmd) + code = os.system(cmd) + if code != 0: + raise Exception("Failed: " + cmd) +print("\n") +for p in l: + print(f'"/eodata/{p}",') + */ + val artifactoryPaths = Set( "/eodata/Sentinel-2/MSI/L2A/2023/01/17/S2B_MSIL2A_20230117T104259_N0509_R008_T31UGS_20230117T120337.SAFE/manifest.safe", "/eodata/Sentinel-2/MSI/L2A/2023/01/17/S2B_MSIL2A_20230117T104259_N0509_R008_T31UGS_20230117T120337.SAFE/MTD_MSIL2A.xml", @@ -406,6 +426,17 @@ object LayerFixtures { "/eodata/Sentinel-2/MSI/L2A/2024/03/24/S2B_MSIL2A_20240324T230529_N0510_R044_T04WDD_20240324T234241.SAFE/GRANULE/L2A_T04WDD_A036821_20240324T230529/MTD_TL.xml", "/eodata/Sentinel-2/MSI/L2A/2024/03/24/S2B_MSIL2A_20240324T230529_N0510_R044_T04WDD_20240324T234241.SAFE/manifest.safe", "/eodata/Sentinel-2/MSI/L2A/2024/03/24/S2B_MSIL2A_20240324T230529_N0510_R044_T04WDD_20240324T234241.SAFE/MTD_MSIL2A.xml", + // testMissingS2DateLine + "/eodata/Sentinel-2/MSI/L2A/2024/04/02/S2B_MSIL2A_20240402T000609_N0510_R016_T01WCU_20240402T003652.SAFE/manifest.safe", + "/eodata/Sentinel-2/MSI/L2A/2024/04/02/S2B_MSIL2A_20240402T000609_N0510_R016_T01WCU_20240402T003652.SAFE/MTD_MSIL2A.xml", + "/eodata/Sentinel-2/MSI/L2A/2024/04/02/S2B_MSIL2A_20240402T000609_N0510_R016_T60WWD_20240402T003652.SAFE/MTD_MSIL2A.xml", + "/eodata/Sentinel-2/MSI/L1C/2024/04/02/S2B_MSIL1C_20240402T000609_N0510_R016_T01WCU_20240402T001958.SAFE/manifest.safe", + "/eodata/Sentinel-2/MSI/L1C/2024/04/02/S2B_MSIL1C_20240402T000609_N0510_R016_T01WCU_20240402T001958.SAFE/MTD_MSIL1C.xml", + "/eodata/Sentinel-2/MSI/L2A/2024/04/02/S2B_MSIL2A_20240402T000609_N0510_R016_T60WWD_20240402T003652.SAFE/GRANULE/L2A_T60WWD_A036936_20240402T000609/IMG_DATA/R20m/T60WWD_20240402T000609_SCL_20m.jp2", + "/eodata/Sentinel-2/MSI/L1C/2024/04/02/S2B_MSIL1C_20240402T000609_N0510_R016_T60WWD_20240402T001958.SAFE/MTD_MSIL1C.xml", + "/eodata/Sentinel-2/MSI/L1C/2024/04/02/S2B_MSIL1C_20240402T000609_N0510_R016_T60WWD_20240402T001958.SAFE/manifest.safe", + "/eodata/Sentinel-2/MSI/L2A/2024/04/02/S2B_MSIL2A_20240402T000609_N0510_R016_T01WCU_20240402T003652.SAFE/GRANULE/L2A_T01WCU_A036936_20240402T000609/IMG_DATA/R20m/T01WCU_20240402T000609_SCL_20m.jp2", + "/eodata/Sentinel-2/MSI/L2A/2024/04/02/S2B_MSIL2A_20240402T000609_N0510_R016_T60WWD_20240402T003652.SAFE/manifest.safe", ) for (path <- artifactoryPaths) { diff --git a/openeo-geotrellis/src/test/scala/org/openeo/geotrellis/layers/FileLayerProviderTest.scala b/openeo-geotrellis/src/test/scala/org/openeo/geotrellis/layers/FileLayerProviderTest.scala index 648fdeba..942186ac 100644 --- a/openeo-geotrellis/src/test/scala/org/openeo/geotrellis/layers/FileLayerProviderTest.scala +++ b/openeo-geotrellis/src/test/scala/org/openeo/geotrellis/layers/FileLayerProviderTest.scala @@ -1076,7 +1076,7 @@ class FileLayerProviderTest extends RasterMatchers{ cubeSpatial.writeGeoTiff("tmp/testPixelValueOffsetNeededCorner.tiff") val arr = cubeSpatial.collect().array assertTrue(isNoData(arr(1)._2.toArrayTile().band(0).get(162, 250))) - assertEquals(172, arr(0)._2.toArrayTile().band(0).get(5, 5), 1) + assertEquals(187, arr(0)._2.toArrayTile().band(0).get(160, 5), 1) } @Test @@ -1091,7 +1091,7 @@ class FileLayerProviderTest extends RasterMatchers{ cubeSpatial.writeGeoTiff("tmp/testPixelValueOffsetNeededDark.tiff") val band = cubeSpatial.collect().array(0)._2.toArrayTile().band(0) - assertEquals(888, band.get(0, 0), 1) + assertEquals(682, band.get(20, 140), 1) assertEquals(-582, band.get(133, 151), 1) } @@ -1141,16 +1141,22 @@ class FileLayerProviderTest extends RasterMatchers{ new Directory(outDir.toFile).deepFiles.foreach(_.delete()) Files.createDirectories(outDir) - val dateFrom = ZonedDateTime.parse("2024-04-02T00:00:00Z") - val dateTo = ZonedDateTime.parse("2024-04-03T00:00:00Z") - val extent = Extent(178.7384, 70.769, 178.8548, 70.8254) val projected_polygons_native_crs = ProjectedPolygons.fromExtent(extent, LatLng.proj4jCrs.toString) val utmCrs = CRS.fromName(crsName) val reprojected = projected_polygons_native_crs.polygons.head.reproject(projected_polygons_native_crs.crs, utmCrs) val poly2 = ProjectedPolygons(Array(reprojected), utmCrs) - val layer = LayerFixtures.sentinel2CubeCDSEGeneric((dateFrom, dateTo), poly2, bandNames = java.util.Arrays.asList("IMG_DATA_Band_SCL_20m_Tile1_Data")) + val jsonPath = "/org/openeo/geotrellis/testMissingS2DateLine.json" + + + val bandNames = java.util.Arrays.asList("IMG_DATA_Band_SCL_20m_Tile1_Data") + + val layer = LayerFixtures.sentinel2Cube( + LocalDate.of(2024, 4, 2), poly2, jsonPath, + new DataCubeParameters, + bandNames, + ) val layer_collected = layer.collect() assert(layer_collected.nonEmpty) diff --git a/pom.xml b/pom.xml index f8a33caf..90804d68 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,7 @@ geotrellis-accumulo-extensions geotrellis-s3-extensions - + geotrellis-sentinelhub geotrellis-extensions geotrellis-seeder openeo-geotrellis