import dascore as dc
from dascore.units import get_byte_count
assert get_byte_count(25 * dc.units.megabytes) == 25_000_000
assert get_byte_count(dc.get_quantity("1 MiB")) == 1_048_576get_byte_count
get_byte_count(
value: Quantity ,
)-> ‘float’
Return the number of bytes a data size quantity represents.
Parameters
| Parameter | Description |
|---|---|
| value | A quantity of information (eg 25 * dc.units.megabytes). |
Note
For data sizes, float() returns bits: eight times the byte count. to_float instead raises UnitError.