imas.backends.netcdf.ids_tensorizer.IDSTensorizer¶
- class imas.backends.netcdf.ids_tensorizer.IDSTensorizer(ids: IDSToplevel, paths_to_tensorize: list[str])¶
Bases:
objectCommon functionality for tensorizing IDSs. Used in IDS2NC and util.to_xarray.
- __init__(ids: IDSToplevel, paths_to_tensorize: list[str])¶
Initialize IDSTensorizer.
- Parameters:
- ids: IDSToplevel¶
IDSToplevel to store in the netCDF group
- paths_to_tensorize: list[str]¶
Restrict tensorization to the provided paths. If an empty list is provided, all filled quantities in the IDS will be tensorized.
Methods
__init__(ids, paths_to_tensorize)Initialize IDSTensorizer.
Collect all filled data in the IDS and determine dimension sizes.
Determine tensorized data shapes and sparsity, save in
shapes.filter_coordinates(path)Filter the coordinates list from NCMetadata to filled variables only.
Append all paths that are coordinates of self.paths_to_tensorize
tensorize(path, fillvalue)Tensorizes the data at the given path with the specified fill value.
Attributes
IDS to tensorize.
List of paths to tensorize
NetCDF related metadata.
Map dimension name to its size.
Map of IDS paths to filled data nodes.
Set of filled IDS variables
True iff the IDS time mode is homogeneous.
Map of IDS paths to data shape arrays.
- collect_filled_data() None¶
Collect all filled data in the IDS and determine dimension sizes.
Results are stored in
filled_dataanddimension_size.
- dimension_size¶
Map dimension name to its size.
- filled_data¶
Map of IDS paths to filled data nodes.
- filled_variables¶
Set of filled IDS variables
- filter_coordinates(path: str) str¶
Filter the coordinates list from NCMetadata to filled variables only.
- homogeneous_time¶
True iff the IDS time mode is homogeneous.
- ids¶
IDS to tensorize.
- ncmeta¶
NetCDF related metadata.
- paths_to_tensorize¶
List of paths to tensorize
- shapes¶
Map of IDS paths to data shape arrays.