monkey_wrench.input_output.seviri._models module

The module providing a function to read and resample SEVIRI native files from FSFile objects.

monkey_wrench.input_output.seviri._models.DEFAULT_CHANNEL_NAMES = ['VIS006', 'VIS008', 'IR_016', 'IR_039', 'WV_062', 'WV_073', 'IR_087', 'IR_097', 'IR_108', 'IR_120', 'IR_134', 'HRV']

Names of SEVIRI channels.

monkey_wrench.input_output.seviri._models.catch_warnings()[source]
class monkey_wrench.input_output.seviri._models.RemoteSeviriFile(*, fsspec_cache: Literal['filecache', 'blockcache'] | None = None)[source]

Bases: FsSpecCache

open(product_id: str) FSFile[source]

Open SEVIRI native files (.nat) remotely, inside a zip archive using the given product ID.

Parameters:

product_id – The product ID to open.

Returns:

A file object of type FSFile, which can be further used by satpy.

class monkey_wrench.input_output.seviri._models.Resampler(*, fsspec_cache: ~typing.Literal['filecache', 'blockcache'] | None = None, 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, dataset_save_options: dict[str, bool | str | int] = {'include_lonlats': False, 'writer': 'cf'}, area: ~typing.Annotated[~pathlib.Path, ~pydantic.types.PathType(path_type=file), ~pydantic.functional_validators.AfterValidator(func=~monkey_wrench.input_output._types.<lambda>)] | dict[str, ~typing.Any] | ~pyresample.geometry.AreaDefinition, output_filename_generator: ~typing.Annotated[~typing.Callable[[...], ~pathlib.Path], ~pydantic.functional_validators.BeforeValidator(func=~monkey_wrench.generic.models._function.validate_function_path, json_schema_input_type=PydanticUndefined)] | ~typing.Callable[[str], ~pathlib.Path] = <function input_filename_from_product_id>, channel_names: list[str] = ['VIS006', 'VIS008', 'IR_016', 'IR_039', 'WV_062', 'WV_073', 'IR_087', 'IR_097', 'IR_108', 'IR_120', 'IR_134', 'HRV'], radius_of_influence: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)] = 20000, remove_file_if_exists: bool = True)[source]

Bases: Area, DatasetSaveOptions, DateTimeDirectory, RemoteSeviriFile

output_filename_generator: Annotated[Callable[[...], Path], BeforeValidator(func=validate_function_path, json_schema_input_type=PydanticUndefined)] | Callable[[str], Path]

The function using which an output filename will be generated from the given input filename (SEVIRI native file).

The generated filename is used to store the resampled file. The generated output filename will be prepended with output_path to compose a complete filepath for the output file.

channel_names: list[str]

The list of channels to load from the file. Defaults to satpy.readers.seviri_base.CHANNEL_NAMES.values().

area: AbsolutePath[FilePath] | dict[str, Any] | AreaDefinition

A filepath, a dictionary, or an object of type AreaDefinition which holds the area information for resampling.

dataset_save_options: dict[str, bool | str | int]

A dictionary which includes the actual storage options.

The default behaviour is to use cf as the writer and exclude longitude and latitude values, i.e. dataset_save_options = dict(writer="cf", include_lonlats=False)

datetime_format_string: str

The format string to create subdirectories from the datetime object. Defaults to "%Y/%m/%d".

reset_child_datetime_directory: bool

Whether to remove the (child) directory first if it already exists. Defaults to False.

This might save us from issues regarding files being overwritten and corrupted.

parent_output_directory_path: ExistingDirectoryPath
fsspec_cache: Literal['filecache', 'blockcache'] | None

How to buffer, e.g. "filecache", "blockcache", or None. Defaults to None.

Warning

None might cause too many requests to be sent to the server!

radius_of_influence: Annotated[int, Ge(ge=0)]

An integer which marks the search radius (in meters) for neighbouring data points. Defaults to 20_000.

remove_file_if_exists: bool

A boolean to determine whether to removes the output file first if it already exists.

This might save us from some issues regrading files being overwritten and corrupted.

resample(product_id: str) None[source]

Resample the given SEVIRI native file (opened with fsspec) using the resampler attributes.

Parameters:

product_id – The product ID to open.