FFSM++ 1.1.0
French Forest Sector Model ++
Loading...
Searching...
No Matches
output_parser_example Namespace Reference

Functions

 main ()
 
 override_globals ()
 
 printCharts ()
 
 printTables ()
 
 printAATables ()
 

Function Documentation

◆ main()

main ( )

Definition at line 11 of file output_parser_example.py.

11def main():
12
13 override_globals()
14 prepare_data()
15 reset_output()
16
17 # H - Printing charts
18 if g.printChartsFlag:
19 printCharts()
20
21 # I - Print tables
22 if g.printTablesFlag:
23 printTables()
24
25 # L - Print area allocation confrontation
26 if g.printAATablesFlag:
27 printAATables()
28
29 print ("Done!")
30
31# =============================================================================
int main(int argc, char *argv[])
Definition main.cpp:39

Referenced by printAATables().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ override_globals()

override_globals ( )

Definition at line 32 of file output_parser_example.py.

32def override_globals():
33
34 g.scenarios = {
35 'default': '#8c0000', # red-brown
36 'debug': '#1349B5',
37 }
38
39 g.forIFiles = [ 'results/forestData_'+i+'.csv' for i in g.scenarios]
40 g.carbonIFiles = [ 'results/carbonBalance_'+i+'.csv' for i in g.scenarios]
41
42
43
44 g.years = [str(y) for y in range(2012,2051)] # [2012-2050]
45 g.printChartsFlag = True
46 g.printTablesFlag = True
47 g.printAATablesFlag = False
48 g.chartoutdir = 'charts'
49 g.tableoutdir = 'tables'
50
51
52
53 g.spGroups = ['Fut_Feu', 'Fut_Mix', 'Fut_Con', 'Mel_Feu', 'Mel_Mix', 'Tail_Feu',]
54
55 g.countries = {'FRA': [['AlsChaLor','AquPoi','AuvLim','BasHau','BouFra','BrePay','Cen','Cor','IleNorPic','LanPro','Mid','Rho'],'France']}
56
57 g.regions = {'AlsChaLor': 'Alsace ; Champagne Ardenne ; Lorraine',
58 'AquPoi': 'Aquitaine ; Poitou Charentes',
59 'AuvLim': 'Auvergne ; Limousin',
60 'BasHau': 'Basse Normandie ; Haute Normandie',
61 'BouFra': 'Bourgogne : Franche Comté',
62 'BrePay': 'Bretagne ; pays de la Loire',
63 'Cen': 'Centre Val de Loire',
64 'Cor': 'Corse',
65 'IleNorPic': 'Ile de France ; Nord Pas de Calais ; Picardie',
66 'LanPro': 'Languedoc Roussillon ; Provence Alpes Côtes d\'Azur',
67 'Mid': 'Midi Pyrénées',
68 'Rho': 'Rhône Alpes',}
69
70
71
72
73 g.pProd = ['hardWRoundW','softWRoundW','pulpWFuelW']
74 g.tProd = ['fuelW','hardWSawnW','softWSawnW','plyW','pulpW','pannels']
75
76 #key: human name
77 #value[0]: list of sp groups
78 #value[1]: chart line type
79 #value[2]: chart line width
80 #value[3]: (optional) alias in the data. If present, the input data will be converted to the name at input time
81 g.spAggregates = {'00_Total': [['Fut_Feu', 'Fut_Mix', 'Fut_Con', 'Mel_Feu', 'Mel_Mix', 'Tail_Feu',],'-',4,''],
82 '01_Broadleaved': [['Fut_Feu', 'Mel_Feu','Tail_Feu'],'--',3,'broadL'],
83 '02_Coniferous': [['Fut_Con'],':',3,'con'],
84 '03_Mixed': [['Fut_Mix','Mel_Mix'],'-.',3,'mixedBC']
85 }
86
87
88# =============================================================================

Referenced by main().

Here is the caller graph for this function:

◆ printAATables()

printAATables ( )

Definition at line 120 of file output_parser_example.py.

120def printAATables():
121 print ("Printing area allocation tables..")
122
123# =============================================================================
124# EXECUTION ACTUALLY STARTS HERE.....

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printCharts()

printCharts ( )

Definition at line 89 of file output_parser_example.py.

89def printCharts():
90 print ("Printing charts..")
91
92
93 title('c','subsection', "Carbon charts")
94 # def plotCarbonChart(scenarios_h,region,title, filename):
95 plotCarbonChart(['default','debug'],'FRA','','cbalance_ecoeffect_example')
96
97
98# =============================================================================

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printTables()

printTables ( )

Definition at line 99 of file output_parser_example.py.

99def printTables():
100 print ("Printing tables..")
101
102 # def printTable(ref_scenario, comparing_scenarios, variables_h, regions_h, years_h, title, filename, singleComparation=False, refYear=0):
103 # Print a LaTeX Table for variables variable_h comparing ref_scenario scenario vs coparing_scenarios.
104 # @param singleComparation: if True multiple comparing scenarios are treated as multiple replications of the same scenario and
105 # some basic stats are computed; if False they are all represented as diff from the ref_scenario.
106 # @param refYear: if 0 reference vs comparing scenarios are compared on the same year (or average of years if years_h has length > 1.).
107 # Otherwise the comparing scneario at year(s) years_h is compared with reference scenario at year refYear (useful to see the dynamic
108 # effects within a single scenario)
109
110 outvars = ['expReturns','harvestedArea','hV','regArea','vReg','forArea','vol']
111 outvars_state = ['forArea','vol']
112 outvars_flow = ['expReturns','harvestedArea','hV','regArea','vReg']
113 printTable('debug',['default'],outvars,['FRA'],['2050'],'[2050 vs 2012]','example',False,2012)
114
115 title('t','subsection',"Carbon tables")
116 #printCarbonTable(ref_scenario, comparing_scenarios, region, year_start, year_end, title, filename, avg=False, singleComparation=True )
117 printCarbonTable('debug',['default'],'FRA', '2012', '2050', "\\ce{CO2} balance [yearly avg. 2012-2050]",'cbalance_11000', True, False)
118
119# =============================================================================

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function: