docs: def save_gmf_data(dstore, sitecol, gmfs, imts, events=()):
      """
      :param dstore: a :class:`openquake.baselib.datastore.DataStore` instance
      :param sitecol: a :class:`openquake.hazardlib.site.SiteCollection` instance
      :param gmfs: an array of shape (N, E, M)
      :param imts: a list of IMT strings
      :param events: E event IDs or the empty tuple
      """
      if len(events) == 0:
          E = gmfs.shape[1]
          events = numpy.zeros(E, rupture.events_dt)
          events['eid'] = numpy.arange(E, dtype=U64)
      dstore['events'] = events
      offset = 0
      gmfa = get_gmv_data(sitecol.sids, gmfs, events)
      dstore['gmf_data/data'] = gmfa
      dic = general.group_array(gmfa, 'sid')
      lst = []
      all_sids = sitecol.complete.sids
      for sid in all_sids:
          rows = dic.get(sid, ())
          n = len(rows)
          lst.append((offset, offset + n))
          offset += n
      dstore['gmf_data/imts'] = ' '.join(imts)
      dstore['gmf_data/indices'] = numpy.array(lst, U32)