for assets in assets_by_site:
 lon, lat = assets[0].location
 site, distance = siteobjects.get_closest(lon, lat)
 if distance <= asset_hazard_distance:
 # keep the assets, otherwise discard them
 assets_by_sid += {site.sid: list(assets)}
Assets on the same risk site are collected together; then one gets the closest hazard site to the risk site (within
and asset_hazard_distance which by default is of 5 km) and associates the assets to that hazard site; this is repeated
for all risk sites until the association is complete. Just to be clear on the terminology:
risk site = lon, lat of the asset as in the exposure XML file
hazard site = lon, lat where you have the external GMF defined