climate_ref.cli.datasets
#
View and ingest input datasets
The metadata from these datasets are stored in the database so that they can be used to determine which executions are required for a given diagnostic without having to re-parse the datasets.
fetch_data(ctx, registry, output_directory=None, force_cleanup=False, symlink=False, verify=True)
#
Fetch REF-specific datasets
These datasets have been verified to have open licenses and are in the process of being added to Obs4MIPs.
Source code in packages/climate-ref/src/climate_ref/cli/datasets.py
ingest(ctx, file_or_directory, source_type, solve=False, dry_run=False, n_jobs=None, skip_invalid=True, chunk_size=None, check_health=True, skip_existing=False)
#
Ingest a directory of datasets into the database
Each dataset will be loaded and validated using the specified dataset adapter. This will extract metadata from the datasets and store it in the database.
A table of the datasets will be printed to the console at the end of the operation.
Source code in packages/climate-ref/src/climate_ref/cli/datasets.py
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 305 306 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 370 371 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 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | |
list_(ctx, source_type=SourceDatasetType.CMIP6.value, column=None, include_files=typer.Option(False, help='Include files in the output'), include_retracted=typer.Option(False, help='Include retracted datasets in the output. Off by default, so the listing matches solve-time eligibility, and a retracted dataset is never shown masking the live version that replaced it. Passing this flag also disables latest-only deduplication, so every version of every dataset is listed. Keeping the deduplication on would let a retracted newer version outrank and hide a live older one.'), limit=typer.Option(100, min=0, help='Limit the number of datasets (or files when using --include-files) to display to this number.'), dataset_filter=None, output_format=OutputFormat.table)
#
List the datasets that have been ingested
The data catalog is sorted by the date that the dataset was ingested (first = newest).
By default only the latest, non-retracted version of each dataset is listed, matching what
the solver would select. Pass --include-retracted to also see retracted datasets (see
the retracted_at column). This also disables latest-only deduplication so every version is
listed, since otherwise a retracted newer version could outrank and hide a live older one.
Source code in packages/climate-ref/src/climate_ref/cli/datasets.py
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 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 | |
list_columns(ctx, source_type=SourceDatasetType.CMIP6.value, include_files=typer.Option(False, help='Include files in the output'))
#
List the available columns in the data catalog for the given source type.
Source code in packages/climate-ref/src/climate_ref/cli/datasets.py
retract(ctx, slug)
#
Retract a dataset so it is excluded from future solve-time selection.
The dataset's row and files are left intact for provenance and historical execution inspection. Only its eligibility to satisfy a diagnostic's data requirements changes. There is no hard-delete path (a dataset that has ever run cannot be removed without either violating a foreign key or destroying execution provenance), so this is the only way to stop a superseded dataset (e.g. an old obs4MIPs row re-ingested under obs4REF) from continuing to match diagnostics.
Retracting an already-retracted dataset is a no-op.
Source code in packages/climate-ref/src/climate_ref/cli/datasets.py
stats(ctx, source_type=None, group_by=None)
#
Show summary statistics for datasets.
Displays counts of datasets grouped by dataset type, with finalisation status breakdown and file counts. Optionally expand by a facet using --group-by (e.g., --group-by source_id).
Source code in packages/climate-ref/src/climate_ref/cli/datasets.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | |
unretract(ctx, slug)
#
Restore a retracted dataset to solve-eligibility.
The inverse of retract. Unretracting a dataset that is not currently retracted is a no-op.