def getChunks(dsets,nbchunks):
  """ Splits dataset object into smaller chunks

  Parameters:
    * dsets (dict): dataset
    * nbchunks (int): number of data chunks to be created

  Returns:
    * dict: chunks from dataset stored as dictionaries
  """

  ret = []
  for ichunk in range(nbchunks):
    datagrp = {}
    for groupnm in dsets:
      alldata = dsets[groupnm]
      surveys = {}
      for inp in alldata:
        datalist = alldata[inp]
        nrpts = len(datalist)
        start = int(ichunk * nrpts / nbchunks)
        end = int((ichunk+1) * nrpts / nbchunks)
        datalist = datalist[start:end]
        surveys.update({inp: datalist})
      datagrp.update({groupnm: surveys})
    ret.append(datagrp)
  return ret