Copernicus Data Space Ecosystem OData API

Tools for accessing (searching and downloading) datasets from the Copernicus Data Space Ecosystem OData API.

Sensors:

  • RSGIS_ODATA_SEN1 = 1

  • RSGIS_ODATA_SEN1_RTC = 11

  • RSGIS_ODATA_SEN2 = 2

  • RSGIS_ODATA_SEN3 = 3

  • RSGIS_ODATA_SEN5P = 5

  • RSGIS_ODATA_SEN6 = 6

  • RSGIS_ODATA_COP_DEM = 100

  • RSGIS_ODATA_SMOS = 101

Orbit Direction:

  • RSGIS_ODATA_ORBIT_DIR_ASC = 1

  • RSGIS_ODATA_ORBIT_DIR_DESC = 2

Order By Direction:

  • RSGIS_ODATA_ORDERBY_ASC = 1

  • RSGIS_ODATA_ORDERBY_DESC = 2

Product Types:

  • RSGIS_ODATA_PROD_TYPE_S1_SLC = 101

  • RSGIS_ODATA_PROD_TYPE_S1_GRD = 102

  • RSGIS_ODATA_PROD_TYPE_S1_OCN = 103

  • RSGIS_ODATA_PROD_TYPE_S2_MSI_1C = 201

  • RSGIS_ODATA_PROD_TYPE_S2_MSI_2A = 202

  • RSGIS_ODATA_PROD_TYPE_S3_SR_1_SRA = 301

  • RSGIS_ODATA_PROD_TYPE_S3_SR_1_SRA_A = 302

  • RSGIS_ODATA_PROD_TYPE_S3_SR_1_SRA_BS = 303

  • RSGIS_ODATA_PROD_TYPE_S3_SR_2_LAN = 304

  • RSGIS_ODATA_PROD_TYPE_S3_OL_1_EFR = 305

  • RSGIS_ODATA_PROD_TYPE_S3_OL_1_ERR = 306

  • RSGIS_ODATA_PROD_TYPE_S3_OL_2_LFR = 307

  • RSGIS_ODATA_PROD_TYPE_S3_OL_2_LRR = 308

  • RSGIS_ODATA_PROD_TYPE_S3_SL_1_RBT = 309

  • RSGIS_ODATA_PROD_TYPE_S3_SL_2_LST = 310

  • RSGIS_ODATA_PROD_TYPE_S3_SY_2_SYN = 311

  • RSGIS_ODATA_PROD_TYPE_S3_SY_2_V10 = 312

  • RSGIS_ODATA_PROD_TYPE_S3_SY_2_VG1 = 313

  • RSGIS_ODATA_PROD_TYPE_S3_SY_2_VGP = 314

  • RSGIS_ODATA_PROD_TYPE_S3_SY_2_AOD = 315

  • RSGIS_ODATA_PROD_TYPE_S3_SL_2_FRP = 316

  • RSGIS_ODATA_PROD_TYPE_S5P_L1B_IR_SIR = 501

  • RSGIS_ODATA_PROD_TYPE_S5P_L1B_IR_UVN = 502

  • RSGIS_ODATA_PROD_TYPE_S5P_L1B_RA_BD1 = 503

  • RSGIS_ODATA_PROD_TYPE_S5P_L1B_RA_BD2 = 504

  • RSGIS_ODATA_PROD_TYPE_S5P_L1B_RA_BD3 = 505

  • RSGIS_ODATA_PROD_TYPE_S5P_L1B_RA_BD4 = 506

  • RSGIS_ODATA_PROD_TYPE_S5P_L1B_RA_BD5 = 507

  • RSGIS_ODATA_PROD_TYPE_S5P_L1B_RA_BD6 = 508

  • RSGIS_ODATA_PROD_TYPE_S5P_L1B_RA_BD7 = 509

  • RSGIS_ODATA_PROD_TYPE_S5P_L1B_RA_BD8 = 510

  • RSGIS_ODATA_PROD_TYPE_S5P_L2_AER_AI = 511

  • RSGIS_ODATA_PROD_TYPE_S5P_L2_AER_LH = 512

  • RSGIS_ODATA_PROD_TYPE_S5P_L2_CH4 = 513

  • RSGIS_ODATA_PROD_TYPE_S5P_L2_CLOUD = 514

  • RSGIS_ODATA_PROD_TYPE_S5P_L2_CO = 515

  • RSGIS_ODATA_PROD_TYPE_S5P_L2_HCHO = 516

  • RSGIS_ODATA_PROD_TYPE_S5P_L2_NO2 = 517

  • RSGIS_ODATA_PROD_TYPE_S5P_L2_NP_BD3 = 518

  • RSGIS_ODATA_PROD_TYPE_S5P_L2_NP_BD6 = 519

  • RSGIS_ODATA_PROD_TYPE_S5P_L2_NP_BD7 = 520

  • RSGIS_ODATA_PROD_TYPE_S5P_L2_O3_TCL = 521

  • RSGIS_ODATA_PROD_TYPE_S5P_L2_O3 = 522

  • RSGIS_ODATA_PROD_TYPE_S5P_L2_SO2 = 523

  • RSGIS_ODATA_PROD_TYPE_S5P_AUX_CTMFCT = 524

  • RSGIS_ODATA_PROD_TYPE_S5P_AUX_CTMANA = 525

rsgislib.dataaccess.copernicus_odata.download_scn(access_token: str, scn_info: Dict, out_path: str)

A function which downloads a single scene to the out_path. Note, during the download the file will be given the extension .incomplete until the is complete when it will be renamed. If available the MD5 checksum of the file will be checked.

Parameters:
  • access_token – The access token to download the scene use get_access_token function to generate the access token.

  • scn_info – A dictionary with the scene information from query_scn or query_scn_lst functions.

  • out_path – The output path where the scene will be saved.

rsgislib.dataaccess.copernicus_odata.download_scns(access_token: str, scns_info: List[Dict], out_path: str, no_except: bool = True)

A function which loops through a list of scenes and downloads the datasets using the download_scn function. Option to print exceptions rather than stopping so all available scenes are downloaded.

Parameters:
  • access_token – The access token to download the scene use get_access_token function to generate the access token.

  • scns_info – A list of dictionaries with the scene information from query_scn or query_scn_lst functions.

  • out_path – The output path where the scene will be saved.

  • no_except – If True (Default) then expections are not outputted.

rsgislib.dataaccess.copernicus_odata.get_access_token(username: str = None, password: str = None) str

A function to get the access token from the Copernicus Data Space Ecosystem.

Parameters:
  • username – Your username for the Copernicus Data Space Ecosystem. If RSGIS_COP_USER environmental variable is specified then username will read from there is None is passed (Default: None)

  • password – Your password for the Copernicus Data Space Ecosystem. If RSGIS_COP_PASS environmental variable is specified then password will read from there is None is passed (Default: None)

Returns:

the access token Copernicus Open Access Hub.

rsgislib.dataaccess.copernicus_odata.get_sensor_collection_name(sensor: int) str

A function which returns the name of a sensor collection for the RSGIS_ODATA_* sensor specified. This function is primarily used internally by the functions in this module.

Parameters:

sensor – RSGIS_ODATA_* sensor

Returns:

ODATA string for the sensor

rsgislib.dataaccess.copernicus_odata.query_scn(scn_name: str) Dict

A function which queries for a single scene using the scene name for example: S2B_MSIL2A_20240602T112119_N0510_R037_T30UVD_20240602T125034.SAFE

Parameters:

scn_name – name of the scene to be found

Returns:

dictionary of the information for the scene

rsgislib.dataaccess.copernicus_odata.query_scn_lst(sensor: int, bbox: Tuple[float, float, float, float] | List[float], start_date: datetime = None, end_date: datetime = None, cloud_cover: float = None, orbit_dir: int = None, product_type: int = None, order_by: int = 1, max_n_rslts: int = 25, start_n: int = None) List[Dict]

A function which uses the Copernicus Data Space Ecosystem OData API to find lists of scenes using criteria to filter the return list of scenes.

Parameters:
  • sensor – The sensor / product being search for (e.g., RSGIS_ODATA_SEN1 or RSGIS_ODATA_SEN2)

  • bbox – is a bbox (xMin, xMax, yMin, yMax) in EPSG:4326

  • start_date – a datetime object representing the start date (i.e., earlier date)

  • end_date – a datetime object representing the end date (i.e., later date)

  • cloud_cover – value between 0-100 where scenes with cloud cover less than the threshold will be returned

  • orbit_dir – The orbit direction ascending (RSGIS_ODATA_ORBIT_DIR_ASC) or descending (RSGIS_ODATA_ORBIT_DIR_DESC)

  • product_type – The product type specified as RSGIS_ODATA_PROD_TYPE* (e.g., RSGIS_ODATA_PROD_TYPE_S1_SLC, RSGIS_ODATA_PROD_TYPE_S1_GRD, RSGIS_ODATA_PROD_TYPE_S2_MSI_1C, RSGIS_ODATA_PROD_TYPE_S2_MSI_2A)

  • order_by – Order by date either ascending (RSGIS_ODATA_ORDERBY_ASC) or descending (RSGIS_ODATA_ORDERBY_DESC)

  • max_n_rslts – Maximum number of scenes that will be returned (default: 25)

  • start_n – An offset skipping the first n scenes. Can be used in combination with max_n_rslts to query in ‘pages’

Returns:

returns list of dictionaries containing all scene information