Basic inspections
This notebook starts from the packaged MARIO IOT test table and then repeats the same inspection pattern on the packaged SUT fixture.
Load the test table
INFO Parser: excel reading IOT flows from /Users/lorenzorinaldi/Documents/GitHub/MARIO/mario/test/tables/test_IOT_standard.xlsx.
INFO Parser: state payload ready with 6 canonical blocks.
INFO Parser: excel state ready for IOT.
INFO Metadata: initialized.
name = IOT test (standard)
table = IOT
scenarios = ['baseline']
Factor of production = 3
Satellite account = 2
Consumption category = 1
Region = 2
Sector = 3
Check scenarios and sets
['Factor of production',
'Satellite account',
'Consumption category',
'Region',
'Sector']
{'Factor of production': ['Taxes', 'Wages', 'Capital'],
'Satellite account': ['Employment', 'CO2'],
'Consumption category': ['Final demand'],
'Region': ['Reg1', 'Reg2'],
'Sector': ['Agriculture', 'Services', 'Industry']}
['Agriculture', 'Services', 'Industry']
['Agriculture', 'Services', 'Industry']
Search labels
{'Sector': ['Agriculture']}
Check stored matrices
dict_keys(['E', 'EY', 'V', 'VY', 'Y', 'Z'])
Query for a matrix
|
|
Region |
Reg1 |
Reg2 |
|
|
Level |
Sector |
Sector |
|
|
Item |
Agriculture |
Industry |
Services |
Agriculture |
Industry |
Services |
| Region |
Level |
Item |
|
|
|
|
|
|
| Reg1 |
Sector |
Agriculture |
9.308651e+05 |
5.357799e+06 |
1.075278e+06 |
2363.029548 |
50607.806861 |
10341.916110 |
| Industry |
1.122397e+06 |
2.289284e+07 |
1.065096e+07 |
1413.697219 |
134910.657543 |
30367.209709 |
| Services |
1.893586e+06 |
9.737509e+06 |
3.059785e+07 |
1301.725200 |
27813.857216 |
58525.384254 |
| Reg2 |
Sector |
Agriculture |
4.168587e+02 |
2.596041e+03 |
8.430071e+02 |
2962.557738 |
30635.045696 |
7961.643900 |
| Industry |
6.890987e+03 |
1.335193e+05 |
6.555829e+04 |
9736.931972 |
287300.673355 |
161126.940614 |
| Services |
1.590090e+03 |
1.555045e+04 |
3.843707e+04 |
16680.335207 |
312355.775242 |
722089.042972 |
If you want to query for multiple matrices in given scenarios use the “query” method.
| Region |
Reg1 |
Reg2 |
| Level |
Sector |
Sector |
| Item |
Agriculture |
Industry |
Services |
Agriculture |
Industry |
Services |
| Item |
|
|
|
|
|
|
| Employment |
1.702588e+06 |
6.547713e+05 |
2.050334e+06 |
7.393224e+02 |
3.939633e+03 |
1.852450e+04 |
| CO2 |
3.415989e+12 |
8.884627e+12 |
1.878737e+13 |
2.315340e+10 |
4.839515e+10 |
1.679321e+11 |
The “query” method will also calculate matrices in case they are missing
INFO Resolver: resolving e for baseline.
INFO Resolver: trying e via formula build_iot_e_from_E_X.
INFO Resolver: resolved e via formula build_iot_e_from_E_X.
| Region |
Reg1 |
Reg2 |
| Level |
Sector |
Sector |
| Item |
Agriculture |
Industry |
Services |
Agriculture |
Industry |
Services |
| Item |
|
|
|
|
|
|
| Employment |
0.170734 |
0.012327 |
0.019621 |
0.009259 |
0.003295 |
0.007659 |
| CO2 |
342552.270192 |
167269.943085 |
179791.790027 |
289962.466193 |
40474.898330 |
69431.794242 |
Repeat the same checks on a SUT
The same inspection methods work on SUT databases, but you will see Activity and Commodity sets plus split blocks such as U, S, Ya, and Yc.
INFO Parser: excel reading SUT flows from /Users/lorenzorinaldi/Documents/GitHub/MARIO/mario/test/tables/test_SUT_standard.xlsx.
INFO Parser: state payload ready with 10 canonical blocks.
INFO Parser: excel state ready for SUT.
INFO Metadata: initialized.
name = SUT test (standard)
table = SUT
tech_assumption = industry-based
scenarios = ['baseline']
Activity = 2
Commodity = 2
Factor of production = 3
Satellite account = 2
Consumption category = 1
Region = 2
['Activity',
'Commodity',
'Factor of production',
'Satellite account',
'Consumption category',
'Region']
{'Activity': ['Manufacturing', 'Services'],
'Commodity': ['Goods', 'Services'],
'Factor of production': ['Taxes', 'Wages', 'Capital'],
'Satellite account': ['Employment', 'CO2'],
'Consumption category': ['Final demand'],
'Region': ['Region 1', 'Region 2']}
{'Activity': ['Services'], 'Commodity': ['Services']}
Check stored SUT matrices
dict_keys(['EY', 'Ea', 'Ec', 'S', 'U', 'VY', 'Va', 'Vc', 'Ya', 'Yc'])
|
|
Region |
Region 1 |
Region 2 |
|
|
Level |
Activity |
Activity |
|
|
Item |
Manufacturing |
Services |
Manufacturing |
Services |
| Region |
Level |
Item |
|
|
|
|
| Region 1 |
Commodity |
Goods |
3.334903e+11 |
1.657755e+11 |
1.487965e+11 |
6.895332e+10 |
| Services |
3.261811e+11 |
7.254021e+11 |
1.176727e+10 |
3.588505e+10 |
| Region 2 |
Commodity |
Goods |
1.922623e+11 |
4.099986e+10 |
3.038628e+13 |
1.157115e+13 |
| Services |
2.614852e+10 |
5.823465e+10 |
1.154871e+13 |
3.075294e+13 |
Query derived SUT matrices
query(...) behaves the same way on SUT databases and can materialize missing split or unified blocks on demand.
INFO Resolver: resolving u for baseline.
INFO Resolver: trying u via extract.
INFO Resolver: trying u via formula build_sut_u_from_U_Xa.
INFO Resolver: resolved u via formula build_sut_u_from_U_Xa.
|
|
Region |
Region 1 |
Region 2 |
|
|
Level |
Activity |
Activity |
|
|
Item |
Manufacturing |
Services |
Manufacturing |
Services |
| Region |
Level |
Item |
|
|
|
|
| Region 1 |
Commodity |
Goods |
0.261452 |
0.068540 |
0.002359 |
0.000660 |
| Services |
0.255721 |
0.299919 |
0.000187 |
0.000343 |
| Region 2 |
Commodity |
Goods |
0.150731 |
0.016951 |
0.481652 |
0.110734 |
| Services |
0.020500 |
0.024077 |
0.183058 |
0.294300 |
INFO Resolver: resolving Xc for baseline.
INFO Resolver: trying Xc via formula build_sut_Xc_from_U_Yc.
INFO Resolver: resolved Xc via formula build_sut_Xc_from_U_Yc.
|
|
Item |
production |
| Region |
Level |
Item |
|
| Region 1 |
Commodity |
Goods |
1.311430e+12 |
| Services |
2.382765e+12 |
| Region 2 |
Commodity |
Goods |
6.302777e+13 |
| Services |
1.045551e+14 |