Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
dec-heim committed Feb 18, 2023
1 parent c5f3508 commit 6f21257
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12 (main, Apr 4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)]"
"version": "3.9.12"
},
"vscode": {
"interpreter": {
Expand Down
24 changes: 21 additions & 3 deletions src/nemglo/lite.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ def get_market_data(conf):
start_date=convert_dt_fmt(c_md.start_date) + " " + [c_md.start_time if hasattr(c_md, "start_time") else "00:00"][0],
end_date=convert_dt_fmt(c_md.end_date) + " " + [c_md.end_time if hasattr(c_md, "end_time") else "00:00"][0],
)
data._download_geninfo(filter_regions=[c_md.region])
try:
data._download_geninfo(filter_regions=[c_md.region])
except Exception as e:
logger.error(e)
print(e)
tracedata, tracedata['time'], tracedata['prices'], tracedata['vre'] = {}, {}, {}, {}

# Nemed Data -> Emissions extraction
Expand All @@ -63,17 +67,31 @@ def get_market_data(conf):
except Exception as e:
print(e)


prc_df = data.get_prices()
try:
prc_df = data.get_prices()
except Exception as e:
logger.error(e)
print(e)
tracedata['time'] = prc_df['Time']
tracedata['prices'] = prc_df['Prices']
result = {}
logger.info("Prepare Results JSON")
result['availgens'] = data._info['DUID'].to_list()
logger.info("+availgens")
result['availgens_default_cap'] = data._info['Reg Cap (MW)'].to_list()
logger.info("+availgens_default_cap")
result['availgens_tech'] = data._info['Fuel Source - Descriptor'].to_list()
logger.info("+availgens_tech")

result['time'] = convert_timestamp(tracedata['time'])
logger.info("+time")

result['timestamps'] = json.loads(tracedata['time'].dt.tz_localize('Australia/Sydney').to_json(orient='records'))
logger.info("+timestamps")

result['prices'] = tracedata['prices'].to_list()
logger.info("+prices")

if ('emissions_data' in conf):
result['emissions'] = co2_df['Intensity_Index'].to_list()
logger.info('=== End get_market_data() ===')
Expand Down
2 changes: 1 addition & 1 deletion src/nemglo/planning/data_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def get_prices(self):
# Resample data if requested interval length is not 5 minutes
if self._intlength != 5:
self._prices = pd.DataFrame(prices.resample(str(self._intlength)+'min',
label='right', origin='end').mean())
label='right', origin='end')['RRP'].mean())
else:
self._prices = pd.DataFrame(prices[['RRP']])

Expand Down

0 comments on commit 6f21257

Please sign in to comment.