Index
source package isofit.luts.stores
Base class for creating ISOFIT LUTs. Must be subclassed to implement the store creation logic.
Classes
-
Create — Prepare a LUT path
Functions
-
create — Factory function to return the correct Create subclass
source create(path: str, *args, **kwargs)
Factory function to return the correct Create subclass
Parameters
-
path : str — Store path. Uses the extension to determine the correct subclass
-
*args : list — Arguments to pass to the subclass
-
*args : dict — Key-word arguments to pass to the subclass
Returns
-
obj — Create subclass object
Raises
-
AttributeError
source class Create(path: str, keys: object, wl: np.ndarray, grid: dict, mode: str = 'w', attrs: dict = {}, consts: dict = {}, onedim: dict = {}, alldim: dict = {}, zeros: List[str] = [], chunks: List[int] | str = 'auto', init: bool = True, **kwargs)
Prepare a LUT path
Parameters
-
path : str — Path for the LUT.
-
keys : object — Default keys to set. This is needed to pre-initilize the LUT store to optimize the flushing of data to disk.
-
wl : np.ndarray — The wavelength array.
-
grid : dict — The LUT grid, formatted as {str: Iterable}.
-
mode : str, default="w" — Mode to open with.
-
attrs : dict, defaults={} — Dict of dataset attributes, ie. {"RT_mode": "transm"}
-
consts : dict, optional, default={} — Dictionary of constant values. Appends/replaces current Create.consts list.
-
onedim : dict, optional, default={} — Dictionary of one-dimensional data. Appends/replaces to the current Create.onedim list.
-
alldim : dict, optional, default={} — Dictionary of multi-dimensional data. Appends/replaces to the current Create.alldim list.
-
zeros : List[str], optional, default=[] — List of zero values. Appends to the current Create.zeros list.
-
chunks : list[int] | "auto", default="auto" — Chunking strategy to use on alldim variables. "auto" will chunk along the point dimension
-
init : bool, default=True — Call the initialize function
-
*kwargs : dict — Captures any additional key-word arguments and ignores
Methods
-
pointIndices — Get the indices of the point in the grid.
-
queuePoint — Queues a point and its data to the internal hold list which is used by the flush function to write these points to disk.
-
flush — Flushes the (point, data) pairs held in the hold list to the LUT
-
writePoint — Queues a point and immediately flushes to disk.
-
finalize — Finalizes the store by writing any remaining attributes to disk
source method Create.pointIndices(point: np.ndarray) → List[int]
Get the indices of the point in the grid.
Parameters
-
point : np.ndarray — The coordinates of the point in the grid.
Returns
-
List[int] — Mapped point values to index positions.
source method Create.queuePoint(point: np.ndarray, data: dict) → None
Queues a point and its data to the internal hold list which is used by the flush function to write these points to disk.
Parameters
-
point : np.ndarray — The coordinates of the point in the grid.
-
data : dict — Data for this point to write.
source method Create.flush(finalize: bool = False) → None
Flushes the (point, data) pairs held in the hold list to the LUT
Parameters
-
finalize : bool, default=False — Calls the
finalizefunction
source method Create.writePoint(point: np.ndarray, data: dict) → None
Queues a point and immediately flushes to disk.
Parameters
-
point : np.ndarray — The coordinates of the point in the grid.
-
data : dict — Data for this point to write.
source method Create.finalize()
Finalizes the store by writing any remaining attributes to disk