cf.FieldAncillary.trunc¶
- FieldAncillary.trunc(*args, **kwargs)[source]¶
Truncate the data, element-wise.
The truncated value of the scalar
x, is the nearest integeriwhich is closer to zero thanxis. I.e. the fractional part of the signed numberxis discarded.Added in version 1.0.
- Parameters:
- Returns:
FieldAncillaryorNoneThe construct with truncated data. If the operation was in-place then
Noneis returned.
Examples
>>> print(f.array) [-1.9 -1.5 -1.1 -1. 0. 1. 1.1 1.5 1.9] >>> print(f.trunc().array) [-1. -1. -1. -1. 0. 1. 1. 1. 1.] >>> f.trunc(inplace=True) >>> print(f.array) [-1. -1. -1. -1. 0. 1. 1. 1. 1.]