def get_gmv_data(sids, gmfs, events):
    """
    Convert an array of shape (N, E, M) into an array of type gmv_data_dt
    """
    N, E, M = gmfs.shape
    gmv_data_dt = numpy.dtype(
        [('rlzi', U16), ('sid', U32), ('eid', U64), ('gmv', (F32, (M,)))])
    # NB: ordering of the loops: first site, then event
    lst = [(event['rlz'], sids[s], ei, gmfs[s, ei])
           for s in numpy.arange(N, dtype=U32)
           for ei, event in enumerate(events)]
    return numpy.array(lst, gmv_data_dt)
def get_gmv_data ( sids , gmfs , events ) : N , E , M = gmfs . shape gmv_data_dt = numpy . dtype ( [ ( 'rlzi' , U16 ) , ( 'sid' , U32 ) , ( 'eid' , U64 ) , ( 'gmv' , ( F32 , ( M , ) ) ) ] ) lst = [ ( event [ 'rlz' ] , sids [ s ] , ei , gmfs [ s , ei ] ) for s in numpy . arange ( N , dtype = U32 ) for ei , event in enumerate ( events ) ] return numpy . array ( lst , gmv_data_dt )
Convert an array of shape (N, E, M) into an array of type gmv_data_dt