Currently, I use np.around(8) to remove unneeded precision from the expanded JSON files. This saves data on the hard-drive, as well as bandwidth when serving files.
(the reasoning for 8 digits of precision being enough for the viewer is that 4k * 4k = 16000000, so if we start with a zoomed out view on a 4k screen, this should be enough to zoom into a single pixel and still be precise enough down to the individual pixel)
However, while np.around() works exactly the way it should, I just realised that this is not what I actually want:
The problem here is highlighted by the last two values: 2.34e-06 would ideally be 2.34124135e-06, and 1231351231.1231594 reduced to 1.23135123e09 or 1231351230 (which would be less characters in this case).
It's not a big issue at the moment - the dynamic range and order of magnitude of our data does not seem to produce large artefacts from this rounding error (mainly because we can't zoom yet and because few people use the viewer on 4k resolution).
Maybe there is a built-in numpy method for achieving this, otherwise this has to be done manually.
Currently, I use
np.around(8)
to remove unneeded precision from the expanded JSON files. This saves data on the hard-drive, as well as bandwidth when serving files.(the reasoning for 8 digits of precision being enough for the viewer is that 4k * 4k = 16000000, so if we start with a zoomed out view on a 4k screen, this should be enough to zoom into a single pixel and still be precise enough down to the individual pixel)
However, while
np.around()
works exactly the way it should, I just realised that this is not what I actually want:The problem here is highlighted by the last two values:
2.34e-06
would ideally be2.34124135e-06
, and1231351231.1231594
reduced to1.23135123e09
or1231351230
(which would be less characters in this case).It's not a big issue at the moment - the dynamic range and order of magnitude of our data does not seem to produce large artefacts from this rounding error (mainly because we can't zoom yet and because few people use the viewer on 4k resolution).
Maybe there is a built-in numpy method for achieving this, otherwise this has to be done manually.