Commit de1b485c authored by Thibault Hallouin's avatar Thibault Hallouin
Browse files

use relative import of pybind extension

1 merge request!1release v0.1.0.0
Pipeline #43047 failed with stage
in 2 minutes and 55 seconds
Showing with 11 additions and 7 deletions
+11 -7
from typing import List, Dict
from numpy import dtype
from numpy.typing import NDArray
import evalhyd.core
from ._evalhyd import _evald
def evald(q_obs: NDArray[dtype('float64')],
......@@ -15,6 +16,7 @@ def evald(q_obs: NDArray[dtype('float64')],
bootstrap: Dict[str, int] = None,
dts: List[str] = None) -> List[NDArray[dtype('float64')]]:
"""Function to evaluate determinist streamflow predictions"""
# required arguments
kwargs = {
# convect 1D array into 2D array view
......@@ -39,4 +41,4 @@ def evald(q_obs: NDArray[dtype('float64')],
if dts is not None:
kwargs['dts'] = dts
return evalhyd.core._evald(**kwargs)
return _evald(**kwargs)
from typing import List, Dict
from numpy import dtype
from numpy.typing import NDArray
import evalhyd.core
from ._evalhyd import _evalp
def evalp(q_obs: NDArray[dtype('float64')],
......@@ -13,6 +14,7 @@ def evalp(q_obs: NDArray[dtype('float64')],
bootstrap: Dict[str, int] = None,
dts: List[str] = None) -> List[NDArray[dtype('float64')]]:
"""Function to evaluate probabilist streamflow predictions"""
# required arguments
kwargs = {
'q_obs': q_obs,
......@@ -32,4 +34,4 @@ def evalp(q_obs: NDArray[dtype('float64')],
if dts is not None:
kwargs['dts'] = dts
return evalhyd.core._evalp(**kwargs)
return _evalp(**kwargs)
......@@ -72,7 +72,7 @@ auto evalp(
}
// Python Module and Docstrings
PYBIND11_MODULE(core, m)
PYBIND11_MODULE(_evalhyd, m)
{
xt::import_numpy();
......
......@@ -61,8 +61,8 @@ for dep, version, url in deps:
# configure Python extension
ext_modules = [
Pybind11Extension(
"evalhyd.core",
['evalhyd/src/core.cpp'],
"evalhyd._evalhyd",
['evalhyd/src/evalhyd.cpp'],
include_dirs=[
numpy.get_include(),
os.path.join(sys.prefix, 'include'),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment