docs: def get_tdata(t_format, files):
      """
      Get the time information from file names
  
      Parameters
      ----------
      t_format: str
          The string that can be used to get the time information in the files.
          Any numeric datetime format string (e.g. %Y, %m, %H) can be used, but
          not non-numeric strings like %b, etc. See [1]_ for the datetime format
          strings
      files: list of str
          The that contain the time informations
  
      Returns
      -------
      pandas.Index
          The time coordinate
      list of str
          The file names as they are sorten in the returned index
  
      References
      ----------
      .. [1] https://docs.python.org/2/library/datetime.html"""
      def median(arr):
          return arr.min() + (arr.max() - arr.min())/2
      import re
      from pandas import Index
      t_pattern = t_format
      for fmt, patt in t_patterns.items():
          t_pattern = t_pattern.replace(fmt, patt)
      t_pattern = re.compile(t_pattern)
      time = list(range(len(files)))
      for i, f in enumerate(files):
          time[i] = median(np.array(list(map(
              lambda s: np.datetime64(dt.datetime.strptime(s, t_format)),
              t_pattern.findall(f)))))
      ind = np.argsort(time)  # sort according to time
      files = np.array(files)[ind]
      time = np.array(time)[ind]
      return to_datetime(Index(time, name='time')), files