"""
pyltm package
-------------
This is the entry point for ``pyltm`` package.
.. currentmodule:: pyltm
.. autosummary::
:toctree: _generate
"""
import os
[docs]
def get_pyltm_shlibpath() -> str: # pragma: no cover
"""
Returns the absolute path to the location of shared libraries within
the pyltm python package.
"""
return os.path.normpath(
os.path.join(os.path.dirname(__file__), "bin" if os.name == "nt" else "lib")
)
[docs]
def update_path_env(): # pragma: no cover
"""
Updates the PATH environment variable, adding the pyltm shared library path.
"""
if os.name == "nt":
# Dependent DLL's are located in PYLTM_LIBPATH. Also on Linux, but it uses
# the RPATH value in the ELF header of the .so file
# NOTE: These two do the same thing, but seemingly they don't both always
# work - may be an issue with Anaconda3 specifically.
pyltm_shlibpath = get_pyltm_shlibpath()
os.environ["PATH"] = os.environ["PATH"] + os.pathsep + pyltm_shlibpath
os.add_dll_directory(pyltm_shlibpath)
update_path_env()
# Import _core_pyltm into pyltm namespace
from ._core_pyltm import *
# This list must be updated manually to enable autoapi documentation in Sphinx
__all__: list[str] = [
"AggregatedHydroModule",
"BatteryModule",
"BiddingZone",
"Busbar",
"BusbarTS",
"BusbarTSes",
"BusbarWaterValue",
"Bypass",
"CalendarMode",
"ConversionLimit",
"CriticalNetworkElement",
"DCLine",
"ExportSettings",
"ExportTarget",
"ExportedData",
"Exporter",
"FactorValues",
"FeedbackFactors",
"GlobalSettings",
"HistoricalType",
"HydraulicCoupling",
"Inflow",
"Load",
"LtmApiModel",
"LtmApiModule",
"MainPriceSeries",
"MarketCalibrationArea",
"MarketStep",
"ModelType",
"NDArray_f32",
"NDArray_f64",
"NDArray_int64_t",
"Plant",
"Pump",
"PyExporter",
"PyLtmConnection",
"PyLtmReference",
"PyltmResult",
"Reservoir",
"ReservoirType",
"SecondaryPriceSeries",
"SimulationType",
"Solar",
"Spill",
"Txy",
"TxyLin",
"V10DatasetConverter",
"WaterValue",
"WaterValueData",
"Watercourse",
"Wind",
"WindData",
"Xy",
"add",
"datatypes",
"get_pyltm_shlibpath",
"os",
"update_path_env",
"util",
]