Perform means and quantiles in memory

The computation of the stats in the hazard calculators is ultra-slow because a huge amount of data is read from the database. However that same data can be kept in memory and everything can become extra fast. The potential problem is for large computations. If the memory consumption is too big we must use the tiling approach.
An analysis in under way. It should not be an issue. For instance with 10,000 sites, 1000 realizations, 19 levels and 10 IMTs the expected memory consumption is 10000*1000*19*10*8/1024/1024/1024 = 14 TB.
The tests are green: https://ci.openquake.org/job/zdevel_oq-engine/548

PS: my analysis shows that actually we are using *less* memory than before. The reason is that reading the curves from the database takes much more memory than storing them into numpy arrays. The time spent in the post-processing phase improves drastically. For instance for Yufang's computation went down from 60 minutes to 4 minutes.
Yes. In the case of sampling all weights are None and if you look inside `post_processing.mean_curve` a simple average will be done (there is a line `if all(none_weights): weights = None`). This is kind of ugly, since it is asymmetric with the treatment for quantiles. We may want to change that in the future. For instance, instead of all weights equal to None it would make sense to have all weights equal to 1/R where R is the number of realizations, and then no special case for None would be needed.