-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRate_Script.py
68 lines (53 loc) · 2.31 KB
/
Rate_Script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 13 19:56:00 2018
@author: llavi
"""
import os
from os.path import join
import pandas as pd
import numpy as np
import time
start_time = time.time()
cwd = os.getcwd()
data_path = join(cwd, 'data')
rates_path = join(data_path, 'Raw_OpenEI_Rate_Data.csv')
# load the rates csv
rates = pd.read_csv(rates_path)
# the inputs
input_year = 2016
input_peak_kW = 51
input_utility = "Consolidated Edison Co-NY Inc"
input_sector = "Commercial"
input_voltage = "Transmission"
# Pacific Gas & Electric Co / Georgia Power Co / Baltimore Gas & Electric Co / Southern California Edison Co
# Pennsylvania Electric Co (Pennsylvania) / Austin Energy / Duke Energy Carolinas, LLC
#Consolidated Edison Co-NY Inc / Duquesne Light Co
def rate_options(rates, year, peak_kW, utility, sector, voltage):
# for the years
rates['startdate'].fillna('1/1/2000 0:00', inplace=True)
start_dates = pd.to_datetime(rates['startdate'])
rates['startyear'] = pd.DatetimeIndex(start_dates).year
rates['enddate'].fillna('1/1/2100 0:00', inplace=True)
end_dates = pd.to_datetime(rates['enddate'])
rates['endyear'] = pd.DatetimeIndex(end_dates).year
# for the max/min kW
rates['peakkwcapacitymin'].fillna(0, inplace=True)
rates['peakkwcapacitymax'].fillna(1000000000, inplace=True)
# to erase N/A's for voltage
rates['voltagecategory'].fillna('None', inplace=True)
rate_options = rates[(rates['utility'] == utility) &
(rates['sector'] == sector) & (rates['startyear'] <= year)
& (rates['endyear'] >= year) & (rates['peakkwcapacitymin'] <= peak_kW)
& (rates['peakkwcapacitymax'] >= peak_kW)
& (pd.isnull(rates['energyratestructure/period0/tier0rate'])==False)
& (rates['name'].str.contains('Agricultur')==False)
& (rates['name'].str.contains('AGRICULTUR')==False)
& (rates['voltagecategory'].isin([voltage, 'None']))]
return (rate_options)
test_output = rate_options(rates, input_year, input_peak_kW, input_utility, input_sector, input_voltage)
print(test_output)
# write this to a csv you can check, just for now
test_output.to_csv('test.csv')
end_time = time.time() - start_time
print ("time elapsed during run is " + str(end_time) + " seconds")