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, ea and ec. 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 as Region_from and Sector_to instead of the legacy explicit level columns.

Beyond Percentage/Absolute/Update, the coefficient and final-demand sheets that drive the mix updates (z/Y on IOT, u/s/Yc on SUT) offer the Supply mix 1-10 and Trade mix 1-10 options, applied through update_supply_mix() and update_trade_mix(). The combined option list is stored on the hidden indeces sheet 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.