pyradtran.params.ParamSpec#

class pyradtran.params.ParamSpec(keyword: str, dtype: type = <class 'float'>, units: str | None = None, valid_range: ~typing.Tuple[float, float] | None = None, choices: tuple | None = None, applicability: str = 'both', formatter: ~typing.Callable[[~typing.Any], str] | None = None, doc: str = '')[source]#

Bases: object

Declarative description of one uvspec parameter.

Parameters:
  • keyword (str) – The uvspec keyword (possibly multi-word, e.g. "mol_modify O3").

  • dtype (type, default float) – Expected scalar type; used for coercion before validation.

  • units (str, optional) – Physical units, for documentation and error messages.

  • valid_range (tuple of float, optional) – Inclusive (lo, hi) range for numeric values.

  • choices (tuple, optional) – Allowed values for enumerated parameters.

  • applicability ({“solar”, “thermal”, “both”}, default "both") – Which source modes the parameter applies to.

  • formatter (callable, optional) – value -> full input line. Defaults to "{keyword} {value}".

  • doc (str) – One-line description.

__init__(keyword: str, dtype: type = <class 'float'>, units: str | None = None, valid_range: ~typing.Tuple[float, float] | None = None, choices: tuple | None = None, applicability: str = 'both', formatter: ~typing.Callable[[~typing.Any], str] | None = None, doc: str = '') None#
applicability: str = 'both'#
choices: tuple | None = None#
doc: str = ''#
dtype#

alias of float

format_line(value: Any) str[source]#

Render the full uvspec input line for value.

formatter: Callable[[Any], str] | None = None#
keyword: str#
units: str | None = None#
valid_range: Tuple[float, float] | None = None#
validate(value: Any) None[source]#

Raise ValidationError if value is out of spec.

String values are passed through unvalidated (escape hatch for raw uvspec syntax), except for choices parameters.