rs_workflows/dpr_flow.md
DPR flow implementation
compute_eopf_origin_datetime(env, input_products, dpr_processor)
Compute the maximum eopf:origin_datetime across all input CADU products.
For each input product, this function retrieves the corresponding item
from the catalog using its CADU ID and collection ID, extracts the
eopf:origin_datetime property, and returns the latest (maximum)
datetime value found.
If an item cannot be retrieved from the catalog, the error is logged and processing continues with the remaining products.
Parameters
env : object
Execution environment object used to serialize and pass context
to the catalog flow.
input_products : Iterable[dict]
Iterable of input product mappings. Each mapping is expected to
contain values of the form (cadu_id, collection_id).
Returns
str
ISO 8601 string representing the maximum eopf:origin_datetime
found among all retrieved items. If no valid items are found,
returns the fallback value "2023-01-01T00:00:00Z".
Source code in docs/rs-client-libraries/rs_workflows/dpr_flow.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
create_stac_item(env, input_products, eopf_feature, s3_data_location, product_name, dpr_processor)
Create a list of STAC Items from EOPF features and processing payload metadata.
This function builds STAC Items compliant with EOPF constraints by: - Injecting EOPF-specific properties into each feature - Attaching output product assets - Propagating origin datetimes from input products
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eopf_features
|
list[dict]
|
List of GeoJSON-like feature dictionaries. |
required |
s3_data_location
|
str
|
Base S3 path where output products are stored. |
required |
Returns:
| Type | Description |
|---|---|
Item
|
list[Item]: List of constructed STAC Item objects. |
Source code in docs/rs-client-libraries/rs_workflows/dpr_flow.py
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 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 | |
extract_products_and_zattrs(files, base_path)
Extract product names and associated .zattrs files from a list of file paths.
This function scans a list of file paths and identifies Zarr products by
detecting valid .zattrs files under the given base path. It supports both
common Zarr layouts:
1. base_path/
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files
|
list[str]
|
List of file paths to scan. |
required |
base_path
|
str
|
Base directory under which products are located. |
required |
Returns:
| Type | Description |
|---|---|
|
tuple[list[str], list[str]]:
- A list of unique product names discovered.
- A list of full paths to detected |
Source code in docs/rs-client-libraries/rs_workflows/dpr_flow.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
read_zattrs_sync(path)
Download .zattrs file synchronously using prefect_utils.s3_download_file
and return parsed JSON dicts in memory.
Source code in docs/rs-client-libraries/rs_workflows/dpr_flow.py
82 83 84 85 86 87 88 89 90 | |
run_processor(env, processor, payload, cluster_info, s3_payload_run, input_products)
async
Run the DPR processor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env
|
FlowEnvArgs
|
Prefect flow environment |
required |
processor
|
DprProcessor
|
DPR processor name |
required |
s3_payload_run
|
str
|
S3 bucket location of the output final DPR payload file. |
required |
Source code in docs/rs-client-libraries/rs_workflows/dpr_flow.py
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
s3_download_file_sync(s3_path, to_path, **download_kwargs)
Download a file from S3 synchronously.
Source code in docs/rs-client-libraries/rs_workflows/dpr_flow.py
93 94 95 96 97 98 99 100 101 102 103 | |
s3_list(s3_prefix)
List all S3 objects under a prefix without downloading.
Source code in docs/rs-client-libraries/rs_workflows/dpr_flow.py
37 38 39 40 41 42 | |
update_eopf_assets(env, input_products, payload, dpr_processor)
Update EOPF-related STAC assets by discovering products in S3 and
generating corresponding STAC items from .zattrs metadata.
This task inspects the workflow output products defined in the payload,
identifies the unique S3 base path, and discovers all product files and
associated .zattrs metadata files under that path. The .zattrs
metadata is read synchronously and used to extract EOPF discovery
information and product types, which are then converted into STAC items.
Steps performed:
1. Extract the unique S3 base path from payload["I/O"]["output_products"].
2. List all files under the resolved S3 path.
3. Separate product files from .zattrs metadata files.
4. Read and parse .zattrs metadata synchronously.
5. Extract EOPF discovery metadata and EOPF product types.
6. Build STAC items using the extracted metadata and input products.
Parameters
env : object
Execution environment used to provide context when creating STAC items.
input_products : list[dict]
List of input product mappings used to relate generated STAC items
to their upstream products.
payload : dict
Workflow payload containing input/output definitions. The S3 discovery
path is read from payload["I/O"]["output_products"].
Returns
tuple
A tuple (stac_items, eopf_types) where:
- stac_items : list
List of STAC items generated from EOPF .zattrs discovery metadata.
- eopf_types : list[str]
List of extracted EOPF product type identifiers.
Source code in docs/rs-client-libraries/rs_workflows/dpr_flow.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | |