def main(outDir, subArea, chartTitlePre): yLabelText = 'Hectares' varList = [ ' DownyBrome0-0.33 (ha)', ' DownyBrome0.33-0.66 (ha)', ' DownyBrome0.66-1 (ha)' ] repList = list( set(pd.io.parsers.read_csv(outDir + r'Downy_Brome_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_DownyBrome.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot total area totalArea = pd.io.parsers.read_csv(outDir + r'Downy_Brome_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] reporterFunc.plotReporter('Downy Brome', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) # plot by owner totalArea = pd.io.parsers.read_csv(outDir + r'Downy_Brome_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] reporterFunc.plotReporter('Downy Brome - ' + owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): yLabelText = 'Cubic Meters' repList = list( set( pd.io.parsers.read_csv(outDir + r'VolumeAvailable_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_VolumeAvailable.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot total area totalArea = pd.io.parsers.read_csv(outDir + r'VolumeAvailable_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] varList = list(totalArea.columns.values) varList.remove('Scenario') varList.remove(' Run') varList.remove(' Year') varList.remove(' Version') varList.remove(' Timestamp') reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): yLabelText = 'Hectares' repList = list(set(pd.io.parsers.read_csv(outDir + r'VFO_Spotted_Owl_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_VFO_SpottedOwl.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot total area totalArea = pd.io.parsers.read_csv(outDir + r'VFO_Spotted_Owl_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] varList = list(totalArea.columns.values) varList.remove('Scenario') varList.remove(' Run') varList.remove(' Year') varList.remove(' Version') varList.remove(' Timestamp') reporterFunc.plotReporter('VFO Spotted Owl', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) # plot by owner totalArea = pd.io.parsers.read_csv(outDir + r'VFO_Spotted_Owl_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] reporterFunc.plotReporter('VFO Spotted Owl - ' + owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): yLabelText = 'Hectares' speciesList = [ 'Goshawk', 'Pileated', 'Sapsucker', 'Owl', 'Bluebird', 'White-headed', 'Marten', 'Black-backed' ] repList = list( set( pd.io.parsers.read_csv(outDir + r'ILAP_wildlife_models_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_ILAP_wildlife_models.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot total area totalArea = pd.io.parsers.read_csv(outDir + r'ILAP_wildlife_models_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] varList = list(totalArea.columns.values) for species in speciesList: subVarList = [] for varName in varList: if species in varName: subVarList.append(varName) reporterFunc.plotReporter('iLAP ' + species, pdfFile, totalArea, 0, subVarList, subArea, chartTitle, yLabelText) # plot by owner totalAreaOwner = pd.io.parsers.read_csv( outDir + r'ILAP_wildlife_models_by_OWNER_pivot.csv') totalAreaOwner = totalAreaOwner[totalAreaOwner[' Run'] == repNum] ownerNames = list(set(totalAreaOwner[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalAreaOwner[totalAreaOwner[' OWNER_label'] == owner] reporterFunc.plotReporter('iLAP - ' + species + ' - ' + owner, pdfFile, byOwner, 0, subVarList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): varList = [' NumberDwellings1kmFromStandRep', ' NumberDwellings1kmFromMixSev', ' NumberDwellings1kmFromFire'] yLabelText = 'Number of Dwellings' repList = list(set(pd.io.parsers.read_csv(outDir + r'FireExperience_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_FireExperience.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot total area totalArea = pd.io.parsers.read_csv(outDir + r'FireExperience_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): yLabelText = 'Percent of Area' PVTmngGrpArea = reporterFunc.getPVTHa(subArea) repList = list( set( pd.io.parsers.read_csv(outDir + r'PotentialDisturbance_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_PotentialDisturbance.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot total area varList = [ ' PotentialSurfaceFire(ha)', ' PotentialMixedSeverityFire(ha)', ' PotentialHighSeverityFire(ha)' ] totalArea = pd.io.parsers.read_csv(outDir + r'PotentialDisturbance_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] reporterFunc.plotReporter('', pdfFile, totalArea, sum(PVTmngGrpArea), varList, subArea, chartTitle, yLabelText) # plot potential disturbance by PVT management group for PVTgpNum in range(0, 7): PVTgp = 'PMG' + str(PVTgpNum) varList = list(totalArea.columns.values) varList.remove('Scenario') varList.remove(' Run') varList.remove(' Year') varList.remove(' Version') varList.remove(' Timestamp') subVarList = [] for varName in varList: if PVTgp in varName: subVarList.append(varName) reporterFunc.plotReporter(PVTgp, pdfFile, totalArea, PVTmngGrpArea[PVTgpNum], subVarList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(subArea, runName, chartTitle): outDir = "C:\\Users\\olsenk\\Dropbox\\FPF\\Envision Runs\\keith_test\\" + runName + "\\" pdfFile = PdfPages(outDir + '50_DwellingIncreasePct.pdf') varList = [' NumberDwellings'] # plot total area totalArea = pd.io.parsers.read_csv(outDir + r'FireWise_pivot.csv') reporterFunc.plotReporter('', pdfFile, totalArea, varList, subArea, chartTitle, yLabeltext) fig = pl.figure(1, figsize=(11, 8.5)) ax = fig.add_subplot(1, 1, 1) # for varName in [' NumberDwellingsFirewise', ' NumberDwellings']: ax.plot(totalArea[' Year'], totalArea[' NumberDwellings']) # build legend #fontP = FontProperties() #fontP.set_size('10') #ax.legend(prop = fontP, bbox_to_anchor=(1.07,1.07)) pl.xlabel('Simulation Year') pl.ylabel('Total Number of Dwellings (' + str( int((totalArea[' NumberDwellings'][50] - totalArea[' NumberDwellings'][0]) / 50)) + ') increase per year') pl.tick_params(axis='both', which='major', labelsize=10) #ax.text(0.02,0.92,'% Area where HCI >33', fontsize=8, transform=ax.transAxes) pl.ylim([0, None]) pl.xlim([0, None]) pctIncrease = (totalArea[' NumberDwellings'][50] - totalArea[' NumberDwellings'][0] ) / totalArea[' NumberDwellings'][0] * 100 fig.suptitle('FPF North - 18 March 2015 - ' + str(pctIncrease) + ' pct increase', fontsize=14, fontweight='bold') # pl.figtext(0.5,0.03,time.strftime("%d %B %Y"), fontsize=8) pdfFile.savefig() pl.close() pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): varList = [' NumberOfNewDwellings'] yLabelText = 'Number of New Dwellings' repList = list( set( pd.io.parsers.read_csv(outDir + r'DwellingsInWUI_by_WUI_pivot.csv') [' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_Dwellings.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot by wui totalArea = pd.io.parsers.read_csv(outDir + r'DwellingsInWUI_by_WUI_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] byWUITable = pd.DataFrame() for wui in set(totalArea[' WUI_label']): byWUI = totalArea[totalArea[' WUI_label'] == wui] byWUI = byWUI.drop(byWUI.index[:1]) if len(byWUITable) == 0: byWUITable = byWUI else: byWUI = byWUI.set_index(' Year') byWUI = byWUI.drop('Scenario', 1) byWUI = byWUI.drop(' Run', 1) byWUI = byWUI.drop(' Version', 1) byWUI = byWUI.drop(' Timestamp', 1) byWUI = byWUI.drop(' WUI_value', 1) byWUI = byWUI.drop(' WUI_label', 1) byWUITable = byWUITable.join(byWUI, ' Year', 'left') byWUITable = byWUITable.rename(columns={varList[0]: wui}) reporterFunc.plotReporter('', pdfFile, byWUITable, 0, set(totalArea[' WUI_label']), subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): varList = [ ' Smoke_surfaceFire (Mg)', ' Smoke_mixSevFire (Mg)', ' Smoke_standRepFire (Mg)', ' Smoke_prescribedFire (Mg)' ] yLabelText = 'Smoke Particles <2.5 microns (Mg)' repList = list( set(pd.io.parsers.read_csv(outDir + r'Smoke_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_Smoke.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot landscape totalArea = pd.io.parsers.read_csv(outDir + r'Smoke_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): varList = [ ' Dwellings in Rural Residential', ' Dwellings in Resort District', ' Dwellings in Urban Reserve', ' Dwellings in Forest Use 1', ' Dwellings in EFU' ] yLabelText = 'Average Dwellings per Hectare' zoneHa = reporterFunc.getZoneHa(subArea) repList = list( set( pd.io.parsers.read_csv(outDir + r'DwellingsInZone_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_DwellingsInZone.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot landscape totalArea = pd.io.parsers.read_csv(outDir + r'DwellingsInZone_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] for varName in varList: totalArea[varName] = totalArea[varName] / zoneHa[varName] reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) # plot landscape in absolute numbers of dwellings totalArea = pd.io.parsers.read_csv(outDir + r'DwellingsInZone_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] yLabelText = 'Number of Dwellings' reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): yLabelText = 'Tree Volume (m3)' varList = [ ' Volume of Live Trees (m3)', ' Volume of Dead Trees (m3)', ' Volume of Live and Dead (m3)' ] repList = list( set( pd.io.parsers.read_csv(outDir + r'VolumeAllTrees_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_TotalVolume.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot total area totalArea = pd.io.parsers.read_csv(outDir + r'VolumeAllTrees_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) # plot by owner totalArea = pd.io.parsers.read_csv( outDir + r'VolumeAllTrees_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): repList = list( set(pd.io.parsers.read_csv(outDir + r'FireWiseWUI_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_FireWiseWUI.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot percent firewise ylabelText = 'Percent of Dwellings Adopting Firewise Behavior' totalArea = pd.io.parsers.read_csv(outDir + r'FireWiseWUI_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] totalArea['pct Firewise in WUI'] = totalArea[ ' NumberDwellingsFirewise'] / totalArea[' NumberDwellings'] * 100 reporterFunc.plotReporter('', pdfFile, totalArea, 0, ['pct Firewise in WUI'], subArea, chartTitle, ylabelText) # plot total number of dwellings varList = [' NumberDwellingsFirewise', ' NumberDwellings'] yLabelText = 'Number of Dwellings' reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) # plot firewise by owner totalArea = pd.io.parsers.read_csv(outDir + r'FireWiseWUI_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] byOwner['pct Firewise in WUI'] = byOwner[ ' NumberDwellingsFirewise'] / byOwner[' NumberDwellings'] * 100 reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, ['pct Firewise in WUI'], subArea, chartTitle, ylabelText) reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): varList = [' Biomass available for bioenergy (Mg)'] yLabelText = 'Bioenergy Density (Mg)' repList = list( set(pd.io.parsers.read_csv(outDir + r'bioenergy_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_BioEnergy.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot landscape totalArea = pd.io.parsers.read_csv(outDir + r'bioenergy_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) # plot by owner totalArea = pd.io.parsers.read_csv(outDir + r'bioenergy_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) # plot by owner detl totalArea = pd.io.parsers.read_csv( outDir + r'bioenergy_by_OWNER_DETL_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_DETL_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_DETL_label'] == owner] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): varList = [ ' Harvest Total (m3)', ' Total Merch Harvest (m3)', ' Salvage Harvest (m3)', ' Merch Harvest Live(m3)' ] varList2 = [ ' Harvest Total SYU (m3)', ' Total Merch Harvest SYU (m3)', ' Salvage Harvest SYU (m3)', ' Merch Harvest Live SYU (m3)' ] yLabelText = 'Cubic Meters' # plot harvest volume by owner. Create additional graph for SYU only volume. repList = list( set( pd.io.parsers.read_csv(outDir + r'WoodProducts_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_VolumeHarvest.pdf') pdfFile2 = PdfPages(outDir + 'R' + str(repNum) + '_VolumeHarvest_SYU.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot total area totalArea = pd.io.parsers.read_csv(outDir + r'WoodProducts_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) reporterFunc.plotReporter('', pdfFile2, totalArea, 0, varList2, subArea, chartTitle, yLabelText) # plot by owner totalArea = pd.io.parsers.read_csv(outDir + r'WoodProducts_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) reporterFunc.plotReporter(owner, pdfFile2, byOwner, 0, varList2, subArea, chartTitle, yLabelText) # plot by owner detl totalArea = pd.io.parsers.read_csv( outDir + r'WoodProducts_by_OWNER_DETL_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_DETL_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_DETL_label'] == owner] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) reporterFunc.plotReporter(owner, pdfFile2, byOwner, 0, varList2, subArea, chartTitle, yLabelText) pdfFile.close() pdfFile2.close() # plot harvest volume by owner for Ponerosa Pine (cover type 750 - 770). Create additional graph for PP SYU only volume. repList = list( set( pd.io.parsers.read_csv(outDir + r'WoodProducts_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_VolumeHarvest_PP.pdf') pdfFile2 = PdfPages(outDir + 'R' + str(repNum) + '_VolumeHarvest_PP_SYU.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot by owner totalArea = pd.io.parsers.read_csv( outDir + r'WoodProducts_PP_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] totalArea2 = pd.io.parsers.read_csv(outDir + r'WoodProducts_by_OWNER_pivot.csv') totalArea2 = totalArea2[totalArea2[' Run'] == repNum] totalArea3 = pd.io.parsers.read_csv( outDir + r'WoodProducts_MC_by_OWNER_pivot.csv') totalArea3 = totalArea3[totalArea3[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] byOwner2 = totalArea2[totalArea2[' OWNER_label'] == owner] byOwner3 = totalArea3[totalArea3[' OWNER_label'] == owner] fig = pl.figure(1, figsize=(11, 8.5)) ax = fig.add_subplot(1, 1, 1) reporterFunc.plotReporter_partial(fig, ax, owner, byOwner2, 0, [' Total Merch Harvest (m3)'], subArea, chartTitle, yLabelText) reporterFunc.plotReporter_partial(fig, ax, owner, byOwner, 0, [' PP Total Merch Harvest (m3)'], subArea, chartTitle, yLabelText) reporterFunc.plotReporter_partial(fig, ax, owner, byOwner3, 0, [' MC Total Merch Harvest (m3)'], subArea, chartTitle, yLabelText) pdfFile.savefig() pl.close() fig = pl.figure(1, figsize=(11, 8.5)) ax = fig.add_subplot(1, 1, 1) reporterFunc.plotReporter_partial( fig, ax, owner, byOwner2, 0, [' Total Merch Harvest SYU (m3)'], subArea, chartTitle, yLabelText) reporterFunc.plotReporter_partial( fig, ax, owner, byOwner, 0, [' PP Total Merch Harvest SYU (m3)'], subArea, chartTitle, yLabelText) reporterFunc.plotReporter_partial( fig, ax, owner, byOwner3, 0, [' MC Total Merch Harvest SYU (m3)'], subArea, chartTitle, yLabelText) pdfFile2.savefig() pl.close() pdfFile.close() pdfFile2.close() # plot volume of large trees salvage harvest for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_VolumeHarvest_LgTree_SalHarvest.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot by owner totalArea = pd.io.parsers.read_csv(outDir + r'WoodProducts_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] totalArea2 = pd.io.parsers.read_csv( outDir + r'LgTreeVol_SalHarvest_by_OWNER_pivot.csv') totalArea2 = totalArea2[totalArea2[' Run'] == repNum] totalArea2['Large Tree Salvage Harv (m3)'] = totalArea2[ ' LgTreeVol SalHarvest Giant (m3)'] + totalArea2[ ' LgTreeVol SalHarvest Large (m3)'] + totalArea2[ ' LgTreeVol SalHarvest Medium (m3)'] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] byOwner2 = totalArea2[totalArea2[' OWNER_label'] == owner] fig = pl.figure(1, figsize=(11, 8.5)) ax = fig.add_subplot(1, 1, 1) reporterFunc.plotReporter_partial(fig, ax, owner, byOwner, 0, [' Salvage Harvest (m3)'], subArea, chartTitle, yLabelText) reporterFunc.plotReporter_partial(fig, ax, owner, byOwner2, 0, ['Large Tree Salvage Harv (m3)'], subArea, chartTitle, yLabelText) pdfFile.savefig() pl.close() # plot by owner detl totalArea = pd.io.parsers.read_csv( outDir + r'WoodProducts_by_OWNER_DETL_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] totalArea2 = pd.io.parsers.read_csv( outDir + r'LgTreeVol_SalHarvest_by_OWNER_DETL_pivot.csv') totalArea2 = totalArea2[totalArea2[' Run'] == repNum] totalArea2['Large Tree Salvage Harv (m3)'] = totalArea2[ ' LgTreeVol SalHarvest Giant (m3)'] + totalArea2[ ' LgTreeVol SalHarvest Large (m3)'] + totalArea2[ ' LgTreeVol SalHarvest Medium (m3)'] ownerNames = list(set(totalArea[' OWNER_DETL_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_DETL_label'] == owner] byOwner2 = totalArea2[totalArea2[' OWNER_DETL_label'] == owner] fig = pl.figure(1, figsize=(11, 8.5)) ax = fig.add_subplot(1, 1, 1) reporterFunc.plotReporter_partial(fig, ax, owner, byOwner, 0, [' Salvage Harvest (m3)'], subArea, chartTitle, yLabelText) reporterFunc.plotReporter_partial(fig, ax, owner, byOwner2, 0, ['Large Tree Salvage Harv (m3)'], subArea, chartTitle, yLabelText) pdfFile.savefig() pl.close() pdfFile.close() # plot volume of large trees merch harv live for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_VolumeHarvest_LgTree_MerchHarvLive.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot by owner totalArea = pd.io.parsers.read_csv(outDir + r'WoodProducts_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] totalArea2 = pd.io.parsers.read_csv( outDir + r'LgTreeVol_MerchHarvLive_D3_D55_by_OWNER_pivot.csv') totalArea2 = totalArea2[totalArea2[' Run'] == repNum] totalArea2['Lg Tree MerchHarvLive D55 (m3)'] = totalArea2[ ' LgTreeVol MerchHarvLive D55_1 (m3)'] + totalArea2[ ' LgTreeVol MerchHarvLive D55_2 (m3)'] + totalArea2[ ' LgTreeVol MerchHarvLive D55_3 (m3)'] + totalArea2[ ' LgTreeVol MerchHarvLive D55_4 (m3)'] + totalArea2[ ' LgTreeVol MerchHarvLive D55_5 (m3)'] totalArea2['Lg Tree MerchHarvLive D3 (m3)'] = totalArea2[ ' LgTreeVol MerchHarvLive D3_1 (m3)'] + totalArea2[ ' LgTreeVol MerchHarvLive D3_2 (m3)'] + totalArea2[ ' LgTreeVol MerchHarvLive D3_3 (m3)'] + totalArea2[ ' LgTreeVol MerchHarvLive D3_4 (m3)'] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] byOwner2 = totalArea2[totalArea2[' OWNER_label'] == owner] fig = pl.figure(1, figsize=(11, 8.5)) ax = fig.add_subplot(1, 1, 1) reporterFunc.plotReporter_partial(fig, ax, owner, byOwner, 0, [' Merch Harvest Live(m3)'], subArea, chartTitle, yLabelText) reporterFunc.plotReporter_partial( fig, ax, owner, byOwner2, 0, ['Lg Tree MerchHarvLive D55 (m3)'], subArea, chartTitle, yLabelText) reporterFunc.plotReporter_partial( fig, ax, owner, byOwner2, 0, ['Lg Tree MerchHarvLive D3 (m3)'], subArea, chartTitle, yLabelText) pdfFile.savefig() pl.close() # plot by owner detl totalArea = pd.io.parsers.read_csv( outDir + r'WoodProducts_by_OWNER_DETL_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] totalArea2 = pd.io.parsers.read_csv( outDir + r'LgTreeVol_MerchHarvLive_D3_D55_by_OWNER_DETL_pivot.csv') totalArea2 = totalArea2[totalArea2[' Run'] == repNum] totalArea2['Lg Tree MerchHarvLive D55 (m3)'] = totalArea2[ ' LgTreeVol MerchHarvLive D55_1 (m3)'] + totalArea2[ ' LgTreeVol MerchHarvLive D55_2 (m3)'] + totalArea2[ ' LgTreeVol MerchHarvLive D55_3 (m3)'] + totalArea2[ ' LgTreeVol MerchHarvLive D55_4 (m3)'] + totalArea2[ ' LgTreeVol MerchHarvLive D55_5 (m3)'] totalArea2['Lg Tree MerchHarvLive D3 (m3)'] = totalArea2[ ' LgTreeVol MerchHarvLive D3_1 (m3)'] + totalArea2[ ' LgTreeVol MerchHarvLive D3_2 (m3)'] + totalArea2[ ' LgTreeVol MerchHarvLive D3_3 (m3)'] + totalArea2[ ' LgTreeVol MerchHarvLive D3_4 (m3)'] ownerNames = list(set(totalArea[' OWNER_DETL_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_DETL_label'] == owner] byOwner2 = totalArea2[totalArea2[' OWNER_DETL_label'] == owner] fig = pl.figure(1, figsize=(11, 8.5)) ax = fig.add_subplot(1, 1, 1) reporterFunc.plotReporter_partial(fig, ax, owner, byOwner, 0, [' Merch Harvest Live(m3)'], subArea, chartTitle, yLabelText) reporterFunc.plotReporter_partial( fig, ax, owner, byOwner2, 0, ['Lg Tree MerchHarvLive D55 (m3)'], subArea, chartTitle, yLabelText) reporterFunc.plotReporter_partial( fig, ax, owner, byOwner2, 0, ['Lg Tree MerchHarvLive D3 (m3)'], subArea, chartTitle, yLabelText) pdfFile.savefig() pl.close() pdfFile.close() varList = [' Saw Timber Total (m3)'] for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_VolumeStanding.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot total area totalArea = pd.io.parsers.read_csv(outDir + r'WoodProducts_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) # plot by owner totalArea = pd.io.parsers.read_csv(outDir + r'WoodProducts_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) # plot by owner detl totalArea = pd.io.parsers.read_csv( outDir + r'WoodProducts_by_OWNER_DETL_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_DETL_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_DETL_label'] == owner] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): # ownerHaForested = reporterFunc.getOwnerForestedHa(subArea) repList = list( set( pd.io.parsers.read_csv( outDir + r'PST_NSO_fire_severity_by_OWNER_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_PST_NSO_HSfire_Federal.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot by owner totalArea = pd.io.parsers.read_csv( outDir + r'PST_NSO_fire_severity_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ['Federal']: yLabelText = 'Hectares' byOwner = totalArea[totalArea[' OWNER_label'] == owner] varList = list(byOwner.columns.values) varList.remove('Scenario') varList.remove(' Run') varList.remove(' Year') varList.remove(' Version') varList.remove(' Timestamp') varList.remove(' OWNER_value') varList.remove(' OWNER_label') varList1 = [] varList2 = [] for var in varList: if 'fire' in var: varList1.append(var) else: varList2.append(var) reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList1, subArea, chartTitle, yLabelText) reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList2, subArea, chartTitle, yLabelText) # Repeat graph with percent area # yLabelText = 'Percent of Forested Area' # reporterFunc.plotReporter(owner, pdfFile, byOwner, ownerHaForested[owner], varList, subArea, chartTitle, yLabelText) # plot by owner_detl totalArea = pd.io.parsers.read_csv( outDir + r'nonPST_NSO_fire_severity_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ['Federal']: yLabelText = 'Hectares' byOwner = totalArea[totalArea[' OWNER_label'] == owner] varList = list(byOwner.columns.values) varList.remove('Scenario') varList.remove(' Run') varList.remove(' Year') varList.remove(' Version') varList.remove(' Timestamp') varList.remove(' OWNER_value') varList.remove(' OWNER_label') varList1 = [] varList2 = [] for var in varList: if 'fire' in var: varList1.append(var) else: varList2.append(var) reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList1, subArea, chartTitle, yLabelText) reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList2, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): yLabelText = 'Carbon (Mg C)' repList = list( set(pd.io.parsers.read_csv(outDir + r'Carbon_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_Carbon.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot landscape totalArea = pd.io.parsers.read_csv(outDir + r'Carbon_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] varList = list(totalArea.columns.values) varList.remove('Scenario') varList.remove(' Run') varList.remove(' Year') varList.remove(' Version') varList.remove(' Timestamp') # varList.remove(' OWNER_value') # varList.remove(' OWNER_label') reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) # plot by owner totalArea = pd.io.parsers.read_csv(outDir + r'Carbon_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] varList = list(byOwner.columns.values) varList.remove('Scenario') varList.remove(' Run') varList.remove(' Year') varList.remove(' Version') varList.remove(' Timestamp') varList.remove(' OWNER_value') varList.remove(' OWNER_label') reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) # plot by owner detl totalArea = pd.io.parsers.read_csv(outDir + r'carbon_by_OWNER_DETL_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_DETL_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_DETL_label'] == owner] varList = list(byOwner.columns.values) varList.remove('Scenario') varList.remove(' Run') varList.remove(' Year') varList.remove(' Version') varList.remove(' Timestamp') varList.remove(' OWNER_DETL_value') varList.remove(' OWNER_DETL_label') reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): repList = list( set( pd.io.parsers.read_csv(outDir + r'FireWiseVars_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_FireWiseVars.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot percent firewise ylabelText = 'Number of Dwellings' varList = [ ' DwellingsWithFIRE_500M_5y', ' DwellingsWithFIRE_10KM_5y', ' DwellingsWithPSFIRE_10KM_5y', ' DwellingsWithPRFIRE_2KM_5y' ] totalArea = pd.io.parsers.read_csv(outDir + r'FireWiseVars_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, ylabelText) # plot average flame length varList = [' AvgPotentialFL_1km'] yLabelText = 'Average Potential flame length (m) within 1km of IDU' reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) # plot average flame length varList = [' AvgTPH_500m'] yLabelText = 'Average Trees per Ha within 500m of IDU' reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) # plot firewise vars by owner totalArea = pd.io.parsers.read_csv(outDir + r'FireWiseVars_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] ylabelText = 'Number of Dwellings' varList = [ ' DwellingsWithFIRE_500M_5y', ' DwellingsWithFIRE_10KM_5y', ' DwellingsWithPSFIRE_10KM_5y', ' DwellingsWithPRFIRE_2KM_5y' ] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, ylabelText) # plot average flame length varList = [' AvgPotentialFL_1km'] yLabelText = 'Average Potential flame length (m) within 1km of IDU' reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) # plot average flame length varList = [' AvgTPH_500m'] yLabelText = 'Average Trees per Ha within 500m of IDU' reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."
def main(outDir, subArea, chartTitlePre): # load area stats by owner areaStats = pd.io.parsers.read_csv(outDir + "AreaStats_by_OWNER_pivot.csv") areaStats = areaStats[(areaStats[' Year'] == 1) | (areaStats[' Year'] == 2007)] repList = list( set( pd.io.parsers.read_csv( outDir + r'ManagementDisturb_by_OWNER_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_ManagementDisturb.pdf') pdfFile2 = PdfPages(outDir + 'R' + str(repNum) + '_ManagementDisturb_SYU.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot by owner totalArea = pd.io.parsers.read_csv( outDir + r'ManagementDisturb_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: yLabelText = 'Hectares Treated' byOwner = totalArea[totalArea[' OWNER_label'] == owner] varList = list(byOwner.columns.values) varList.remove('Scenario') varList.remove(' Run') varList.remove(' Year') varList.remove(' Version') varList.remove(' Timestamp') varList.remove(' OWNER_value') varList.remove(' OWNER_label') # create varList for SYU varList2 = [] for varName in varList: if " SYU" in varName: varList2.append(varName) for varName in varList2: varList.remove(varName) reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) reporterFunc.plotReporter(owner, pdfFile2, byOwner, 0, varList2, subArea, chartTitle, yLabelText) # Repeat graph with percent area yLabelText = 'Percent of Forested Area' reporterFunc.plotReporter( owner, pdfFile, byOwner, areaStats[areaStats[' OWNER_label'] == owner][' Forested (ha)'].iloc[0], varList, subArea, chartTitle, yLabelText) # plot by owner_detl totalArea = pd.io.parsers.read_csv( outDir + r'ManagementDisturb_by_OWNER_DETL_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_DETL_label'])) ownerNames.sort() for owner in ownerNames: yLabelText = 'Hectares Treated' byOwner = totalArea[totalArea[' OWNER_DETL_label'] == owner] varList = list(byOwner.columns.values) varList.remove('Scenario') varList.remove(' Run') varList.remove(' Year') varList.remove(' Version') varList.remove(' Timestamp') varList.remove(' OWNER_DETL_value') varList.remove(' OWNER_DETL_label') # create varList for SYU varList2 = [] for varName in varList: if " SYU" in varName: varList2.append(varName) for varName in varList2: varList.remove(varName) reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) reporterFunc.plotReporter(owner, pdfFile2, byOwner, 0, varList2, subArea, chartTitle, yLabelText) pdfFile.close() pdfFile2.close() print "Done."
def main(outDir, subArea, chartTitlePre): # load area stats by owner areaStats = pd.io.parsers.read_csv(outDir + "AreaStats_by_OWNER_pivot.csv") areaStats = areaStats[(areaStats[' Year'] == 1) | (areaStats[' Year'] == 2007)] repList = list( set( pd.io.parsers.read_csv( outDir + r'ForestStructure_by_OWNER_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_ForestStructure_byOwner.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot total area totalArea = pd.io.parsers.read_csv( outDir + r'ForestStructure_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: yLabelText = 'Hectares' byOwner = totalArea[totalArea[' OWNER_label'] == owner] varList = list(byOwner.columns.values) varList.remove('Scenario') varList.remove(' Run') varList.remove(' Year') varList.remove(' Version') varList.remove(' Timestamp') varList.remove(' OWNER_value') subVarList = [] for varName in varList: if 'All' in varName: subVarList.append(varName) reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, subVarList, subArea, chartTitle, yLabelText) # plot percent of forested area yLabelText = 'Percent of Forested Area' reporterFunc.plotReporter( owner, pdfFile, byOwner, areaStats[areaStats[' OWNER_label'] == owner][' Forested (ha)'].iloc[0], subVarList, subArea, chartTitle, yLabelText) # plot fire occurrence by PVT management group yLabelText = 'Hectares' for PVTgpNum in range(1, 7): PVTgp = 'PMG' + str(PVTgpNum) varList = list(byOwner.columns.values) varList.remove('Scenario') varList.remove(' Run') varList.remove(' Year') varList.remove(' Version') varList.remove(' Timestamp') varList.remove(' OWNER_value') subVarList = [] for varName in varList: if PVTgp in varName: subVarList.append(varName) reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, subVarList, subArea, chartTitle, yLabelText) pdfFile.close() # Print out forest structure 2 file varList = [ ' Early Successional (ha) Forest', ' Pole and Small (ha) Forest', ' Medium (ha) Forest', ' Large and Giant (ha) Forest', ' Open Canopy (ha) Sm+ Forest', ' Closed Canopy (ha) Sm+ Forest' ] yLabelText = 'Hectares' pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_ForestStructure2_byOwner.pdf') # plot total area totalArea = pd.io.parsers.read_csv(outDir + r'ForestStructure2_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) # plot by owner totalArea = pd.io.parsers.read_csv( outDir + r'ForestStructure2_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) # plot by owner detl totalArea = pd.io.parsers.read_csv( outDir + r'ForestStructure2_by_OWNER_DETL_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_DETL_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_DETL_label'] == owner] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() # Print out forest structure 3 file varList = [ ' Open Canopy (ha) Forest', ' Moderate Canopy (ha) Forest', ' Closed Canopy (ha) Forest', ' Post-disturb Canopy (ha) Forest', ' No Layers (ha) Forest', ' Single-story (ha) Forest', ' Multi-story (ha) Forest' ] yLabelText = 'Hectares' pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_ForestStructure3_byOwner.pdf') # plot total area totalArea = pd.io.parsers.read_csv(outDir + r'ForestStructure3_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) # plot by owner totalArea = pd.io.parsers.read_csv( outDir + r'ForestStructure3_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) # plot by owner detl totalArea = pd.io.parsers.read_csv( outDir + r'ForestStructure3_by_OWNER_DETL_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_DETL_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_DETL_label'] == owner] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() # Print out forest structure 3 PMG345 file varList = [ ' Open Canopy (ha) PMG345', ' Moderate Canopy (ha) PMG345', ' Closed Canopy (ha) PMG345', ' Post-disturb Canopy (ha) PMG345', ' No Layers (ha) PMG345', ' Single-story (ha) PMG345', ' Multi-story (ha) PMG345' ] yLabelText = 'Hectares' pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_ForestStructure3_PMG345_byOwner.pdf') # plot total area totalArea = pd.io.parsers.read_csv(outDir + r'ForestStructure3_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] reporterFunc.plotReporter('', pdfFile, totalArea, 0, varList, subArea, chartTitle, yLabelText) # plot by owner totalArea = pd.io.parsers.read_csv( outDir + r'ForestStructure3_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_label'] == owner] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) # plot by owner detl totalArea = pd.io.parsers.read_csv( outDir + r'ForestStructure3_by_OWNER_DETL_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_DETL_label'])) ownerNames.sort() for owner in ownerNames: byOwner = totalArea[totalArea[' OWNER_DETL_label'] == owner] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done with ForestStructure by Owner"
def main(outDir, subArea, chartTitlePre): # load area stats by owner areaStats = pd.io.parsers.read_csv(outDir + "AreaStats_by_OWNER_pivot.csv") areaStats = areaStats[(areaStats[' Year'] == 1) | (areaStats[' Year'] == 2007)] repList = list( set( pd.io.parsers.read_csv( outDir + r'PotentialDisturbance_by_OWNER_pivot.csv')[' Run'])) for repNum in repList: pdfFile = PdfPages(outDir + 'R' + str(repNum) + '_PotentialDisturbance_byOwner.pdf') chartTitle = chartTitlePre + ' - R' + str(repNum) # plot by owner totalArea = pd.io.parsers.read_csv( outDir + r'PotentialDisturbance_by_OWNER_pivot.csv') totalArea = totalArea[totalArea[' Run'] == repNum] ownerNames = list(set(totalArea[' OWNER_label'])) ownerNames.sort() for owner in ownerNames: yLabelText = 'Hectares' varList = [ ' PotentialSurfaceFire(ha)', ' PotentialMixedSeverityFire(ha)', ' PotentialHighSeverityFire(ha)' ] byOwner = totalArea[totalArea[' OWNER_label'] == owner] reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, varList, subArea, chartTitle, yLabelText) # ploy by percent of forested area yLabelText = 'Percent of Forested Area' reporterFunc.plotReporter( owner, pdfFile, byOwner, areaStats[areaStats[' OWNER_label'] == owner][' Forested (ha)'].iloc[0], varList, subArea, chartTitle, yLabelText) # plot potential disturbance by PVT management group yLabelText = 'Hectares' for PVTgpNum in range(0, 7): PVTgp = 'PMG' + str(PVTgpNum) varList = list(byOwner.columns.values) varList.remove('Scenario') varList.remove(' Run') varList.remove(' Year') varList.remove(' Version') varList.remove(' Timestamp') subVarList = [] for varName in varList: if PVTgp in varName: subVarList.append(varName) reporterFunc.plotReporter(owner, pdfFile, byOwner, 0, subVarList, subArea, chartTitle, yLabelText) pdfFile.close() print "Done."