startDateTuple = xlrd.xldate.xldate_as_tuple(r[4].value,workbook.datemode) endDateTuple = xlrd.xldate.xldate_as_tuple(r[5].value,workbook.datemode) timeZone = r[6].value sensorType = r[7].value condition = r[8].value climate = r[9].value coord = (r[10].value,r[11].value) PERdict[serial] = [site,location,project,startDateTuple,endDateTuple, timeZone,sensorType,condition,climate,coord] except Exception as e: print e raise Exception("Cannot find/open 'PER Logger Data.xlsx' in the parent directory, or the file format is faulty") #Create madgetech objects from all valid .csv files in folder. create a dictionary of these objects with serial as key #eliminate sensors that do not have a listed gps coordinate and csv files that are not for TOW sensors. mts = mt2.mt2folder(r'..\2 TOW Sensor Analysis\_raw') mtdict = dict([(mt.serial,mt) for mt in mts if PERdict[mt.serial][9]!=('','') and PERdict[mt.serial][6]=='TOW']) keys = sorted(mtdict.keys(),key = lambda x:PERdict[x][0]) #create lists for the cross site Q4 plots overallPlotT = [] overallQ4inc = [] overallQ4time = [] #create TOW data processor TOWproc = TOWprocessor() with open('TOW bucketing.csv','wb') as csvfile: csvwrite = csv.writer(csvfile,delimiter = ',') csvwrite.writerow(['Site','Location','minimun Voltage','maximum Voltage','Readings','Mean','Q1','Q2+Q3','Q4']+['Bucket ' + str(n) for n in range(bucketCount)]) for key in keys:
import numpy as np from matplotlib.ticker import MaxNLocator from pylab import get_cmap from madgetech import madgetech_2 as mt2 from madgetech.madgetech_2_rht import rhtProcessor from perdb import perdb from math import sqrt try: #load meta data into a dictionary PERdict = perdb.loadPERdict() invPERdict = perdb.inversePERdict() #Create madgetech objects from all valid .csv files in folder. create a dictionary of these objects with serial as key #eliminate sensors that do not have a listed gps coordinate and csv files that are not for corrosion sensors. mts = mt2.mt2folder(r'..\3 RHT and TC Sensor Analysis\_raw') mtdict = dict([(mt.serial,mt) for mt in mts if PERdict[mt.serial][6]=='RHT']) keys = sorted(mtdict.keys()) #create rht data processor rhtproc = rhtProcessor() tempAggregates = [] rhAggregates = [] for key in keys: mt = mtdict[key] mt.loaddata() secondInterval = mt.timeinterval.total_seconds() site,location,project,startDateTuple,endDateTuple,timeZone,sensorType,condition,climate,coord = PERdict[key]
condition = r[8].value climate = r[9].value coord = (r[10].value, r[11].value) PERdict[serial] = [ site, location, project, startDateTuple, endDateTuple, timeZone, sensorType, condition, climate, coord ] except Exception as e: print e raise Exception( "Cannot find/open 'PER Logger Data.xlsx' in the parent directory, or the file format is faulty" ) #Create madgetech objects from all valid .csv files in folder. create a dictionary of these objects with serial as key #eliminate sensors that do not have a listed gps coordinate and csv files that are not for TOW sensors. mts = mt2.mt2folder(r'..\2 TOW Sensor Analysis\_raw') mtdict = dict([ (mt.serial, mt) for mt in mts if PERdict[mt.serial][9] != ('', '') and PERdict[mt.serial][6] == 'TOW' ]) keys = sorted(mtdict.keys(), key=lambda x: PERdict[x][0]) #create lists for the cross site Q4 plots overallPlotT = [] overallQ4inc = [] overallQ4time = [] #create TOW data processor TOWproc = TOWprocessor() with open('TOW bucketing.csv', 'wb') as csvfile:
import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator from pylab import get_cmap from googleEarth import plotGoogleColorMap as pltGE from perdb import perdb from madgetech import madgetech_2 as mt2 from madgetech.madgetech_2_cs import CorrosionSensorProcessor try: #load meta data into a dictionary PERdict = perdb.loadPERdict() invPERdict = perdb.inversePERdict() #Create madgetech objects from all valid .csv files in folder. create a dictionary of these objects with serial as key #eliminate sensors that do not have a listed gps coordinate and csv files that are not for corrosion sensors. mts = mt2.mt2folder(r'..\1 Corrosion Sensor Analysis\_raw') mtdict = dict([(mt.serial,mt) for mt in mts if PERdict[mt.serial][9]!=('','') and PERdict[mt.serial][6]=='CS']) keys = sorted(mtdict.keys()) #create lists for the cross site cumulative corrosion index and the Google Earth color plot overallPlotT=[] overallPlotY = [] googleEarthList = [] #create a corrosion sensor data processing object (Contains functions for processing corrosion sensor data) csProc = CorrosionSensorProcessor(useDefaultInput = True) #Iterate through serial numbers for key in keys: try: #load data from the mt object and truncate data to the dates listed in the PER meta data excel spreadsheet
import numpy as np from matplotlib.ticker import MaxNLocator from pylab import get_cmap from madgetech import madgetech_2 as mt2 from madgetech.madgetech_2_rht import rhtProcessor from perdb import perdb from math import sqrt try: #load meta data into a dictionary PERdict = perdb.loadPERdict() invPERdict = perdb.inversePERdict() #Create madgetech objects from all valid .csv files in folder. create a dictionary of these objects with serial as key #eliminate sensors that do not have a listed gps coordinate and csv files that are not for corrosion sensors. mts = mt2.mt2folder(r'..\3 RHT and TC Sensor Analysis\_raw') mtdict = dict([(mt.serial, mt) for mt in mts if PERdict[mt.serial][6] == 'RHT']) keys = sorted(mtdict.keys()) #create rht data processor rhtproc = rhtProcessor() tempAggregates = [] rhAggregates = [] for key in keys: mt = mtdict[key] mt.loaddata() secondInterval = mt.timeinterval.total_seconds() site, location, project, startDateTuple, endDateTuple, timeZone, sensorType, condition, climate, coord = PERdict[