Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gailin/fix consumed sign bug #221

Merged
merged 5 commits into from
Sep 7, 2022
Merged

Conversation

gailin-p
Copy link
Collaborator

@gailin-p gailin-p commented Sep 7, 2022

Closes #214 , see issue for more commentary

  • Negative generated emission rates are set to zero during write_power_sector_results
  • Negative consumed emission rates were bugs, these were fixed by:
    • fixing the incorrect sign on interchange during calculation of net_consumed_mwh
    • using EIA-930 demand instead of net_consumed_mwh for BAs with inconsistencies between EIA-930 interchange and our net_generation_mwh, because these inconsistencies prevent calculation of a reasonable net_consumed_mwh
  • Add rate columns to validation check for negative values
  • Add running of validation check to output_to_results to guarantee that all result files must pass validation check

* add neg check to output_to_results
* add rate columns to negative check
* make negative check not error on small (small run has data issues leading to negative, caused by using subset of data)
@gailin-p gailin-p changed the base branch from main to development September 7, 2022 15:31
.gitignore Outdated
@@ -14,6 +14,9 @@ notebooks/.ipynb_checkpoints
notebooks/*/.ipynb_checkpoints
.hypothesis/

# Editor settings
.vscode/*
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems to duplicate line 24 (although I hadn't included the wildcard) - maybe we should just delete line 24

self.results[ba]["net_consumed_mwh"] = (
self.generation[ba] + self.eia930.df[KEYS["E"]["TI"] % ba]
)[self.generation.index]
if ba in BA_930_INCONSISTENCY:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great, I like how we only use demand for these BAs that have issues.

@@ -77,13 +92,18 @@ def output_intermediate_data(df, file_name, path_prefix, year, skip_outputs):


def output_to_results(df, file_name, subfolder, path_prefix, skip_outputs):
# Always check columns that should not be negative.
small = "small" in path_prefix
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a clever way to do this without passing args.small to the function!

@gailin-p gailin-p merged commit 329c9aa into development Sep 7, 2022
@gailin-p gailin-p deleted the gailin/fix_consumed_sign_bug branch September 7, 2022 17:38
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.

Negative EFs for some BAs
2 participants