def poolStatPDFs(paramDict):
  """
  ...This should be used with
  the map() method in the multiprocessing library (Pool object)

  Call
    from multiprocessing import Pool, cpu_count, Process
    p = Pool(nCores)
    compareDat = prepForPool(ref, test)
    p.map(poolStatPDFs, compareDat)

  Input
    paramDict -- dictionary, output from prepForPool

  Output
    PDF...

  """

  # unpack dictionary
  plotVars = paramDict['plotVars']
  outFile = paramDict['pdf']
  wnRange = paramDict['wnRange']
  band = paramDict['band']
  nCol = paramDict['numberCol']
  shortWave = paramDict['sw']

  sys.exit('This needs a lot of work')
  rrtmgp.statPDF(refFile, testFile, singlePDF=True, \
    tPauseP=paramDict['tPauseP'], xTitle=xt, yTitle=yt, \
    prefix=statPrefix, atmType=aType, statCSV=statCSV)

  return
Beispiel #2
0
    def plotStat(self):
        """
    Plot test and reference flux and HR statistics (max diff, RMS 
    diff, diff spread, troposphere/stratosphere)
    """

        COMPARE.statPDF(self.refFile, self.testFile, singlePDF=True, \
          xTitle=self.xTitle, yTitle=self.yTitle, forcing=self.forcing, \
          prefix=self.statPrefix, atmType=self.atmType)
        tmpPDF = '%s_all_bands.pdf' % self.statPrefix
        os.rename(tmpPDF, '%s/%s' % (self.outDir, tmpPDF))
  testFile = cParse.get('Filename Params', 'test_path')
  profPrefix = cParse.get('Filename Params', 'profiles_prefix')
  statPrefix = cParse.get('Filename Params', 'stats_prefix')

  xt = cRefName
  yt = '%s - %s' % (cTestName, cRefName)

  totCores = cpu_count()
  if args.available_cores:
    print('User can use up to {} cores'.format(totCores))
    sys.exit(0)
  # endif ac

  # plot profile statistics
  if args.stats:
    rrtmgp.statPDF(refFile, testFile, forcing=False, singlePDF=True, \
      xTitle=xt, yTitle=yt)
  else:
    compareDat = prepForPool(refFile, testFile, plotMean=args.mean, \
      yLog=args.log_y, inBand=inBand, atmType=aType, \
      prefix=profPrefix)

    nCores = args.cores
    nCores = nCores if nCores < totCores else totCores-1

    p = Pool(nCores)

    if args.profiles: p.map(poolProfPDFs, compareDat)
  # end plot_stats
# end main()