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

Rename several exchanges with US #1409

Merged
merged 3 commits into from May 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/exchanges.json
Expand Up @@ -459,7 +459,7 @@
},
"rotation": 90
},
"CA-AB->US": {
"CA-AB->US-MT": {
"lonlat": [
-111.920238,
49.016577
Expand All @@ -469,7 +469,7 @@
},
"rotation": 180
},
"CA-BC->US": {
"CA-BC->US-BPA": {
"lonlat": [
-119.300532,
49.044392
Expand Down
2 changes: 1 addition & 1 deletion mockserver/public/v3/state

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions parsers/CA_AB.py
Expand Up @@ -159,7 +159,7 @@ def fetch_exchange(zone_key1='CA-AB', zone_key2='CA-BC', session=None, target_da
flows = {
'CA-AB->CA-BC': df_exchanges[1][1]['British Columbia'],
'CA-AB->CA-SK': df_exchanges[1][1]['Saskatchewan'],
'CA-AB->US': df_exchanges[1][1]['Montana']
'CA-AB->US-MT': df_exchanges[1][1]['Montana']
}
sortedZoneKeys = '->'.join(sorted([zone_key1, zone_key2]))
if sortedZoneKeys not in flows:
Expand Down Expand Up @@ -188,5 +188,9 @@ def isfloat(value):
print(fetch_production())
print('fetch_price() ->')
print(fetch_price())
print('fetch_exchange() ->')
print(fetch_exchange())
print('fetch_exchange(CA-AB, CA-BC) ->')
print(fetch_exchange('CA-AB', 'CA-BC'))
print('fetch_exchange(CA-AB, CA-SK) ->')
print(fetch_exchange('CA-AB', 'CA-SK'))
print('fetch_exchange(CA-AB, US-MT) ->')
print(fetch_exchange('CA-AB', 'US-MT'))
10 changes: 6 additions & 4 deletions parsers/CA_BC.py
Expand Up @@ -38,8 +38,8 @@ def fetch_exchange(zone_key1=None, zone_key2=None, session=None, target_datetime
datetime = arrow.get(
arrow.get(obj[0], 'DD-MMM-YY HH:mm:ss').datetime, timezone).datetime

if (zone_key1 == 'CA-BC' and zone_key2 == 'US'):
sortedZoneKeys = 'CA-BC->US'
if (zone_key1 == 'CA-BC' and zone_key2 == 'US-BPA'):
sortedZoneKeys = 'CA-BC->US-BPA'
netFlow = float(obj[1])
elif (zone_key1 == 'CA-AB' and zone_key2 == 'CA-BC'):
sortedZoneKeys = 'CA-AB->CA-BC'
Expand All @@ -58,5 +58,7 @@ def fetch_exchange(zone_key1=None, zone_key2=None, session=None, target_datetime
if __name__ == '__main__':
"""Main method, never used by the Electricity Map backend, but handy for testing."""

print('fetch_exchange() ->')
print(fetch_exchange())
print('fetch_exchange(CA-BC, US-BPA) ->')
print(fetch_exchange('CA-BC', 'US-BPA'))
print('fetch_exchange(CA-AB, CA-BC) ->')
print(fetch_exchange('CA-AB', 'CA-BC'))