mario.Database.get_shock_excel
- Database.get_shock_excel(path=None, num_shock=10, clusters=None, **legacy_clusters)#
Write an Excel template for defining shocks.
- Parameters:
path – Output path for the workbook. When omitted, MARIO writes to the default Excel output directory.
num_shock – Number of shock rows to pre-create in the workbook template.
clusters – Preferred cluster payload. When omitted, MARIO uses clusters already stored on the database, optionally merged with any legacy keyword clusters.
**legacy_clusters – Backward-compatible cluster mappings passed as keyword arguments.
- Returns:
The template workbook is written to disk.
- Return type:
None
Notes
For SUT databases, the template exposes split block sheets such as
u,s,Ya,Yc,va,vc,eaandec. Sheets whose current block is entirely zero are omitted to keep the workbook compact.shock_calc(...)still accepts the old unified workbook format (z,v,e,Y) for backward compatibility. For both IOT and SUT, the new template uses flat-style column names such asRegion_fromandSector_toinstead of the legacy explicit level columns.Beyond
Percentage/Absolute/Update, the coefficient and final-demand sheets that drive the mix updates (z/Yon IOT,u/s/Ycon SUT) offer theSupply mix 1-10andTrade mix 1-10options, applied throughupdate_supply_mix()andupdate_trade_mix(). The combined option list is stored on the hiddenindecessheet and referenced by the picklists (Excel limits inline validation lists to 255 characters).
For regional classifications, Excel picklists show the distinct union of
observed codes and cluster names. The regional cluster definitions remain on
the database (or are supplied through clusters=); the menus do not imply
that every code is valid in every region. Shock application validates and
expands the actual regional selections. Template generation checks sparse
blocks for nonzero entries without converting them to dense arrays.