Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support numpy/python 32 bit float type names #800

Merged
merged 3 commits into from
Apr 22, 2024

Conversation

hellkite500
Copy link
Member

Add support for numpy/python 32 bit float type names in python bmi adapter.

Changes

  • python adapter now maps float32, np.float32, and numpy.float32 to the cxx float type

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (link if applicable)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

Target Environment support

  • Linux
  • MacOs

@hellkite500 hellkite500 force-pushed the python-32-bit-float branch from 9e2dbd8 to 4db33c3 Compare April 20, 2024 22:26
Copy link
Contributor

@robertbartel robertbartel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to go look it up, but apparently numpy's single-precision float type goes by the name numpy.single as well. I suggested a change to account for this too.

Regardless, should we also update the Variable Types and Sizes section of doc/BMIconventions.md?

include/bmi/Bmi_Py_Adapter.hpp Outdated Show resolved Hide resolved
hellkite500 and others added 2 commits April 22, 2024 06:09
@hellkite500
Copy link
Member Author

Updated bmi docs in 1d22bbc

@robertbartel robertbartel merged commit f778a18 into master Apr 22, 2024
19 checks passed
@robertbartel robertbartel deleted the python-32-bit-float branch April 22, 2024 13:58
@@ -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`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This missed documenting that float32 is accepted

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(without a numpy. or np. prefix)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants