-
Notifications
You must be signed in to change notification settings - Fork 924
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add US-SEC parser for Seminole Electric Cooperative in Florida (#1902)
* Start on US-FL SEC parser, just solar background in #1713. example output: ```json [{ 'zoneKey': 'US-SEC' 'datetime': "2019-07-02T11:00:00Z", 'production': {'solar': 0.0125}, 'source': 'apps.seminole.coop', }, { 'zoneKey': 'US-SEC' 'datetime': "2019-07-02T12:00:00Z", 'production': {'solar': 0.1269}, 'source': 'apps.seminole.coop', }, ... ] ``` * EIA bug fix: extract ['series'][0]['data'] even with target_datetime * US-SEC: fetch production from EIA for #1713 * finish US-SEC: merge gas/coal from EIA with solar for #1713 uses `ENTSOE.merge_production_outputs()`, and there isn't much precedent for parsers reusing, so i've also added a TODO to move that function to `lib.utils`. * add US-SEC (Florida) to README and capacity zones * add details to US-SEC and EIA._fetch_production_or_consumption docstrings * add US-SEC geometries based on Florida counties Florida county GeoJSON downloaded from https://geodata.myflorida.com/datasets/swfwmd::florida-counties Counties chosen from https://www.seminole-electric.com/members/ and linked pages, then lightly manually edited. TODO: figure out why topogen.sh always downloads the Florida GeoJSON file every time, even though it's wrapped in an `if [ ! -e ... ]` just like the NACIS zip downloads. * US-SEC: add US-FL counties raw GeoJSON to third_party_maps downloaded from https://geodata.myflorida.com/datasets/swfwmd::florida-counties on 2019-08-05. source URL: https://opendata.arcgis.com/datasets/4abd0a3669204df2bc3a57066d217959_4.geojson * US-SEC: merge Florida counties and drop internal borders
- Loading branch information
Showing
8 changed files
with
152 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Parser for the Seminole Electric Cooperative in Florida, USA. | ||
Combines hourly gas and coal production data from EIA with hourly solar generation from http://apps.seminole.coop/db/cs/ . Both generally lag a day or so behind, and sometimes as much as 10d behind. | ||
https://www.seminole-electric.com/facilities/generation/ lists two 650MW coal-fired plants, one 810MW gas plant, and a small 2.2MW solar farm. However, EIA combines coal and gas generation data, so we report those together as unknown. | ||
https://github.com/tmrowco/electricitymap-contrib/issues/1713 | ||
""" | ||
|
||
import logging | ||
from datetime import timezone | ||
|
||
import pandas as pd | ||
|
||
from parsers import EIA | ||
from parsers.ENTSOE import merge_production_outputs | ||
|
||
|
||
def fetch_production(zone_key='US-SEC', session=None, target_datetime=None, | ||
logger=logging.getLogger(__name__)): | ||
unknown = fetch_unknown(zone_key=zone_key, session=session, | ||
target_datetime=target_datetime, logger=logger) | ||
solar = fetch_solar(session=session, logger=logger) | ||
return merge_production_outputs((unknown, solar), zone_key, | ||
merge_source='eia.org, apps.seminole.coop') | ||
|
||
|
||
def fetch_unknown(zone_key='US-SEC', session=None, target_datetime=None, | ||
logger=logging.getLogger(__name__)): | ||
data = EIA.fetch_production(zone_key=zone_key, session=session, | ||
target_datetime=target_datetime, logger=logger) | ||
for hour in data: | ||
hour.update({ | ||
'production': {'unknown': hour.pop('value')}, | ||
'storage': {}, # required by merge_production_outputs | ||
}) | ||
|
||
return data | ||
|
||
|
||
def fetch_solar(session=None, logger=logging.getLogger(__name__)): | ||
url = 'http://apps.seminole.coop/db/cs/render.ashx?ItemPath=/Applications/Solar+Dashboard/Cooperative+Solar+-+Data&Format=EXCEL&rptHDInterval=Week&rptHDOffset=0' | ||
df = pd.read_excel(url, sheet_name='Hourly', skiprows=[0]) | ||
|
||
return [{ | ||
'zoneKey': 'US-SEC', | ||
'datetime': row['Date/Time (UTC)'].to_pydatetime().replace(tzinfo=timezone.utc), | ||
'production': {'solar': row['kW'] / 1000.0}, | ||
'storage': {}, # required by merge_production_outputs | ||
'source': 'apps.seminole.coop', | ||
} for _, row in df.iterrows()] | ||
|
||
|
||
def main(): | ||
"""Main method, not used by the ElectricityMap backend, just for testing.""" | ||
import pprint | ||
print('fetch_production() ->') | ||
print(pprint.pprint(fetch_production())) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.