GTAP parser walkthrough#
This notebook is the practical guide for parsing GTAP bundles in MARIO.
Warning
The current GTAP parser is tied to the GTAP workflow developed in the context of the ongoing ENTICE activities behind the current MARIO support. At the moment, MARIO can use only one specific GTAP Power MRIO version and local bundle organization. That bundle is not always available in practice, even for users who hold a GTAP license, so this page should be read as a workflow note for a narrow supported case rather than as general GTAP support. Updates will be provided as soon as the supported scope changes.
ENTICE project website: www.enticeproject.eu
What this notebook covers#
the current GTAP parser scope exposed by MARIO;
the difference between
csv,gdx, andautoinput selection;the expected local bundle layout;
the current caveat that GTAP support is targeted to the GTAP Power
MRIOworkflow, not yet to every GTAP distribution.
Relevant source pages#
GTAP portal: GTAP at Purdue University
The current parser support follows the GTAP Power MRIO workflow used in the current
ENTICE-related work behind MARIO’s narrow GTAP support.MARIO does not download GTAP assets automatically. Access to the underlying files depends on your own GTAP data availability and licensing arrangement, and the supported GTAP Power MRIO bundle is not always distributed in a form that MARIO can parse directly.
Main entry point#
For normal user workflows, the public entry point is:
mario.parse_gtap(...)
The current implementation supports:
GTAP
Poweronly;MRIOlayout only;IOTtables only;local
csvandgdxbundles.
Key arguments#
The key public arguments are:
path: GTAP bundle directory, or one file inside that directory;table: currently only"IOT"is supported;variant: currently only"power"is supported;layout: currently only"MRIO"is supported;input_format: use"auto","csv", or"gdx".
[ ]:
import mario
Expected local layouts and caveats#
Typical local layouts are:
For the CSV workflow:
GTAP/
`-- bundle/
|-- GSDFSRCxDST.csv
|-- GSDFXTAX.csv
|-- GSDF.csv
|-- GSDFEMI.csv
`-- GSDFNRG.csv
For the GDX workflow:
GTAP/
`-- bundle/
|-- GSDFSRCxDST.gdx
|-- GSDFXTAX.gdx
|-- GSDF.gdx
|-- GSDFEMI.gdx
`-- GSDFNRG.gdx
Practical caveats:
MARIO works with local GTAP bundles only;
input_format="auto"prefers the CSV bundle when both payloads are complete;gdxparsing requires the GAMS Python API in the active environment, because MARIO reads the containers throughgams.transfer;the current backend is intentionally narrow and should be presented as targeted GTAP Power
MRIOsupport, not yet as generic support for all GTAP products.
Parse a CSV bundle#
Use this when the local folder contains the GTAP Power MRIO CSV payload and you want to be explicit about the selected format.
[ ]:
db = mario.parse_gtap(
path="/path/to/gtap_bundle",
table="IOT",
variant="power",
layout="MRIO",
input_format="csv",
calc_all=False,
)
Auto-detect the available payload#
Use input_format="auto" when you want MARIO to inspect the bundle directory and pick a supported payload automatically. If both payloads are present and complete, MARIO prefers the CSV workflow.
[ ]:
db = mario.parse_gtap(
path="/path/to/gtap_bundle",
table="IOT",
input_format="auto",
calc_all=False,
)
Parse a GDX bundle#
Use this when the available GTAP Power MRIO bundle is stored as GDX files and the active environment already includes the GAMS Python API.
[ ]:
db = mario.parse_gtap(
path="/path/to/gtap_bundle",
table="IOT",
input_format="gdx",
calc_all=False,
)