Skip to content

Commit

Permalink
doc(BMI): Add notes on numpy float types supported by ngen
Browse files Browse the repository at this point in the history
  • Loading branch information
hellkite500 authored and robertbartel committed Apr 22, 2024
1 parent d4e9db2 commit f778a18
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion doc/BMIconventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,19 @@ Since the [BMI Documentation] simply states that, "Use of native language type n
* `get_var_itemsize` result **must** match the size of the data type in the compiler used to build ngen
* Python
* `int`, `long`, `long long`, `int64`, `longlong`, `float`, `float64`, `long double`
* also accepts `numpy.float64` and `np.float64` but this usage is discouraged! Please use the non-namespaced names above.
* also accepts the following numpy types
- `numpy.float64` and `np.float64` for double precision floats
- `numpy.float32`, `np.float32`, `numpy.single`, and `np.single` for single precision floats

Use of these namespaced types should be limited to variables that are implemented as numpy arrays in the model, as the data type is part of the of the array metadata. E.g.
```python
import numpy as np
variable = np.ndarray((1,1), dtype=np.single)
print(variable.dtype)
```
will produce `dtype('float32')`.

For variables where the dtype is not directly accessed from the numpy meta data, this usage is discouraged! Please use the non-namespaced names above.

# Input and output published variables

Expand Down

0 comments on commit f778a18

Please sign in to comment.