Command line¶
The command-line interface exposes the main grid_doctor workflows for
use in scripts and batch processing environments.
Entry point¶
grid_doctor.cli
¶
Command-line helpers for grid-doctor conversion scripts.
get_parser(name, description=None)
¶
Create a parser preloaded with common grid-doctor options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Program name shown in |
required |
description
|
str | None
|
Optional one-line program description. |
None
|
Returns:
| Type | Description |
|---|---|
ArgumentParser
|
Parser configured with common S3 and verbosity arguments. |
Examples:
parser = get_parser("convert-icon", description="Build a HEALPix pyramid")
args = parser.parse_args()
Source code in grid_doctor/cli/parser.py
setup_logging_from_args(args, **kwargs)
¶
Initialise logging from parsed CLI arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
Namespace
|
Parsed arguments containing a |
required |
**kwargs
|
Unpack[LoggingOptions]
|
Extra keyword arguments forwarded to
|
{}
|
Source code in grid_doctor/cli/parser.py
Logging¶
-v flags from get_parser are applied by
setup_logging_from_args; outside the CLI, call setup_logging directly.
setup_logging(verbosity=0, level=None, fmt=_DEFAULT_FORMAT, datefmt=_DEFAULT_DATE_FORMAT)
¶
Configure the root handler and set the global log level.
Call this once at program startup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
verbosity
|
int
|
Number of |
0
|
level
|
int, str, or None
|
Explicit level; overrides verbosity when given. |
None
|
fmt
|
str
|
:mod: |
_DEFAULT_FORMAT
|
datefmt
|
str
|
Date format string. |
_DEFAULT_DATE_FORMAT
|