def extract_agg_damages(dstore, what):
    """
    Aggregate damages of the given loss type and tags. Use it as
    /extract/agg_damages/structural?taxonomy=RC&zipcode=20126

    :returns:
        array of shape (R, D), being R the number of realizations and D the
        number of damage states, or an array of length 0 if there is no data
        for the given tags
    """
    loss_type, tags = get_loss_type_tags(what)
    if 'dmg_by_asset' in dstore:  # scenario_damage
        lti = dstore['oqparam'].lti[loss_type]
        losses = dstore['dmg_by_asset'][:, :, lti, 0]
    else:
        raise KeyError('No damages found in %s' % dstore)
    return _filter_agg(dstore['assetcol'], losses, tags)
def extract_agg_damages ( dstore , what ) : loss_type , tags = get_loss_type_tags ( what ) if 'dmg_by_asset' in dstore : lti = dstore [ 'oqparam' ] . lti [ loss_type ] losses = dstore [ 'dmg_by_asset' ] [ : , : , lti , 0 ] else : raise KeyError ( 'No damages found in %s' % dstore ) return _filter_agg ( dstore [ 'assetcol' ] , losses , tags )
Aggregate damages of the given loss type and tags. Use it as
    /extract/agg_damages/structural?taxonomy=RC&zipcode=20126

    :returns:
        array of shape (R, D), being R the number of realizations and D the
        number of damage states, or an array of length 0 if there is no data
        for the given tags