imas.backends.netcdf.ids2nc.IDS2NC

class imas.backends.netcdf.ids2nc.IDS2NC(ids: IDSToplevel, group: Group)

Bases: IDSTensorizer

Class responsible for storing an IDS to a NetCDF file.

__init__(ids: IDSToplevel, group: Group)

Initialize IDS2NC converter.

Parameters:
ids: IDSToplevel

IDSToplevel to store in the netCDF group

group: Group

Empty netCDF group to store the IDS in.

Methods

__init__(ids, group)

Initialize IDS2NC converter.

collect_filled_data()

Collect all filled data in the IDS and determine dimension sizes.

create_dimensions()

Create netCDF dimensions.

create_variables()

Create netCDF variables.

determine_data_shapes()

Determine tensorized data shapes and sparsity, save in shapes.

filter_coordinates(path)

Filter the coordinates list from NCMetadata to filled variables only.

include_coordinate_paths()

Append all paths that are coordinates of self.paths_to_tensorize

run()

Store the IDS in the NetCDF group.

store_data()

Store data in the netCDF variables

tensorize(path, fillvalue)

Tensorizes the data at the given path with the specified fill value.

Attributes

group

NetCDF Group to store the IDS in.

ids

IDS to tensorize.

paths_to_tensorize

List of paths to tensorize

ncmeta

NetCDF related metadata.

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

homogeneous_time

True iff the IDS time mode is homogeneous.

shapes

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_data and dimension_size.

create_dimensions() None

Create netCDF dimensions.

create_variables() None

Create netCDF variables.

determine_data_shapes() None

Determine tensorized data shapes and sparsity, save in shapes.

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.

group

NetCDF Group to store the IDS in.

homogeneous_time

True iff the IDS time mode is homogeneous.

ids

IDS to tensorize.

include_coordinate_paths() None

Append all paths that are coordinates of self.paths_to_tensorize

ncmeta

NetCDF related metadata.

paths_to_tensorize

List of paths to tensorize

run() None

Store the IDS in the NetCDF group.

shapes

Map of IDS paths to data shape arrays.

store_data() None

Store data in the netCDF variables

tensorize(path, fillvalue)

Tensorizes the data at the given path with the specified fill value.

Parameters:
path

The path to the data in the IDS.

fillvalue

The value to fill the tensor with. Can be of any type, including strings.

Returns:

A tensor filled with the data from the specified path.


Last update: 2026-01-28