Skip to content

Instantly share code, notes, and snippets.

View zaneselvans's full-sized avatar

Zane Selvans zaneselvans

View GitHub Profile
@zaneselvans
zaneselvans / ferc_plant_sklearn.ipynb
Created July 6, 2018 22:41
FERC Plant Classifier
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zaneselvans
zaneselvans / keybase.md
Created November 14, 2018 14:29
Keybase proof of GitHub identity.

Keybase proof

I hereby claim:

  • I am zaneselvans on github.
  • I am zaneselvans (https://keybase.io/zaneselvans) on keybase.
  • I have a public key ASAaMMpOphB4xFGYvI6ED-ulvGi3hAaLxVyGT2oi-LuQFQo

To claim this, I am signing this object:

@zaneselvans
zaneselvans / bga-explained.ipynb
Created September 24, 2019 23:14
PUDL Boiler Generator Associations Explained
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zaneselvans
zaneselvans / nrel_nsrdb_monthly.py
Last active February 9, 2021 05:27
Pulling monthly total irradiance from the NREL NSRDB API
import os
import pandas as pd
import itertools
def get_nsrdb_data(
locations,
years,
attributes="ghi",
leap_day="true",
interval=60,
@zaneselvans
zaneselvans / epa-facility-locations-fact-api.py
Created July 23, 2021 19:58
Pull all EPA Facility latitudes and longitudes from the FACT API
import os
import urllib3
import pandas as pd
from urllib3 import request
import certifi
import json
url = f"https://api.epa.gov/FACT/1.0/facilities?api_key={os.environ['API_KEY_EPA_FACT']}"
http = urllib3.PoolManager(
@zaneselvans
zaneselvans / rockport-ferc1-timeseries.csv
Last active October 8, 2021 23:35
Sample FERC 1 steam plant time series for entity matching
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 53 columns, instead of 17 in line 1.
report_year,utility_id_ferc1,utility_id_pudl,utility_name_ferc1,plant_id_pudl,plant_id_ferc1,plant_name_ferc1,asset_retirement_cost,avg_num_employees,capacity_factor,capacity_mw,capex_equipment,capex_land,capex_per_mw,capex_structures,capex_total,construction_type,construction_year,installation_year,net_generation_mwh,not_water_limited_capacity_mw,opex_allowances,opex_boiler,opex_coolants,opex_electric,opex_engineering,opex_fuel,opex_fuel_per_mwh,opex_misc_power,opex_misc_steam,opex_nonfuel,opex_nonfuel_per_mwh,opex_operations,opex_per_mwh,opex_plants,opex_production_total,opex_rents,opex_steam,opex_steam_other,opex_structures,opex_transfer,peak_demand_mw,plant_capability_mw,plant_hours_connected_while_generating,plant_type,record_id,water_limited_capacity_mw,coal_fraction_mmbtu,gas_fraction_mmbtu,nuclear_fraction_mmbtu,oil_fraction_mmbtu,unknown_fraction_mmbtu,waste_fraction_mmbtu
1994,1,7,AEP Generating Company,527,1056,rockport unit 1,,,0.819842641376888,650.0,490684127,6395551,894688.3,84467746,581547424,
@zaneselvans
zaneselvans / record-linkage-example-eia.csv
Created October 10, 2021 19:52
EIA to FERC1 Entity Matching Example
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 13 columns, instead of 10 in line 7.
capacity_factor,capacity_mw,fuel_cost_per_mmbtu,fuel_type_code_pudl,heat_rate_mmbtu_mwh,installation_year,net_generation_mwh,plant_id_pudl,plant_name,report_date,total_fuel_cost,total_mmbtu,utility_id_pudl
0.5540409056538725,2569.5,3.008543250719239,,8.80157206926361,,12470807.018,32,Barry,2019-01-01,300575542.6785368,100290009.68900001,18
,272.0,,coal,,,,32,Barry,2019-01-01,,,18
0.06607603800177611,153.1,2.878531157145114,gas,,,88618.27482231004,32,Barry 1,2019-01-01,1190545.6621597596,413594.8499999999,18
0.05667240289547967,153.1,2.878531157145114,gas,,,76006.53317768994,32,Barry 2,2019-01-01,966892.1159616909,335897.74199999997,18
0.13828147519597636,403.7,3.1586704229218143,coal,11.100510077642642,,489020.2682607532,32,Barry 4,2019-01-01,17146445.71236468,5428374.416,18
0.5334216620789289,788.8,3.1586704229218143,coal,10.040013142556504,,3685883.941739246,32,Barry 5,2019-01-01,116890778.60662277,37006323.217,18
0.8719241620228464,535.4,2.878531157145114,gas,7.094328251595888,,4089415.0,32,Barry 6,2019-01