StreamHexahedralDataset.
quan
¶Converts an scalar into a yt.units.yt_array.YTQuantity
The returned YTQuantity will be dimensionless by default, but can be
cast to arbitray units using the input_units
keyword argument.
Parameters: | input_scalar : an integer or floating point scalar
input_units : String unit specification, unit symbol object, or astropy
dtype : string or NumPy dtype object
|
---|
Examples
>>> import yt
>>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
>>> a = ds.quan(1, 'cm')
>>> b = ds.quan(2, 'm')
>>> a + b
201.0 cm
>>> b + a
2.01 m
Quantities created this way automatically know about the unit system of the dataset.
>>> a = ds.quan(5, 'code_length')
>>> a.in_cgs()
1.543e+25 cm