reVeal.config.characterize.Characterization#

class Characterization(*, dset: str, data_dir: Annotated[Path, PathType(path_type=dir)], method: Annotated[str, StringConstraints(strip_whitespace=None, to_upper=None, to_lower=True, strict=None, min_length=None, max_length=None, pattern=None)], attribute: str | None = None, weights_dset: str | None = None, parallel: bool = True, max_workers: Annotated[int, Gt(gt=0)] | None = None, neighbor_order: Annotated[int, Ge(ge=0)] = 0, buffer_distance: float = 0.0, where: str | None = None, dset_src: Annotated[Path, PathType(path_type=file)], dset_format: DatasetFormatEnum | None = None, dset_ext: str | None = None, crs: str | None = None, weights_dset_src: Annotated[Path, PathType(path_type=file)] | None = None)[source]#

Bases: BaseModelStrict

Inputs for a single characterization entry in the CharacterizeConfig.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Methods

attribute_check()

Check that attribute is provided for required methods and warn if attribute is provided for methods where it doesn't apply.

check_method_applicability()

Check that the specified method is applicable to the input dset_format.

is_valid_method(value)

Check that method is one of the allowable values.

parallel_check()

Check that, if parallel is set to True or max_workers was provided, the selected method can be parallelized.

set_crs()

Dynamically set the crs property.

set_dset_ext()

Dynamically set the dset_ext property.

set_dset_format()

Dynamically set the the dset_source property.

set_dset_src()

Dynamically set the the dset_source property by joining input data_dir and dset.

set_weights_dset_src()

Dynamically set the the weights_dset_src property by joining input data_dir and weights_dset.

weights_dset_check()

Check that, if weights_dset is provided, the selected method is applicable to the method.

where_check()

Check that entry for where does not contain any questionable code.

Attributes

model_computed_fields

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_extra

Get extra fields set during validation.

model_fields

model_fields_set

Returns the set of fields that have been explicitly set on this model instance.

dset

data_dir

method

attribute

weights_dset

parallel

max_workers

neighbor_order

buffer_distance

where

dset_src

dset_format

dset_ext

crs

weights_dset_src

classmethod is_valid_method(value)[source]#

Check that method is one of the allowable values.

Parameters:

value (str) – Input value

Returns:

str – Output value

Raises:

ValueError – A ValueError will be raised if the input method is invalid.

set_dset_src()[source]#

Dynamically set the the dset_source property by joining input data_dir and dset.

set_weights_dset_src()[source]#

Dynamically set the the weights_dset_src property by joining input data_dir and weights_dset.

set_dset_ext()[source]#

Dynamically set the dset_ext property.

set_dset_format()[source]#

Dynamically set the the dset_source property.

where_check()[source]#

Check that entry for where does not contain any questionable code. Also issues a warning if where is specified but doesn’t apply to the specified method.

attribute_check()[source]#

Check that attribute is provided for required methods and warn if attribute is provided for methods where it doesn’t apply. Also ensure that the attribute is present in the input dataset and is a numeric datatype.

Raises:
  • ValueError – A ValueError will be raised if attribute is missing for a required method or does not exist in the input dataset.

  • TypeError – A TypeError will be raised if the input attribute exists in the dataset but is not a numeric datatype.

set_crs()[source]#

Dynamically set the crs property.

check_method_applicability()[source]#

Check that the specified method is applicable to the input dset_format.

weights_dset_check()[source]#

Check that, if weights_dset is provided, the selected method is applicable to the method. If not, warn the user.

parallel_check()[source]#

Check that, if parallel is set to True or max_workers was provided, the selected method can be parallelized. If not, warn the user.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

property model_extra: dict[str, Any] | None#

Get extra fields set during validation.

Returns:

A dictionary of extra fields, or None if config.extra is not set to “allow”.

property model_fields_set: set[str]#

Returns the set of fields that have been explicitly set on this model instance.

Returns:
A set of strings representing the fields that have been set,

i.e. that were not filled from defaults.