input4mips_validation.cli#
| Sub-package | Description |
|---|---|
| common_arguments_and_options | Common arguments and options used across our CI |
| db | CLI for database handling |
input4mips_validation.cli
#
Command-line interface
cli(version=None, no_logging=None, logging_level=None, logging_config=None)
#
Entrypoint for the command-line interface
Source code in src/input4mips_validation/cli/__init__.py
upload_ftp_command(tree_root, ftp_dir_rel_to_root, password, username='anonymous', ftp_server='ftp.llnl.gov', ftp_dir_root='/incoming', n_threads=4, cv_source=None, dry_run=False, continue_on_error=False)
#
Upload files to an FTP server
We recommend running this with a log level of INFO to start, then adjusting from there.
Source code in src/input4mips_validation/cli/__init__.py
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 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 | |
validate_file(file, cv_source, write_in_drs, xr_variable_processor, frequency_metadata_keys, bounds_info, time_dimension, allow_cf_checker_warnings)
#
Validate a file
Optionally, re-write the file in the DRS.
This is the direct Python API. We expose this for two reasons:
- to make it easier for those who want to use Python rather than the CLI
- to ensure that we're passing all the CLI arguments correctly (this function has no keyword arguments, so if we forget one, the CLI won't work)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
Path
|
File to validate. |
required |
cv_source
|
Union[str, None]
|
The source from which to load the CVs. For full details, see |
required |
write_in_drs
|
Union[Path, None]
|
If the file passes validation, the root directory for writing the file in the DRS. If |
required |
xr_variable_processor
|
XRVariableProcessorLike
|
Helper to use for processing the variables in xarray objects. |
required |
frequency_metadata_keys
|
FrequencyMetadataKeys
|
Metadata definitions for frequency information |
required |
bounds_info
|
Union[BoundsInfo, None]
|
Metadata definitions for bounds handling. If |
required |
time_dimension
|
str
|
The time dimension of the data |
required |
allow_cf_checker_warnings
|
bool
|
Allow validation to pass, even if the CF-checker raises warnings? |
required |
Source code in src/input4mips_validation/cli/__init__.py
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 214 215 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 | |
validate_file_command(file, cv_source=None, write_in_drs=None, bnds_coord_indicators='bnds;bounds', frequency_metadata_key='frequency', no_time_axis_frequency='fx', time_dimension='time', allow_cf_checker_warnings=False)
#
Validate a single file
This validation is only partial
because some validation can only be performed if we have the entire file tree.
See the validate-tree command for this validation.
Source code in src/input4mips_validation/cli/__init__.py
validate_tree(tree_root, cv_source, xr_variable_processor, frequency_metadata_keys, bounds_info, time_dimension, rglob_input, allow_cf_checker_warnings, output_html)
#
Validate a tree of files
Optionally, write the validation output out as HTML.
This is the direct Python API. We expose this for two reasons:
- to make it easier for those who want to use Python rather than the CLI
- to ensure that we're passing all the CLI arguments correctly (this function has no keyword arguments, so if we forget one, the CLI won't work)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree_root
|
Path
|
The root of the tree of files to validate |
required |
cv_source
|
Union[str, None]
|
The source from which to load the CVs. For full details, see |
required |
xr_variable_processor
|
XRVariableProcessorLike
|
Helper to use for processing the variables in xarray objects. |
required |
frequency_metadata_keys
|
FrequencyMetadataKeys
|
Metadata definitions for frequency information |
required |
bounds_info
|
Union[BoundsInfo, None]
|
Metadata definitions for bounds handling If |
required |
time_dimension
|
str
|
The time dimension of the data |
required |
rglob_input
|
str
|
String to use when applying |
required |
allow_cf_checker_warnings
|
bool
|
Allow validation to pass, even if the CF-checker raises warnings? |
required |
output_html
|
Union[Path, None]
|
If not |
required |
Source code in src/input4mips_validation/cli/__init__.py
validate_tree_command(tree_root, cv_source=None, bnds_coord_indicators='bnds;bounds', frequency_metadata_key='frequency', no_time_axis_frequency='fx', time_dimension='time', rglob_input='*.nc', allow_cf_checker_warnings=False, output_html=None)
#
Validate a tree of files
This checks things like whether all external variables are also provided and all tracking IDs are unique.
Source code in src/input4mips_validation/cli/__init__.py
version_callback(version)
#
If requested, print the version string and exit