mario.parse_gtap
- mario.parse_gtap(
- path: str,
- table: str = 'IOT',
- variant: str = 'power',
- layout: str = 'MRIO',
- input_format: str = 'auto',
- matrix_layouts: dict | None = None,
- model: str = 'Database',
- name: str | None = None,
- year: int | None = None,
- calc_all: bool = False,
- **kwargs,
Parse a locally downloaded GTAP bundle.
The current backend supports the GTAP Power multi-regional input-output bundle used in the Horizon collaboration. The parser is structured with explicit
variantandlayoutarguments so more GTAP branches can be added later without changing the public API.- Parameters:
path (str) – directory containing the GTAP bundle, or one file inside that directory.
table (str, optional) – currently only
IOTis supported.variant (str, optional) – GTAP family. The only supported value today is
power.layout (str, optional) – GTAP layout. The only supported value today is
MRIO.input_format (str, optional) – one of
auto,csvorgdx.autoprefers the CSV bundle when both bundles are present in the same directory.matrix_layouts (dict, optional) – opt-in semantic row layouts for the factor and satellite blocks, e.g.
{"V": ("Region", "Sector"), "E": ("Region", "Sector")}. By default (None) the historical flat row names are kept (“MTAX_AUS_GRO”, “EMI_CO2_AUS_COA”, …). With the layout enabled the same rows are exposed as a(Region, Sector, item)MultiIndex – values are identical, only the index representation changes – and row families without a region or sector of their own (PTAX, VAAD, ETAX, DTAX, domestic satellite accounts) carry the sentinel label"TOTAL"on the levels that do not apply. Only the full("Region", "Sector")layout is currently supported.model (str, optional) – Public MARIO model class to instantiate; defaults to
Database.name (str, optional) – Dataset name stored in metadata.
year (int, optional) – Reference year stored in metadata.
calc_all (bool, optional) – Materialize derived matrices immediately after parsing; defaults to
False.
Notes
The GDX path requires the GAMS Python API in the active environment because MARIO relies on
gams.transferto read the GDX containers (the pip packagegamsapi[transfer]is sufficient).Output- and value-added-based emission accounts, which the csv export encodes with the
SRC="TOT"placeholder, are captured as domestic satellite rows of the destination region (e.g.EMI_CH4_dms_QO), mirroring how the GDX bundles store them. Any satellite record mass the parser cannot attribute is reported with a warning instead of being silently dropped.