45 new variable statistics final energy by carriernatural gas#54
Draft
45 new variable statistics final energy by carriernatural gas#54
Conversation
7 tasks
Contributor
Reviewer's GuideAdds a new statistics function and corresponding tests and mappings to compute IAMC variable 'Final Energy [by Carrier]|Natural Gas', including logic to exclude pipeline gas flows, separate residential/commercial and industry gas demand, and adjust for non-fossil gas shares. Flow diagram for Final_Energy_by_Carrier__Natural_Gas statistics functionflowchart TD
A[Call Final_Energy_by_Carrier__Natural_Gas] --> B[Compute non_fossil_gas_prod using n.statistics.supply on bus_carrier gas and non fossil gas carriers]
B --> C[Compute all_gas using n.statistics.withdrawal for bus_carrier gas and components Link]
C --> D[Build forbidden_pattern for forbidden_parts pipeline]
D --> E[Filter out pipeline related carriers from all_gas to get total_gas_usage]
E --> F[Group total_gas_usage by kwargs.groupby and sum]
F --> G[Compute non_fossil_fraction = non_fossil_gas_prod divided by total_gas_usage]
G --> H[Replace inf values in non_fossil_fraction with NaN]
H --> I[Clip non_fossil_fraction at upper bound 1]
I --> J[Group non_fossil_fraction by kwargs.groupby and take mean]
J --> K[Rename index of non_fossil_fraction using UNITS_MAPPING]
A --> L[Compute rescom withdrawal for bus_carrier gas and residential commercial gas boiler carriers]
A --> M[Compute industry withdrawal for bus_carrier gas for industry and industry carriers]
L --> N[Assemble series_list = rescom and industry]
M --> N
N --> O[Remove empty series from series_list]
O --> P{series_list is empty}
P -->|Yes| Q[Return empty pd.Series with MultiIndex using kwargs.groupby]
P -->|No| R[Concatenate series_list into total]
R --> S[Rename index of total using UNITS_MAPPING and group by kwargs.groupby and sum]
S --> T[Align non_fossil_fraction to total using reindex_like and fill NaN with 0]
T --> U[Compute result = total multiplied by 1 minus non_fossil_fraction]
U --> V[Return result]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Statistics-function for variable
Final Energy [by Carrier]|Natural GasTo Dos
tests/- stick to the testing-READMEValidation
gas for industryincludes non-energetic use of gas in industry-sector > needs ratio to substractSummary by Sourcery
Add a statistics function to compute final energy consumption from fossil natural gas and integrate it into the variable mapping and unit handling.
New Features:
Enhancements:
Tests: