@@ -191,7 +191,7 @@ def test_tax_emission_pool_world(test_mp):
191
191
pdt .assert_frame_equal (exp , obs , check_dtype = False )
192
192
193
193
194
- def test_bound_emission_pool (test_mp ):
194
+ def test_bound_emission_pool_up (test_mp ):
195
195
s = make_westeros (test_mp , quiet = True )
196
196
prep_scenario (s , test_mp )
197
197
@@ -206,8 +206,8 @@ def test_bound_emission_pool(test_mp):
206
206
"unit" : "???" ,
207
207
}
208
208
)
209
- s .add_par ("bound_emission_pool " , df )
210
- s .commit ("bound_emission_pool added" )
209
+ s .add_par ("bound_emission_pool_up " , df )
210
+ s .commit ("bound_emission_pool_up added" )
211
211
212
212
s .solve ()
213
213
@@ -242,7 +242,7 @@ def test_bound_emission_pool(test_mp):
242
242
pdt .assert_frame_equal (exp , obs , check_dtype = False )
243
243
244
244
245
- def test_bound_emission_pool_removal (test_mp ):
245
+ def test_bound_emission_pool_lo (test_mp ):
246
246
s = make_westeros (test_mp , quiet = True )
247
247
prep_scenario (s , test_mp )
248
248
@@ -257,31 +257,95 @@ def test_bound_emission_pool_removal(test_mp):
257
257
"unit" : "???" ,
258
258
}
259
259
)
260
- s .add_par ("bound_emission_pool" , df )
261
- s .commit ("bound_emission_pool added" )
260
+ s .add_par ("bound_emission_pool_up" , df )
261
+
262
+ df = pd .DataFrame (
263
+ {
264
+ "node" : "Westeros" ,
265
+ "type_emission" : "GHG" ,
266
+ "type_tec" : "all" ,
267
+ "year" : [710 ],
268
+ "value" : [84000 ],
269
+ "unit" : "???" ,
270
+ }
271
+ )
272
+ s .add_par ("bound_emission_pool_lo" , df )
273
+
274
+ s .commit ("bound_emission_pool_lo and _up added" )
275
+
276
+ s .solve ()
277
+
278
+ exp = pd .DataFrame (
279
+ {
280
+ "node" : "Westeros" ,
281
+ "emission" : "CO2" ,
282
+ "type_tec" : "all" ,
283
+ "year" : [700 , 710 , 720 ],
284
+ "lvl" : [86254.74797636835 , 84000.0 , 85000.0 ],
285
+ "mrg" : 0.0 ,
286
+ }
287
+ )
288
+
289
+ obs = s .var ("EMISS_POOL" )
290
+
291
+ pdt .assert_frame_equal (exp , obs , check_dtype = False )
292
+
293
+ exp = pd .DataFrame (
294
+ {
295
+ "node" : "Westeros" ,
296
+ "type_emission" : "GHG" ,
297
+ "type_tec" : "all" ,
298
+ "year" : [720 ],
299
+ "lvl" : [33.075572 ],
300
+ "mrg" : 0.0 ,
301
+ }
302
+ )
303
+
304
+ obs = s .var ("PRICE_EMISSION_POOL" )
305
+
306
+ pdt .assert_frame_equal (exp , obs , check_dtype = False )
307
+
308
+
309
+ def test_bound_emission_pool_up_removal (test_mp ):
310
+ s = make_westeros (test_mp , quiet = True )
311
+ prep_scenario (s , test_mp )
312
+
313
+ s .check_out ()
314
+ df = pd .DataFrame (
315
+ {
316
+ "node" : "Westeros" ,
317
+ "type_emission" : "GHG" ,
318
+ "type_tec" : "all" ,
319
+ "year" : [700 , 710 , 720 ],
320
+ "value" : [87000 , 86000 , 85000 ],
321
+ "unit" : "???" ,
322
+ }
323
+ )
324
+ s .add_par ("bound_emission_pool_up" , df )
325
+ s .commit ("bound_emission_pool_up added" )
262
326
263
327
# Ensure that bound has been added
264
- obs = s .par ("bound_emission_pool " )
328
+ obs = s .par ("bound_emission_pool_up " )
265
329
pdt .assert_frame_equal (df , obs , check_dtype = False )
266
330
267
331
s .solve ()
268
332
269
333
# Ensure that is_ set for bound has been added upon solving
270
334
exp = df .drop (["value" , "unit" ], axis = 1 )
271
- obs = s .set ("is_bound_emission_pool " )
335
+ obs = s .set ("is_bound_emission_pool_up " )
272
336
pdt .assert_frame_equal (exp , obs , check_dtype = False )
273
337
274
338
# Esnure that is_ set is removed when removing parameter
275
339
s .remove_solution ()
276
340
s .check_out ()
277
- s .remove_par ("bound_emission_pool " , df )
341
+ s .remove_par ("bound_emission_pool_up " , df )
278
342
s .commit ("bound_emission_poll removed" )
279
343
280
- obs = s .set ("is_bound_emission_pool " )
344
+ obs = s .set ("is_bound_emission_pool_up " )
281
345
assert obs .empty is True
282
346
283
347
284
- def test_bound_emission_pool_modification_inc_yrs (test_mp ):
348
+ def test_bound_emission_pool_up_modification_inc_yrs (test_mp ):
285
349
s = make_westeros (test_mp , quiet = True )
286
350
prep_scenario (s , test_mp )
287
351
@@ -296,18 +360,18 @@ def test_bound_emission_pool_modification_inc_yrs(test_mp):
296
360
"unit" : "???" ,
297
361
}
298
362
)
299
- s .add_par ("bound_emission_pool " , df )
300
- s .commit ("bound_emission_pool added" )
363
+ s .add_par ("bound_emission_pool_up " , df )
364
+ s .commit ("bound_emission_pool_up added" )
301
365
302
366
# Ensure that bound has been added
303
- obs = s .par ("bound_emission_pool " )
367
+ obs = s .par ("bound_emission_pool_up " )
304
368
pdt .assert_frame_equal (df , obs , check_dtype = False )
305
369
306
370
s .solve ()
307
371
308
372
# Ensure that is_ set for bound has been added upon solving
309
373
exp = df .drop (["value" , "unit" ], axis = 1 )
310
- obs = s .set ("is_bound_emission_pool " )
374
+ obs = s .set ("is_bound_emission_pool_up " )
311
375
pdt .assert_frame_equal (exp , obs , check_dtype = False )
312
376
313
377
# Now check that when the dataframe is extended, if the "is_" set
@@ -324,22 +388,22 @@ def test_bound_emission_pool_modification_inc_yrs(test_mp):
324
388
"unit" : "???" ,
325
389
}
326
390
)
327
- s .add_par ("bound_emission_pool " , df )
328
- s .commit ("bound_emission_pool added" )
391
+ s .add_par ("bound_emission_pool_up " , df )
392
+ s .commit ("bound_emission_pool_up added" )
329
393
330
394
# Ensure that bound has been added
331
- obs = s .par ("bound_emission_pool " )
395
+ obs = s .par ("bound_emission_pool_up " )
332
396
pdt .assert_frame_equal (df , obs , check_dtype = False )
333
397
334
398
s .solve ()
335
399
336
400
# Ensure that is_ set for bound has been added upon solving
337
401
exp = df .drop (["value" , "unit" ], axis = 1 )
338
- obs = s .set ("is_bound_emission_pool " )
402
+ obs = s .set ("is_bound_emission_pool_up " )
339
403
pdt .assert_frame_equal (exp , obs , check_dtype = False )
340
404
341
405
342
- def test_bound_emission_pool_modification_red_yrs (test_mp ):
406
+ def test_bound_emission_pool_up_modification_red_yrs (test_mp ):
343
407
s = make_westeros (test_mp , quiet = True )
344
408
prep_scenario (s , test_mp )
345
409
@@ -354,18 +418,18 @@ def test_bound_emission_pool_modification_red_yrs(test_mp):
354
418
"unit" : "???" ,
355
419
}
356
420
)
357
- s .add_par ("bound_emission_pool " , df )
358
- s .commit ("bound_emission_pool added" )
421
+ s .add_par ("bound_emission_pool_up " , df )
422
+ s .commit ("bound_emission_pool_up added" )
359
423
360
424
# Ensure that bound has been added
361
- obs = s .par ("bound_emission_pool " )
425
+ obs = s .par ("bound_emission_pool_up " )
362
426
pdt .assert_frame_equal (df , obs , check_dtype = False )
363
427
364
428
s .solve ()
365
429
366
430
# Ensure that is_ set for bound has been added upon solving
367
431
exp = df .drop (["value" , "unit" ], axis = 1 )
368
- obs = s .set ("is_bound_emission_pool " )
432
+ obs = s .set ("is_bound_emission_pool_up " )
369
433
pdt .assert_frame_equal (exp , obs , check_dtype = False )
370
434
371
435
# Now check that when the dataframe is extended, if the "is_" set
@@ -374,8 +438,8 @@ def test_bound_emission_pool_modification_red_yrs(test_mp):
374
438
s .check_out ()
375
439
376
440
# Remove existing
377
- df = s .par ("bound_emission_pool " )
378
- s .remove_par ("bound_emission_pool " , df )
441
+ df = s .par ("bound_emission_pool_up " )
442
+ s .remove_par ("bound_emission_pool_up " , df )
379
443
380
444
df = pd .DataFrame (
381
445
{
@@ -387,16 +451,16 @@ def test_bound_emission_pool_modification_red_yrs(test_mp):
387
451
"unit" : "???" ,
388
452
}
389
453
)
390
- s .add_par ("bound_emission_pool " , df )
391
- s .commit ("bound_emission_pool added" )
454
+ s .add_par ("bound_emission_pool_up " , df )
455
+ s .commit ("bound_emission_pool_up added" )
392
456
393
457
# Ensure that bound has been added
394
- obs = s .par ("bound_emission_pool " )
458
+ obs = s .par ("bound_emission_pool_up " )
395
459
pdt .assert_frame_equal (df , obs , check_dtype = False )
396
460
397
461
s .solve ()
398
462
399
463
# Ensure that is_ set for bound has been added upon solving
400
464
exp = df .drop (["value" , "unit" ], axis = 1 )
401
- obs = s .set ("is_bound_emission_pool " )
465
+ obs = s .set ("is_bound_emission_pool_up " )
402
466
pdt .assert_frame_equal (exp , obs , check_dtype = False )
0 commit comments