Slice files

Collection of Slice objects. Offers additional functionality for filtering and using slices as well as its subclasses such as SubSlice.

Classes:

Slice(root_path, slice_id, cell_centered, ...)

Slice file data container including metadata. Consists of multiple subslices, one for each

SubSlice(parent_slc, filename, dimension, ...)

Part of a slice that cuts through a single mesh.

Functions:

implements(np_function)

Decorator to register an __array_function__ implementation for Slices.

class fdsreader.slcf.slice.Slice(root_path: str, slice_id: str, cell_centered: bool, times: ndarray, multimesh_data: Collection[Dict])[source]
Slice file data container including metadata. Consists of multiple subslices, one for each

mesh the slice cuts through. In case a slice cuts right through the border of two meshes, the generated data would be duplicated. For edge-centered slices a random of both generated slices will be discarded as the data is completely identical. For cell-centered slices the data of both slices will be saved as SubSlice s, therefore it might seem as if all slices would be duplicated, in reality however the slices might contain different data.

Variables:
  • cell_centered – Indicates whether centered positioning for data is used.

  • quantity – Quantity object containing information about the quantity calculated for this slice with the corresponding short_name and unit.

  • times – Numpy array containing all times for which data has been recorded.

  • n_t – Total number of time steps for which output data has been written.

  • orientation – Orientation [1,2,3] of the slice in case it is 2D, 0 otherwise.

  • extentExtent object containing 3-dimensional extent information.

Methods:

clear_cache()

Remove all data from the internal cache that has been loaded so far to free memory.

get_2d_slice_from_3d(slice_direction, value)

Creates a 2D-Slice from a 3D-Slice by slicing the Slice.

get_coordinates([ignore_cell_centered])

Returns a dictionary containing a numpy ndarray with coordinates for each dimension.

get_nearest_index(dimension, value)

Get the nearest mesh coordinate index in a specific dimension.

get_nearest_timestep(time)

Calculates the nearest timestep for which data has been output for this slice.

get_subslice(key)

Returns the SubSlice that cuts through the given mesh.

mean()

Calculates the mean over the whole slice.

sort_subslices_cartesian()

Returns all subslices sorted in cartesian coordinates.

std()

Calculates the standard deviation over the whole slice.

to_global([masked, fill, return_coordinates])

Creates a global numpy ndarray from all subslices (works for 2D- and 3D-slices).

Attributes:

extent_dirs

The directions in which there is an extent.

meshes

Returns a list of all meshes this slice cuts through.

subslices

Get a list with all SubSlices.

type

vmax

vmin

clear_cache()[source]

Remove all data from the internal cache that has been loaded so far to free memory.

property extent_dirs: Tuple[Literal['x', 'y', 'z'], Literal['x', 'y', 'z'], Literal['x', 'y', 'z']]

The directions in which there is an extent. All three dimensions in case the slice is 3D.

get_2d_slice_from_3d(slice_direction: Literal['x', 'y', 'z', 1, 2, 3], value: float)[source]

Creates a 2D-Slice from a 3D-Slice by slicing the Slice. :param slice_direction: The direction in which to cut through the slice. :param value: The position at which to start cutting through the slice.

get_coordinates(ignore_cell_centered: bool = False) Dict[Literal['x', 'y', 'z'], ndarray][source]

Returns a dictionary containing a numpy ndarray with coordinates for each dimension. For cell-centered slices, the coordinates can be adjusted to represent cell-centered coordinates.

Parameters:

ignore_cell_centered – Whether to shift the coordinates when the slice is cell_centered or not.

get_nearest_index(dimension: Literal['x', 'y', 'z'], value: float) int[source]

Get the nearest mesh coordinate index in a specific dimension.

get_nearest_timestep(time: float) int[source]

Calculates the nearest timestep for which data has been output for this slice.

get_subslice(key: int | str | Mesh) SubSlice[source]

Returns the SubSlice that cuts through the given mesh. When an int is provided the nth SubSlice will be returned.

mean()[source]

Calculates the mean over the whole slice.

Returns:

The calculated mean value.

property meshes: List[Mesh]

Returns a list of all meshes this slice cuts through.

sort_subslices_cartesian()[source]

Returns all subslices sorted in cartesian coordinates.

std()[source]

Calculates the standard deviation over the whole slice.

Returns:

The calculated standard deviation.

property subslices: List[SubSlice]

Get a list with all SubSlices.

to_global(masked: bool = False, fill: float = 0, return_coordinates: bool = False) ndarray | Tuple[ndarray, ndarray] | Tuple[ndarray, Dict[Literal['x', 'y', 'z'], ndarray]] | Tuple[Tuple[ndarray, ndarray], Tuple[Dict[Literal['x', 'y', 'z'], ndarray], Dict[Literal['x', 'y', 'z'], ndarray]]][source]

Creates a global numpy ndarray from all subslices (works for 2D- and 3D-slices). Note: This method might create a sparse np-array that consumes lots of memory. Attention: Two global slices are returned in cases where cell-centered slices cut right through one or more mesh borders. If there is a cell-centered slice that cuts right through the border of two meshes (mesh1 and mesh2), there will actually be two slices that could be equally relevant for the user. The one will cells on mesh1 and the one with cells on mesh2. As there are no cells in between (i.e. where the slice “should” be) and cell-centered slices output values at the centers of each cell, FDS simply outputs two slices, one on each side of the mesh borders. The fdsreader will not discard any data, both slices that are output by FDS are sent to the user for him to decide which one to use.

Parameters:
  • masked – Whether to apply the obstruction mask to the slice or not.

  • fill – The fill value to use for masked slice entries. Only used when masked=True.

  • return_coordinates – If true, return the matching coordinate for each value on the generated grid.

property type: Literal['2D', '3D']
property vmax
property vmin
class fdsreader.slcf.slice.SubSlice(parent_slc, filename: str, dimension: Dimension, extent: Extent, mesh: Mesh)[source]

Part of a slice that cuts through a single mesh.

Variables:
  • mesh – The mesh the subslice cuts through.

  • extentExtent object containing 3-dimensional extent information.

  • dimensionDimension object containing information about steps in each dimension.

Attributes:

cell_centered

Indicates whether centered positioning for data is used.

data

Method to lazy load the slice's data.

n_t

Get the number of timesteps for which data was output.

orientation

Orientation [1,2,3] of the slice in case it is 2D, 0 otherwise.

shape

2D-shape of the slice.

times

vector_data

Method to lazy load the slice's vector data if it exists.

vmax

vmin

Methods:

clear_cache()

Remove all data from the internal cache that has been loaded so far to free memory.

get_coordinates([ignore_cell_centered])

Returns a dictionary containing a numpy ndarray with coordinates for each dimension.

property cell_centered: bool

Indicates whether centered positioning for data is used.

clear_cache()[source]

Remove all data from the internal cache that has been loaded so far to free memory.

property data: ndarray

Method to lazy load the slice’s data.

get_coordinates(ignore_cell_centered: bool = False) Dict[Literal['x', 'y', 'z'], ndarray][source]

Returns a dictionary containing a numpy ndarray with coordinates for each dimension. For cell-centered slices, the coordinates can be adjusted to represent cell-centered coordinates.

Parameters:

ignore_cell_centered – Whether to shift the coordinates when the slice is cell_centered or not.

property n_t: int

Get the number of timesteps for which data was output.

property orientation: Literal[0, 1, 2, 3]

Orientation [1,2,3] of the slice in case it is 2D, 0 otherwise.

property shape: Tuple[int, int]

2D-shape of the slice.

property times
property vector_data: Dict[str, ndarray]

Method to lazy load the slice’s vector data if it exists.

property vmax
property vmin
fdsreader.slcf.slice.implements(np_function)[source]

Decorator to register an __array_function__ implementation for Slices.

Collection of GeomSlice objects. Offers extensive functionality for filtering and using geomslices as well as its subclasses such as SubSlice.

Classes:

GeomSlice(root_path, geomslice_id, times, ...)

Slice file data container including metadata. Consists of multiple subgeomslices, one for each

SubGeomSlice(parent_slice, filename, ...)

Part of a geomslice that cuts through a single mesh.

Functions:

implements(np_function)

Decorator to register an __array_function__ implementation for GeomSlices.

class fdsreader.slcf.geomslice.GeomSlice(root_path: str, geomslice_id: str, times: ndarray, multimesh_data: Collection[Dict])[source]
Slice file data container including metadata. Consists of multiple subgeomslices, one for each

mesh the geomslice cuts through.

Variables:
  • cell_centered – Indicates whether centered positioning for data is used.

  • quantity – Quantity object containing information about the quantity calculated for this geomslice with the corresponding short_name and unit.

  • times – Numpy array containing all times for which data has been recorded.

  • n_t – Total number of time steps for which output data has been written.

  • orientation – Orientation [1,2,3] of the geomslice in case it is 2D, 0 otherwise.

  • extentExtent object containing 3-dimensional extent information.

Methods:

clear_cache()

Remove all data from the internal cache that has been loaded so far to free memory.

get_nearest_timestep(time)

Calculates the nearest timestep for which data has been output for this geomslice.

get_subgeomslice(key)

Returns the SubGeomSlice that cuts through the given mesh.

mean()

Calculates the mean over the whole geomslice.

std()

Calculates the standard deviation over the whole geomslice.

Attributes:

data

faces

meshes

Returns a list of all meshes this geomslice cuts through.

subgeomslices

Get a list with all SubGeomSlices.

vertices

vmax

vmin

clear_cache()[source]

Remove all data from the internal cache that has been loaded so far to free memory.

property data
property faces
get_nearest_timestep(time: float) int[source]

Calculates the nearest timestep for which data has been output for this geomslice.

get_subgeomslice(key: int | str | Mesh) SubGeomSlice[source]

Returns the SubGeomSlice that cuts through the given mesh. When an int is provided the nth SubGeomSlice will be returned.

mean()[source]

Calculates the mean over the whole geomslice.

Returns:

The calculated mean value.

property meshes: List[Mesh]

Returns a list of all meshes this geomslice cuts through.

std()[source]

Calculates the standard deviation over the whole geomslice.

Returns:

The calculated standard deviation.

property subgeomslices: List[SubGeomSlice]

Get a list with all SubGeomSlices.

property vertices
property vmax
property vmin
class fdsreader.slcf.geomslice.SubGeomSlice(parent_slice, filename: str, geom_filename: str, extent: Extent, mesh: Mesh)[source]

Part of a geomslice that cuts through a single mesh.

Variables:

mesh – The mesh the subgeomslice cuts through.

Methods:

clear_cache()

Remove all data from the internal cache that has been loaded so far to free memory.

Attributes:

data

Method to lazy load the geomslice's data.

faces

Method to lazy load the geomslice's data.

n_t

Get the number of timesteps for which data was output.

orientation

Orientation [1,2,3] of the geomslice in case it is 2D, 0 otherwise.

times

vertices

Method to lazy load the geomslice's data.

vmax

vmin

clear_cache()[source]

Remove all data from the internal cache that has been loaded so far to free memory.

property data: ndarray

Method to lazy load the geomslice’s data.

property faces: ndarray

Method to lazy load the geomslice’s data.

property n_t: int

Get the number of timesteps for which data was output.

property orientation: Literal[1, 2, 3]

Orientation [1,2,3] of the geomslice in case it is 2D, 0 otherwise.

property times
property vertices: ndarray

Method to lazy load the geomslice’s data.

property vmax
property vmin
fdsreader.slcf.geomslice.implements(np_function)[source]

Decorator to register an __array_function__ implementation for GeomSlices.