gcages.ar6#
AR6 components
Modules:
| Name | Description |
|---|---|
harmonisation |
Harmonisation part of the AR6 workflow |
infilling |
Infilling part of the AR6 workflow |
post_processing |
Post-processing part of the AR6 workflow |
pre_processing |
Pre-processing part of the workflow |
scm_running |
Simple climate model (SCM) running part of the AR6 workflow |
Classes:
| Name | Description |
|---|---|
AR6Harmoniser |
Harmoniser that follows the same logic as was used in AR6 |
AR6Infiller |
Infiller that follows the same logic as was used in AR6 |
AR6PostProcessor |
Post-processor that follows the same logic as was used in AR6 |
AR6PreProcessor |
Pre-processor that follows the same logic as was used in AR6 |
AR6SCMRunner |
Simple climate model runner that follows the same logic as was used in AR6 |
Functions:
| Name | Description |
|---|---|
get_ar6_full_historical_emissions |
Get the full AR6 historical emissions |
AR6Harmoniser #
Harmoniser that follows the same logic as was used in AR6
If you want exactly the same behaviour as in AR6,
initialise using from_ar6_like_config
Methods:
| Name | Description |
|---|---|
__call__ |
Harmonise |
from_ar6_config |
Initialise from the config used in AR6 |
validate_aneris_overrides |
Validate the aneris overrides value |
validate_historical_emissions |
Validate the historical emissions value |
Attributes:
| Name | Type | Description |
|---|---|---|
aneris_overrides |
Series[str] | None
|
Overrides to supply to |
calc_scaling_year |
int
|
Year to use for calculating a scaling factor from historical |
harmonisation_year |
int
|
Year in which to harmonise |
historical_emissions |
DataFrame
|
Historical emissions to use for harmonisation |
n_processes |
int
|
Number of processes to use for parallel processing. |
progress |
bool
|
Should progress bars be shown for each operation? |
run_checks |
bool
|
If |
Source code in src/gcages/ar6/harmonisation.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | |
aneris_overrides
class-attribute
instance-attribute
#
Overrides to supply to aneris.convenience.harmonise_all
For source code and docs, see e.g. https://github.com/iiasa/aneris/blob/v0.4.2/src/aneris/convenience.py.
calc_scaling_year
instance-attribute
#
calc_scaling_year: int
Year to use for calculating a scaling factor from historical
This is only needed if self.harmonisation_year
is not in the emissions to be harmonised.
For example, if self.harmonisation_year is 2015
and self.calc_scaling_year is 2010
and we have a scenario without 2015 data,
then we will use the difference from historical in 2010
to infer a value for 2015.
This logic was perculiar to AR6, it may not be repeated.
historical_emissions
class-attribute
instance-attribute
#
Historical emissions to use for harmonisation
n_processes
class-attribute
instance-attribute
#
Number of processes to use for parallel processing.
Set to 1 to process in serial.
progress
class-attribute
instance-attribute
#
progress: bool = True
Should progress bars be shown for each operation?
run_checks
class-attribute
instance-attribute
#
run_checks: bool = True
If True, run checks on both input and output data
If you are sure about your workflow, you can disable the checks to speed things up (but we don't recommend this unless you really are confident about what you're doing).
__call__ #
Harmonise
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_emissions
|
DataFrame
|
Emissions to harmonise |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Harmonised emissions |
Source code in src/gcages/ar6/harmonisation.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | |
from_ar6_config
classmethod
#
from_ar6_config(
ar6_historical_emissions_file: Path,
run_checks: bool = True,
progress: bool = True,
n_processes: int = cpu_count(),
) -> AR6Harmoniser
Initialise from the config used in AR6
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar6_historical_emissions_file
|
Path
|
File containing the AR6 historical emissions |
required |
run_checks
|
bool
|
Should checks of the input and output data be performed? If this is turned off, things are faster, but error messages are much less clear if things go wrong. |
True
|
progress
|
bool
|
Should a progress bar be shown for each operation? |
True
|
n_processes
|
int
|
Number of processes to use for parallel processing. Set to 1 to process in serial. |
cpu_count()
|
Returns:
| Type | Description |
|---|---|
AR6Harmoniser
|
Initialised harmoniser |
Source code in src/gcages/ar6/harmonisation.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | |
validate_aneris_overrides #
Validate the aneris overrides value
If self.run_checks is False, then this is a no-op
Source code in src/gcages/ar6/harmonisation.py
validate_historical_emissions #
Validate the historical emissions value
If self.run_checks is False, then this is a no-op
Source code in src/gcages/ar6/harmonisation.py
AR6Infiller #
Infiller that follows the same logic as was used in AR6
If you want exactly the same behaviour as in AR6,
initialise using from_ar6_config
Methods:
| Name | Description |
|---|---|
__call__ |
Infill |
from_ar6_config |
Initialise from the config used in AR6 |
Attributes:
| Name | Type | Description |
|---|---|---|
harmonisation_year |
int | None
|
Year in which the data was harmonised |
historical_emissions |
DataFrame | None
|
Historical emissions used for harmonisation |
infillers |
Mapping[str, Callable[[DataFrame], DataFrame]]
|
Functions to use for infilling each variable. |
n_processes |
int | None
|
Number of processes to use for parallel processing. |
progress |
bool
|
Should progress bars be shown for each operation? |
run_checks |
bool
|
If |
Source code in src/gcages/ar6/infilling.py
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | |
harmonisation_year
class-attribute
instance-attribute
#
harmonisation_year: int | None = None
Year in which the data was harmonised
Only required if run_checks is True to check
that the infilled data is also harmonised.
historical_emissions
class-attribute
instance-attribute
#
historical_emissions: DataFrame | None = None
Historical emissions used for harmonisation
Only required if run_checks is True to check
that the infilled data is also harmonised.
infillers
instance-attribute
#
Functions to use for infilling each variable.
The keys define the variable that can be infilled. The variables define the function which, given inputs with the expected lead variables, returns the infilled timeseries.
n_processes
class-attribute
instance-attribute
#
n_processes: int | None = None
Number of processes to use for parallel processing.
Set to None to process in serial.
progress
class-attribute
instance-attribute
#
progress: bool = True
Should progress bars be shown for each operation?
run_checks
class-attribute
instance-attribute
#
run_checks: bool = True
If True, run checks on both input and output data
If you are sure about your workflow, you can disable the checks to speed things up (but we don't recommend this unless you really are confident about what you're doing).
__call__ #
Infill
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_emissions
|
DataFrame
|
Emissions to infill |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Infilled emissions |
Source code in src/gcages/ar6/infilling.py
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | |
from_ar6_config
classmethod
#
from_ar6_config(
ar6_infilling_db_file: Path,
ar6_infilling_db_cfcs_file: Path,
variables_to_infill: Iterable[str] | None = None,
run_checks: bool = True,
historical_emissions: DataFrame | None = None,
harmonisation_year: int | None = None,
progress: bool = True,
n_processes: int | None = None,
) -> AR6Infiller
Initialise from the config used in AR6
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar6_infilling_db_file
|
Path
|
File containing the AR6 infilling database This is for all emissions except CFCs. |
required |
ar6_infilling_db_cfcs_file
|
Path
|
File containing the AR6 infilling database for CFCs |
required |
variables_to_infill
|
Iterable[str] | None
|
Variables to infill. If not supplied, we use the default set from AR6. |
None
|
run_checks
|
bool
|
Should checks of the input and output data be performed? If this is turned off, things are faster, but error messages are much less clear if things go wrong. |
True
|
historical_emissions
|
DataFrame | None
|
Historical emissions used for harmonisation Only required if |
None
|
harmonisation_year
|
int | None
|
Year in which the data was harmonised Only required if |
None
|
progress
|
bool
|
Should a progress bar be shown for each operation? |
True
|
n_processes
|
int | None
|
Number of processes to use for parallel processing. Set to |
None
|
Returns:
| Type | Description |
|---|---|
AR6Infiller
|
Initialised harmoniser |
Source code in src/gcages/ar6/infilling.py
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | |
AR6PostProcessor #
Post-processor that follows the same logic as was used in AR6
If you want exactly the same behaviour as in AR6,
initialise using from_ar6_config
Methods:
| Name | Description |
|---|---|
__call__ |
Do the post-processing |
from_ar6_config |
Initialise from the config used in AR6 |
Attributes:
| Name | Type | Description |
|---|---|---|
assessed_gsat_variable |
str
|
Name of the output variable that will contain temperature output |
exceedance_thresholds_of_interest |
tuple[float, ...]
|
Thresholds of interest for calculating exceedance probabilities |
gsat_assessment_median |
float
|
Median of the GSAT assessment |
gsat_assessment_pre_industrial_period |
tuple[int, ...]
|
Pre-industrial time period used for the GSAT assessment |
gsat_assessment_time_period |
tuple[int, ...]
|
Time period over which the GSAT assessment applies |
n_processes |
int | None
|
Number of processes to use for parallel processing. |
progress |
bool
|
Should progress bars be shown for each operation where they make sense? |
quantiles_of_interest |
tuple[float, ...]
|
Quantiles to include in output |
raw_gsat_variable_in |
str
|
Name of the variable that contains raw temperature output in the input |
run_checks |
bool
|
If |
Source code in src/gcages/ar6/post_processing.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | |
assessed_gsat_variable
instance-attribute
#
assessed_gsat_variable: str
Name of the output variable that will contain temperature output
This temperature output is in line with the (AR6) assessed historical warming.
exceedance_thresholds_of_interest
instance-attribute
#
Thresholds of interest for calculating exceedance probabilities
gsat_assessment_median
instance-attribute
#
gsat_assessment_median: float
Median of the GSAT assessment
gsat_assessment_pre_industrial_period
instance-attribute
#
Pre-industrial time period used for the GSAT assessment
gsat_assessment_time_period
instance-attribute
#
Time period over which the GSAT assessment applies
n_processes
class-attribute
instance-attribute
#
Number of processes to use for parallel processing.
Set to None to process in serial.
progress
class-attribute
instance-attribute
#
progress: bool = True
Should progress bars be shown for each operation where they make sense?
quantiles_of_interest
instance-attribute
#
Quantiles to include in output
raw_gsat_variable_in
instance-attribute
#
raw_gsat_variable_in: str
Name of the variable that contains raw temperature output in the input
The temperature output should be global-mean surface air temperature (GSAT).
run_checks
class-attribute
instance-attribute
#
run_checks: bool = True
If True, run checks on both input and output data
If you are sure about your workflow, you can disable the checks to speed things up (but we don't recommend this unless you really are confident about what you're doing).
__call__ #
__call__(in_df: DataFrame) -> PostProcessingResult
Do the post-processing
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_df
|
DataFrame
|
Data to post-process |
required |
Returns:
| Type | Description |
|---|---|
timeseries, metadata :
|
Post-processed results These are both timeseries as well as scenario-level metadata. |
Source code in src/gcages/ar6/post_processing.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | |
from_ar6_config
classmethod
#
from_ar6_config(
exceedance_thresholds_of_interest: tuple[
float, ...
] = tuple(arange(1.0, 4.01, 0.5)),
quantiles_of_interest: tuple[float, ...] = (
0.05,
0.1,
1.0 / 6.0,
0.33,
0.5,
0.67,
5.0 / 6.0,
0.9,
0.95,
),
raw_gsat_variable_in: str = "Surface Air Temperature Change",
assessed_gsat_variable: str = "Surface Temperature (GSAT)",
run_checks: bool = True,
progress: bool = True,
n_processes: int | None = cpu_count(),
) -> AR6PostProcessor
Initialise from the config used in AR6
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exceedance_thresholds_of_interest
|
tuple[float, ...]
|
The thresholds for which we are interested in exceedance probabilities |
tuple(arange(1.0, 4.01, 0.5))
|
quantiles_of_interest
|
tuple[float, ...]
|
The quantiles we want to include in the results |
(0.05, 0.1, 1.0 / 6.0, 0.33, 0.5, 0.67, 5.0 / 6.0, 0.9, 0.95)
|
raw_gsat_variable_in
|
str
|
Name of the variable that contains raw temperature output in the input The temperature output should be global-mean surface air temperature (GSAT). |
'Surface Air Temperature Change'
|
assessed_gsat_variable
|
str
|
Name of the output variable that will contain temperature output This temperature output is in line with the (AR6) assessed historical warming. |
'Surface Temperature (GSAT)'
|
run_checks
|
bool
|
Should checks of the input and output data be performed? If this is turned off, things are faster, but error messages are much less clear if things go wrong. |
True
|
progress
|
bool
|
Should progress bars be shown for each operation? |
True
|
n_processes
|
int | None
|
Number of processes to use for parallel processing. Set to 1 to process in serial. |
cpu_count()
|
Returns:
| Type | Description |
|---|---|
AR6PostProcessor
|
Initialised post-processor |
Source code in src/gcages/ar6/post_processing.py
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | |
AR6PreProcessor #
Pre-processor that follows the same logic as was used in AR6
If you want exactly the same behaviour as in AR6,
initialise using from_ar6_config
Methods:
| Name | Description |
|---|---|
__call__ |
Pre-process |
from_ar6_config |
Initialise from config that was used in AR6 |
Attributes:
| Name | Type | Description |
|---|---|---|
conditional_removals |
tuple[tuple[str, tuple[str, ...]], ...] | None
|
Specification for variables that can be removed if other variables are present |
conditional_sums |
tuple[tuple[str, tuple[str, ...]], ...] | None
|
Specification for variables that can be created from other variables |
drop_if_identical |
tuple[tuple[str, str], ...] | None
|
Variables that can be dropped if they are idential to another variable |
emissions_out |
tuple[str, ...]
|
Names of emissions that can be included in the result of pre-processing |
n_processes |
int | None
|
Number of processes to use for parallel processing. |
negative_value_not_small_threshold |
float
|
Threshold which defines when a negative value is not small |
progress |
bool
|
Should progress bars be shown for each operation? |
reclassifications |
Mapping[str, tuple[str, ...]] | None
|
Variables that should be reclassified as being part of another variable |
run_checks |
bool
|
If |
Source code in src/gcages/ar6/pre_processing.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | |
conditional_removals
class-attribute
instance-attribute
#
conditional_sums
class-attribute
instance-attribute
#
drop_if_identical
class-attribute
instance-attribute
#
emissions_out
instance-attribute
#
Names of emissions that can be included in the result of pre-processing
Not all these emissions need to be there, but any names which are not in this list will be removed as part of pre-processing.
n_processes
class-attribute
instance-attribute
#
Number of processes to use for parallel processing.
Set to None to process in serial.
negative_value_not_small_threshold
instance-attribute
#
negative_value_not_small_threshold: float
Threshold which defines when a negative value is not small
Non-CO2 emissions less than this that are negative are not automatically set to zero.
progress
class-attribute
instance-attribute
#
progress: bool = True
Should progress bars be shown for each operation?
reclassifications
class-attribute
instance-attribute
#
run_checks
class-attribute
instance-attribute
#
run_checks: bool = True
If True, run checks on both input and output data
If you are sure about your workflow, you can disable the checks to speed things up (but we don't recommend this unless you really are confident about what you're doing).
__call__ #
Pre-process
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_emissions
|
DataFrame
|
Emissions to pre-process |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Pre-processed emissions |
Source code in src/gcages/ar6/pre_processing.py
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | |
from_ar6_config
classmethod
#
from_ar6_config(
run_checks: bool = True,
progress: bool = True,
n_processes: int | None = cpu_count(),
) -> AR6PreProcessor
Initialise from config that was used in AR6
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run_checks
|
bool
|
Should checks of the input and output data be performed? If this is turned off, things are faster, but error messages are much less clear if things go wrong. |
True
|
progress
|
bool
|
Should a progress bar be shown for each operation? |
True
|
n_processes
|
int | None
|
Number of processes to use for parallel processing. Set to |
cpu_count()
|
Returns:
| Type | Description |
|---|---|
AR6PreProcessor
|
Initialised Pre-processor |
Source code in src/gcages/ar6/pre_processing.py
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | |
AR6SCMRunner #
Simple climate model runner that follows the same logic as was used in AR6
If you want exactly the same behaviour as in AR6,
initialise using from_ar6_config
Methods:
| Name | Description |
|---|---|
__call__ |
Run the simple climate model |
from_ar6_config |
Initialise from the config used in AR6 |
Attributes:
| Name | Type | Description |
|---|---|---|
batch_size_scenarios |
int | None
|
The number of scenarios to run at a time |
climate_models_cfgs |
dict[str, list[dict[str, Any]]]
|
Climate models to run and the configuration to use with them |
db |
OpenSCMDB | None
|
Database in which to store the output of the runs |
force_interpolate_to_yearly |
bool
|
Should we interpolate scenarios we run to yearly steps before running the SCMs. |
harmonisation_year |
int | None
|
Year in which the data was harmonised |
historical_emissions |
DataFrame | None
|
Historical emissions used for harmonisation |
n_processes |
int | None
|
Number of processes to use for parallel processing. |
output_variables |
tuple[str, ...]
|
Variables to include in the output |
progress |
bool
|
Should progress bars be shown for each operation? |
res_column_type |
type
|
Type to cast the result's column type to |
run_checks |
bool
|
If |
verbose |
bool
|
Should verbose messages be printed? |
Source code in src/gcages/ar6/scm_running.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | |
batch_size_scenarios
class-attribute
instance-attribute
#
batch_size_scenarios: int | None = None
The number of scenarios to run at a time
Smaller batch sizes use less memory, but take longer overall (all else being equal).
If not supplied, all scenarios are run simultaneously.
climate_models_cfgs
class-attribute
instance-attribute
#
climate_models_cfgs: dict[str, list[dict[str, Any]]] = (
field(
repr=lambda x: join(
f"{climate_model}: {len(cfgs)} configurations"
for (climate_model, cfgs) in items()
)
)
)
Climate models to run and the configuration to use with them
db
class-attribute
instance-attribute
#
db: OpenSCMDB | None = None
Database in which to store the output of the runs
If not supplied, output of the runs is not stored.
force_interpolate_to_yearly
class-attribute
instance-attribute
#
force_interpolate_to_yearly: bool = True
Should we interpolate scenarios we run to yearly steps before running the SCMs.
harmonisation_year
class-attribute
instance-attribute
#
harmonisation_year: int | None = None
Year in which the data was harmonised
Only required if run_checks is True to check
that the data to run is harmonised.
historical_emissions
class-attribute
instance-attribute
#
historical_emissions: DataFrame | None = None
Historical emissions used for harmonisation
Only required if run_checks is True to check
that the data to run is harmonised.
n_processes
class-attribute
instance-attribute
#
Number of processes to use for parallel processing.
Set to None to process in serial.
output_variables
instance-attribute
#
Variables to include in the output
progress
class-attribute
instance-attribute
#
progress: bool = True
Should progress bars be shown for each operation?
res_column_type
class-attribute
instance-attribute
#
Type to cast the result's column type to
run_checks
class-attribute
instance-attribute
#
run_checks: bool = True
If True, run checks on both input and output data
If you are sure about your workflow, you can disable the checks to speed things up (but we don't recommend this unless you really are confident about what you're doing).
verbose
class-attribute
instance-attribute
#
verbose: bool = True
Should verbose messages be printed?
This is a temporary hack while we think about how to handle logging
__call__ #
Run the simple climate model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_emissions
|
DataFrame
|
Emissions to run |
required |
force_rerun
|
bool
|
Force scenarios to re-run (i.e. disable caching). |
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Raw results from the simple climate model |
Source code in src/gcages/ar6/scm_running.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
from_ar6_config
classmethod
#
from_ar6_config(
magicc_exe_path: Path,
magicc_prob_distribution_path: Path,
output_variables: tuple[
str, ...
] = DEFAULT_OUTPUT_VARIABLES,
batch_size_scenarios: int | None = None,
db: OpenSCMDB | None = None,
historical_emissions: DataFrame | None = None,
harmonisation_year: int | None = None,
verbose: bool = True,
run_checks: bool = True,
progress: bool = True,
n_processes: int | None = cpu_count(),
) -> AR6SCMRunner
Initialise from the config used in AR6
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
magicc_exe_path
|
Path
|
Path to the MAGICC executable to use. This should be a MAGICC v7.5.3 executable. |
required |
magicc_prob_distribution_path
|
Path
|
Path to the MAGICC probabilistic distribution. This should be the AR6 probabilistic distribution. |
required |
output_variables
|
tuple[str, ...]
|
Variables to include in the output |
DEFAULT_OUTPUT_VARIABLES
|
batch_size_scenarios
|
int | None
|
The number of scenarios to run at a time |
None
|
db
|
OpenSCMDB | None
|
Database to use for storing results. If not supplied, raw outputs are not stored. |
None
|
historical_emissions
|
DataFrame | None
|
Historical emissions used for harmonisation Only required if |
None
|
harmonisation_year
|
int | None
|
Year in which the data was harmonised Only required if |
None
|
verbose
|
bool
|
Should verbose messages be printed? This is a temporary hack while we think about how to handle logging |
True
|
run_checks
|
bool
|
Should checks of the input and output data be performed? If this is turned off, things are faster, but error messages are much less clear if things go wrong. |
True
|
progress
|
bool
|
Should progress bars be shown for each operation? |
True
|
n_processes
|
int | None
|
Number of processes to use for parallel processing. Set to |
cpu_count()
|
Returns:
| Type | Description |
|---|---|
AR6SCMRunner
|
Initialised SCM runner |
Source code in src/gcages/ar6/scm_running.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | |
get_ar6_full_historical_emissions
cached
#
Get the full AR6 historical emissions
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
Path
|
Filepath from which to load the emissions |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Historical emissions as used in AR6 |
Raises:
| Type | Description |
|---|---|
AssertionError
|
|