diff --git a/.travis.yml b/.travis.yml index 5481a0d..5e5f392 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ os: - osx env: matrix: + - CONDA_ENV=3.8 - CONDA_ENV=3.7 - CONDA_ENV=3.6 sudo: false diff --git a/README.rst b/README.rst index 0f2be1c..752c32b 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,8 @@ BMI for Python ============== +Python bindings for the CSDMS `Basic Model Interface `_. + Install ------- @@ -17,6 +19,13 @@ with conda from the *conda-forge* channel, $ conda install bmipy -c conda-forge +To build and install *bmipy* from source, + +.. code-block:: bash + + $ git clone https://github.com/csdms/bmi-python + $ cd bmi-python + $ pip install . Usage ----- @@ -30,3 +39,7 @@ Usage def initialize(self, config_file): # Your implementation goes here + +A complete sample implementation is given in the +https://github.com/csdms/bmi-example-python +repository. diff --git a/bmipy/bmi.py b/bmipy/bmi.py index d594a4f..c4841d6 100644 --- a/bmipy/bmi.py +++ b/bmipy/bmi.py @@ -41,6 +41,17 @@ def update(self) -> None: """ ... + @abstractmethod + def update_until(self, time: float) -> None: + """Advance model state until the given time. + + Parameters + ---------- + time : float + A model time later than the current model time. + """ + ... + @abstractmethod def finalize(self) -> None: """Perform tear-down tasks for the model. @@ -62,6 +73,28 @@ def get_component_name(self) -> str: """ ... + @abstractmethod + def get_input_item_count(self) -> int: + """Count of a model's input variables. + + Returns + ------- + int + The number of input variables. + """ + ... + + @abstractmethod + def get_output_item_count(self) -> int: + """Count of a model's output variables. + + Returns + ------- + int + The number of output variables. + """ + ... + @abstractmethod def get_input_var_names(self) -> Tuple[str]: """List of a model's input variables. @@ -621,6 +654,24 @@ def get_grid_edge_nodes(self, grid: int, edge_nodes: np.ndarray) -> np.ndarray: """ ... + @abstractmethod + def get_grid_face_edges(self, grid: int, face_edges: np.ndarray) -> np.ndarray: + """Get the face-edge connectivity. + + Parameters + ---------- + grid : int + A grid identifier. + face_edges : ndarray of int + A numpy array to place the face-edge connectivity. + + Returns + ------- + ndarray of int + The input numpy array that holds the face-edge connectivity. + """ + ... + @abstractmethod def get_grid_face_nodes(self, grid: int, face_nodes: np.ndarray) -> np.ndarray: """Get the face-node connectivity. diff --git a/setup.py b/setup.py index 0513763..27df8a9 100644 --- a/setup.py +++ b/setup.py @@ -18,6 +18,7 @@ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Scientific/Engineering :: Physics", ], diff --git a/tests/test_bmipy.py b/tests/test_bmipy.py index 9527458..d4bad78 100644 --- a/tests/test_bmipy.py +++ b/tests/test_bmipy.py @@ -61,6 +61,12 @@ def set_value_at_indices(self, var_name, src, indices): def get_component_name(self): pass + def get_input_item_count(self): + pass + + def get_output_item_count(self): + pass + def get_input_var_names(self): pass @@ -106,6 +112,9 @@ def get_grid_face_count(self, grid): def get_grid_face_nodes(self, grid, face_nodes): pass + def get_grid_face_edges(self, grid, face_edges): + pass + def get_grid_node_count(self, grid): pass