pycsamt.api.cli.params#
pycsamt.api.cli.params#
Custom Click parameter types for pyCSAMT-specific inputs.
Use these as the type= argument on @click.argument or
@click.option to get automatic validation and helpful error messages.
Examples
import click
from pycsamt.api.cli.params import EDIPath, FreqRange, StationList
@click.command()
@click.argument("edi", type=EDIPath())
@click.option("--freq", type=FreqRange(), default=None)
@click.option("--stations", type=StationList(), default=None)
def my_command(edi, freq, stations):
...
Classes
|
A Click Path type for a directory that contains EDI files. |
|
A Click Path type that additionally requires a |
Parse a |
|
Parse a comma-separated list of pipeline step codes or names. |
|
Parse a comma-separated list of station identifiers. |
- class pycsamt.api.cli.params.EDIDir[source]#
Bases:
PathA Click Path type for a directory that contains EDI files.
- convert(value, param, ctx)[source]#
Convert the value to the correct type. This is not called if the value is
None(the missing value).This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.
The
paramandctxarguments may beNonein certain situations, such as when converting prompt input.If the value cannot be converted, call
fail()with a descriptive message.
- class pycsamt.api.cli.params.EDIPath[source]#
Bases:
PathA Click Path type that additionally requires a
.ediextension.- convert(value, param, ctx)[source]#
Convert the value to the correct type. This is not called if the value is
None(the missing value).This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.
The
paramandctxarguments may beNonein certain situations, such as when converting prompt input.If the value cannot be converted, call
fail()with a descriptive message.
- class pycsamt.api.cli.params.FreqRange[source]#
Bases:
ParamTypeParse a
fmin:fmaxfrequency-range string into(float, float).Examples
--freq 0.1:1000→(0.1, 1000.0)- convert(value, param, ctx)[source]#
Convert the value to the correct type. This is not called if the value is
None(the missing value).This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.
The
paramandctxarguments may beNonein certain situations, such as when converting prompt input.If the value cannot be converted, call
fail()with a descriptive message.
- class pycsamt.api.cli.params.PipeStepList[source]#
Bases:
ParamTypeParse a comma-separated list of pipeline step codes or names.
Each token is validated against the step registry, so the user gets an immediate error with a hint if they mistype a code.
Examples
--steps NR001,FREQ002,FREQ001,FREQ004,SS001→
['NR001', 'FREQ002', 'FREQ001', 'FREQ004', 'SS001']--steps notch_powerline,drop_duplicates,align_grid→
['NR001', 'FREQ002', 'FREQ004']
- convert(value, param, ctx)[source]#
Convert the value to the correct type. This is not called if the value is
None(the missing value).This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.
The
paramandctxarguments may beNonein certain situations, such as when converting prompt input.If the value cannot be converted, call
fail()with a descriptive message.
- class pycsamt.api.cli.params.StationList[source]#
Bases:
ParamTypeParse a comma-separated list of station identifiers.
Examples
--stations S01,S02,S03→['S01', 'S02', 'S03']- convert(value, param, ctx)[source]#
Convert the value to the correct type. This is not called if the value is
None(the missing value).This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.
The
paramandctxarguments may beNonein certain situations, such as when converting prompt input.If the value cannot be converted, call
fail()with a descriptive message.