flixopt.io ¶
Classes¶
CalculationResultsPaths dataclass
¶
Functions¶
remove_none_and_empty ¶
Recursively removes None and empty dicts and lists values from a dictionary or list.
document_linopy_model ¶
Convert all model variables and constraints to a structured string representation. This can take multiple seconds for large models. The output can be saved to a yaml file with readable formating applied.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path | Path | Path to save the document. Defaults to None. | None |
save_dataset_to_netcdf ¶
Python
save_dataset_to_netcdf(ds: Dataset, path: str | Path, compression: int = 0, engine: Literal['netcdf4', 'scipy', 'h5netcdf'] = 'h5netcdf') -> None
Save a dataset to a netcdf file. Store all attrs as JSON strings in 'attrs' attributes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds | Dataset | Dataset to save. | required |
path | str | Path | Path to save the dataset to. | required |
compression | int | Compression level for the dataset (0-9). 0 means no compression. 5 is a good default. | 0 |
Raises:
Type | Description |
---|---|
ValueError | If the path has an invalid file extension. |