Skip to content

Commit da966e4

Browse files
committed
feat(add_field) check type and convert to np.float64 is array type is int
1 parent 9d57507 commit da966e4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Changed
1515

16+
- (containers/features) `add_field` now warns and auto-converts `np.int32`/`np.int64` fields to `np.float64` for CGNS compatibility.
1617
- (sample) add_tree: add in_place arg to decide whether the added tree should be kept unchanged (with in_place=False).
1718
- (docs/actions) better explain which package and dev env for which OS, and repair readthedocs generation.
1819
- (containers/managers) return a warning when an automatically resolved time stamp is different from 0.0.

src/plaid/containers/features.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,9 @@ def add_field(
11601160
11611161
Args:
11621162
name (str): The name of the field to be added.
1163-
field (Field): The field data to be added.
1163+
field (Field): The field data to be added. Integer arrays with dtype
1164+
``np.int32`` or ``np.int64`` are automatically converted to
1165+
``np.float64`` (with a warning) for CGNS compatibility.
11641166
location (str, optional): The grid location where the field will be stored. Defaults to 'Vertex'.
11651167
Possible values : :py:const:`plaid.constants.CGNS_FIELD_LOCATIONS`
11661168
zone_name (str, optional): The name of the zone where the field will be added. Defaults to None.

0 commit comments

Comments
 (0)