Example #1
0
def plotSensorSeeingPC (which):
  days = seeing [which]
  allDays = allSeeing [which]
  siteRange = args.indirs [which]

  yTicks = []
  correlationsArray = []
  for p in ambient.parameterBasenames [1:]:
    otherDays = ambient.Days (os.path.join (siteRange.path, p + ".orig"), args.start_date, args.stop_date)
    otherDays.setGoodness (allDays)
    yTicks.append (p)
    dayList = ambient.dayListFromRange (otherDays, siteRange.startDate, siteRange.stopDate)
    correlations = ambient.goodCorrelate (days, dayList, args.min_points)
    correlationsArray.append (correlations)

  ambient.plotSensorSeeingPC (os.path.join (args.outdir, "pc-seeing+all-{}.pdf").format (siteRange.name),
                              correlationsArray, yTicks, days,
                              args.indirs [which].name)
Example #2
0
leapYear = False
for i in range (2):
  allSeeing.append (getSeeingDays (i))
  if allSeeing [-1].isLeapYear ():
    leapYear = True

for i in range (2):
  dayList = ambient.dayListFromRange (allSeeing [i], args.indirs [i].startDate, args.indirs [i].stopDate, leapYear=leapYear)
  seeing.append (dayList)


# 1e. calculate PC for each day. Sort from highest to lowest PC
#make a list of (day0, day1, pc)
#day0 is never None but day1 can be None whenever it's lacking a day that site0 has
#pc values > 1.0 mean nonsense, including not enough matching points
correlations = ambient.goodCorrelate (seeing [0], seeing [1], args.min_points)

#sort on pc
correlations = sorted (correlations, key=lambda x: x[2], reverse=not args.worst)
def writeCorr (out, c):
  day0 = c [0]
  day1 = c [1]
  if not day0:
    return

  if not day1 or not day0.good:
    out.write ("{:%m/%d/%y}\n".format (day0.datetime))
  else:
    out.write ("{:%m/%d/%y} {:%m/%d/%y} {:.5f} \
    ({} {}) ({} {}))\n".format (day0.datetime,
                            day1.datetime,