CADIP
Module for interacting with CADU system through a FastAPI APIRouter.
This module provides functionality to retrieve a list of products from the CADU system for a specified station. It includes an API endpoint, utility functions, and initialization for accessing EODataAccessGateway.
search_products(request, datetime='', station=FPath(description='CADIP station identifier (MTI, SGS, MPU, INU, etc)'), session_id='', limit=1000, sortby='-created')
Endpoint to retrieve a list of products from the CADU system for a specified station.
This function validates the input 'datetime' format, performs a search for products using the CADIP provider, writes the search results to the database, and generates a STAC Feature Collection from the products.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request |
Request
|
The request object (unused). |
required |
datetime |
str
|
Time interval in ISO 8601 format. |
''
|
station |
str
|
CADIP station identifier (e.g., MTI, SGS, MPU, INU). |
Path(description='CADIP station identifier (MTI, SGS, MPU, INU, etc)')
|
session_id |
str
|
Session from which file belong. |
''
|
limit |
int
|
Maximum number of products to return. Defaults to 1000. |
1000
|
sortby |
str
|
Sort by +/-fieldName (ascending/descending). Defaults to "-datetime". |
'-created'
|
Returns:
Type | Description |
---|---|
list[dict] | dict
|
list[dict] | dict: A list of STAC Feature Collections or an error message. If no products are found in the specified time range, returns an empty list. |
Raises:
Type | Description |
---|---|
HTTPException(exceptions)
|
If the pagination limit is less than 1. |
HTTPException(exceptions)
|
If there is a bad station identifier (CreateProviderFailed). |
HTTPException(exceptions)
|
If there is a database connection error (sqlalchemy.exc.OperationalError). |
HTTPException(exceptions)
|
If there is a connection error to the station. |
HTTPException(exceptions)
|
If there is a general failure during the process. |
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
search_session(request, station=FPath(description='CADIP station identifier (MTI, SGS, MPU, INU, etc)'), id=None, platform=None, start_date=None, stop_date=None)
Endpoint to retrieve a list of sessions from any CADIP station.
A valid session search request must contain at least a value for either id, platform, or a time interval (start_date and stop_date correctly defined).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request |
Request
|
The request object (unused). |
required |
station |
str
|
CADIP station identifier (e.g., MTI, SGS, MPU, INU). |
Path(description='CADIP station identifier (MTI, SGS, MPU, INU, etc)')
|
id |
str
|
Session identifier(s), comma-separated. Defaults to None. |
None
|
platform |
str
|
Satellite identifier(s), comma-separated. Defaults to None. |
None
|
start_date |
str
|
Start time in ISO 8601 format. Defaults to None. |
None
|
stop_date |
str
|
Stop time in ISO 8601 format. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A STAC Feature Collection of the sessions. |
Raises:
Type | Description |
---|---|
HTTPException(exceptions)
|
If search parameters are missing. |
HTTPException(exceptions)
|
If there is a JSON mapping error. |
HTTPException(exceptions)
|
If there is a value error during mapping. |
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
Module used to download CADU files from CADIP stations.
CadipDownloadResponse
Bases: BaseModel
Endpoint response
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_download.py
79 80 81 82 |
|
download_products(request, name, station=FPath(description='CADIP station identifier (MTI, SGS, MPU, INU, etc)'), local=None, obs=None, db=Depends(get_db))
Initiate an asynchronous download process for a CADU product using EODAG.
This endpoint triggers the download of a CADU product identified by the given name of the file. It starts the download process in a separate thread using the start_eodag_download function and updates the product's status in the database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request |
Request
|
The request object (unused). |
required |
name |
str
|
CADU product name. |
required |
station |
str
|
CADIP station identifier (e.g., MTI, SGS, MPU, INU). |
Path(description='CADIP station identifier (MTI, SGS, MPU, INU, etc)')
|
local |
str
|
Local download directory. Defaults to None. |
None
|
obs |
str
|
Object storage path (e.g., "s3://bucket-name/sub/dir"). Defaults to None. |
None
|
db |
Session
|
The database connection object. |
Depends(get_db)
|
Returns:
Name | Type | Description |
---|---|---|
JSONResponse |
responses
|
A JSON response indicating whether the download process has started. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the product is not found in the database. |
HTTPException
|
If the download thread fails to start. |
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_download.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
start_eodag_download(argument)
Start the eodag download process.
This function initiates the eodag download process using the provided arguments. It sets up the temporary directory where the files are to be downloaded and gets the database handler
Parameters:
Name | Type | Description | Default |
---|---|---|---|
argument |
EoDAGDownloadHandler
|
An instance of EoDAGDownloadHandler containing |
required |
the arguments used in the downloading process
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_download.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
HTTP endpoints to get the downloading status from CADIP stations.
get_download_status(request, name, db=Depends(get_db), station=FPath(description='CADIP station identifier (MTI, SGS, MPU, INU, etc)'))
Get the download status of a CADU product by its name.
This endpoint retrieves the download status of a CADU product from the database using the provided product name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request |
Request
|
The request object (unused). |
required |
name |
str
|
CADU product name. |
required |
db |
Session
|
The database connection object. |
Depends(get_db)
|
station |
str
|
CADIP station identifier (e.g., MTI, SGS, MPU, INU). |
Path(description='CADIP station identifier (MTI, SGS, MPU, INU, etc)')
|
Returns:
Name | Type | Description |
---|---|---|
ReadDownloadStatus |
DownloadStatus
|
The download status of the product. |
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_status.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|