Skip to content

12 calculate blue columns function#13

Merged
alxsmith merged 20 commits intomainfrom
12-calculate-blue-columns-function
Aug 27, 2025
Merged

12 calculate blue columns function#13
alxsmith merged 20 commits intomainfrom
12-calculate-blue-columns-function

Conversation

@alxsmith
Copy link
Copy Markdown
Contributor

@alxsmith alxsmith commented Aug 26, 2025

calculate intermediate columns and return as df

@alxsmith alxsmith linked an issue Aug 26, 2025 that may be closed by this pull request
@alxsmith alxsmith marked this pull request as draft August 26, 2025 19:32
@alxsmith alxsmith requested a review from karpdave August 27, 2025 16:06
@alxsmith alxsmith marked this pull request as ready for review August 27, 2025 16:07
####### TODO: ticket
intermediate_columns = compute_blue_columns() # returns pl.DataFrame
# TODO: ticket
intermediate_df_gas = compute_intermediate_cols(year, input_params, scenario_params, "gas")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is cleaner as just "compute_intermediate_gas_cols" and "compute_intermediate_electric_cols", rather than the branching in compute_intermediate_cols

ts_params.gas_fixed_overhead_costs + gas_maintenance_cost + npa_opex
) # npa_opex is 0 if scenario_params.capex_opex == "capex" OR gas_electric == "electric"
# costs_depreciation = gas_depreciation_expense
total_costs = costs_fixed + costs_volumetric
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe call this like "opex_costs" or something, because it's weird that "total_costs" isn't in fact the total of all costs (we add "costs_depreciation" in the next line). I introduced this bad name in the spreadsheet, sorry

) -> pl.DataFrame:
# TODO: implement this
if gas_electric == "gas":
num_gas_users = input_params.gas.num_users_init - npa.compute_num_converts_from_df(ts_params.npa_projects, year)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: the signature on this function changes a little bit in the npa_projects PR, but it's a trivial merge. New call will be:

npa.compute_total_converts_from_df(year, ts_params.npa_projects, cumulative=True)

def compute_blue_columns(year: int, gas_params: GasParams, shared_params: SharedParams) -> pl.DataFrame:
def compute_intermediate_cols(
year: int,
input_params: InputParams,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this also needs to take ScenarioParams right, so it can know whether to assign opex costs for npa projects?


# gas_usage = input_params.gas_usage_per_user * num_gas_users
# gas_costs_volumetric = gas_usage * input_params.gas_cost_per_therm
# return pl.DataFrame({"year": year, "gas_usage": gas_usage, "gas_costs_volumetric": gas_costs_volumetric})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at this commented out return statement, I feel better about the request to split this into two functions, since we'd need to branch the return as well since the columns being created are different

@alxsmith alxsmith merged commit bd4bf36 into main Aug 27, 2025
0 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

calculate blue columns function

2 participants