message_ix icon indicating copy to clipboard operation
message_ix copied to clipboard

Fix handling of activity years and life time of technologies in the tutorials

Open LauWien opened this issue 4 years ago • 3 comments

Secondly, as observed in the follow-up discussions on the last capacity building workshop, when we add parameters where the index includes both vintage and activity years, then in the past we have just added activity years that stretch the entire model horizon, irrespective of the lifetime of the technology. This definitely needs to be fixed as this causes too much confusion for new users.

Originally posted by @OFR-IIASA in https://github.com/iiasa/message_ix/issues/502#issuecomment-908102971

LauWien avatar Oct 19 '21 15:10 LauWien

@LauWien I added a small bit of code for the Indian colleagues in a tutorial. Please find the snippet below:

for tec, val in costs.items():
    for y in scenario.par('technical_lifetime',
                          filters={'node_loc': country,
                                   'technology': tec})['year_vtg'].tolist():
        year_act = scenario.years_active(node=country, tec=tec, yr_vtg=y)
        df = make_df(base_fix_cost,
                     technology=tec,
                     value=val,
                     year_vtg=y,
                     year_act=year_act)
        scenario.add_par('fix_cost', df)

OFR-IIASA avatar Oct 20 '21 05:10 OFR-IIASA

Perfect, thank you!

LauWien avatar Oct 20 '21 06:10 LauWien

I think this issue is relevant beyond tutorials. While trying to add data frames for new technologies in the global model using make_df , the year_act and year_vtg are not mapped according to technical_lifetime

awais307 avatar Feb 09 '22 08:02 awais307