ogstools.mesh.create.dataframe module#

ogstools.mesh.create.dataframe.dataframe_from_csv(layer_set_id, layer_sets_csvfile, surfaces)[source]#

Create a DataFrame from CSV data for a specific layer set.

This function reads a CSV file containing layer set information and filters it for a specific layer set ID. It then maps layer IDs to surface files and returns a DataFrame with material IDs, surface filenames, and resolutions. The surfaces corresponding to the layer_id must be sorted from top to bottom (high z values to low z values).

Parameters:
  • layer_set_id (int) – The layer set ID to filter the CSV data by.

  • layer_sets_csvfile (Path | str) – CSV file containing layer set information.

  • surfaces (dict[int, Path] | Path | str) – Either a dictionary mapping layer IDs to surface files, or a path to a directory containing surface files. If a directory path is provided, all .vtu files in the directory will be used. In that case, the layer_id in the layer_sets_csvfile has to correspond to the sorted list of .vtu files in the directory.

Returns:

A DataFrame containing columns ‘material_id’, ‘filename’, and ‘resolution’ for the specified layer set.

Raises:

ValueError, If no model is defined with the given layer_set_id.

Return type:

DataFrame