Skip to content

Commit

Permalink
fixed syntax warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophGehbauer committed Oct 19, 2024
1 parent 90d42ca commit 2a44c33
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion afc/defaultConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Default configuration.
"""

# pylint: disable=too-many-arguments, bare-except, too-many-locals
# pylint: disable=too-many-arguments, bare-except, too-many-locals, too-many-positional-arguments
# pylint: disable=invalid-name, dangerous-default-value, unused-argument

import os
Expand Down
2 changes: 1 addition & 1 deletion afc/radiance/forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# pylint: disable=too-many-locals, too-many-instance-attributes, too-many-arguments
# pylint: disable=redefined-outer-name, invalid-name, too-many-statements
# pylint: disable=consider-using-dict-items, protected-access, pointless-string-statement
# pylint: disable=import-outside-toplevel
# pylint: disable=import-outside-toplevel, too-many-positional-arguments

import os
import time
Expand Down
1 change: 1 addition & 0 deletions afc/rcModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"""

# pylint: disable=invalid-name, too-many-arguments, too-many-locals, too-many-statements
# pylint: disable=too-many-positional-arguments

def R1C1(i, Ti_p, To, Qi_ext, param):
"""Function for RC model considering indoor, outdoor conditions.
Expand Down
1 change: 1 addition & 0 deletions afc/utility/midas.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

# pylint: disable=redefined-outer-name, invalid-name, too-many-arguments, duplicate-code
# pylint: disable=too-many-positional-arguments

import os
import json
Expand Down
2 changes: 1 addition & 1 deletion afc/utility/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Plotting module.
"""

# pylint: disable=invalid-name, too-many-arguments
# pylint: disable=invalid-name, too-many-arguments, too-many-positional-arguments

import matplotlib.pyplot as plt
# from matplotlib.pyplot import cm
Expand Down
2 changes: 1 addition & 1 deletion afc/utility/thermostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Thermostat control module.
"""

# pylint: disable=too-many-arguments
# pylint: disable=too-many-arguments, too-many-positional-arguments

def afc_to_hvac_setpoint(ctrl_outputs, tdead=0.5):
"""Utility to convert from AFC to thermostat setpoints."""
Expand Down
1 change: 1 addition & 0 deletions afc/utility/watttime.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""

# pylint: disable=redefined-outer-name, invalid-name, too-many-arguments, duplicate-code
# pylint: disable=too-many-positional-arguments

import os
import json
Expand Down
37 changes: 18 additions & 19 deletions afc/utility/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
print('WARNING: Using local directory as root.')
root = os.getcwd()

WEATHER_RESOURCES = os.path.join(os.path.dirname(root), 'resources', 'weather')

def read_tmy3(filename=None, coerce_year=dt.datetime.now().year, convert_numeric=True):
"""Reads TMY data file."""
weather, info = pvlib.iotools.read_tmy3(filename=filename,
Expand Down Expand Up @@ -106,6 +108,22 @@ def get_forecast(st=dt.datetime.now(), tz=-8,
data.index = data.index.tz_localize(None)
return data, model

def example_weather_forecast(date=None, horizon=24,
weather_path=os.path.join(WEATHER_RESOURCES, 'USA_CA_San.Francisco.Intl.AP.724940_TMY3.csv')):
"""Reads weather forecast CSV"""
if not date:
# select today's date
start_time = dt.datetime.now().date()
else:
start_time = pd.to_datetime(date)
# read weather (forecast) data
weather = read_tmy3(weather_path, coerce_year=start_time.year) [0]
weather = weather.resample('5min').interpolate()
# output data
wf = weather.loc[start_time:start_time+pd.DateOffset(hours=horizon),]
wf = wf[['temp_air','dni','dhi','wind_speed']+['ghi']].copy()
return wf

if __name__ == '__main__':
import time
root_repo = os.path.dirname(root)
Expand All @@ -126,23 +144,4 @@ def get_forecast(st=dt.datetime.now(), tz=-8,
loc=loc0, model=model0)
print(f'Duration for forecast: {round(time.time()-st1,1)}s')
print(forecast[['ghi','dhi','dni']].round(0))



def example_weather_forecast(date=None, horizon=24):
"""Reads weather forecast CSV"""
if not date:
# select today's date
start_time = dt.datetime.now().date()
else:
start_time = pd.to_datetime(date)
# read weather (forecast) data
weather_path = os.path.join(os.path.dirname(root), 'resources', 'weather',
'USA_CA_San.Francisco.Intl.AP.724940_TMY3.csv')
weather = read_tmy3(weather_path, coerce_year=start_time.year) [0]
weather = weather.resample('5min').interpolate()
# output data
wf = weather.loc[start_time:start_time+pd.DateOffset(hours=horizon),]
wf = wf[['temp_air','dni','dhi','wind_speed']+['ghi']].copy()
return wf

0 comments on commit 2a44c33

Please sign in to comment.