mario.Database.add_sectors
- Database.add_sectors(
- io='inventories',
- scenario='baseline',
- inplace=True,
- split=False,
- keep_all_split_steps=False,
- notes=None,
- ignore_warnings=True,
- cvxlab_path=None,
- input_data_files_type='xlsx',
- only_input_data_gen=False,
- solver=None,
- solver_parameters=None,
- parent_name=None,
- parent_names=None,
- residue=None,
- VA_fix=False,
- accept_non_unitary_sum=False,
Apply the add-sectors workbook to the selected scenario.
- Parameters:
io – Either a workbook path or the special value
"inventories". When a path is provided, MARIO reads workbook metadata and grouped inventory sheets from that file first. When"inventories"is used, the caller is expected to have already loaded workbook state withread_add_sectors_excel(...)/read_inventory_sheets(...).scenario – Scenario to read the source coefficient blocks from.
inplace – When
False, return a modified copy. WhenTrue, the method mutates the current database and returnsNone.notes – Optional metadata notes appended to the database history.
ignore_warnings – Passed through to the engine for the handful of cases where the historical workflow intentionally muted warnings.
split – When
Trueand the table is an IOT, run the split workflow after the standard coefficient-side insertion.VA_fix – When
True, warn about any database factor-of-production rows that are missing from the workbook inventories before slice filling starts.accept_non_unitary_sum – When
True, allow inventory sheets whose factor/sector rows do not sum to 1. Sheets whose factor/sector rows sum to 0 are skipped entirely; other non-unitary inventories proceed with a warning instead of raising duringVA_fixaugmentation.keep_all_split_steps – When
Falseandsplit=True, keep only the final available split result asbaselineand discard intermediate scenarios such asoriginal,split_<scenario>, andsplit_cvxlab. WhenTrue, preserve all intermediate split scenarios.cvxlab_path – Directory where MARIO should generate the CVXLab model directory.
input_data_files_type – Format for the generated CVXLab input files.
"xlsx"is fully supported."csv"is available only for input-data generation.only_input_data_gen – When
True, stop after generating the CVXLab model directory and input data. No optimization run is executed.solver – Optional solver passed through to CVXLab.
solver_parameters – Optional solver keyword arguments passed to CVXLab. When provided, they are forwarded as
mosek_paramsto preserve the historical MARIO split workflow.parent_name – Optional new label for the residual parent sector when exactly one parent sector is being split.
parent_names – Optional mapping of split child sector or parent sector -> new parent label. This is useful when you want the residual parent sector to be renamed after the split, for example
{"Non metallic minerals": "Other non metallic minerals"}.residue – Threshold for zeroing out small positive values in the CVXLab input data. Values strictly below this threshold are set to zero before writing the input files. When
None(default), no correction is applied.
Notes
The workbook-driven non-split insertion always runs first. If
split=Truefor an IOT, MARIO then builds a deterministicsplit_<scenario>flow scenario and optionally hands it to CVXLab. By default, the final available split scenario is then promoted back tobaseline.