libera_utils.footprint_matching.readers.registry.ReaderRegistry#

class libera_utils.footprint_matching.readers.registry.ReaderRegistry#

Bases: object

Plugin registry mapping string keys to AncillaryReader subclasses.

This is a stateless class (all methods are static) that wraps a module-level _registry dict. Readers register themselves automatically when their module is imported via the __init_subclass__ hook in AncillaryReader. Manual registration is neither necessary nor recommended.

Examples

>>> import libera_utils.footprint_matching.readers  # triggers registration
>>> ReaderRegistry.list_readers()
['CLDPIX', 'ERA5_Pressure', 'ERA5_Surface', 'FLASHFlux', 'IGBP', 'NISE', 'VIIRS_AOD', 'VIIRS_BRDF', 'VIIRS_CLDPROP_D3']
>>> ReaderRegistry.get("IGBP").__name__
'IGBPReader'
__init__()#

Methods

get(name)

Return the reader class registered under name.

get_readers_for_mode(mode)

Return the readers that contribute to a product's definition.

list_readers()

Return a sorted list of all registered reader keys.

_registry: dict[str, type[AncillaryReader]] = {'CLDPIX': <class 'libera_utils.footprint_matching.readers.cldpix.CLDPIXReader'>, 'ERA5_Pressure': <class 'libera_utils.footprint_matching.readers.era5_pressure.ERA5PressureLevelReader'>, 'ERA5_Surface': <class 'libera_utils.footprint_matching.readers.era5_surface.ERA5SurfaceReader'>, 'FLASHFlux': <class 'libera_utils.footprint_matching.readers.flashflux.FLASHFluxReader'>, 'IGBP': <class 'libera_utils.footprint_matching.readers.igbp.IGBPReader'>, 'NISE': <class 'libera_utils.footprint_matching.readers.nsidc.NISEReader'>, 'VIIRS_AOD': <class 'libera_utils.footprint_matching.readers.aod.VIIRSAODReader'>, 'VIIRS_BRDF': <class 'libera_utils.footprint_matching.readers.brdf.VIIRSBRDFReader'>, 'VIIRS_CLDPROP_D3': <class 'libera_utils.footprint_matching.readers.viirs.VIIRSCldpropD3Reader'>}#
static get(name: str) → type[AncillaryReader]#

Return the reader class registered under name.

Parameters:

name (str) – Registry key (e.g., "IGBP").

Returns:

The registered reader class. Callers can then instantiate it with a list of staged granule paths: cls([Path("some_file.hdf")]).

Return type:

type[AncillaryReader]

Raises:

KeyError – If no reader is registered under name.

static get_readers_for_mode(mode: OperationalMode) → dict[str, type[AncillaryReader]]#

Return the readers that contribute to a product’s definition.

Membership is read from FMATCH_MODE_READERS, which is derived from the built-in readers’ VariableSpec.modes.

Parameters:

mode (OperationalMode) – The operational mode (product) whose readers to return.

Returns:

Mapping of registry key to reader class for every reader in the product’s set. Only the built-in readers are returned; readers other code registers after the package import are not included.

Return type:

dict[str, type[AncillaryReader]]

Examples

>>> from libera_utils.footprint_matching.types import OperationalMode
>>> import libera_utils.footprint_matching.readers  # triggers registration
>>> sorted(ReaderRegistry.get_readers_for_mode(OperationalMode.CAM))
['IGBP', 'NISE', 'VIIRS_CLDPROP_D3']
>>> imager = ReaderRegistry.get_readers_for_mode(OperationalMode.IMAGER)
>>> 'CLDPIX' in imager and 'ERA5_Pressure' in imager  # RBSP alongside ERA5
True
>>> camtime = ReaderRegistry.get_readers_for_mode(OperationalMode.IMAGER_CAMTIME)
>>> 'ERA5_Pressure' in camtime  # pressure-level ERA5 is radiometer-timescale only
False
static list_readers() → list[str]#

Return a sorted list of all registered reader keys.

Returns:

Alphabetically sorted registry keys.

Return type:

list[str]