catalyst-cooperative / pudl

The Public Utility Data Liberation Project provides analysis-ready energy system data to climate advocates, researchers, policymakers, and journalists.
https://catalyst.coop/pudl
MIT License
471 stars 108 forks source link

Error in generation allocation #2049

Closed arengel closed 1 year ago

arengel commented 1 year ago

Describe the bug

An AttributeError occurs in allocate_gen_fuel_by_generator_energy_source.

Bug Severity

How badly is this bug affecting you?

To Reproduce

pt = pudl.output.pudltabl.PudlTabl(
    sqlalchemy.create_engine(pudl.workspace.setup.get_defaults()["pudl_db"]),
    freq="AS",
    fill_fuel_cost=True,
    roll_fuel_cost=True,
    fill_net_gen=True,
)
df = pt.gen_fuel_by_generator_energy_source_eia923()

When running this code I get the following error:

Traceback (most recent call last):
  File "/Users/aengel/mambaforge/envs/hub/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3433, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-4-d690f2444caf>", line 1, in <module>
    df = pt.gen_fuel_by_generator_energy_source_eia923()
  File "/Users/aengel/mambaforge/envs/hub/lib/python3.10/site-packages/pudl/output/pudltabl.py", line 787, in gen_fuel_by_generator_energy_source_eia923
    ] = allocate_gen_fuel_by_generator_energy_source(pudl_out=self)
  File "/Users/aengel/mambaforge/envs/hub/lib/python3.10/site-packages/pudl/analysis/allocate_net_gen.py", line 271, in allocate_gen_fuel_by_generator_energy_source
    _ = test_original_gf_vs_the_allocated_by_gens_gf(
  File "/Users/aengel/mambaforge/envs/hub/lib/python3.10/site-packages/pudl/analysis/allocate_net_gen.py", line 1886, in test_original_gf_vs_the_allocated_by_gens_gf
    max_diff = gf_test[f"{data_col}_diff"].max().round(2)
AttributeError: 'float' object has no attribute 'round'

Software Environment?

zaneselvans commented 1 year ago

Hmm. I'm not able to reproduce this error, also on python 3.10.6, having just downloaded the PUDL DB from yesterday with the same sha256 sum. I wonder what's different.

zaneselvans commented 1 year ago

Fixed by PR #2052