Skip to main content

A tool to download and parse historical BPA transmission data

Project description

Bpa Fetch

A tool to fetch and parse historical Balancing Authority (power generation) data published by the Bonneville Power Administration (BPA). Data is provided in 5 minute increments as far back as 2007 and the full set can be found here (under item 5).

Output Columns

The following columns are in the output data, all power numbers are in megawatts. Note that the available columns has changed over time so what columns are present will depend on what years you've pulled.

  1. time - UTC timestamp for the data. [Always Available]
  2. load - Load in BPA area. Note that BPA provides power to other Transmission Authorities so load will likely not be equal to the sum of generation. [Always Available]
  3. nuclear_generation - Generation from nuclear sources. [Available 2017 Onwards]
  4. hydro_generation - Generation from hydroelectric sources. [Always Available]
  5. wind_generation - Generation from wind farms. [Always Available]
  6. fossil_generation - Generation from fossil fuel and biomass sources. [Available 2017 Onwards]
  7. solar_generation - Generation from commercial solar farms. [Available 2022 Onwards]
  8. thermal_generation - Generation from thermal sources including fossil fuels and nuclear. [Available Until 2017]
  9. wind_forecast - Forecasted output provided by operators. [Available 2018 Onward]
  10. wind_basepoint - Sum of dispatches when BPA is participating in the EIM, otherwise operator forecasts. [Available 2022 Onward]
  11. solar_forecast - Forecasted output provided by operators. [Available 2022 Onward]
  12. solar_basepoint - Sum of dispatches when BPA is participating in the EIM, otherwise operator forecasts. [Available 2022 Onward]
  13. year - Year the data is for. [Always Available]

NOTE: For wind farms with output split between Transmission Authorities, only the portion sent to BPA is reported.

Installation

This tool is distributed through PyPi and can be installed using pip install bpa_fetch

Usage

bpa-fetch [DATES ...] -r -o file.format -f format
This is meant to be a primarily command line tool, and provides the command bpa-fetch for users when installed.
It is also possible to execute directly with python by calling python -m bpa_fetch which takes the same arguments as described below.

The follow arguments are available:

  • DATES : A list of space seperated years to pull (ig: 2010 2013 2020). If no dates are provided, all years will be pulled.
  • --out -o: The file to save pulled data to. If not specified, out-{timestamp}.[format] will be used.
  • --range -r: If this flag is used, two years will be expected for DATES and all years between DATE 1 and DATE 2 will be pulled (inclusive).
  • --format -f: The format of the saved data, options are Parquet1 and Pandas. When using pandas, the default file extension is .pkl.gz unless set using -o. Defaults to PARQUET


1 - Parquet is a file format developed by the Apache Software Foundation for data analysis workloads and provides small file sizes and fast, efficient queries. To view and work with Parquet, tools like Tad and DuckDB can be used.

Examples

  • To pull all years and save as the default filename and format: bpa-fetch
  • To pull all years between 2010 & 2016 and save as pandas to the default filename: bpa-fetch 2010 2016 -r -f pandas
  • To pull years 2012, 2015, and 2016 and save as a parquet to output/year-data.parquet: bpa-fetch 2012 2015 2016 -o "output/year-data.parquet"
  • To pull only 2017: bpa-fetch 2017

User Functions

The function bpa_fetch.pull_years is also available and returns a pandas Dataframe of the pulled data. It takes two arguments:

  • years is a list of years (as ints) to pull, if None than all years will be pulled.
  • working_dir is a pathlib.Path object pointing to the directory to use during execution. Defaults to ./bpa_data

Caching

To speed up execution and reduce network traffic, rudimentary caching system is used that saves the BPA files to disk at working_dir on first run and then only downloads the current year going forwards. This implementation has some potential issues including failing to pull updated data if run in the new year, leaving the previous year missing data. Improvements to this system are in development

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bpa_fetch-1.0.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bpa_fetch-1.0.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file bpa_fetch-1.0.1.tar.gz.

File metadata

  • Download URL: bpa_fetch-1.0.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.5

File hashes

Hashes for bpa_fetch-1.0.1.tar.gz
Algorithm Hash digest
SHA256 226b96a75b2569dc18ea137dd9d49a94e3ad8a3e09fee9fa9b407162ddc637d6
MD5 05ec8038020a83de1197dae5189d4fee
BLAKE2b-256 a74763e28dd3872c9dd43c349111a947003fa7f43a51110113042e60957f8cd2

See more details on using hashes here.

File details

Details for the file bpa_fetch-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: bpa_fetch-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.5

File hashes

Hashes for bpa_fetch-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ce9f92f118dbc350f0f81fa339fa94488247ff4a262fd5dd018926c628364174
MD5 688082d5707aea0e6081dd1354bda8a7
BLAKE2b-256 d3174ae324823f92599e5a1e2b28bcd0f9908bbc197752d8edd7e648709930da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page