monkey_wrench.chimp._models module

class monkey_wrench.chimp._models.ChimpRetrieval(*, model_filepath: ~typing.Annotated[~pathlib.Path, ~pydantic.types.PathType(path_type=file), ~pydantic.functional_validators.AfterValidator(func=~monkey_wrench.input_output._types.<lambda>), ~pydantic.functional_validators.AfterValidator(func=~monkey_wrench.input_output._types.ensure_path_does_not_end_with_slash)], parent_output_directory_path: ~typing.Annotated[~pathlib.Path, ~pydantic.types.PathType(path_type=dir), ~pydantic.functional_validators.AfterValidator(func=~monkey_wrench.input_output._types.<lambda>)], datetime_format_string: str = '%Y/%m/%d', reset_child_datetime_directory: bool = False, collection: ~monkey_wrench.query._types.EumetsatCollection | str, device: ~typing.Literal['cpu', 'cuda'] = 'cpu', sequence_length: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)] = 16, temporal_overlap: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)] = 0, tile_size: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 256, verbose: bool = True, strict: bool = False)[source]

Bases: Collection, DateTimeDirectory, ModelFile

Pydantic model for CHIMP retrievals.

device: Literal['cpu', 'cuda']
sequence_length: Annotated[int, Ge(ge=0)]
temporal_overlap: Annotated[int, Ge(ge=0)]
tile_size: Annotated[int, Gt(gt=0)]
verbose: bool
strict: bool

Determines whether an exception must be raised if there are missing timestamps. Defaults to False.

By default, CHIMP is expected to handle missing timestamps if they are not in the beginning or the end of the sequence. In such cases, we log a warning. However, if this is set to True we raise an exception instead.

Warning

It is not 100% guaranteed that a retrieval can always be performed in the absence of some timestamps. There might be edge cases that CHIMP cannot handle.

validate_collection() Self[source]
run_in_batches(lst: List) None[source]

Perform CHIMP retrievals in batches.

__input_filepaths_as_strings(batch: list[Annotated[Path, PathType(path_type=file)]]) list[str]

Convert paths to strings and ensure each batch includes the same number of items as sequence length.

__run_for_single_batch(batch: list[Annotated[Path, PathType(path_type=file)]], retrieve_function: Callable) None

Helper function to perform a single CHIMP retrieval for a single batch.