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

EIA860 2001-2003 #1122

Merged
merged 15 commits into from
Sep 11, 2021
Merged

EIA860 2001-2003 #1122

merged 15 commits into from
Sep 11, 2021

Conversation

bendnorman
Copy link
Member

Added a DBF reader to GenericExtractor to handle the early years of EIA data.

@bendnorman bendnorman added the eia860 Anything having to do with EIA Form 860 label Aug 12, 2021
@bendnorman bendnorman self-assigned this Aug 12, 2021
@bendnorman bendnorman marked this pull request as draft August 12, 2021 20:20
@codecov
Copy link

codecov bot commented Aug 12, 2021

Codecov Report

Merging #1122 (f0ea452) into dev (bb61dda) will increase coverage by 0.04%.
The diff coverage is 58.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #1122      +/-   ##
==========================================
+ Coverage   81.07%   81.10%   +0.04%     
==========================================
  Files          48       48              
  Lines        6016     6054      +38     
==========================================
+ Hits         4877     4910      +33     
- Misses       1139     1144       +5     
Impacted Files Coverage Δ
src/pudl/constants.py 100.00% <ø> (ø)
src/pudl/transform/eia.py 96.12% <ø> (ø)
src/pudl/transform/eia860.py 96.15% <ø> (ø)
src/pudl/glue/ferc1_eia.py 66.19% <6.25%> (-7.80%) ⬇️
src/pudl/extract/excel.py 95.73% <83.33%> (-2.35%) ⬇️
src/pudl/helpers.py 93.07% <100.00%> (+0.24%) ⬆️
src/pudl/analysis/timeseries_cleaning.py 88.62% <0.00%> (+2.84%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb61dda...f0ea452. Read the comment docs.

@bendnorman
Copy link
Member Author

I was able to run the full ETL process on the 2001-2019 EIA years. I originally received a harvesting "inconsistent" error for plants.service_area. Upon further analysis of the field, I decided to move it to the annual table. While it rarely changes for plant entities, I found some instances of plants service areas changing due to utility rebrands or acquisitions.

@zaneselvans, what additional steps are needed to close out this issue and merge the PR? #1069 and running the data validation checks?

@bendnorman bendnorman marked this pull request as ready for review August 23, 2021 17:12
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Member

@zaneselvans zaneselvans left a comment

Choose a reason for hiding this comment

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

I had a few minor questions but nothing blocking. This looks good to me. I can't remember, did you run the full integration tests? i.e. tox -e full_integration or tox -e full? That would exercise a lot of the output and analysis functions trying to make use of the earlier data.

@@ -236,11 +239,17 @@ def extract(self, **partitions):
if (len(self.METADATA._column_map[page].index)
+ len(self.cols_added)) != len(df.columns):
# raise AssertionError(
# TODO (bendnorman): Enforce canonical fields for all raw fields?
# TODO (bendnorman): Doesn't the condition conflict with the warning message? Should the warning message include self.cols_added?
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a bug and likely the source of some of the weird messages.

@@ -452,6 +452,25 @@ def get_db_utils_eia(pudl_engine):
return db_utils_eia


def get_utility_most_recent_capacity(pudl_engine):
"""Get a list of all utilities' most recent total net capacity of their generators."""
Copy link
Member

Choose a reason for hiding this comment

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

It might not make sense to only look at the most recent capacities to rank the utilities, since we're sometimes mapping older entities. But I guess at this point usually it's a new year of data, so maybe it doesn't matter.

energy_source_2_transport_3,,,,proposed_transportation_2c,proposed_transportation_2c,proposed_transportation_2c,,,,,,,,,,,,,
multiple_fuels,,,,,,,,,multiple_fuels,multiple_fuels,multiple_fuels,multiple_fuels,,,,multiple_fuels,multiple_fuels,multiple_fuels,multiple_fuels
ownership_code,owner,owner,owner,owner,owner,owner,ownership,ownership,ownership,ownership,ownership,ownership,ownership,ownership,ownership,ownership,ownership,ownership,ownership
turbines_num,propwind,propwind,propwind,proposed_turbines,proposed_turbines,proposed_turbines,turbines,turbines,turbines,turbines,turbines,turbines,,,,,,,
Copy link
Member

Choose a reason for hiding this comment

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

Are these early years referring to wind turbines? Is that true for the latter years as well?

@zaneselvans
Copy link
Member

Oh @bendnorman it looks like you need to merge dev in again before the merge. There's at least one conflict, in the eia_test.py module...

* The new dbf extractor for the old eia860 years appears to depend on the xlsxreader
  package, which we didn't have a direct dependency on before. Not sure why this didn't
  break when @bendnorman ran the full ETL.  I had recently removed this dependency since
  we weren't actually using it anywhere, so this seems like a stale test environment.
  But if the tests are run with tox they should recreate the environment as it is
  specified in setup.py. Anyway, I added xlsxreader back into the setup.py
  install_requires.
* Fixed the datapackage merge errors that were happening because the EPA CEMS and EIA
  datapackages were using different years of EIA 860 data in the etl_full.yml settings.
* The expected number of rows for some of the eia860 tables were wrong after the
  merge. I haven't fixed this because I'm going to almost immediately combine this
  branch with the direct SQL/Parquet branch, which also has a different number of rows.
  So I'll run the validation there instead.

Closes #848
Previously we checked whether the **number** of columns extracted from
Excel spreadsheets was what we expected, and if not, reported which
extra columns were found in the data, but not in our maps of the data.
But this is only one possible way that things can go wrong.

I've updated the check to compare the actual columns of the extracted
dataframe with those that we expect to see as sets, so if they're
different but have the same number of elements, we'll still be notified.

I've also updated it to report what partition of the data the error is
happening in, and to report both when there are **extra** columns in the
data that don't show up in our maps, and when there are columns
**missing** from the data that we expect to see, based on our maps. And
it's possible to get both kinds of warnings at the same time, since
we're looking at set differences, rather than just the number of
elements.
@zaneselvans zaneselvans merged commit 070bf7c into dev Sep 11, 2021
@zaneselvans zaneselvans deleted the eia860-2001-2003-dbf branch September 11, 2021 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
eia860 Anything having to do with EIA Form 860
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants