flekspy.idl.series#

IDLSeries: Sequence container for temporal series of IDL .out / .outs files. Provides lazy-loaded LRU caching, header pre-scanning, temporal slicing, nearest-time frame lookup, and optional dataset concatenation.

Attributes#

Classes#

IDLSeries

Sequence container for a series of IDL (.out/.outs) output files.

Functions#

read_idl_header(→ Dict[str, Any])

Read metadata header of an IDL (.out/.outs) file without loading grid arrays.

Module Contents#

flekspy.idl.series.logger#
flekspy.idl.series.read_idl_header(filename: str | pathlib.Path) → Dict[str, Any][source]#

Read metadata header of an IDL (.out/.outs) file without loading grid arrays.

Parameters:

filename (str or Path) – Path to IDL file.

Returns:

Extracted header attributes (time, iter, grid, ndim, variables, parameters, etc.).

Return type:

dict

class flekspy.idl.series.IDLSeries(files: str | pathlib.Path | Sequence[str | pathlib.Path], eager: bool = False, max_cache: int = 32, _headers: List[Dict[str, Any]] | None = None)[source]#

Bases: Sequence[xarray.Dataset]

Sequence container for a series of IDL (.out/.outs) output files.

Provides fast metadata scanning, lazy loading with LRU cache, temporal slicing, and nearest-frame lookup by time or iteration.

Parameters:
  • files (str or Sequence of (str or Path)) – File path pattern (e.g. ‘run/PC/*.out’) or list of file paths.

  • eager (bool, default False) – If True, loads all datasets into memory at initialization. If False, loads datasets on-demand when indexed.

  • max_cache (int, default 32) – Maximum number of datasets to hold in memory when lazy loading.

eager = False#
max_cache#
_cache: collections.OrderedDict[int, xarray.Dataset]#
_datasets: List[xarray.Dataset] | None = None#
times#
iters#
__len__() → int[source]#
__getitem__(index: int | slice) → xarray.Dataset | IDLSeries[source]#
__iter__() → Iterator[xarray.Dataset][source]#
get_frame(time: float | None = None, iter: int | None = None) → Tuple[int, xarray.Dataset][source]#

Find the frame nearest to the requested time or iteration.

clear_cache() → None[source]#

Clear memory cache of loaded datasets.

to_dataset(vars: Sequence[str] | None = None) → xarray.Dataset[source]#

Concatenate all frames into a single xarray.Dataset with a ‘time’ dimension.

__repr__() → str[source]#