Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copernicus Data Space Ecosystem #583

Closed
nekicier opened this issue Jan 26, 2023 · 55 comments
Closed

Copernicus Data Space Ecosystem #583

nekicier opened this issue Jan 26, 2023 · 55 comments
Labels
discussion scihub-replacement Questions related to the replacement of the discontinued Copernicus Open Access Hub

Comments

@nekicier
Copy link

nekicier commented Jan 26, 2023

Hello,
Here is a news from ESA which announce the interruption of service of Copernicus Data Hub at September 2023.
https://scihub.copernicus.eu/news/News01146

Is it schedule to sentinelsat to switch to the new service Data Space Ecosystem ?
Thanks for the anwser.

Best
Nicolas

@j08lue
Copy link
Contributor

j08lue commented Jan 26, 2023

As far as I know, the new Copernicus Data Space Ecosystem uses very different data discovery and distribution mechanisms:

  1. You will be able to discover the data via standard STAC (no more need for client libraries for bespoke APIs, like Sentinelsat)
  2. And access all the data in the cloud (T-Systems or CreoDIAS, I suppose) as well as in data-proximate services (JupyterHub, openEO, etc).

Not sure how the support for good old file download will look like. CreoDIAS Finder has that option and maybe that will stay around. Anyone know when Copernicus Open Access Hub (aka SciHub) will be decommissioned?

A lot of the logic of Sentinelsat will become obsolete when we no longer need to jump through hoops to pull single files out of Copernicus' nose (e.g. the whole Long Term Archive access misery). In a way, it is weird that we needed a community-developed client library for properly making use of the most basic functionality of the Copernicus API, because their own clients were insufficient.

Maybe there will be enough interest and someone willing to create a new client library that implements Sentinelsat's API and metadata format against the new official Copernicus services. I hope though that the new services will lend themselves better to standard tooling and more people will be able to use data-proximate compute.

@j08lue
Copy link
Contributor

j08lue commented Feb 2, 2023

The new discovery (and download) APIs feature OData and OpenSearch interfaces. https://documentation.dataspace.copernicus.eu/#/APIs

The data returned by both follows the same schema and is valid GeoJSON.

Download links point at https://zipper.creodias.eu - product contents are gathered from object storage and zipped before shipping.

{
"type": "FeatureCollection",
"properties": {
"id": "83a3744f-d43e-5ead-be06-0e40533d3a1a",
"totalResults": 416859,
"exactCount": true,
"startIndex": 1,
"itemsPerPage": 1,
"query": {
"originalFilters": {
"collection": "Sentinel2",
"sortParam": "startDate",
"maxRecords": "1"
},
"appliedFilters": {
"collection": "Sentinel2",
"sortParam": "startDate",
"maxRecords": "1"
},
"processingTime": 4.939621241
},
"links": [
{
"rel": "self",
"type": "application/json",
"title": "self",
"href": "http://catalogue.dataspace.copernicus.eu/resto/api/collections/Sentinel2/search.json?startDate=2021-07-01&completionDate=2021-07-31&sortParam=startDate&maxRecords=1"
},
{
"rel": "search",
"type": "application/opensearchdescription+xml",
"title": "OpenSearch Description Document",
"href": "http://catalogue.dataspace.copernicus.eu/resto/api/collections/Sentinel2/describe.xml"
},
{
"rel": "next",
"type": "application/json",
"title": "next",
"href": "http://catalogue.dataspace.copernicus.eu/resto/api/collections/Sentinel2/search.json?page=2&startDate=2021-07-01&completionDate=2021-07-31&sortParam=startDate&maxRecords=1"
},
{
"rel": "last",
"type": "application/json",
"title": "last",
"href": "http://catalogue.dataspace.copernicus.eu/resto/api/collections/Sentinel2/search.json?page=416859&startDate=2021-07-01&completionDate=2021-07-31&sortParam=startDate&maxRecords=1"
}
]
},
"features": [
{
"type": "Feature",
"id": "033d1996-57a5-5787-b76c-11ebda56774a",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-126.62152,
76.56115660434
],
[
-126.6219,
76.561079263695
],
[
-127.09917,
76.459685917284
],
[
-127.569916,
76.357466825105
],
[
-128.0344,
76.254413536922
],
[
-128.49226,
76.150491401071
],
[
-128.9438,
76.045833401294
],
[
-129.00075,
76.032329963613
],
[
-129.00078,
76.581028747004
],
[
-126.62152,
76.56115660434
]
]
]
},
"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"
}
},
"productIdentifier": "[/eodata/Sentinel-2/MSI/L1C/2021/06/30/S2B_MSIL1C_20210630T220059_N0301_R072_T09XWE_20210630T222928.SAFE](https://catalogue.dataspace.copernicus.eu/eodata/Sentinel-2/MSI/L1C/2021/06/30/S2B_MSIL1C_20210630T220059_N0301_R072_T09XWE_20210630T222928.SAFE)",
"parentIdentifier": null,
"title": "S2B_MSIL1C_20210630T220059_N0301_R072_T09XWE_20210630T222928.SAFE",
"description": null,
"organisationName": "ESA",
"startDate": "2021-06-30T22:00:59.024Z",
"completionDate": "2021-06-30T22:00:59.024Z",
"productType": "S2MSI1C",
"processingLevel": "S2MSI1C",
"platform": "S2B",
"instrument": "MSI",
"resolution": 60,
"sensorMode": "INS-NOBS",
"orbitNumber": 22549,
"quicklook": null,
"thumbnail": "https://finder.creodias.eu/files/Sentinel-2/MSI/L1C/2021/06/30/S2B_MSIL1C_20210630T220059_N0301_R072_T09XWE_20210630T222928.SAFE/S2B_MSIL1C_20210630T220059_N0301_R072_T09XWE_20210630T222928-ql.jpg",
"updated": "2021-07-01T00:34:30.516Z",
"published": "2021-07-01T00:34:30.516Z",
"snowCover": 0,
"cloudCover": 11.0645,
"gmlgeometry": "<gml:Polygon srsName=\"EPSG:4326\"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-126.62152,76.56115660434 -126.6219,76.561079263695 -127.09917,76.459685917284 -127.569916,76.357466825105 -128.0344,76.254413536922 -128.49226,76.150491401071 -128.9438,76.045833401294 -129.00075,76.032329963613 -129.00078,76.581028747004 -126.62152,76.56115660434</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>",
"centroid": {
"type": "Point",
"coordinates": [
-128.21454713163658,
76.39319815863165
]
},
"orbitDirection": "ASCENDING",
"timeliness": null,
"relativeOrbitNumber": 72,
"processingBaseline": 3.01,
"missionTakeId": "GS2B_20210630T220059_022549_N03.01",
"services": {
"download": {
"url": "https://zipper.creodias.eu/download/033d1996-57a5-5787-b76c-11ebda56774a",
"mimeType": "application/octet-stream",
"size": 0
}
},
"links": [
{
"rel": "self",
"type": "application/json",
"title": "GeoJSON link for 033d1996-57a5-5787-b76c-11ebda56774a",
"href": "http://catalogue.dataspace.copernicus.eu/resto/collections/SENTINEL-2/033d1996-57a5-5787-b76c-11ebda56774a.json"
}
]
}
}
]
}

@fwfichtner
Copy link
Contributor

Because you asked when the Copernicus Open Access Hub (aka SciHub) will be decommissioned, that is planned for June 2023: https://scihub.copernicus.eu/news/News01146

@EmanuelCastanho
Copy link

Has anyone started or is interested in getting started on a Python package that uses the new Copernicus Data Space Ecosystem OData API?

I would like to contribute :)

@j08lue
Copy link
Contributor

j08lue commented Mar 6, 2023

Here is a minimalist lib for the CreoDIAS Finder OpenSearch API: https://github.com/DHI-GRAS/creodias-finder - very quickly hacked together once, but maybe you can salvage some parts. OData seems to be recommended, though.

@Squiccio
Copy link

Squiccio commented Mar 7, 2023

Good morning, i'm a user of Sentinelsat tool that helped me many times in searching and downloading, in an automatic way, a lot of sentinel data. I really hope that i will be able to use it on the new ecosystem, when the actual hub will be disabled. I'm hot a developer and so i hope that someone will help people like me to reach this goal. Thanks to everyone

@fwfichtner
Copy link
Contributor

I have not used it myself, but also eodag does support it in the recent version: https://github.com/CS-SI/eodag/releases/tag/v2.9.1

@EmanuelCastanho
Copy link

Thank you @fwfichtner , I need to test that, it looks like a real powerful tool.

@fpl
Copy link

fpl commented May 27, 2023

The new discovery (and download) APIs feature OData and OpenSearch interfaces. https://documentation.dataspace.copernicus.eu/#/APIs

The data returned by both follows the same schema and is valid GeoJSON.

Download links point at https://zipper.creodias.eu - product contents are gathered from object storage and zipped before shipping.

On the basis of the documentation provided, multiple APIs are available for diving the data (OSearch, OData and STAC) and even an S3 archive for downloading. One possibility would be converting sentinelsat to the new APIs just for back compatibility with people that use it as a library or a cli tool in other scripts. For sure, STAC and S3 are even dealt with by other tools, which could preferable for use. As a seasoned Perl dev I would say that having more choices to do the same thing is always the way. :-)

@mdelgadoblasco
Copy link

I have managed to do a query with standard parameters such a collection, aoi intersect etc, as in the example below,

start_date = "2022-06-01"
end_date = "2022-06-10"
data_collection = "SENTINEL-1"
product_type = 'SLC'
aoi = "POLYGON((4.220581 50.958859,4.521264 50.953236,4.545977 50.906064,4.541858 50.802029,4.489685 50.763825,4.23843 50.767734,4.192435 50.806369,4.189689 50.907363,4.220581 50.958859))'"

json = requests.get(
    f"https://catalogue.dataspace.copernicus.eu/odata/v1/Products?$filter=Collection/Name eq '{data_collection}' and OData.CSC.Intersects(area=geography'SRID=4326;{aoi}) and Attributes/OData.CSC.StringAttribute/any(att:att/Name eq 'productType' and att/OData.CSC.StringAttribute/Value eq '{product_type}') and ContentDate/Start gt {start_date}T00:00:00.000Z and ContentDate/Start lt {end_date}T00:00:00.000Z"
).json()
pd.DataFrame.from_dict(json["value"]).head()
@odata.mediaContentType Id Name ContentType ContentLength OriginDate PublicationDate ModificationDate Online EvictionDate S3Path Checksum ContentDate Footprint GeoFootprint
application/octet-stream 3411a215-5fdb-5274-9d96-76f29e6932d2 S1A_IW_SLC__1SDV_20220609T055904_20220609T0559... application/octet-stream 0 2022-06-09T07:30:10.794Z 2022-06-09T15:40:51.931Z 2022-06-09T15:40:51.931Z True   /eodata/Sentinel-1/SAR/SLC/2022/06/09/S1A_IW_S... [] {'Start': '2022-06-09T05:59:04.000Z', 'End': '... geography'SRID=4326;POLYGON ((4.979048 49.4527... {'type': 'Polygon', 'coordinates': [[[4.979048...
application/octet-stream 153912d7-5e55-570c-bde8-bd7531b3643a S1A_IW_SLC__1SDV_20220604T055054_20220604T0551... application/octet-stream 0 2022-06-04T07:30:00.686Z 2022-06-04T07:33:05.640Z 2022-06-04T07:33:05.640Z True   /eodata/Sentinel-1/SAR/SLC/2022/06/04/S1A_IW_S... [] {'Start': '2022-06-04T05:50:54.776Z', 'End': '... geography'SRID=4326;POLYGON ((6.941348 49.1676... {'type': 'Polygon', 'coordinates': [[[6.941348...
application/octet-stream aa4be9aa-78b9-5bb0-8a16-28e7bd3f7676 S1A_IW_SLC__1SDV_20220607T172457_20220607T1725... application/octet-stream 0 2022-06-07T18:23:19.345Z 2022-06-07T19:01:00.798Z 2022-06-07T19:01:00.798Z True   /eodata/Sentinel-1/SAR/SLC/2022/06/07/S1A_IW_S... [] {'Start': '2022-06-07T17:24:57.272Z', 'End': '... geography'SRID=4326;POLYGON ((3.93701 51.47623... {'type': 'Polygon', 'coordinates': [[[3.93701,...

but then I do not know how to use the s3path to download the data. Anybody can help on that?
THanks in advance!

@fpl
Copy link

fpl commented Aug 9, 2023

From the OData REST API you should now get an access token and use the Ids to download. This is not too different from the old API of the Data Hub.

https://documentation.dataspace.copernicus.eu/APIs/OData.html#product-download

So for instance:

https://catalogue.dataspace.copernicus.eu/odata/v1/Products(aa4be9aa-78b9-5bb0-8a16-28e7bd3f7676)/$value

On the basis of current doc pages, it seems the STAC API is still incomplete at this stage and the most practical thing is implementing the OData update for the new system. About the S3, I'm not sure the catalog is routing an S3 protocol even for non DIAS computing resources.

@EmanuelCastanho
Copy link

EmanuelCastanho commented Aug 9, 2023

Hi @mdelgadoblasco ,

I implemented the CDSE based on OData for one of my scripts and according to my needs:
https://github.com/AIRCentre/POS2IDON/blob/main/modules/S2L1CProcessing.py
Maybe you or someone else can extract useful information from the following functions:

generate_tokens
save_tokens
collect_s2l1c_CDSE
download_s2l1c_CDSE

Now you have the options of access and refresh tokens.

@mdelgadoblasco
Copy link

Thank you very much! I tried to use/adapt your code for S1 SLC data but it simply does not seem to work. I get always 301 code.
However, if I try to use command line curl commands I am able to download the data returned by the query I created.

Anybody can bring some light why this 301 code happens to S1 SLC products? Maybe are not still available?

@fpl
Copy link

fpl commented Aug 11, 2023

Thank you very much! I tried to use/adapt your code for S1 SLC data but it simply does not seem to work. I get always 301 code. However, if I try to use command line curl commands I am able to download the data returned by the query I created.

Anybody can bring some light why this 301 code happens to S1 SLC products? Maybe are not still available?

301 is a permanent move, probably the result is routed elsewhere and you need to follow the new URL to get the result, something that curl does automagically. I see that the Python code above does not manage that case, instead.
I would use the pycurl package instead of requests and its FOLLOWLOCATION option.

@EmanuelCastanho
Copy link

@fpl
Part of the code is from CDSE documentation at the end of the page (https://documentation.dataspace.copernicus.eu/APIs/OData.html#product-download).

I thought the following block of code (line 373) was taking care of the 301 error:

while response.status_code in (301, 302, 303, 307):
     url = response.headers['Location']
     response = session.get(url, allow_redirects=False)

Seems like I need to check and see if the problem is from my or their code.
Thank you for the feedback!

@mdelgadoblasco
Copy link

I also used it but it never leaves the while loop.... let me know if you manage solve it.
Thanks!

@EmanuelCastanho
Copy link

EmanuelCastanho commented Aug 14, 2023

Yes @mdelgadoblasco , you are right, I tried with your input example and in fact it stays too much time inside the loop and at the end it generates the wrong .zip file. If you remove the .zip extension you will see that saves the error code only.
Maybe this is an interesting issue to share with eu-cdse/documentation

I tested with pycurl and worked:

auth = "Authorization: Bearer {at}".format(at=access_token)
with open("test.zip", "wb") as f:
        curl = pycurl.Curl()
        curl.setopt(pycurl.VERBOSE, 1) 
        curl.setopt(pycurl.URL, product_url)
        curl.setopt(pycurl.HTTPHEADER, [auth])
        curl.setopt(pycurl.FOLLOWLOCATION, 1) 
        curl.setopt(pycurl.UNRESTRICTED_AUTH, 1)
        curl.setopt(pycurl.WRITEDATA, f)
        curl.setopt(pycurl.NOPROGRESS, False) 
        curl.setopt(pycurl.XFERINFOFUNCTION, lambda dwt,dwd,upt,upd:print(f'\r{((dwd/dwt)*100 if dwt else 0):.2f}%',end=''))
        curl.perform()
        curl.close()

Is there an option in requests for --location-trusted? This seems to be the problem.

@mdelgadoblasco
Copy link

Ouh! perfect!
Thanks @fpl and @EmanuelCastanho!
Indeed using curl worked and I was trying exactly to find its equivalent in pycurl or in requests.

I will use the provide code above . ;)

@j08lue j08lue added scihub-replacement Questions related to the replacement of the discontinued Copernicus Open Access Hub discussion labels Aug 28, 2023
@mdelgadoblasco
Copy link

mdelgadoblasco commented Sep 5, 2023

Hi all!
Using the pycurl the download of any Sentinel-1 SLC starts, but after more than 30min downloading, it stops with the following error:

33.20%* HTTP/2 stream 1 was not closed cleanly before end of the underlying stream
* Send failure: Connection reset by peer
* OpenSSL SSL_write: Connection reset by peer, errno 104
* Failed sending HTTP2 data
33.20%* Connection #1 to host zipper.dataspace.copernicus.eu left intact
Traceback (most recent call last):
  File "/mnt/c/Users/jdelgado/Downloads/cdse_data_search_download/CDSE_search_download_202309.py", line 355, in <module>
    download_results(os.path.join(destination_folder,'test_df.csv'),access,destination_folder)
  File "/mnt/c/Users/jdelgado/Downloads/cdse_data_search_download/CDSE_search_download_202309.py", line 273, in download_results
    download_myfile(access,data.iloc[k].values,output_folder)
  File "/mnt/c/Users/jdelgado/Downloads/cdse_data_search_download/CDSE_search_download_202309.py", line 302, in download_myfile
    curl.perform()

How can I solve that?
Thank you in advance

@fpl
Copy link

fpl commented Sep 5, 2023

In the last weeks, I've been migrating my other code to CDSE, I don't see any special network issue, I'm currently able to download in a multi-threaded queue even 20 files in a few minutes with 10 workers or more. What you are pointing out seems to be a network issue, but I'm not sure if you have exhausted your quota and now finding timeouts for bandwidth reduction. For sure, I can't note anything like that. The nominal quota should be at least 6TB/month with 4 threads, but that is not enforced apparently now.

EDIT: starting from the beginning of October, it seems the 4 stream limit is actually enforced. Sad, but at least all products seem online.

@valgur valgur mentioned this issue Sep 21, 2023
@fpl
Copy link

fpl commented Sep 22, 2023

I summarize here some information about the CDSE services for future use, at this point in time: the OSearch API has some inconsistencies to be considered in the workflow. There is a general limitation of 200,000 products to deal with a query. While page 1 of a big query can be loaded in any case, successive calls with page >1 are limited, and in practice, after 90,000 products the API returns an empty feature list.
Due to the upper limit of 2000 features per page by protocol (maxRecords), in practice, this implies that the maximum valid page is 44. All this requires that searches need to be done with a narrow enough time window to avoid exploiting the upper limits and returning invalid lists. The safest thing to do is to issue a warning when a query seems exploiting the 90K upper bound, because something could change in the next future.

@massimozanetti
Copy link

massimozanetti commented Nov 2, 2023

Hi all, I see there is the possibility that the utility provided by sentinelsat can be no longer available due to the changes in Copernicus services. The main reason I always used sentinelsat (thank you to this nice community!) was to deal with queries of many products (more than one) and dowload it all without taking care too much of all the mess related with OData coding... I read the current info from ESA, but it seems there is no such a thing in their API to download more than one product... am I right? Any suggestion to replace my service based on sentinelsat with something else (Python based) for the specific purpose of just download of multiple products? Thank you very much....

@fpl
Copy link

fpl commented Nov 2, 2023

Hi all, I see there is the possibility that the utility provided by sentinelsat can be no longer available due to the changes in Copernicus services. The main reason I always used sentinelsat (thank you to this nice community!) was to deal with queries of many products (more than one) and dowload it all without taking care too much of all the mess related with OData coding... I read the current info from ESA, but it seems there is no such a thing in their API to download more than one product... am I right? Any suggestion to replace my service based on sentinelsat with something else (Python based) for the specific purpose of just download of multiple products? Thank you very much....

I'm not sure what you mean, but of course, OData can be used to download up to 4 products concurrently with the same credentials. There are quite a few differences between the old and the new service protocols, so sentinelsat needs a few changes here and there, something I could complete in a few time starting from the next week. In the mean time the old service was dismantled yesterday.

@massimozanetti
Copy link

Thank you @fpl for your reply.

What I mean is this, with sentinelsat I could search images with SentinelAPI.query() using some keywords and/or input data like geometries and dates. The method returned a dataframe with a list of products, that I could give to download_all() to download all of them, easily. Now, reading ESA docs (https://dataspace.copernicus.eu/news/2023-9-28-accessing-sentinel-mission-data-new-copernicus-data-space-ecosystem-apis) I see there is code to download one product at a time. In my understanding sentinelsat was a very useful utility to avoid coding all this one-by-one download scripts, to get the work of downloading many products easily done.. hope this clarifies!
Max

@EmanuelCastanho
Copy link

Hi @massimozanetti , you can still do that with CDSE with some adjustments. For example, currently I am using a clumsy (I must admit) function that I developed to search and download from CDSE using Python, my output is a text file with something like this:

https://catalogue.dataspace.copernicus.eu/odata/v1/Products(2c8c3c77-bcb8-5c3e-b866-83d539b3468a)/$value/S2B_MSIL1C_20220224T072859_N0400_R049_T36JUN_20220224T111238.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(7858ca5e-93fc-53b3-94d3-d0a174495161)/$value/S2A_MSIL1C_20220219T072941_N0400_R049_T36JUN_20220219T092523.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(1afbf7ee-6b54-5492-9f0f-b6588b29535d)/$value/S2B_MSIL1C_20220105T073209_N0301_R049_T36JUN_20220105T093156.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(f26931b6-a3e7-5b66-b490-6768361b1711)/$value/S2A_MSIL1C_20220301T072831_N0400_R049_T36JUN_20220301T092628.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(d80ee1ee-dff9-5d67-9a9e-d7913bbb4f58)/$value/S2B_MSIL1C_20220204T073009_N0400_R049_T36JUN_20220204T092721.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(2e681a34-ebf3-5d87-96a2-6621f847bb26)/$value/S2B_MSIL1C_20220214T073009_N0400_R049_T36JUN_20220214T092931.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(7f8b6dbb-d319-5f6c-a147-a7653d82ff56)/$value/S2A_MSIL1C_20220120T073231_N0301_R049_T36JUN_20220120T092522.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(c118bf01-104c-50bd-a197-9a5cd9be8e1e)/$value/S2A_MSIL1C_20220130T073141_N0400_R049_T36JUN_20220130T092628.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(c55a394f-6d00-5850-904c-790eed77dbfb)/$value/S2A_MSIL1C_20220110T073301_N0301_R049_T36JUN_20220110T092616.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(586b4d5d-5b3e-517a-82f6-87e243e88d78)/$value/S2B_MSIL1C_20220115T073149_N0301_R049_T36JUN_20220115T093122.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(085f8d29-d73e-5939-894d-a421b7d5d21e)/$value/S2A_MSIL1C_20220209T073041_N0400_R049_T36JUN_20220209T112304.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(b5e70eb3-f1de-5ac2-bf1b-f1610a82e38d)/$value/S2B_MSIL1C_20220125T073109_N0400_R049_T36JUN_20220125T100415.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(acf4e432-a385-50e3-b2e2-082dda2db6a0)/$value/S2A_MSIL1C_20220202T074131_N0400_R092_T36JUN_20220202T093442.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(f30800a9-e2c8-5b1b-9bbc-58a3c62e1118)/$value/S2A_MSIL1C_20220123T074221_N0301_R092_T36JUN_20220123T093711.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(e8bfd8a3-00c3-5c62-93cc-a41d74667aca)/$value/S2B_MSIL1C_20220118T074139_N0301_R092_T36JUN_20220118T093826.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(cd19ae6d-7e49-5779-bb78-1249f503ae6b)/$value/S2B_MSIL1C_20220207T074009_N0400_R092_T36JUN_20220207T094126.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(d7524540-4d2d-5208-b878-87d70f00d121)/$value/S2B_MSIL1C_20220217T073949_N0400_R092_T36JUN_20220217T094023.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(21659277-cabf-5fcb-aedb-e2b48608e19d)/$value/S2B_MSIL1C_20220128T074049_N0400_R092_T36JUN_20220128T095824.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(c986c4ee-ca6b-5d41-acee-91adf8b06265)/$value/S2A_MSIL1C_20220222T073931_N0400_R092_T36JUN_20220222T093949.SAFE
https://catalogue.dataspace.copernicus.eu/odata/v1/Products(b68a8821-3876-585f-8270-28bbf52e0d7a)/$value/S2A_MSIL1C_20220103T074321_N0301_R092_T36JUN_20220103T093926.SAFE

Results for Sentinel-2L1C using:
roi = {"type":"Polygon","coordinates":[[[31.924896,-29.365421],[31.719933,-29.365421],[31.719933,-29.184538],[31.924896,-29.184538],[31.924896,-29.365421]]]}

sensing_period = ('20220101', '20220301')

Now is start working on adapting sentinelsat on free times, any help you need I will be glad to help :)

@espiritocz
Copy link

espiritocz commented Nov 3, 2023 via email

@Matthew-J-Payne
Copy link

If it's any help, feel free to look into how we created our functions that interact with the CDSE.

@subnet001
Copy link

Hi! I created a CDSE download script. Its currently in early stages, so there's lost missing but i plan on keeping up development on it.

https://github.com/SDFIdk/CDSE_downloader

I hope it can do some good.

@fpl
Copy link

fpl commented Nov 6, 2023

Hi! I created a CDSE download script. Its currently in early stages, so there's lost missing but i plan on keeping up development on it.

https://github.com/SDFIdk/CDSE_downloader

I hope it can do some good.

Thanks, I'm currently rigorously working with a tactical approach by simply trying to get sentinelsat tests working. That is largely suboptimal by a good design PoV, but it seems the most effective mode of supporting the new protocols. I agree with others: rewriting from scratch is probably the fastest way of having something working at large, but the evil is in details, and I had to works several weeks in my other project about CDSE to have a decent result finally.

@fpl
Copy link

fpl commented Nov 10, 2023

I reported to CDSE service network issues with the new services, specifically in downloading multi-GBs images. This is annoying, really. Even the forum is full of people who have problems.

https://helpcenter.dataspace.copernicus.eu/hc/en-gb/requests/1201

@j08lue j08lue unpinned this issue Nov 10, 2023
@subnet001
Copy link

CDSETool is now a published python package and can now query and download reliably.

@massimozanetti
Copy link

does anyone know what is correct way to filter S1 query by th 'relativeOrbitNumber' parameter? I have tried hundreds of variations of this "Attributes/OData.CSC.IntegerAttribute/any(att:att/Name eq 'relativeOrbitNumber' and att/OData.CSC.IntegerAttribute/Value eq 15)" but nothing works... there is not documentation around for the attribute types...

@fpl
Copy link

fpl commented Nov 20, 2023

does anyone know what is correct way to filter S1 query by th 'relativeOrbitNumber' parameter? I have tried hundreds of variations of this "Attributes/OData.CSC.IntegerAttribute/any(att:att/Name eq 'relativeOrbitNumber' and att/OData.CSC.IntegerAttribute/Value eq 15)" but nothing works... there is not documentation around for the attribute types...

The OData attributes can be expanded by appending $expand=Attributes to other criteria. Then you will discover that attributes in the OData search differ from what you could expect, and you should use ronNumber. That's left as an exercise for the reader, I guess. Again I have no words about the new trend of such services...
Of course, you could instead use OSearch where the attribute name is indeed relativeOrbitNumber and be happy. I'm still fighting against those hidden aspects of the APIs set.

immagine

@espiritocz
Copy link

this one should work fine, but see my clumsy solution starting on line 160:
https://github.com/comet-licsar/licsar_proc/blob/main/python/LiCSAR_lib/s1data.py

indeed, NO DOCUMENTATION for parameters and those changed!!! CDSE did NOT do good job here (at least they could have supported sentinelsat development)

@massimozanetti
Copy link

this one should work fine, but see my clumsy solution starting on line 160: https://github.com/comet-licsar/licsar_proc/blob/main/python/LiCSAR_lib/s1data.py

indeed, NO DOCUMENTATION for parameters and those changed!!! CDSE did NOT do good job here (at least they could have supported sentinelsat development)

Thank you @espiritocz, I have found my error:

wrong one: "Attributes/OData.CSC.IntegerAttribute/any(att:att/Name eq 'relativeOrbitNumber' and att/OData.CSC.IntegerAttribute/Value eq 15)"
correct one: "Attributes/OData.CSC.StringAttribute/any(att:att/Name eq 'relativeOrbitNumber' and att/OData.CSC.IntegerAttribute/Value eq 15)"

the first CSC attribute must be String and the second is Integer.

Thank you @fpl for the info, means a lot.

@massimozanetti
Copy link

massimozanetti commented Nov 22, 2023

Is there any documentation on the meaning of the fields the requests.get() function returns in the json? What is exactly ContentLength, and why sometimes is 0? Why Checksum in some products is empty? Thank you for any advice and/or useful link......

@fpl
Copy link

fpl commented Nov 22, 2023

Is there any documentation on the meaning of the fields the requests.get() function returns in the json? What is exactly ContentLength, and why sometimes is 0? Why Checksum in some products is empty? Thank you for any advice and/or useful link......

I guess you are talking about some of the OData results. You should ignore both fields if empty: I'm sad for you.

In a perfect world, one would expect they should be used to get the archive size and its (MD5 and others) checksums. In our real world, they are 0 and an empty list.
E.g.

https://catalogue.dataspace.copernicus.eu/odata/v1/Products?$filter=contains(Name,%20%27SL_2_FRP___%27)&$expand=Assets

That said, I'm afraid you have to use an OData by Name AND COLLECTION search instead, e.g.:

https://catalogue.dataspace.copernicus.eu/odata/v1/Products?$filter=Collection/Name%20eq%20%27SENTINEL-2%27%20and%20Name%20eq%20%27S2B_OPER_AUX_GNSSRD_POD__20220510T031816_V20220502T235946_20220503T235936%27%20and%20ContentDate/Start%20gt%202022-05-03T00:00:00.000Z%20and%20ContentDate/Start%20lt%202022-05-03T00:11:00.000Z

I'm quite sure this is a current bug in the CDSE server software. Note the use of SENTINEL-2 as collection name, which is different and not compatible with Sentinel2, despite documentation.

@nicholasbalasus
Copy link

Hi @fpl - happy to relocate this discussion to somewhere else if it is more appropriate.

I need to download Sentinel-5P files for multiple years. This will total > 10 TB. To do this, I gathered links through OData. The links look like this: http://catalogue.dataspace.copernicus.eu/odata/v1/Products(bd285023-8ff4-5574-87f5-de0a64bd240c)/$value

My goal is then to use my Copernicus maximum of 4 concurrent connections to download this data as fast as possible. I have tried this with the simple bash script below, but the download takes much too long. In particular, every few files, it seems to be limited for a few minutes before picking up again. At the current rate, it would take weeks to download the files. Have you found any effective bulk download methods?

Thanks for any help you can provide!

split -l 5 links.txt links_ # split into multiple files to allow us to periodically regenerate the ACCESS_TOKEN
for file in links_*; do
    export ACCESS_TOKEN=$(curl -d 'client_id=cdse-public' \
                        -d "username=${username}" \
                        -d "password=${password}" \
                        -d 'grant_type=password' \
                        'https://identity.dataspace.copernicus.eu/auth/realms/CDSE/protocol/openid-connect/token' | \
                        python3 -m json.tool | grep "access_token" | awk -F\" '{print $4}')
    xargs -n 1 -P 4 wget -nv --retry-connrefused --tries=0 --content-disposition --header "Authorization: Bearer $ACCESS_TOKEN" -P "${dir}" < $file
    wait
done

@j08lue
Copy link
Contributor

j08lue commented Jan 22, 2024

Seems like a good case for https://gis.stackexchange.com/, actually.

@j08lue j08lue closed this as completed Jan 22, 2024
@espiritocz
Copy link

Hi @fpl - happy to relocate this discussion to somewhere else if it is more appropriate.

I need to download Sentinel-5P files for multiple years. This will total > 10 TB. To do this, I gathered links through OData. The links look like this: http://catalogue.dataspace.copernicus.eu/odata/v1/Products(bd285023-8ff4-5574-87f5-de0a64bd240c)/$value

My goal is then to use my Copernicus maximum of 4 concurrent connections to download this data as fast as possible. I have tried this with the simple bash script below, but the download takes much too long. In particular, every few files, it seems to be limited for a few minutes before picking up again. At the current rate, it would take weeks to download the files. Have you found any effective bulk download methods?

Thanks for any help you can provide!

split -l 5 links.txt links_ # split into multiple files to allow us to periodically regenerate the ACCESS_TOKEN
for file in links_*; do
    export ACCESS_TOKEN=$(curl -d 'client_id=cdse-public' \
                        -d "username=${username}" \
                        -d "password=${password}" \
                        -d 'grant_type=password' \
                        'https://identity.dataspace.copernicus.eu/auth/realms/CDSE/protocol/openid-connect/token' | \
                        python3 -m json.tool | grep "access_token" | awk -F\" '{print $4}')
    xargs -n 1 -P 4 wget -nv --retry-connrefused --tries=0 --content-disposition --header "Authorization: Bearer $ACCESS_TOKEN" -P "${dir}" < $file
    wait
done

hi. I was doing the same mistake - you should not be regenerating ACCESS_TOKEN as their number is limited (!) You have to generate one ACCESS_TOKEN and then use the REFRESH TOKEN instead (that is not well documented, indeed..).
You may check this (so far working) script for inspiration:
https://github.com/comet-licsar/licsar_proc/blob/main/bin/scripts/wget_cdse

@armkhudinyan
Copy link

armkhudinyan commented Apr 5, 2024

Hi, I had built yet another quick version of API to substitute the former Sentinelsat API since the CopernicusHUB decommissioning, then only now to find this issue and many other options developed for downloading from Copernicus Data Space.
https://github.com/CoLAB-ATLANTIC/odata_api

This version uses OData API and imports each of data collection as a subclass. It currently implements only Copernicus mission datasets per my projects' needs, but could be easily extended for the few other datasets available on dataspace. Though I guess it isn't a smart way of making this package cause those external datasets may grow more in the future. Would be happy to hear anyone finding it useful or willing to contribute and improve.

@avalentino
Copy link
Contributor

[...] For instance, CDSE now provides an XML description for each collection:

https://catalogue.dataspace.copernicus.eu/resto/api/collections/<collection>/describe.xml

with relevant information, such as validation patterns and a list of parameters.

Hi @fpl, do you know if there is an equivalent (machine readable) description for other APIs?

@fpl
Copy link

fpl commented Apr 16, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion scihub-replacement Questions related to the replacement of the discontinued Copernicus Open Access Hub
Projects
None yet
Development

No branches or pull requests