As far I understand, the code above aggregats the results by site and then the code below unfolds the result back.
I guess that the intent is to reduce the amount of information transfered, but is it really worth now that we are only transfering a site ID?

As far I know, for the kind of calculation for which PEB has been designed the number of assets (of a given taxonomy) per hazard site should be a.a. smaller than 10. So the code above saves at most (10 - 1) * 4 * block_size bytes.