cost_eco_model_linker.handlers.spreadsheet_interface

Functions

get_industry_codes(ws)

Retrieve industry classification codes found in the given worksheet.

find_table(→ pandas.DataFrame)

Identifies and retrieves table in a given worksheet identified by its first header.

find_cost_table(→ pandas.DataFrame)

Identifies and retrieves cost table based on initial header "Amount".

create_eia_template(wb)

find_or_fill_row(eia_template, it, year, dest, port, ...)

Attempts to identify the matching row. If none found, adds a new row.

create_cost_filters(cost_type_df[, attribution])

Returns dict of common filter combinations.

fill_industry_costs(eia_template, next_idx, df, ...)

Single-pass update of industry costs in EIA template. Accumulates into existing values.

fill_opex(it, _, year, dest, port, eia_template, wb[, ...])

attribution : One of ["COLLECT", "RETURN", None], see Attribution column in Excel worksheets.

fill_capex(it, _, year, dest, port, eia_template, wb)

attribution : One of ["COLLECT", "RETURN"], see Attribution column in Excel worksheets.

fill_EIA_info(prod_wb, deploy_wb, it, iv_start_year, ...)

Fill EIA template with cost data.

Module Contents

cost_eco_model_linker.handlers.spreadsheet_interface.get_industry_codes(ws: win32com.client.CDispatch)

Retrieve industry classification codes found in the given worksheet.

Parameters:

ws (win32com.client.CDispatch) – Excel WorkSheet object

Return type:

List of industry classification codes

cost_eco_model_linker.handlers.spreadsheet_interface.find_table(ws: win32com.client.CDispatch, first_header: str) pandas.DataFrame

Identifies and retrieves table in a given worksheet identified by its first header. Selects contiguous data regions.

Note: Drops NA rows.

Parameters:
  • ws (w32client.CDispatch) – Excel worksheet

  • first_header (str) – Header of first column

cost_eco_model_linker.handlers.spreadsheet_interface.find_cost_table(ws: win32com.client.CDispatch) pandas.DataFrame

Identifies and retrieves cost table based on initial header “Amount”. Selects contiguous data regions.

Note: Drops NA rows.

Parameters:

ws (w32client.CDispatch) – Excel worksheet

cost_eco_model_linker.handlers.spreadsheet_interface.create_eia_template(wb)
cost_eco_model_linker.handlers.spreadsheet_interface.find_or_fill_row(eia_template, it, year, dest, port, expense)

Attempts to identify the matching row. If none found, adds a new row. Returns the row ID (of the existing row, or the new row).

cost_eco_model_linker.handlers.spreadsheet_interface.create_cost_filters(cost_type_df, attribution=None)

Returns dict of common filter combinations.

Filters based on entries in the Type column in CAPEX and OPEX spreadsheets of the cost models.

cost_eco_model_linker.handlers.spreadsheet_interface.fill_industry_costs(eia_template, next_idx, df, ind_codes, unique_ind_codes, cost_filter)

Single-pass update of industry costs in EIA template. Accumulates into existing values.

cost_eco_model_linker.handlers.spreadsheet_interface.fill_opex(it, _, year, dest, port, eia_template, wb, attribution=None)

attribution : One of [“COLLECT”, “RETURN”, None], see Attribution column in Excel worksheets.

cost_eco_model_linker.handlers.spreadsheet_interface.fill_capex(it, _, year, dest, port, eia_template, wb, attribution=None)

attribution : One of [“COLLECT”, “RETURN”], see Attribution column in Excel worksheets.

cost_eco_model_linker.handlers.spreadsheet_interface.fill_EIA_info(prod_wb, deploy_wb, it: int, iv_start_year: int, year: int, dest: str, port: str, eia_template: pandas.DataFrame)

Fill EIA template with cost data.

Parameters:
  • prod_wb – Production model

  • deploy_wb – Deployment model

  • it (int) – ReefMod Engine Iteration ID

  • iv_start_year (int) – Year interventions begin

  • year (int) – Simulation year

  • dest (str) – Deployment destination

  • port (str) – Port where deployments launched from

  • eia_template (pd.DataFrame) – Template to fill