You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new data, or `None` if the operation was in-place.
7410
+
7411
+
**Examples**
7412
+
7413
+
>>> d = cf.Data([1, 2], 'km')
7414
+
>>> e = d.to_units('metre')
7415
+
>>> print(e.Units)
7416
+
'metre'
7417
+
>>> print(e.array)
7418
+
[1000. 2000.]
7419
+
>>> e.to_units('miles', inplace=True)
7420
+
>>> print(e.Units)
7421
+
'miles'
7422
+
>>> print(e.array)
7423
+
[0.62137119 1.24274238]
7424
+
>>> e.to_units('degC')
7425
+
Traceback (most recent call last)
7426
+
...
7427
+
ValueError: Can't set Units to <Units: degC> that are not equivalent to the current units <Units: miles>. Consider using the override_units method instead.
The construct with data converted to the new units, or
4461
+
`None` if the operation was in-place.
4462
+
4463
+
**Examples**
4464
+
4465
+
>>> print(f.Units)
4466
+
'km'
4467
+
>>> print(f.array)
4468
+
[1 2]
4469
+
>>> g = f.to_units('metre')
4470
+
>>> print(g.Units)
4471
+
'metre'
4472
+
>>> print(g.array)
4473
+
[1000. 2000.]
4474
+
>>> g.to_units('miles', inplace=True)
4475
+
>>> print(g.array)
4476
+
[0.62137119 1.24274238]
4477
+
>>> g.to_units('degC')
4478
+
Traceback (most recent call last)
4479
+
...
4480
+
ValueError: Can't set Units to <Units: degC> that are not equivalent to the current units <Units: miles>. Consider using the override_units method instead.
0 commit comments