From da65910cd153f91d6a987546d8b63e1811dd6528 Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel Date: Fri, 3 May 2024 11:07:43 +0200 Subject: [PATCH 1/9] Move docstrings to docstrings_common.json file and generation of the docstrings from simulators to common --- CMakeLists.txt | 23 ++++++++- python/cxx/schedule.cpp | 82 +++++--------------------------- python/docstrings_common.json | 35 ++++++++++++++ python/generate_docstring_hpp.py | 42 ++++++++++++++++ python/opm_embedded/__init__.pyi | 2 +- 5 files changed, 111 insertions(+), 73 deletions(-) create mode 100644 python/docstrings_common.json create mode 100755 python/generate_docstring_hpp.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 9dd80bdb08c..39d4f41e5e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,6 +149,21 @@ macro (sources_hook) endif() set_source_files_properties(src/opm/input/eclipse/Python/Python.cpp PROPERTIES COMPILE_FLAGS -Wno-shadow) + if (OPM_ENABLE_PYTHON) + # Set the path to the input docstrings.json file and the output .hpp file + set(PYTHON_DOCSTRINGS_FILE "${PROJECT_SOURCE_DIR}/python/docstrings_common.json") + set(PYTHON_DOCSTRINGS_GENERATED_HPP "${PROJECT_BINARY_DIR}/python/cxx/OpmCommonPythonDoc.hpp") + # Command to run the Python script + add_custom_command( + OUTPUT ${PYTHON_DOCSTRINGS_GENERATED_HPP} + COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/python/generate_docstring_hpp.py + ${PYTHON_DOCSTRINGS_FILE} ${PYTHON_DOCSTRINGS_GENERATED_HPP} OPMCOMMONPYTHONDOC_HPP "Opm::Common::DocStrings" + DEPENDS ${PYTHON_DOCSTRINGS_FILE} + COMMENT "Generating OpmCommonPythonDoc.hpp from JSON file" + ) + list(INSERT opm-common_SOURCES 0 ${PYTHON_DOCSTRINGS_GENERATED_HPP}) + endif() + if(QuadMath_FOUND) get_target_property(qm_defs QuadMath::QuadMath INTERFACE_COMPILE_DEFINITIONS) get_target_property(qm_options QuadMath::QuadMath INTERFACE_COMPILE_OPTIONS) @@ -157,7 +172,6 @@ macro (sources_hook) PROPERTIES COMPILE_DEFINITIONS "${qm_defs}" COMPILE_OPTIONS "${qm_options}") endif() - endmacro (sources_hook) macro (fortran_hook) @@ -456,6 +470,13 @@ if (OPM_ENABLE_PYTHON) install( PROGRAMS "python/install.py" DESTINATION "${OPM_PYTHON_COMMON_DIR}" ) endif() + if (OPM_ENABLE_PYTHON OR OPM_INSTALL_PYTHON) # if OPM_ENABLE_EMBEDDED_PYTHON is true, then OPM_ENABLE_PYTHON is also automatically true + ## Need to install this Python script such that it can be used by opm-simulators when building against an installed + ## opm-common + install( PROGRAMS "python/generate_docstring_hpp.py" DESTINATION "${OPM_PYTHON_COMMON_DIR}" ) + install( FILES "python/docstrings_common.json" DESTINATION "${OPM_PYTHON_COMMON_DIR}" ) + endif() + # Observe that if the opmcommon library has been built as a shared library the # python library opmcommon_python will in general not find it runtime while # testing. diff --git a/python/cxx/schedule.cpp b/python/cxx/schedule.cpp index a8f6c144041..5e36952ef7b 100644 --- a/python/cxx/schedule.cpp +++ b/python/cxx/schedule.cpp @@ -16,6 +16,7 @@ #include #include "export.hpp" +#include namespace { @@ -192,6 +193,8 @@ namespace { void python::common::export_Schedule(py::module& module) { + using namespace Opm::Common::DocStrings; + // Note: In the below class we use std::shared_ptr as the holder type, see: // // https://pybind11.readthedocs.io/en/stable/advanced/smart_ptrs.html @@ -199,83 +202,20 @@ void python::common::export_Schedule(py::module& module) { // this makes it possible to share the returned object with e.g. and // opm.simulators.BlackOilSimulator Python object // - py::class_< Schedule, std::shared_ptr >( module, "Schedule", R"pbdoc( - The Opm::Schedule class - this is a representation of all the content from - the SCHEDULE section, notably all well and group information and the timestepping. - )pbdoc") + py::class_< Schedule, std::shared_ptr >( module, "Schedule", ScheduleClass_docstring) .def(py::init(), py::arg("deck"), py::arg("eclipse_state")) .def("_groups", &get_groups, py::arg("report_step")) .def_property_readonly( "start", &get_start_time ) .def_property_readonly( "end", &get_end_time ) .def_property_readonly( "timesteps", &get_timesteps ) .def("__len__", &Schedule::size) - .def("__getitem__", &getitem) - .def("shut_well", py::overload_cast(&Schedule::shut_well), py::arg("well_name"), py::arg("step"), R"( - Shut down a well at a given report step. - - Args: - well_name (str): The name of the well to shut down. - report_step (int): The report step at which to shut down the well. - - Raises: - ValueError: If the report step is in the past or exceeds the duration of the simulation. - - Returns: - None - )") - .def("shut_well", py::overload_cast(&Schedule::shut_well), py::arg("well_name"), R"( - Shut down a well at the current report step. - - Args: - well_name (str): The name of the well to shut down. - - Returns: - None - )") - .def("open_well", py::overload_cast(&Schedule::open_well), py::arg("well_name"), py::arg("step"), R"( - Open a well at a given report step. - - Args: - well_name (str): The name of the well to open. - report_step (int): The report step at which to open the well. - - Raises: - ValueError: If the report step is in the past or exceeds the duration of the simulation. - - Returns: - None - )") - .def("open_well", py::overload_cast(&Schedule::open_well), py::arg("well_name"), R"( - Open a well at the current report step. - - Args: - well_name (str): The name of the well to open. - - Returns: - None - )") - .def("stop_well", py::overload_cast(&Schedule::stop_well), py::arg("well_name"), py::arg("step"), R"( - Stop a well at a given report step. - - Args: - well_name (str): The name of the well to stop. - report_step (int): The report step at which to stop the well. - - Raises: - ValueError: If the report step is in the past or exceeds the duration of the simulation. - - Returns: - None - )") - .def("stop_well", py::overload_cast(&Schedule::stop_well), py::arg("well_name"), R"( - Stop a well at the current report step. - - Args: - well_name (str): The name of the well to stop. - - Returns: - None - )") + .def("__getitem__", &getitem, py::arg("report_step"), Schedule_getitem_docstring) + .def("shut_well", py::overload_cast(&Schedule::shut_well), py::arg("well_name"), py::arg("step"), Schedule_shut_well_well_name_step_docstring) + .def("shut_well", py::overload_cast(&Schedule::shut_well), py::arg("well_name"), Schedule_shut_well_well_name_docstring) + .def("open_well", py::overload_cast(&Schedule::open_well), py::arg("well_name"), py::arg("step"), Schedule_open_well_well_name_step_docstring) + .def("open_well", py::overload_cast(&Schedule::open_well), py::arg("well_name"), Schedule_open_well_well_name_docstring) + .def("stop_well", py::overload_cast(&Schedule::stop_well), py::arg("well_name"), py::arg("step"), Schedule_stop_well_well_name_step_docstring) + .def("stop_well", py::overload_cast(&Schedule::stop_well), py::arg("well_name"), Schedule_stop_well_well_name_docstring) .def( "get_wells", &Schedule::getWells, py::arg("well_name_pattern")) .def( "get_injection_properties", &get_injection_properties, py::arg("well_name"), py::arg("report_step")) .def( "get_production_properties", &get_production_properties, py::arg("well_name"), py::arg("report_step")) diff --git a/python/docstrings_common.json b/python/docstrings_common.json new file mode 100644 index 00000000000..6d0163d4bb3 --- /dev/null +++ b/python/docstrings_common.json @@ -0,0 +1,35 @@ +{ + "ScheduleClass": { + "type": "class", + "signature": "opm.io.schedule.Schedule", + "doc": "The Schedule class - this is a representation of all the content from the SCHEDULE section, notably all well and group information and the timestepping." + }, + "Schedule_getitem": { + "signature": "opm.io.schedule.Schedule.__getitem__(report_step: int) -> ScheduleState", + "doc": "Return the ScheduleState at the given report step.\n\n:param report_step: The report step.\n:type report_step: int\n\n:return: The ScheduleState at the given report step.\n:type return: ScheduleState" + }, + "Schedule_shut_well_well_name_step": { + "signature": "opm.io.schedule.Schedule.shut_well(well_name: str, step: int) -> None", + "doc": "Shut down a well at a given report step.\n\n:param well_name: The name of the well to shut down.\n:type well_name: str\n:param step: The report step at which to shut down the well.\n:type step: int" + }, + "Schedule_shut_well_well_name": { + "signature": "opm.io.schedule.Schedule.shut_well(well_name: str) -> None", + "doc": "Shut down a well at the current report step.\n\n:param well_name: The name of the well to shut down.\n:type well_name: str" + }, + "Schedule_open_well_well_name_step": { + "signature": "opm.io.schedule.Schedule.open_well(well_name: str, step: int) -> None", + "doc": "Open a well at a given report step.\n\n:param well_name: The name of the well to open.\n:type well_name: str\n:param step: The report step at which to open the well.\n:type step: int\n:raises ValueError: If the report step is in the past or exceeds the duration of the simulation." + }, + "Schedule_open_well_well_name": { + "signature": "opm.io.schedule.Schedule.open_well(well_name: str) -> None", + "doc": "Open a well at the current report step.\n\n:param well_name: The name of the well to open.\n:type well_name: str" + }, + "Schedule_stop_well_well_name_step":{ + "signature": "opm.io.schedule.Schedule.stop_well(well_name: str, step: int) -> None", + "doc": "Stop a well at a given report step.\n\n:param well_name: The name of the well to stop.\n:type well_name: str\n:param step: The report step at which to stop the well.\n:type step: int\n:raises ValueError: If the report step is in the past or exceeds the duration of the simulation." + }, + "Schedule_stop_well_well_name": { + "signature": "opm.io.schedule.Schedule.stop_well(well_name: str) -> None", + "doc": "Stop a well at the current report step.\n\n:param well_name: The name of the well to stop.\n:type well_name: str" + } +} diff --git a/python/generate_docstring_hpp.py b/python/generate_docstring_hpp.py new file mode 100755 index 00000000000..c9203fc7f73 --- /dev/null +++ b/python/generate_docstring_hpp.py @@ -0,0 +1,42 @@ +import json +import sys + +def generate_hpp_from_json(json_path: str, output_hpp_path: str, macro: str, namespace: str): + with open(json_path, 'r', encoding='utf-8') as file: + docstrings = json.load(file) + + hpp_content = f"""\ +#ifndef {macro} +#define {macro} + +// Generated docstrings +namespace {namespace} """ + hpp_content += "{" + + for func_name, info in docstrings.items(): + doc = info['doc'].replace('\n', '\n ') + hpp_content += f""" +static constexpr char {func_name}_docstring[] = R\"doc( +{doc} +)doc\";\n""" + hpp_content += "}" + hpp_content += f"""\ + // namespace {namespace} + +#endif // {macro} +""" + + with open(output_hpp_path, 'w', encoding='utf-8') as file: + file.write(hpp_content) + +if __name__ == "__main__": + # Check that exactly three command line arguments are provided + if len(sys.argv) != 5: + print("Usage: python generate_docstring_hpp.py ") + sys.exit(1) + # Extract json_path and output_hpp_path from command line arguments + json_path = sys.argv[1] + output_hpp_path = sys.argv[2] + macro = sys.argv[3] + namespace = sys.argv[4] + generate_hpp_from_json(json_path, output_hpp_path, macro, namespace) diff --git a/python/opm_embedded/__init__.pyi b/python/opm_embedded/__init__.pyi index b8a4443b4d8..913628e6a93 100644 --- a/python/opm_embedded/__init__.pyi +++ b/python/opm_embedded/__init__.pyi @@ -2704,7 +2704,7 @@ class Schedule: def stop_well(self, well_name: str) -> None: ... def well_names(self, well_name_pattern: str) -> List[str]: ... def __contains__(self, well_name: str) -> bool: ... - def __getitem__(self, arg0: int) -> ScheduleState: ... + def __getitem__(self, report_step: int) -> ScheduleState: ... def __iter__(self) -> typing.Iterator[ScheduleState]: ... def __len__(self) -> int: ... @property From 650813bed84dbb3e04195f0f18918892f48c7697 Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel Date: Tue, 7 May 2024 08:55:26 +0200 Subject: [PATCH 2/9] Add documentation to the 'not-so-clear' methods of the Schedule class --- python/cxx/schedule.cpp | 10 +++++----- python/docstrings_common.json | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/python/cxx/schedule.cpp b/python/cxx/schedule.cpp index 5e36952ef7b..72d5e32c10d 100644 --- a/python/cxx/schedule.cpp +++ b/python/cxx/schedule.cpp @@ -204,7 +204,7 @@ void python::common::export_Schedule(py::module& module) { // py::class_< Schedule, std::shared_ptr >( module, "Schedule", ScheduleClass_docstring) .def(py::init(), py::arg("deck"), py::arg("eclipse_state")) - .def("_groups", &get_groups, py::arg("report_step")) + .def("_groups", &get_groups, py::arg("report_step"), Schedule_groups_docstring) .def_property_readonly( "start", &get_start_time ) .def_property_readonly( "end", &get_end_time ) .def_property_readonly( "timesteps", &get_timesteps ) @@ -216,11 +216,11 @@ void python::common::export_Schedule(py::module& module) { .def("open_well", py::overload_cast(&Schedule::open_well), py::arg("well_name"), Schedule_open_well_well_name_docstring) .def("stop_well", py::overload_cast(&Schedule::stop_well), py::arg("well_name"), py::arg("step"), Schedule_stop_well_well_name_step_docstring) .def("stop_well", py::overload_cast(&Schedule::stop_well), py::arg("well_name"), Schedule_stop_well_well_name_docstring) - .def( "get_wells", &Schedule::getWells, py::arg("well_name_pattern")) - .def( "get_injection_properties", &get_injection_properties, py::arg("well_name"), py::arg("report_step")) - .def( "get_production_properties", &get_production_properties, py::arg("well_name"), py::arg("report_step")) + .def( "get_wells", &Schedule::getWells, py::arg("well_name_pattern"), Schedule_get_wells_docstring) + .def( "get_injection_properties", &get_injection_properties, py::arg("well_name"), py::arg("report_step"), Schedule_get_injection_properties_docstring) + .def( "get_production_properties", &get_production_properties, py::arg("well_name"), py::arg("report_step"), Schedule_get_production_properties_docstring) .def("well_names", py::overload_cast(&Schedule::wellNames, py::const_), py::arg("well_name_pattern")) - .def( "get_well", &get_well, py::arg("well_name"), py::arg("report_step")) + .def( "get_well", &get_well, py::arg("well_name"), py::arg("report_step"), Schedule_get_well_docstring) .def( "insert_keywords", py::overload_cast(&insert_keywords), py::arg("keywords"), py::arg("step")) .def( "insert_keywords", py::overload_cast(&insert_keywords), py::arg("data"), py::arg("step"), py::arg("unit_system")) .def( "insert_keywords", py::overload_cast(&insert_keywords), py::arg("data"), py::arg("step")) diff --git a/python/docstrings_common.json b/python/docstrings_common.json index 6d0163d4bb3..e9058917686 100644 --- a/python/docstrings_common.json +++ b/python/docstrings_common.json @@ -31,5 +31,25 @@ "Schedule_stop_well_well_name": { "signature": "opm.io.schedule.Schedule.stop_well(well_name: str) -> None", "doc": "Stop a well at the current report step.\n\n:param well_name: The name of the well to stop.\n:type well_name: str" + }, + "Schedule_get_injection_properties": { + "signature": "opm.io.schedule.Schedule.get_injection_properties(well_name: str, report_step: int) -> dict", + "doc": "Get injection properties for a well at a specific report step.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param report_step: The report step to retrieve properties for.\n:type report_step: int\n\n:return: A dict containing the properties surf_inj_rate, resv_inj_rate, bhp_target, thp_target. \n:type return: dict" + }, + "Schedule_get_production_properties": { + "signature": "opm.io.schedule.Schedule.get_production_properties(well_name: str, report_step: int) -> dict", + "doc": "Get production properties for a well at a specific report step.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param report_step: The report step to retrieve properties for.\n:type report_step: int\n\n:return: A dict containing the properties oil_rate, gas_rate, water_rate, liquid_rate, resv_rate, bhp_target, thp_target, alq_value. \n:type return: dict" + }, + "Schedule_groups": { + "signature": "opm.io.schedule.Schedule._groups(report_step: int) -> list", + "doc": "Get a list of all groups at a specified report step.\n\n:param report_step: The report step to retrieve groups for.\n:type report_step: int\n\n:return: A list containing all groups at the specified report step. \n:type return: list" + }, + "Schedule_get_well": { + "signature": "opm.io.schedule.Schedule.get_well(well_name: str, report_step: int) -> Well", + "doc": "Retrieve a well at a given report step.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param report_step: The report step.\n:type report_step: int\n\n:return: Well object at the given report step. \n:type return: well" + }, + "Schedule_get_wells": { + "signature": "opm.io.schedule.Schedule.get_wells(well_name_pattern: str) -> list", + "doc": "Get the names of wells matching a specified pattern.\n\n:param well_name_pattern: The pattern for well names, where '*' acts as a wildcard.\n:type well_name_pattern: str\n\n:return: A list containing the names of wells that match the specified pattern. \n:type return: list" } } From b39ea6a879ef8544f5e7ff0bfd77d6dc462d31fa Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel Date: Tue, 7 May 2024 08:55:50 +0200 Subject: [PATCH 3/9] Add documentation to the 'not-so-clear' methods of the EclipseState class --- python/cxx/eclipse_state.cpp | 18 +++++++++--------- python/docstrings_common.json | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/python/cxx/eclipse_state.cpp b/python/cxx/eclipse_state.cpp index 5fd48748504..b2094c1df6a 100644 --- a/python/cxx/eclipse_state.cpp +++ b/python/cxx/eclipse_state.cpp @@ -5,6 +5,7 @@ #include "export.hpp" +#include namespace { @@ -96,6 +97,8 @@ namespace { void python::common::export_EclipseState(py::module& module) { + using namespace Opm::Common::DocStrings; + // Note: In the below class we std::shared_ptr as the holder type, see: // // https://pybind11.readthedocs.io/en/stable/advanced/smart_ptrs.html @@ -103,10 +106,7 @@ void python::common::export_EclipseState(py::module& module) { // this makes it possible to share the returned object with e.g. and // opm.simulators.BlackOilSimulator Python object // - py::class_< EclipseState, std::shared_ptr >( module, "EclipseState", R"pbdoc( - The Opm::EclipseState class - this is a representation of all static properties in the model, - ranging from porosity to relperm tables. The content of the EclipseState is immutable and may not - be changed at runtime.)pbdoc") + py::class_< EclipseState, std::shared_ptr >( module, "EclipseState", EclipseStateClass_docstring) .def(py::init()) .def_property_readonly( "title", &EclipseState::getTitle ) .def( "field_props", &get_field_props, ref_internal) @@ -114,11 +114,11 @@ void python::common::export_EclipseState(py::module& module) { .def( "config", &EclipseState::cfg, ref_internal) .def( "tables", &EclipseState::getTableManager, ref_internal) .def( "has_input_nnc", &EclipseState::hasInputNNC ) - .def( "simulation", &EclipseState::getSimulationConfig, ref_internal) - .def( "input_nnc", &getNNC ) - .def( "faultNames", &faultNames ) - .def( "faultFaces", &faultFaces, py::arg("fault_name")) - .def( "jfunc", &jfunc ) + .def( "simulation", &EclipseState::getSimulationConfig, ref_internal, EclipseState_simulation_docstring) + .def( "input_nnc", &getNNC, EclipseState_input_nnc_docstring) + .def( "faultNames", &faultNames, EclipseState_faultNames_docstring) + .def( "faultFaces", &faultFaces, py::arg("fault_name"), EclipseState_faultFaces_docstring) + .def( "jfunc", &jfunc, EclipseState_jfunc_docstring) ; } diff --git a/python/docstrings_common.json b/python/docstrings_common.json index e9058917686..8e9f27f9716 100644 --- a/python/docstrings_common.json +++ b/python/docstrings_common.json @@ -1,4 +1,29 @@ { + "EclipseStateClass": { + "type": "class", + "signature": "opm.io.ecl_state.EclipseState", + "doc": "The EclipseState class - this is a representation of all static properties in the model,ranging from porosity to relperm tables.\nThe content of the EclipseState is immutable and may not be changed at runtime." + }, + "EclipseState_input_nnc": { + "signature": "opm.io.ecl_state.EclipseState.input_nnc() -> list", + "doc": "Returns a list of non-neighboring connections.\n\nOne non-neighboring connection is a tuple containing the following elements:\n- index1 (int): Index of the first cell.\n- index2 (int): Index of the second cell.\n- transmissibility (double): Transmissibility between the two cells.\n\n:return: A list of non-neighboring connections. \n:type return: list" + }, + "EclipseState_faultNames": { + "signature": "opm.io.ecl_state.EclipseState.faultNames() -> list", + "doc": "Returns a list of fault names.\n\n:return: A list containing the names of faults. \n:type return: list" + }, + "EclipseState_faultFaces": { + "signature": "opm.io.ecl_state.EclipseState.faultFaces(fault_name: str) -> list", + "doc": "Returns a list of faces of a fault with the given name.\n\n:param fault_name: The name of the fault.\n:type fault_name: str\n\n:return: A list containing the faces of the specified fault. \n:type return: list" + }, + "EclipseState_jfunc": { + "signature": "opm.io.ecl_state.EclipseState.jfunc() -> dict", + "doc": "Function returning a dictionary with the following entries: ['FLAG', 'DIRECTION', 'ALPHA_FACTOR', 'BETA_FACTOR', 'OIL_WATER', 'GAS_OIL']\n\n:return: A dictionary containing the specified entries. \n:type return: dict" + }, + "EclipseState_simulation": { + "signature": "opm.io.ecl_state.EclipseState.simulation() -> SimulationConfiguration", + "doc": "Returns the simulation configuration.\n\n:return: The simulation configuration. \n:type return: SimulationConfiguration" + }, "ScheduleClass": { "type": "class", "signature": "opm.io.schedule.Schedule", From a08da3ff04fd30c977734d48c6b4b5076ccd4913 Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel Date: Fri, 7 Jun 2024 08:13:18 +0200 Subject: [PATCH 4/9] Add documentation to the 'not-so-clear' methods of the ScheduleState class --- python/cxx/schedule_state.cpp | 10 +++++++--- python/docstrings_common.json | 13 +++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/python/cxx/schedule_state.cpp b/python/cxx/schedule_state.cpp index a2e2451d2e9..58988c2c54f 100644 --- a/python/cxx/schedule_state.cpp +++ b/python/cxx/schedule_state.cpp @@ -2,6 +2,8 @@ #include "export.hpp" +#include + namespace { const Group& get_group(const ScheduleState& st, const std::string& group_name) { return st.groups.get(group_name); @@ -18,8 +20,10 @@ namespace { */ void python::common::export_ScheduleState(py::module& module) { - py::class_(module, "ScheduleState") - .def_property_readonly("nupcol", py::overload_cast<>(&ScheduleState::nupcol, py::const_)) - .def("group", &get_group, ref_internal, py::arg("group_name")) + using namespace Opm::Common::DocStrings; + + py::class_(module, "ScheduleState", ScheduleStateClass_docstring) + .def_property_readonly("nupcol", py::overload_cast<>(&ScheduleState::nupcol, py::const_), ScheduleState_nupcol_docstring) + .def("group", &get_group, ref_internal, py::arg("group_name"), ScheduleState_get_group_docstring) ; } diff --git a/python/docstrings_common.json b/python/docstrings_common.json index 8e9f27f9716..d4186eed198 100644 --- a/python/docstrings_common.json +++ b/python/docstrings_common.json @@ -76,5 +76,18 @@ "Schedule_get_wells": { "signature": "opm.io.schedule.Schedule.get_wells(well_name_pattern: str) -> list", "doc": "Get the names of wells matching a specified pattern.\n\n:param well_name_pattern: The pattern for well names, where '*' acts as a wildcard.\n:type well_name_pattern: str\n\n:return: A list containing the names of wells that match the specified pattern. \n:type return: list" + }, + "ScheduleStateClass": { + "signature": "ScheduleState", + "type": "class", + "doc": "The ScheduleState class." + }, + "ScheduleState_nupcol": { + "signature": "ScheduleState.nupcol", + "doc": "The NUPCOL value at this Schedule State. This is a positive integer that defines the maximum number of Newton iterations used to update well targets within a time step." + }, + "ScheduleState_get_group": { + "signature": "ScheduleState.get_group(group_name: str) -> Group", + "doc": "Get the group with the specified name from the schedule state.\n\n:param group_name: The name of the group to retrieve from the schedule state.\n:type group_name: str\n\n:return: The group with the specified name from the schedule state. \n:type return: Group" } } From 624906e60a0aac0e4b0c8e33e0e87174ecf8c704 Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel Date: Fri, 7 Jun 2024 08:13:52 +0200 Subject: [PATCH 5/9] Add documentation to the 'not-so-clear' methods of the Well class --- python/cxx/well.cpp | 11 +++++++---- python/docstrings_common.json | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/python/cxx/well.cpp b/python/cxx/well.cpp index 5b83d5fca71..a59aa57c8cd 100644 --- a/python/cxx/well.cpp +++ b/python/cxx/well.cpp @@ -5,6 +5,7 @@ #include #include "export.hpp" +#include namespace { @@ -34,17 +35,19 @@ namespace { void python::common::export_Well(py::module& module) { + using namespace Opm::Common::DocStrings; + py::class_< Well >( module, "Well") .def_property_readonly( "name", &Well::name ) .def_property_readonly( "preferred_phase", &preferred_phase ) - .def( "pos", &get_pos ) + .def( "pos", &get_pos, Well_pos_docstring) .def( "status", &status ) - .def( "isdefined", &Well::hasBeenDefined ) + .def( "isdefined", &Well::hasBeenDefined, Well_isdefined_docstring) .def( "isinjector", &Well::isInjector ) .def( "isproducer", &Well::isProducer ) .def( "group", &Well::groupName ) .def( "guide_rate", &Well::getGuideRate ) - .def( "available_gctrl", &Well::isAvailableForGroupControl ) - .def( "connections", &connections ); + .def( "available_gctrl", &Well::isAvailableForGroupControl, Well_available_gctrl_docstring) + .def( "connections", &connections, Well_connections_docstring); } diff --git a/python/docstrings_common.json b/python/docstrings_common.json index d4186eed198..caa8e4e7c40 100644 --- a/python/docstrings_common.json +++ b/python/docstrings_common.json @@ -89,5 +89,26 @@ "ScheduleState_get_group": { "signature": "ScheduleState.get_group(group_name: str) -> Group", "doc": "Get the group with the specified name from the schedule state.\n\n:param group_name: The name of the group to retrieve from the schedule state.\n:type group_name: str\n\n:return: The group with the specified name from the schedule state. \n:type return: Group" + }, + "WellClass": { + "type": "class", + "signature": "Well", + "doc": "The Well class." + }, + "Well_pos": { + "signature": "Well.pos() -> tuple", + "doc": "Retrieve the position of the well.\n\n:return: A tuple containing the (i, j) coordinates and the reference depth of the well. \n:type return: tuple" + }, + "Well_isdefined": { + "signature": "Well.isdefined(report_step: int) -> bool", + "doc": "Check if the well is defined at a specific report step.\n\n:param report_step: The report step to check for the well's definition.\n:type report_step: int\n\n:return: True if the well is defined at the specified report step, False otherwise. \n:type return: bool" + }, + "Well_available_gctrl": { + "signature": "Well.available_gctrl() -> bool", + "doc": "Check if the well is available for group control.\n\n:return: True if the well is available for group control, False otherwise. \n:type return: bool" + }, + "Well_connections": { + "signature": "Well.connections() -> list", + "doc": "Get a list of all connections associated with the well.\n\n:return: A list containing all connections of the well. \n:type return: list" } } From 847d6d7514e2a9403431f9f6e5d68582463be5f3 Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel Date: Fri, 7 Jun 2024 08:13:40 +0200 Subject: [PATCH 6/9] Add documentation to the 'not-so-clear' methods of the SummaryState class --- python/cxx/summary_state.cpp | 27 ++++++++++++----------- python/docstrings_common.json | 41 +++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 13 deletions(-) diff --git a/python/cxx/summary_state.cpp b/python/cxx/summary_state.cpp index 56a0e01020f..0725726aa33 100644 --- a/python/cxx/summary_state.cpp +++ b/python/cxx/summary_state.cpp @@ -25,6 +25,8 @@ #include #include "export.hpp" +#include + namespace { @@ -42,22 +44,21 @@ std::vector wells(const SummaryState * st) { void python::common::export_SummaryState(py::module& module) { - py::class_>(module, "SummaryState", R"pbdoc( - The Opm::SummaryState class - this is where the current summary results of the simulator are stored. - The SummaryState class has methods to get hold of well, group and general variables. - )pbdoc") + using namespace Opm::Common::DocStrings; + + py::class_>(module, "SummaryState", SummaryStateClass_docstring) .def(py::init()) .def("update", &SummaryState::update) - .def("update_well_var", &SummaryState::update_well_var, py::arg("well_name"), py::arg("variable_name"), py::arg("new_value")) - .def("update_group_var", &SummaryState::update_group_var, py::arg("group_name"), py::arg("variable_name"), py::arg("new_value")) - .def("well_var", py::overload_cast(&SummaryState::get_well_var, py::const_), py::arg("well_name"), py::arg("variable_name")) - .def("group_var", py::overload_cast(&SummaryState::get_group_var, py::const_), py::arg("group_name"), py::arg("variable_name")) - .def("elapsed", &SummaryState::get_elapsed) - .def_property_readonly("groups", groups) - .def_property_readonly("wells", wells) + .def("update_well_var", &SummaryState::update_well_var, py::arg("well_name"), py::arg("variable_name"), py::arg("new_value"), SummaryState_update_well_var_docstring) + .def("update_group_var", &SummaryState::update_group_var, py::arg("group_name"), py::arg("variable_name"), py::arg("new_value"), SummaryState_update_group_var_docstring) + .def("well_var", py::overload_cast(&SummaryState::get_well_var, py::const_), py::arg("well_name"), py::arg("variable_name"), SummaryState_well_var_docstring) + .def("group_var", py::overload_cast(&SummaryState::get_group_var, py::const_), py::arg("group_name"), py::arg("variable_name"), SummaryState_group_var_docstring) + .def("elapsed", &SummaryState::get_elapsed, SummaryState_elapsed_docstring) + .def_property_readonly("groups", groups, SummaryState_groups_docstring) + .def_property_readonly("wells", wells, SummaryState_wells_docstring) .def("__contains__", &SummaryState::has) - .def("has_well_var", py::overload_cast(&SummaryState::has_well_var, py::const_), py::arg("well_name"), py::arg("variable_name")) - .def("has_group_var", py::overload_cast(&SummaryState::has_group_var, py::const_), py::arg("group_name"), py::arg("variable_name")) + .def("has_well_var", py::overload_cast(&SummaryState::has_well_var, py::const_), py::arg("well_name"), py::arg("variable_name"), SummaryState_has_well_var_docstring) + .def("has_group_var", py::overload_cast(&SummaryState::has_group_var, py::const_), py::arg("group_name"), py::arg("variable_name"), SummaryState_has_group_var_docstring) .def("__setitem__", &SummaryState::set) .def("__getitem__", py::overload_cast(&SummaryState::get, py::const_)) ; diff --git a/python/docstrings_common.json b/python/docstrings_common.json index caa8e4e7c40..e3e3c068879 100644 --- a/python/docstrings_common.json +++ b/python/docstrings_common.json @@ -1,4 +1,45 @@ { + "SummaryStateClass":{ + "type": "class", + "signature": "opm.io.sim.SummaryState", + "doc": "The SummaryState class - this is where the current summary results of the simulator are stored.\nThe SummaryState class has methods to get hold of well, group and general variables." + }, + "SummaryState_update_well_var": { + "signature": "opm.io.sim.SummaryState.update_well_var(well_name: str, variable_name: str, new_value: double) -> None", + "doc": "Update the variable of a well.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param variable_name: The name of the variable to update.\n:type variable_name: str\n:param new_value: The new value of the variable.\n:type new_value: double" + }, + "SummaryState_update_group_var": { + "signature": "opm.io.sim.SummaryState.update_group_var(group_name: str, variable_name: str, new_value: double) -> None", + "doc": "Update the variable of a group.\n\n:param group_name: The name of the group.\n:type group_name: str\n:param variable_name: The name of the variable to update.\n:type variable_name: str\n:param new_value: The new value of the variable.\n:type new_value: double" + }, + "SummaryState_well_var": { + "signature": "opm.io.sim.SummaryState.well_var(well_name: str, variable_name: str) -> double", + "doc": "Get the value of a variable for a well.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param variable_name: The name of the variable to retrieve.\n:type variable_name: str\n\n:return: The value of the specified variable for the well. \n:type return: double" + }, + "SummaryState_group_var": { + "signature": "opm.io.sim.SummaryState.group_var(group_name: str, variable_name: str) -> double", + "doc": "Get the value of a variable for a group.\n\n:param group_name: The name of the group.\n:type group_name: str\n:param variable_name: The name of the variable to retrieve.\n:type variable_name: str\n\n:return: The value of the specified variable for the group. \n:type return: double" + }, + "SummaryState_elapsed": { + "signature": "opm.io.sim.SummaryState.elapsed() -> double", + "doc": "Return the elapsed time in seconds of the current simulation.\n\n:return: The elapsed time in seconds. \n:type return: double" + }, + "SummaryState_groups": { + "signature": "opm.io.sim.SummaryState.groups -> list", + "doc": "Return a list of strings containing all group names.\n\n:return: A list of strings representing all group names. \n:type return: list" + }, + "SummaryState_wells": { + "signature": "opm.io.sim.SummaryState.wells -> list", + "doc": "Return a list of strings containing all well names.\n\n:return: A list of strings representing all well names. \n:type return: list" + }, + "SummaryState_has_well_var": { + "signature": "opm.io.sim.SummaryState.has_well_var(well_name: str, variable_name: str) -> bool", + "doc": "Check if a well variable exists.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param variable_name: The name of the variable to check.\n:type variable_name: str\n\n:return: True if the variable exists for the well, False otherwise. \n:type return: bool" + }, + "SummaryState_has_group_var": { + "signature": "opm.io.sim.SummaryState.has_group_var(group_name: str, variable_name: str) -> bool", + "doc": "Check if a group variable exists.\n\n:param group_name: The name of the group.\n:type group_name: str\n:param variable_name: The name of the variable to check.\n:type variable_name: str\n\n:return: True if the variable exists for the group, False otherwise. \n:type return: bool" + }, "EclipseStateClass": { "type": "class", "signature": "opm.io.ecl_state.EclipseState", From 140b4f4b5dd2c302e962c47029dd9459d5f91fc1 Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel Date: Tue, 25 Jun 2024 10:25:09 +0200 Subject: [PATCH 7/9] Add workflow to dispatch action to opm-simulators when docstrings_common.json is changed --- .github/workflows/dispatch_opm_simulators.yml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/dispatch_opm_simulators.yml diff --git a/.github/workflows/dispatch_opm_simulators.yml b/.github/workflows/dispatch_opm_simulators.yml new file mode 100644 index 00000000000..b6af560687d --- /dev/null +++ b/.github/workflows/dispatch_opm_simulators.yml @@ -0,0 +1,29 @@ +name: Dispatch to opm-simulators + +on: + push: + branches: master + paths: + - 'python/docstrings_common.json' + pull_request: + branches: master + paths: + - 'python/docstrings_common.json' + +jobs: + dispatch: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Send dispatch to opm-simulators + env: + PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + run: | + curl -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ + https://api.github.com/repos/lisajulia/opm-simulators/dispatches \ + -d '{"event_type":"docstrings_common_updated"}' From d994f87ab0a056a79e165c12070319fc4a76c24c Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel Date: Tue, 25 Jun 2024 16:52:44 +0200 Subject: [PATCH 8/9] Add documentation to the Group class --- python/cxx/group.cpp | 11 +++++++---- python/docstrings_common.json | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/python/cxx/group.cpp b/python/cxx/group.cpp index 8e998c9e8f4..633709630a5 100644 --- a/python/cxx/group.cpp +++ b/python/cxx/group.cpp @@ -2,6 +2,7 @@ #include #include "export.hpp" +#include namespace { @@ -12,9 +13,11 @@ namespace { void python::common::export_Group(py::module& module) { - py::class_< Group >( module, "Group") - .def_property_readonly( "name", &Group::name) - .def_property_readonly( "num_wells", &Group::numWells) - .def_property_readonly( "well_names", &wellnames ); + using namespace Opm::Common::DocStrings; + + py::class_< Group >( module, "Group", GroupClass_docstring) + .def_property_readonly( "name", &Group::name, Group_name_docstring) + .def_property_readonly( "num_wells", &Group::numWells, Group_num_wells_docstring) + .def_property_readonly( "well_names", &wellnames, Group_well_names_docstring); } diff --git a/python/docstrings_common.json b/python/docstrings_common.json index e3e3c068879..97441ea71ec 100644 --- a/python/docstrings_common.json +++ b/python/docstrings_common.json @@ -118,6 +118,23 @@ "signature": "opm.io.schedule.Schedule.get_wells(well_name_pattern: str) -> list", "doc": "Get the names of wells matching a specified pattern.\n\n:param well_name_pattern: The pattern for well names, where '*' acts as a wildcard.\n:type well_name_pattern: str\n\n:return: A list containing the names of wells that match the specified pattern. \n:type return: list" }, + "GroupClass": { + "signature": "Group", + "type": "class", + "doc": "The Group class." + }, + "Group_name": { + "signature": "Group.name", + "doc": "Returns the name of this group.\n\n:return: The name of this group.\n:type return: str" + }, + "Group_num_wells": { + "signature": "Group.name", + "doc": "Returns the number of wells in this group.\n\n:return: The number of wells in this group.\n:type return: int" + }, + "Group_well_names": { + "signature": "Group.name", + "doc": "Returns a list of all well names in this group.\n\n:return: A list of all well names in this group.\n:type return: list" + }, "ScheduleStateClass": { "signature": "ScheduleState", "type": "class", From 73cc234111ff6decf9da2e71c06d41fe28293115 Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel Date: Tue, 25 Jun 2024 17:05:53 +0200 Subject: [PATCH 9/9] Fix minor typos --- python/docstrings_common.json | 52 +++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/python/docstrings_common.json b/python/docstrings_common.json index 97441ea71ec..c13a302296f 100644 --- a/python/docstrings_common.json +++ b/python/docstrings_common.json @@ -6,39 +6,39 @@ }, "SummaryState_update_well_var": { "signature": "opm.io.sim.SummaryState.update_well_var(well_name: str, variable_name: str, new_value: double) -> None", - "doc": "Update the variable of a well.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param variable_name: The name of the variable to update.\n:type variable_name: str\n:param new_value: The new value of the variable.\n:type new_value: double" + "doc": "Updates the variable of a well.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param variable_name: The name of the variable to update.\n:type variable_name: str\n:param new_value: The new value of the variable.\n:type new_value: double" }, "SummaryState_update_group_var": { "signature": "opm.io.sim.SummaryState.update_group_var(group_name: str, variable_name: str, new_value: double) -> None", - "doc": "Update the variable of a group.\n\n:param group_name: The name of the group.\n:type group_name: str\n:param variable_name: The name of the variable to update.\n:type variable_name: str\n:param new_value: The new value of the variable.\n:type new_value: double" + "doc": "Updates the variable of a group.\n\n:param group_name: The name of the group.\n:type group_name: str\n:param variable_name: The name of the variable to update.\n:type variable_name: str\n:param new_value: The new value of the variable.\n:type new_value: double" }, "SummaryState_well_var": { "signature": "opm.io.sim.SummaryState.well_var(well_name: str, variable_name: str) -> double", - "doc": "Get the value of a variable for a well.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param variable_name: The name of the variable to retrieve.\n:type variable_name: str\n\n:return: The value of the specified variable for the well. \n:type return: double" + "doc": "Gets the value of a variable for a well.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param variable_name: The name of the variable to retrieve.\n:type variable_name: str\n\n:return: The value of the specified variable for the well. \n:type return: double" }, "SummaryState_group_var": { "signature": "opm.io.sim.SummaryState.group_var(group_name: str, variable_name: str) -> double", - "doc": "Get the value of a variable for a group.\n\n:param group_name: The name of the group.\n:type group_name: str\n:param variable_name: The name of the variable to retrieve.\n:type variable_name: str\n\n:return: The value of the specified variable for the group. \n:type return: double" + "doc": "Gets the value of a variable for a group.\n\n:param group_name: The name of the group.\n:type group_name: str\n:param variable_name: The name of the variable to retrieve.\n:type variable_name: str\n\n:return: The value of the specified variable for the group. \n:type return: double" }, "SummaryState_elapsed": { "signature": "opm.io.sim.SummaryState.elapsed() -> double", - "doc": "Return the elapsed time in seconds of the current simulation.\n\n:return: The elapsed time in seconds. \n:type return: double" + "doc": "Returns the elapsed time in seconds of the current simulation.\n\n:return: The elapsed time in seconds. \n:type return: double" }, "SummaryState_groups": { "signature": "opm.io.sim.SummaryState.groups -> list", - "doc": "Return a list of strings containing all group names.\n\n:return: A list of strings representing all group names. \n:type return: list" + "doc": "Returns a list of strings containing all group names.\n\n:return: A list of strings representing all group names. \n:type return: list" }, "SummaryState_wells": { "signature": "opm.io.sim.SummaryState.wells -> list", - "doc": "Return a list of strings containing all well names.\n\n:return: A list of strings representing all well names. \n:type return: list" + "doc": "Returns a list of strings containing all well names.\n\n:return: A list of strings representing all well names. \n:type return: list" }, "SummaryState_has_well_var": { "signature": "opm.io.sim.SummaryState.has_well_var(well_name: str, variable_name: str) -> bool", - "doc": "Check if a well variable exists.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param variable_name: The name of the variable to check.\n:type variable_name: str\n\n:return: True if the variable exists for the well, False otherwise. \n:type return: bool" + "doc": "Checks if a well variable exists.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param variable_name: The name of the variable to check.\n:type variable_name: str\n\n:return: True if the variable exists for the well, False otherwise. \n:type return: bool" }, "SummaryState_has_group_var": { "signature": "opm.io.sim.SummaryState.has_group_var(group_name: str, variable_name: str) -> bool", - "doc": "Check if a group variable exists.\n\n:param group_name: The name of the group.\n:type group_name: str\n:param variable_name: The name of the variable to check.\n:type variable_name: str\n\n:return: True if the variable exists for the group, False otherwise. \n:type return: bool" + "doc": "Checks if a group variable exists.\n\n:param group_name: The name of the group.\n:type group_name: str\n:param variable_name: The name of the variable to check.\n:type variable_name: str\n\n:return: True if the variable exists for the group, False otherwise. \n:type return: bool" }, "EclipseStateClass": { "type": "class", @@ -72,43 +72,43 @@ }, "Schedule_getitem": { "signature": "opm.io.schedule.Schedule.__getitem__(report_step: int) -> ScheduleState", - "doc": "Return the ScheduleState at the given report step.\n\n:param report_step: The report step.\n:type report_step: int\n\n:return: The ScheduleState at the given report step.\n:type return: ScheduleState" + "doc": "Returns the ScheduleState at the given report step.\n\n:param report_step: The report step.\n:type report_step: int\n\n:return: The ScheduleState at the given report step.\n:type return: ScheduleState" }, "Schedule_shut_well_well_name_step": { "signature": "opm.io.schedule.Schedule.shut_well(well_name: str, step: int) -> None", - "doc": "Shut down a well at a given report step.\n\n:param well_name: The name of the well to shut down.\n:type well_name: str\n:param step: The report step at which to shut down the well.\n:type step: int" + "doc": "Shuts down a well at a given report step.\n\n:param well_name: The name of the well to shut down.\n:type well_name: str\n:param step: The report step at which to shut down the well.\n:type step: int" }, "Schedule_shut_well_well_name": { "signature": "opm.io.schedule.Schedule.shut_well(well_name: str) -> None", - "doc": "Shut down a well at the current report step.\n\n:param well_name: The name of the well to shut down.\n:type well_name: str" + "doc": "Shuts down a well at the current report step.\n\n:param well_name: The name of the well to shut down.\n:type well_name: str" }, "Schedule_open_well_well_name_step": { "signature": "opm.io.schedule.Schedule.open_well(well_name: str, step: int) -> None", - "doc": "Open a well at a given report step.\n\n:param well_name: The name of the well to open.\n:type well_name: str\n:param step: The report step at which to open the well.\n:type step: int\n:raises ValueError: If the report step is in the past or exceeds the duration of the simulation." + "doc": "Opens a well at a given report step.\n\n:param well_name: The name of the well to open.\n:type well_name: str\n:param step: The report step at which to open the well.\n:type step: int\n:raises ValueError: If the report step is in the past or exceeds the duration of the simulation." }, "Schedule_open_well_well_name": { "signature": "opm.io.schedule.Schedule.open_well(well_name: str) -> None", - "doc": "Open a well at the current report step.\n\n:param well_name: The name of the well to open.\n:type well_name: str" + "doc": "Opens a well at the current report step.\n\n:param well_name: The name of the well to open.\n:type well_name: str" }, "Schedule_stop_well_well_name_step":{ "signature": "opm.io.schedule.Schedule.stop_well(well_name: str, step: int) -> None", - "doc": "Stop a well at a given report step.\n\n:param well_name: The name of the well to stop.\n:type well_name: str\n:param step: The report step at which to stop the well.\n:type step: int\n:raises ValueError: If the report step is in the past or exceeds the duration of the simulation." + "doc": "Stops a well at a given report step.\n\n:param well_name: The name of the well to stop.\n:type well_name: str\n:param step: The report step at which to stop the well.\n:type step: int\n:raises ValueError: If the report step is in the past or exceeds the duration of the simulation." }, "Schedule_stop_well_well_name": { "signature": "opm.io.schedule.Schedule.stop_well(well_name: str) -> None", - "doc": "Stop a well at the current report step.\n\n:param well_name: The name of the well to stop.\n:type well_name: str" + "doc": "Stops a well at the current report step.\n\n:param well_name: The name of the well to stop.\n:type well_name: str" }, "Schedule_get_injection_properties": { "signature": "opm.io.schedule.Schedule.get_injection_properties(well_name: str, report_step: int) -> dict", - "doc": "Get injection properties for a well at a specific report step.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param report_step: The report step to retrieve properties for.\n:type report_step: int\n\n:return: A dict containing the properties surf_inj_rate, resv_inj_rate, bhp_target, thp_target. \n:type return: dict" + "doc": "Gets injection properties for a well at a specific report step.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param report_step: The report step to retrieve properties for.\n:type report_step: int\n\n:return: A dict containing the properties surf_inj_rate, resv_inj_rate, bhp_target, thp_target. \n:type return: dict" }, "Schedule_get_production_properties": { "signature": "opm.io.schedule.Schedule.get_production_properties(well_name: str, report_step: int) -> dict", - "doc": "Get production properties for a well at a specific report step.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param report_step: The report step to retrieve properties for.\n:type report_step: int\n\n:return: A dict containing the properties oil_rate, gas_rate, water_rate, liquid_rate, resv_rate, bhp_target, thp_target, alq_value. \n:type return: dict" + "doc": "Gets production properties for a well at a specific report step.\n\n:param well_name: The name of the well.\n:type well_name: str\n:param report_step: The report step to retrieve properties for.\n:type report_step: int\n\n:return: A dict containing the properties oil_rate, gas_rate, water_rate, liquid_rate, resv_rate, bhp_target, thp_target, alq_value. \n:type return: dict" }, "Schedule_groups": { "signature": "opm.io.schedule.Schedule._groups(report_step: int) -> list", - "doc": "Get a list of all groups at a specified report step.\n\n:param report_step: The report step to retrieve groups for.\n:type report_step: int\n\n:return: A list containing all groups at the specified report step. \n:type return: list" + "doc": "Gets a list of all groups at a specified report step.\n\n:param report_step: The report step to retrieve groups for.\n:type report_step: int\n\n:return: A list containing all groups at the specified report step. \n:type return: list" }, "Schedule_get_well": { "signature": "opm.io.schedule.Schedule.get_well(well_name: str, report_step: int) -> Well", @@ -116,7 +116,7 @@ }, "Schedule_get_wells": { "signature": "opm.io.schedule.Schedule.get_wells(well_name_pattern: str) -> list", - "doc": "Get the names of wells matching a specified pattern.\n\n:param well_name_pattern: The pattern for well names, where '*' acts as a wildcard.\n:type well_name_pattern: str\n\n:return: A list containing the names of wells that match the specified pattern. \n:type return: list" + "doc": "Gets the names of wells matching a specified pattern.\n\n:param well_name_pattern: The pattern for well names, where '*' acts as a wildcard.\n:type well_name_pattern: str\n\n:return: A list containing the names of wells that match the specified pattern. \n:type return: list" }, "GroupClass": { "signature": "Group", @@ -128,11 +128,11 @@ "doc": "Returns the name of this group.\n\n:return: The name of this group.\n:type return: str" }, "Group_num_wells": { - "signature": "Group.name", + "signature": "Group.num_wells", "doc": "Returns the number of wells in this group.\n\n:return: The number of wells in this group.\n:type return: int" }, "Group_well_names": { - "signature": "Group.name", + "signature": "Group.well_names", "doc": "Returns a list of all well names in this group.\n\n:return: A list of all well names in this group.\n:type return: list" }, "ScheduleStateClass": { @@ -146,7 +146,7 @@ }, "ScheduleState_get_group": { "signature": "ScheduleState.get_group(group_name: str) -> Group", - "doc": "Get the group with the specified name from the schedule state.\n\n:param group_name: The name of the group to retrieve from the schedule state.\n:type group_name: str\n\n:return: The group with the specified name from the schedule state. \n:type return: Group" + "doc": "Gets the group with the specified name from the schedule state.\n\n:param group_name: The name of the group to retrieve from the schedule state.\n:type group_name: str\n\n:return: The group with the specified name from the schedule state. \n:type return: Group" }, "WellClass": { "type": "class", @@ -159,14 +159,14 @@ }, "Well_isdefined": { "signature": "Well.isdefined(report_step: int) -> bool", - "doc": "Check if the well is defined at a specific report step.\n\n:param report_step: The report step to check for the well's definition.\n:type report_step: int\n\n:return: True if the well is defined at the specified report step, False otherwise. \n:type return: bool" + "doc": "Checks if the well is defined at a specific report step.\n\n:param report_step: The report step to check for the well's definition.\n:type report_step: int\n\n:return: True if the well is defined at the specified report step, False otherwise. \n:type return: bool" }, "Well_available_gctrl": { "signature": "Well.available_gctrl() -> bool", - "doc": "Check if the well is available for group control.\n\n:return: True if the well is available for group control, False otherwise. \n:type return: bool" + "doc": "Checks if the well is available for group control.\n\n:return: True if the well is available for group control, False otherwise. \n:type return: bool" }, "Well_connections": { "signature": "Well.connections() -> list", - "doc": "Get a list of all connections associated with the well.\n\n:return: A list containing all connections of the well. \n:type return: list" + "doc": "Gets a list of all connections associated with the well.\n\n:return: A list containing all connections of the well. \n:type return: list" } }