Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/cli' into feature/cli
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelduchesne committed Jun 27, 2019
2 parents c32173b + 0e77740 commit da16b89
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 75 deletions.
6 changes: 0 additions & 6 deletions archetypal/trnsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ def convert_idf_to_trnbuild(idf_file, window_lib=None,
* the path to the TRNBuild input file (.idf)
* the path to the TRNSYS dck file (.dck)
Todo:
- Add console info at beginning of each steps of this method
- Add console info about the outputs of the function at the end when it
is completed.
- Add option to hide name conversion report
Example:
>>> # Exemple of setting kwargs to be unwrapped in the function
>>> kwargs_dict = {'u_value': 2.5, 'shgc': 0.6, 't_vis': 0.78,
Expand Down
70 changes: 3 additions & 67 deletions archetypal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,45 +383,6 @@ def layer_composition(row):
return array


def get_row_prop(self, other, on, property):
"""
Todo:
* Not used
* This function may raise an error (it has to). Maybe we can do things
better.
Args:
self:
other:
on:
property:
Returns:
same type as caller
"""
try:
value_series = pd.DataFrame(self).T[on].join(
other.reset_index().set_index([on[0], 'Name']), on=on,
rsuffix='_viz')[property]
except:
raise ValueError()
else:
if len(value_series) > 1:
log('Found more than one possible values for property {} for item '
'{}'.format(
property, self[on]), lg.WARNING)
log('Taking the first occurrence...')

index = value_series.index.values.astype(int)[0]
value_series = value_series.values.astype(float)[0]
elif value_series.isna().all():
raise ValueError('No corresponding property was found')
else:
index = value_series.index.values.astype(int)[0]
value_series = value_series.values.astype(float)[0]
return index, value_series


def schedule_composition(row):
"""Takes in a series with $id and \*_ScheduleDay_Name values and return an
array of dict of the form {'$ref': ref}
Expand Down Expand Up @@ -500,33 +461,6 @@ def date_transform(date_str):
return datetime.strptime('23:00', '%H:%M')


def iscore(row):
"""Helps to group by core and perimeter zones. If any of "has `core` in
name" and "ExtGrossWallArea == 0" is true, will consider zone_loads as core,
else as perimeter.
Todo:
* assumes a basement zone_loads will be considered as a core zone_loads
since no ext wall area for basements.
Args:
row (pandas.Series): a row
Returns:
str: 'Core' or 'Perimeter'
"""
if any(['core' in row[('Zone', 'Zone Name')].lower(),
float(row[('Zone', 'Exterior Gross Wall Area {m2}')]) == 0]):
# We look for the string `core` in the Zone_Name
return 'Core'
elif row[('Zone', 'Part of Total Building Area')] == 'No':
return np.NaN
elif 'plenum' in row[('Zone', 'Zone Name')].lower():
return np.NaN
else:
return 'Perimeter'


def weighted_mean(series, df, weighting_variable):
"""Compute the weighted average while ignoring NaNs. Implements
:func:`numpy.average`.
Expand Down Expand Up @@ -817,6 +751,7 @@ def check_unique_name(first_letters, count, name, unique_list, suffix=False):

return name, count


def angle(v1, v2, acute=True):
"""Calculate the angle between 2 vectors
Expand All @@ -828,7 +763,8 @@ def angle(v1, v2, acute=True):
Returns:
angle (float): angle between the 2 vectors in degree
"""
angle = np.arccos(np.dot(v1, v2) / (np.linalg.norm(v1) * np.linalg.norm(v2)))
angle = np.arccos(
np.dot(v1, v2) / (np.linalg.norm(v1) * np.linalg.norm(v2)))
if (acute == True):
return angle
else:
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ def setup(app):
'eppy': ('https://eppy.readthedocs.io/en/latest/', None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None)}

# -- Options for todo extension ----------------------------------------------
# -- Options for _todo extension ----------------------------------------------

# If true, `todo` and `todoList` produce output, else they produce nothing.
# If true, `_todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True

# -- Autodoc Skip Memebrs ____________________________________________________
Expand Down
6 changes: 6 additions & 0 deletions docs/unix_users.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ This action will make Homebrew inspected your system to make sure the installati
brew install wine
For more information about Wine installation, you can visit the following website: https://www.davidbaumgold.com/tutorials/wine-mac/

Using WINE with ``archetypal convert`` command
----------------------------------------------

Expand All @@ -51,4 +53,8 @@ Example:
archetypal convert --trnsidf-exe "<path to executable on UNIX machine>" "<path to IDF file>"
You can find the executable trnsidf.exe in the TRNSYS default installation folder:
`C:\\TRNSYS18\\Building\\trnsIDF`


.. _Wine: https://www.winehq.org/

0 comments on commit da16b89

Please sign in to comment.