synmax-api-python-client 0.0.44__py3-none-any.whl → 0.0.45__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- DATA/fips_lookup.csv +3196 -3196
- synmax/common/__init__.py +2 -2
- synmax/common/api_client.py +309 -309
- synmax/common/model.py +33 -31
- synmax/config/__init__.py +5 -5
- synmax/hyperion/__init__.py +68 -68
- synmax/hyperion/hyperion_client.py +181 -171
- {synmax_api_python_client-0.0.44.dist-info → synmax_api_python_client-0.0.45.dist-info}/METADATA +10 -13
- synmax_api_python_client-0.0.45.dist-info/RECORD +17 -0
- {synmax_api_python_client-0.0.44.dist-info → synmax_api_python_client-0.0.45.dist-info}/WHEEL +1 -1
- test/hyperion_test.py +187 -187
- test/ip_rate_example.py +50 -50
- synmax_api_python_client-0.0.44.dist-info/RECORD +0 -17
- {synmax_api_python_client-0.0.44.dist-info → synmax_api_python_client-0.0.45.dist-info}/top_level.txt +0 -0
test/hyperion_test.py
CHANGED
|
@@ -1,188 +1,188 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
import multiprocessing
|
|
3
|
-
|
|
4
|
-
import pandas
|
|
5
|
-
import pandas as pd
|
|
6
|
-
from tqdm import tqdm
|
|
7
|
-
import os
|
|
8
|
-
import sys
|
|
9
|
-
|
|
10
|
-
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)))))
|
|
11
|
-
|
|
12
|
-
from synmax.hyperion import HyperionApiClient, ApiPayload, add_daily, get_fips
|
|
13
|
-
|
|
14
|
-
logging.basicConfig(level=logging.INFO)
|
|
15
|
-
|
|
16
|
-
# Test - GET
|
|
17
|
-
|
|
18
|
-
def fetch_region():
|
|
19
|
-
regions = client.fetch_regions()
|
|
20
|
-
print(regions)
|
|
21
|
-
|
|
22
|
-
def fetch_long_term_forecast():
|
|
23
|
-
long_term_forecast = client.fetch_long_term_forecast()
|
|
24
|
-
print(long_term_forecast)
|
|
25
|
-
|
|
26
|
-
def fetch_operator_classification():
|
|
27
|
-
operator_classification = client.fetch_operator_classification()
|
|
28
|
-
print(operator_classification)
|
|
29
|
-
|
|
30
|
-
def fetch_daily_fracked_feet():
|
|
31
|
-
daily_fracked_feet = client.fetch_daily_fracked_feet()
|
|
32
|
-
print(daily_fracked_feet)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
# Test - POST
|
|
36
|
-
|
|
37
|
-
def well_completion():
|
|
38
|
-
payload = ApiPayload(start_date='2021-05-1', end_date='2022-12-25', state_code='CO', operator_name='GREAT WESTERN OPERATING COMPANY LLC')
|
|
39
|
-
|
|
40
|
-
# result_df = client.wells(payload)
|
|
41
|
-
result_df = client.well_completion(payload)
|
|
42
|
-
print(result_df.count())
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def test_rigs():
|
|
46
|
-
states = ['CO', 'LA', 'ND', 'NM', 'OH', 'OK', 'PA', 'TX', 'WV', 'WY']
|
|
47
|
-
df_list = []
|
|
48
|
-
for _state in states:
|
|
49
|
-
payload = ApiPayload(start_date='2016-01-01', end_date='2022-01-31', state_code=_state)
|
|
50
|
-
result_df = client.rigs(payload)
|
|
51
|
-
print(result_df.count())
|
|
52
|
-
df_list.append(result_df)
|
|
53
|
-
|
|
54
|
-
print('Got all stats result')
|
|
55
|
-
if df_list:
|
|
56
|
-
df = pandas.concat(df_list)
|
|
57
|
-
print(df.count())
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
def test_ducs_by_operator():
|
|
61
|
-
payload = ApiPayload(start_date='2021-01-01', end_date='2021-01-31', aggregate_by='operator', operator='LIME ROCK RESOURCES LP')
|
|
62
|
-
|
|
63
|
-
result_df = client.ducs_by_operator(payload)
|
|
64
|
-
print(result_df.count())
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def test_production_by_county_and_operator():
|
|
68
|
-
payload = ApiPayload(start_date='1929-04-01', end_date='1934-01-01', operator_name='Stephens Production Company', state_code='AR')
|
|
69
|
-
result_df = client.production_by_county_and_operator(payload)
|
|
70
|
-
print(result_df.count())
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def test_frac_crews():
|
|
74
|
-
payload = ApiPayload(start_date='2021-10-01', end_date='2021-12-31', state_code='CO', sub_region='Colorado wo SJ', region='west', operator='BILL BARRETT CORPORATION')
|
|
75
|
-
|
|
76
|
-
result_df = client.frac_crews(payload)
|
|
77
|
-
print(result_df.count())
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
def test_production_by_well():
|
|
81
|
-
# payload = ApiPayload(start_date='2016-01-01', end_date='2016-01-31', production_month=529)
|
|
82
|
-
payload = ApiPayload(state_code='WY', start_date='2017-01-01', end_date='2017-12-31', operator_name='CITATION OIL & GAS CORP', region='west', sub_region='Wyoming')
|
|
83
|
-
# payload = ApiPayload(state_code='LA', start_date='2021-01-01', end_date='2021-01-01', production_month=2)
|
|
84
|
-
# result_df = client.production_by_well(payload)
|
|
85
|
-
# print(result_df.count())
|
|
86
|
-
with multiprocessing.Pool(processes=5) as pool:
|
|
87
|
-
data_list = [payload for _ in range(0, 5)]
|
|
88
|
-
message = 'API query progress'
|
|
89
|
-
list(tqdm(pool.imap(client.production_by_well, data_list), desc=message, total=len(data_list),
|
|
90
|
-
dynamic_ncols=True, miniters=0))
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
def test_short_term_forecast():
|
|
94
|
-
# payload = ApiPayload(start_date='2021-08-29', end_date='2022-09-29')
|
|
95
|
-
payload = ApiPayload(start_date='2016-01-01')
|
|
96
|
-
result_df = client.short_term_forecast(payload)
|
|
97
|
-
result_df.to_csv('df_data.csv', index=False)
|
|
98
|
-
print(result_df.count())
|
|
99
|
-
sum_df = result_df[['date', 'gas_monthly']].groupby(by=['date']).sum()
|
|
100
|
-
sum_df.to_csv('sum.csv')
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
def test_short_term_forecast_history():
|
|
104
|
-
payload = ApiPayload(start_date='2021-08-29', end_date='2021-09-10')
|
|
105
|
-
result_df = client.short_term_forecast_history(payload)
|
|
106
|
-
print(result_df.count())
|
|
107
|
-
|
|
108
|
-
payload = ApiPayload(start_date='2020-01-01')
|
|
109
|
-
result_df = client.short_term_forecast(payload)
|
|
110
|
-
|
|
111
|
-
def test_pipeline_scrapes():
|
|
112
|
-
payload = ApiPayload(start_date='2024-01-01', end_date='2024-01-10')
|
|
113
|
-
print(client.__dir__())
|
|
114
|
-
result_df = client.pipeline_scrapes(payload)
|
|
115
|
-
print(result_df.count())
|
|
116
|
-
|
|
117
|
-
def test_fetch_pipeline_scrape_status():
|
|
118
|
-
result_df = client.fetch_pipeline_scrape_status()
|
|
119
|
-
print(result_df.count())
|
|
120
|
-
|
|
121
|
-
# TEST HELPERS
|
|
122
|
-
|
|
123
|
-
def test_daily_func():
|
|
124
|
-
df = pd.DataFrame({'date': ['2022-01-01', '2022-02-01', '2022-03-01'],
|
|
125
|
-
'gas_monthly': [1000, 2000, 3000],
|
|
126
|
-
'oil_monthly': [2000, 3000, 4000],
|
|
127
|
-
'water_monthly': [8000, 9000, 10000]})
|
|
128
|
-
|
|
129
|
-
df = add_daily(df)
|
|
130
|
-
print(df)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
def test_add_fips():
|
|
134
|
-
df = get_fips()
|
|
135
|
-
print(df)
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
def compare_df():
|
|
139
|
-
cols = ['api', 'gas_monthly']
|
|
140
|
-
df1 = pandas.read_csv('df_data.csv')
|
|
141
|
-
df2 = pandas.read_csv('GEOML_dbo_v_current_forecast.csv')
|
|
142
|
-
df1 = df1[cols]
|
|
143
|
-
df2 = df2[cols]
|
|
144
|
-
print(df1.count())
|
|
145
|
-
print(df2.count())
|
|
146
|
-
|
|
147
|
-
merged_df = pd.merge(df1, df2, how="inner", on=["api"])
|
|
148
|
-
print(merged_df.count())
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
def main():
|
|
153
|
-
|
|
154
|
-
# Test GET
|
|
155
|
-
# fetch_region()
|
|
156
|
-
# fetch_operator_classification()
|
|
157
|
-
# fetch_long_term_forecast()
|
|
158
|
-
# fetch_daily_fracked_feet()
|
|
159
|
-
|
|
160
|
-
# Test POST
|
|
161
|
-
#well_completion()
|
|
162
|
-
#test_production_by_well()
|
|
163
|
-
#test_add_fips()
|
|
164
|
-
#test_frac_crews()
|
|
165
|
-
#test_rigs()
|
|
166
|
-
#test_short_term_forecast()
|
|
167
|
-
#test_short_term_forecast_history()
|
|
168
|
-
#test_ducs_by_operator()
|
|
169
|
-
#compare_df()
|
|
170
|
-
#test_pipeline_scrapes()
|
|
171
|
-
test_fetch_pipeline_scrape_status()
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if __name__ == '__main__':
|
|
175
|
-
|
|
176
|
-
# enable debug if required.
|
|
177
|
-
|
|
178
|
-
#logging.basicConfig(level=logging.DEBUG)
|
|
179
|
-
|
|
180
|
-
access_token = ''
|
|
181
|
-
client = HyperionApiClient(access_token=access_token, local_server=True)
|
|
182
|
-
|
|
183
|
-
import synmax.hyperion as hyperion_api
|
|
184
|
-
print(hyperion_api.__file__)
|
|
185
|
-
|
|
186
|
-
print(client.__le__)
|
|
187
|
-
print(dir(client))
|
|
1
|
+
import logging
|
|
2
|
+
import multiprocessing
|
|
3
|
+
|
|
4
|
+
import pandas
|
|
5
|
+
import pandas as pd
|
|
6
|
+
from tqdm import tqdm
|
|
7
|
+
import os
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)))))
|
|
11
|
+
|
|
12
|
+
from synmax.hyperion import HyperionApiClient, ApiPayload, add_daily, get_fips
|
|
13
|
+
|
|
14
|
+
logging.basicConfig(level=logging.INFO)
|
|
15
|
+
|
|
16
|
+
# Test - GET
|
|
17
|
+
|
|
18
|
+
def fetch_region():
|
|
19
|
+
regions = client.fetch_regions()
|
|
20
|
+
print(regions)
|
|
21
|
+
|
|
22
|
+
def fetch_long_term_forecast():
|
|
23
|
+
long_term_forecast = client.fetch_long_term_forecast()
|
|
24
|
+
print(long_term_forecast)
|
|
25
|
+
|
|
26
|
+
def fetch_operator_classification():
|
|
27
|
+
operator_classification = client.fetch_operator_classification()
|
|
28
|
+
print(operator_classification)
|
|
29
|
+
|
|
30
|
+
def fetch_daily_fracked_feet():
|
|
31
|
+
daily_fracked_feet = client.fetch_daily_fracked_feet()
|
|
32
|
+
print(daily_fracked_feet)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Test - POST
|
|
36
|
+
|
|
37
|
+
def well_completion():
|
|
38
|
+
payload = ApiPayload(start_date='2021-05-1', end_date='2022-12-25', state_code='CO', operator_name='GREAT WESTERN OPERATING COMPANY LLC')
|
|
39
|
+
|
|
40
|
+
# result_df = client.wells(payload)
|
|
41
|
+
result_df = client.well_completion(payload)
|
|
42
|
+
print(result_df.count())
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_rigs():
|
|
46
|
+
states = ['CO', 'LA', 'ND', 'NM', 'OH', 'OK', 'PA', 'TX', 'WV', 'WY']
|
|
47
|
+
df_list = []
|
|
48
|
+
for _state in states:
|
|
49
|
+
payload = ApiPayload(start_date='2016-01-01', end_date='2022-01-31', state_code=_state)
|
|
50
|
+
result_df = client.rigs(payload)
|
|
51
|
+
print(result_df.count())
|
|
52
|
+
df_list.append(result_df)
|
|
53
|
+
|
|
54
|
+
print('Got all stats result')
|
|
55
|
+
if df_list:
|
|
56
|
+
df = pandas.concat(df_list)
|
|
57
|
+
print(df.count())
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def test_ducs_by_operator():
|
|
61
|
+
payload = ApiPayload(start_date='2021-01-01', end_date='2021-01-31', aggregate_by='operator', operator='LIME ROCK RESOURCES LP')
|
|
62
|
+
|
|
63
|
+
result_df = client.ducs_by_operator(payload)
|
|
64
|
+
print(result_df.count())
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def test_production_by_county_and_operator():
|
|
68
|
+
payload = ApiPayload(start_date='1929-04-01', end_date='1934-01-01', operator_name='Stephens Production Company', state_code='AR')
|
|
69
|
+
result_df = client.production_by_county_and_operator(payload)
|
|
70
|
+
print(result_df.count())
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_frac_crews():
|
|
74
|
+
payload = ApiPayload(start_date='2021-10-01', end_date='2021-12-31', state_code='CO', sub_region='Colorado wo SJ', region='west', operator='BILL BARRETT CORPORATION')
|
|
75
|
+
|
|
76
|
+
result_df = client.frac_crews(payload)
|
|
77
|
+
print(result_df.count())
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def test_production_by_well():
|
|
81
|
+
# payload = ApiPayload(start_date='2016-01-01', end_date='2016-01-31', production_month=529)
|
|
82
|
+
payload = ApiPayload(state_code='WY', start_date='2017-01-01', end_date='2017-12-31', operator_name='CITATION OIL & GAS CORP', region='west', sub_region='Wyoming')
|
|
83
|
+
# payload = ApiPayload(state_code='LA', start_date='2021-01-01', end_date='2021-01-01', production_month=2)
|
|
84
|
+
# result_df = client.production_by_well(payload)
|
|
85
|
+
# print(result_df.count())
|
|
86
|
+
with multiprocessing.Pool(processes=5) as pool:
|
|
87
|
+
data_list = [payload for _ in range(0, 5)]
|
|
88
|
+
message = 'API query progress'
|
|
89
|
+
list(tqdm(pool.imap(client.production_by_well, data_list), desc=message, total=len(data_list),
|
|
90
|
+
dynamic_ncols=True, miniters=0))
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def test_short_term_forecast():
|
|
94
|
+
# payload = ApiPayload(start_date='2021-08-29', end_date='2022-09-29')
|
|
95
|
+
payload = ApiPayload(start_date='2016-01-01')
|
|
96
|
+
result_df = client.short_term_forecast(payload)
|
|
97
|
+
result_df.to_csv('df_data.csv', index=False)
|
|
98
|
+
print(result_df.count())
|
|
99
|
+
sum_df = result_df[['date', 'gas_monthly']].groupby(by=['date']).sum()
|
|
100
|
+
sum_df.to_csv('sum.csv')
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def test_short_term_forecast_history():
|
|
104
|
+
payload = ApiPayload(start_date='2021-08-29', end_date='2021-09-10')
|
|
105
|
+
result_df = client.short_term_forecast_history(payload)
|
|
106
|
+
print(result_df.count())
|
|
107
|
+
|
|
108
|
+
payload = ApiPayload(start_date='2020-01-01')
|
|
109
|
+
result_df = client.short_term_forecast(payload)
|
|
110
|
+
|
|
111
|
+
def test_pipeline_scrapes():
|
|
112
|
+
payload = ApiPayload(start_date='2024-01-01', end_date='2024-01-10')
|
|
113
|
+
print(client.__dir__())
|
|
114
|
+
result_df = client.pipeline_scrapes(payload)
|
|
115
|
+
print(result_df.count())
|
|
116
|
+
|
|
117
|
+
def test_fetch_pipeline_scrape_status():
|
|
118
|
+
result_df = client.fetch_pipeline_scrape_status()
|
|
119
|
+
print(result_df.count())
|
|
120
|
+
|
|
121
|
+
# TEST HELPERS
|
|
122
|
+
|
|
123
|
+
def test_daily_func():
|
|
124
|
+
df = pd.DataFrame({'date': ['2022-01-01', '2022-02-01', '2022-03-01'],
|
|
125
|
+
'gas_monthly': [1000, 2000, 3000],
|
|
126
|
+
'oil_monthly': [2000, 3000, 4000],
|
|
127
|
+
'water_monthly': [8000, 9000, 10000]})
|
|
128
|
+
|
|
129
|
+
df = add_daily(df)
|
|
130
|
+
print(df)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def test_add_fips():
|
|
134
|
+
df = get_fips()
|
|
135
|
+
print(df)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def compare_df():
|
|
139
|
+
cols = ['api', 'gas_monthly']
|
|
140
|
+
df1 = pandas.read_csv('df_data.csv')
|
|
141
|
+
df2 = pandas.read_csv('GEOML_dbo_v_current_forecast.csv')
|
|
142
|
+
df1 = df1[cols]
|
|
143
|
+
df2 = df2[cols]
|
|
144
|
+
print(df1.count())
|
|
145
|
+
print(df2.count())
|
|
146
|
+
|
|
147
|
+
merged_df = pd.merge(df1, df2, how="inner", on=["api"])
|
|
148
|
+
print(merged_df.count())
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def main():
|
|
153
|
+
|
|
154
|
+
# Test GET
|
|
155
|
+
# fetch_region()
|
|
156
|
+
# fetch_operator_classification()
|
|
157
|
+
# fetch_long_term_forecast()
|
|
158
|
+
# fetch_daily_fracked_feet()
|
|
159
|
+
|
|
160
|
+
# Test POST
|
|
161
|
+
#well_completion()
|
|
162
|
+
#test_production_by_well()
|
|
163
|
+
#test_add_fips()
|
|
164
|
+
#test_frac_crews()
|
|
165
|
+
#test_rigs()
|
|
166
|
+
#test_short_term_forecast()
|
|
167
|
+
#test_short_term_forecast_history()
|
|
168
|
+
#test_ducs_by_operator()
|
|
169
|
+
#compare_df()
|
|
170
|
+
#test_pipeline_scrapes()
|
|
171
|
+
test_fetch_pipeline_scrape_status()
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
if __name__ == '__main__':
|
|
175
|
+
|
|
176
|
+
# enable debug if required.
|
|
177
|
+
|
|
178
|
+
#logging.basicConfig(level=logging.DEBUG)
|
|
179
|
+
|
|
180
|
+
access_token = ''
|
|
181
|
+
client = HyperionApiClient(access_token=access_token, local_server=True)
|
|
182
|
+
|
|
183
|
+
import synmax.hyperion as hyperion_api
|
|
184
|
+
print(hyperion_api.__file__)
|
|
185
|
+
|
|
186
|
+
print(client.__le__)
|
|
187
|
+
print(dir(client))
|
|
188
188
|
main()
|
test/ip_rate_example.py
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
"""Install SynMax Python Client"""
|
|
2
|
-
|
|
3
|
-
# pip install --upgrade synmax-api-python-client
|
|
4
|
-
|
|
5
|
-
"""Install other Dependencies"""
|
|
6
|
-
|
|
7
|
-
# pip install plotly-geo plotly geopandas==0.8.1 pyshp shapely
|
|
8
|
-
|
|
9
|
-
"""Query the production data"""
|
|
10
|
-
|
|
11
|
-
from synmax.hyperion import HyperionApiClient, ApiPayload, add_daily, get_fips
|
|
12
|
-
import pandas as pd
|
|
13
|
-
import plotly.express as px
|
|
14
|
-
import plotly.figure_factory as ff
|
|
15
|
-
|
|
16
|
-
access_token = '************************************'
|
|
17
|
-
client = HyperionApiClient(access_token=access_token)
|
|
18
|
-
|
|
19
|
-
payload = ApiPayload(start_date='2021-01-01', end_date='2022-09-01', state_code='TX', production_month=2)
|
|
20
|
-
df = client.production_by_well(payload)
|
|
21
|
-
# df.to_csv(r'C:\Users\eric\Desktop\TEMP\prod_ip.csv', index=False)
|
|
22
|
-
# df = pd.read_csv(r'C:\Users\eric\Desktop\TEMP\prod_ip.csv')
|
|
23
|
-
|
|
24
|
-
"""convert to mcf/d"""
|
|
25
|
-
df = add_daily(df)
|
|
26
|
-
|
|
27
|
-
"""examine county-level histograms"""
|
|
28
|
-
|
|
29
|
-
fig = px.histogram(df[df.county=='Midland'], x='gas_daily')
|
|
30
|
-
fig.show()
|
|
31
|
-
|
|
32
|
-
"""calculate average per county"""
|
|
33
|
-
|
|
34
|
-
county_df = df[['state_ab', 'county', 'gas_daily']].groupby(['state_ab', 'county'], as_index=False).mean()
|
|
35
|
-
|
|
36
|
-
"""Get FIPS code Lookup Table"""
|
|
37
|
-
|
|
38
|
-
fips_df = get_fips()
|
|
39
|
-
|
|
40
|
-
"""merge fips_df with county_df"""
|
|
41
|
-
county_df = county_df.merge(fips_df[fips_df.state_ab == 'TX'], how='right', on=['state_ab','county'])
|
|
42
|
-
county_df['gas_daily'] = county_df['gas_daily'].fillna(0)
|
|
43
|
-
|
|
44
|
-
"""Create county map"""
|
|
45
|
-
|
|
46
|
-
fig = ff.create_choropleth(fips=county_df.fips.tolist(),
|
|
47
|
-
values=county_df.gas_daily.tolist(),
|
|
48
|
-
county_outline={'color': 'rgb(255,255,255)', 'width': 0.5},
|
|
49
|
-
scope=['TX'],
|
|
50
|
-
binning_endpoints=[75, 125, 250, 500, 1000, 2000, 4000, 8000, 16000, 32000])
|
|
1
|
+
"""Install SynMax Python Client"""
|
|
2
|
+
|
|
3
|
+
# pip install --upgrade synmax-api-python-client
|
|
4
|
+
|
|
5
|
+
"""Install other Dependencies"""
|
|
6
|
+
|
|
7
|
+
# pip install plotly-geo plotly geopandas==0.8.1 pyshp shapely
|
|
8
|
+
|
|
9
|
+
"""Query the production data"""
|
|
10
|
+
|
|
11
|
+
from synmax.hyperion import HyperionApiClient, ApiPayload, add_daily, get_fips
|
|
12
|
+
import pandas as pd
|
|
13
|
+
import plotly.express as px
|
|
14
|
+
import plotly.figure_factory as ff
|
|
15
|
+
|
|
16
|
+
access_token = '************************************'
|
|
17
|
+
client = HyperionApiClient(access_token=access_token)
|
|
18
|
+
|
|
19
|
+
payload = ApiPayload(start_date='2021-01-01', end_date='2022-09-01', state_code='TX', production_month=2)
|
|
20
|
+
df = client.production_by_well(payload)
|
|
21
|
+
# df.to_csv(r'C:\Users\eric\Desktop\TEMP\prod_ip.csv', index=False)
|
|
22
|
+
# df = pd.read_csv(r'C:\Users\eric\Desktop\TEMP\prod_ip.csv')
|
|
23
|
+
|
|
24
|
+
"""convert to mcf/d"""
|
|
25
|
+
df = add_daily(df)
|
|
26
|
+
|
|
27
|
+
"""examine county-level histograms"""
|
|
28
|
+
|
|
29
|
+
fig = px.histogram(df[df.county=='Midland'], x='gas_daily')
|
|
30
|
+
fig.show()
|
|
31
|
+
|
|
32
|
+
"""calculate average per county"""
|
|
33
|
+
|
|
34
|
+
county_df = df[['state_ab', 'county', 'gas_daily']].groupby(['state_ab', 'county'], as_index=False).mean()
|
|
35
|
+
|
|
36
|
+
"""Get FIPS code Lookup Table"""
|
|
37
|
+
|
|
38
|
+
fips_df = get_fips()
|
|
39
|
+
|
|
40
|
+
"""merge fips_df with county_df"""
|
|
41
|
+
county_df = county_df.merge(fips_df[fips_df.state_ab == 'TX'], how='right', on=['state_ab','county'])
|
|
42
|
+
county_df['gas_daily'] = county_df['gas_daily'].fillna(0)
|
|
43
|
+
|
|
44
|
+
"""Create county map"""
|
|
45
|
+
|
|
46
|
+
fig = ff.create_choropleth(fips=county_df.fips.tolist(),
|
|
47
|
+
values=county_df.gas_daily.tolist(),
|
|
48
|
+
county_outline={'color': 'rgb(255,255,255)', 'width': 0.5},
|
|
49
|
+
scope=['TX'],
|
|
50
|
+
binning_endpoints=[75, 125, 250, 500, 1000, 2000, 4000, 8000, 16000, 32000])
|
|
51
51
|
fig.show()
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
DATA/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
DATA/fips_lookup.csv,sha256=Ui1Nibt0RT9nfoccFv2DA9s_UemSldQVJpsqwWYUUsU,57771
|
|
3
|
-
synmax/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
synmax/common/__init__.py,sha256=9lTQMNYvpSLKn54EzpWCsrvnztUOB820qGl3Wb79ppg,106
|
|
5
|
-
synmax/common/api_client.py,sha256=tfbQn3qPB3KdKpK7oOnYchDxQlZJ6axrOahAF9qM7DA,12065
|
|
6
|
-
synmax/common/model.py,sha256=g2w9i1PyUEMQXoxxRk8ntr54pTOfDQ3RF0NqxQruCMY,1317
|
|
7
|
-
synmax/config/__init__.py,sha256=5jSxVXV43wK-OTc9xCdO2XaksoiMgC2Oy42HDXS8MoE,143
|
|
8
|
-
synmax/hyperion/__init__.py,sha256=0pz5W71GgJIy8DkdTIzqWnvlcTqnItAEBJnr7unDHFs,2434
|
|
9
|
-
synmax/hyperion/hyperion_client.py,sha256=_K7iyCrg-cNpIqDfaEd9pnz7Ty4aQtqzGgl7kt_gk-4,7528
|
|
10
|
-
synmax/theia/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
test/hyperion_test.py,sha256=z0SWZ3HDilSxez73_-us7QmmdSzi6-UcZQWkR8XvrsM,5929
|
|
13
|
-
test/ip_rate_example.py,sha256=XPjf6rqxNBU6d4SjSnoceyVPBrcS0ywbpqn1c3rUf90,1754
|
|
14
|
-
synmax_api_python_client-0.0.44.dist-info/METADATA,sha256=mSGjc7ME-4VruY3L35GgOLV9PQk7m0B4zNcNGX_oOe8,3732
|
|
15
|
-
synmax_api_python_client-0.0.44.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
|
|
16
|
-
synmax_api_python_client-0.0.44.dist-info/top_level.txt,sha256=SAjmDfHlJzUmjoGCT1SnS4qGSLN_ZF-p58UN1yW5kB0,17
|
|
17
|
-
synmax_api_python_client-0.0.44.dist-info/RECORD,,
|
|
File without changes
|