pyresample.future.resamplers.registry module
Registry of resampler classes.
- pyresample.future.resamplers.registry.create_resampler(src_geom, dst_geom, resampler=None, cache=None, **kwargs)
Create instance of a
Resamplerwith the provided arguments.- Parameters:
src_geom – Geometry object defining the source geographic region that input data lies on and will be resampled from.
dst_geom – Geometry object defining the destination geographic region that input data will be resampled to.
resampler (
str|None) – The name of a resampler class that has been previously registered withresampler_registry()and will be instantiated. If not provided then a registered Resampler class will be chosen based on the geometry types provided. This is currently always the ‘nearest’ (nearest neighbor) resampler.cache – ResampleCache instance used by the resampler to cache intermediate results for improved resampling performance on multiple executions or future use of the resampler.
kwargs – Additional keyword arguments to pass to the Resampler. Note that most resamplers do not have additional keyword arguments on creation, but instead have extra arguments passed when their
resamplemethods are called.
- Return type:
- pyresample.future.resamplers.registry.list_resamplers()
Get sorted list of registered resamplers.
- Return type:
list[str]
- pyresample.future.resamplers.registry.register_resampler(resampler_name, resampler_cls)
Register
Resamplersubclass for future use.- Parameters:
resampler_name (
str) – Name of the resampler in the registry. This name can then be used in functions likecreate_resampler().resampler_cls (
Type[Resampler]) – Subclass ofResamplerthat will be added to the registry.
- Return type:
None
Examples
Register a custom class:
register_resampler("my_resampler", MyResamplerClass)
Register as a plugin from third-party package (in your setup.py):
entry_points = { "pyresample.resamplers": [ "my_resampler = mypkg.mymodule:MyResamplerClass", ], }
- pyresample.future.resamplers.registry.unregister_resampler(resampler_name)
Remove previously registered Resampler so it can’t be used anymore.
- Return type:
None
- pyresample.future.resamplers.registry.with_loaded_registry(callable)
Load and verify registry plugins before calling the decorated object.
Note: This decorator is structured in a way that this plugin loading only happens on the usage of the provided callable instead of on import time.
- Return type:
Callable