Skip to content

Commit

Permalink
Merge branch 'release/v2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelduchesne committed May 11, 2021
2 parents 72ae4b3 + 1f10ba1 commit 2a7af34
Show file tree
Hide file tree
Showing 80 changed files with 12,400 additions and 21,959 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ 3.7, 3.8, 3.9 ]
os: [ macos-latest, ubuntu-latest, windows-latest ]
python-version: [ 3.7, 3.8 ]
os: [ ubuntu-latest ] # later, add macos-latest, windows-latest
energyplus-version: [ 9.2.0 ] # later, add 9.4.0
include:
- runs-on: ubuntu-latest
compiler: gcc
- energyplus-version: 9.2.0
energyplus-sha: 921312fa1d
energyplus-install: 9-2-0
Expand Down Expand Up @@ -58,7 +60,7 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest-cov pytest-xdist[psutil]
pip install -r requirements.txt -r requirements-dev.txt
python -m pip install -r requirements.txt -r requirements-dev.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -76,3 +78,4 @@ jobs:
files: ./coverage.xml
fail_ci_if_error: false
verbose: true

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ the multizone building model) is now part of a distinct package known as the

## Features

Here is a short overview of features that we are part of archetypal:
Here is a short overview of features that are part of archetypal:

1. Building Complexity Reduction: A utility to transform a multizone EnergyPlus model to a
two-zone normalized model. Such models are called `building archetypes` and are the
Expand Down
12 changes: 1 addition & 11 deletions archetypal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,5 @@
warnings.simplefilter(action="ignore", category=FutureWarning)
warnings.simplefilter(action="ignore", category=UserWarning)

from .utils import *
from .simple_glazing import *
from energy_pandas import EnergySeries, EnergyDataFrame
from .reportdata import ReportData
from .schedule import Schedule
from .plot import *
from .eplus_interface import *
from .idfclass import *
from .dataportal import *
from .idfclass import IDF
from .umi_template import UmiTemplateLibrary
from .utils import *
from .cli import reduce, transition
13 changes: 3 additions & 10 deletions archetypal/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,11 @@
import click
from path import Path

from archetypal import (
UmiTemplateLibrary,
__version__,
config,
docstring_parameter,
log,
parallel_process,
settings,
timeit,
)
from archetypal import __version__, settings
from archetypal.idfclass import IDF
from archetypal.settings import ep_version
from archetypal.umi_template import UmiTemplateLibrary
from archetypal.utils import config, docstring_parameter, log, parallel_process, timeit

from .eplus_interface.exceptions import EnergyPlusVersionError
from .eplus_interface.version import EnergyPlusVersion, get_eplus_dirs
Expand Down
13 changes: 4 additions & 9 deletions archetypal/dataportal.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@
import pycountry as pycountry
import requests

from archetypal import log, make_str, settings

# scipy and sklearn are optional dependencies for faster nearest node search
try:
from osgeo import gdal
except ImportError as e:
gdal = None
from archetypal import settings
from archetypal.utils import log


def tabula_available_buildings(country_name="France"):
Expand Down Expand Up @@ -401,7 +396,7 @@ def save_to_cache(url, response_json):
settings.cache_folder, os.extsep.join([filename, "json"])
)
# dump to json, and save to file
json_str = make_str(json.dumps(response_json))
json_str = json.dumps(response_json)
with io.open(cache_path_filename, "w", encoding="utf-8") as cache_file:
cache_file.write(json_str)

Expand Down Expand Up @@ -541,7 +536,7 @@ def nrel_bcl_api_request(data):
response = requests.get(prepared_url)

# check if an error has occurred
log(response.raise_for_status(), lg.DEBUG)
response.raise_for_status()

# if this URL is not already in the cache, pause, then request it
# get the response size and the domain, log result
Expand Down
19 changes: 12 additions & 7 deletions archetypal/eplus_interface/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,27 @@
"EnergyPlusVersionError",
"EnergyPlusWeatherError",
"BasementThread",
"EnergyPlusExe",
"EnergyPlusThread",
"ExpandObjectsThread",
"SlabThread",
"TransitionThread",
"get_eplus_dirs",
]

from .basement import BasementThread
from .energy_plus import EnergyPlusProgram, EnergyPlusThread
from .exceptions import (
from archetypal.eplus_interface.basement import BasementThread
from archetypal.eplus_interface.energy_plus import (
EnergyPlusExe,
EnergyPlusProgram,
EnergyPlusThread,
)
from archetypal.eplus_interface.exceptions import (
EnergyPlusProcessError,
EnergyPlusVersionError,
EnergyPlusWeatherError,
InvalidEnergyPlusVersion,
)
from .expand_objects import ExpandObjectsThread
from .slab import SlabThread
from .transition import TransitionThread
from .version import EnergyPlusVersion, get_eplus_dirs
from archetypal.eplus_interface.expand_objects import ExpandObjectsThread
from archetypal.eplus_interface.slab import SlabThread
from archetypal.eplus_interface.transition import TransitionThread
from archetypal.eplus_interface.version import EnergyPlusVersion, get_eplus_dirs
8 changes: 3 additions & 5 deletions archetypal/eplus_interface/basement.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
from path import Path
from tqdm import tqdm

from ..eplus_interface.exceptions import (
EnergyPlusProcessError,
EnergyPlusVersionError,
)
from ..eplus_interface.version import EnergyPlusVersion
from archetypal.utils import log

from ..eplus_interface.exceptions import EnergyPlusProcessError, EnergyPlusVersionError
from ..eplus_interface.version import EnergyPlusVersion


class BasementThread(Thread):
"""Basement program manager.
Expand Down
39 changes: 18 additions & 21 deletions archetypal/eplus_interface/energy_plus.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,33 +56,28 @@ def __init__(
):
"""
Args:
idfname (str):
epw (str): Weather file path (default: in.epw in current directory))
output-directory (str): Output directory path (default: current directory)
ep_version (archetypal.EnergyPlusVersion): The version of energyplus
executable.
annual (bool): Force annual simulation. (default: False)
convert (bool): Output IDF->epJSON or epJSON->IDF, dependent on
input
convert (bool): Output IDF->epJSON or epJSON->IDF, dependent on input
file type. (default: False)
output-directory (str): Output directory path (default: current
directory)
ep_version (archetypal.EnergyPlusVersion): The version of
energyplus executable.
design-day (bool): Force design-day-only simulation. (default:
False)
design_day (bool): Force design-day-only simulation. (default: False)
help (bool): Display help information
idd (str) :Input data dictionary path (default: Energy+.idd in
executable directory)
executable directory)
epmacro (bool): Run EPMacro prior to simulation. (default: True)
output-prefix (str): Prefix for output file names (default: eplus)
output_prefix (str): Prefix for output file names (default: eplus)
readvars (bool): Run ReadVarsESO after simulation. (default: True)
output-suffix (str): Suffix style for output file names (
default: L)
-L: Legacy (e.g., eplustbl.csv)
-C: Capital (e.g., eplusTable.csv)
-D: Dash (e.g., eplus-table.csv)
output_suffix (str): Suffix style for output file names (
default: L)
-L: Legacy (e.g., eplustbl.csv)
-C: Capital (e.g., eplusTable.csv)
-D: Dash (e.g., eplus-table.csv)
version (bool): Display version information (default: False)
epw (str): Weather file path (default: in.epw in current
directory))
expandobjects (bool): Run ExpandObjects prior to simulation. (
default:
True)
expandobjects (bool): Run ExpandObjects prior to simulation. (default: True)
"""
self.a = annual
self.c = convert
Expand Down Expand Up @@ -116,9 +111,11 @@ def get_exe_path(self):
self.eplus_weather_path = Path(eplus_weather_path).expand()

def __str__(self):
"""Return string representation."""
return " ".join(self.__repr__())

def __repr__(self):
"""Return a representation of self."""
cmd = [self.eplus_exe_path]
for key, value in self.__dict__.items():
if key not in [
Expand All @@ -130,7 +127,7 @@ def __repr__(self):
if isinstance(value, bool):
cmd.append(f"-{key}") if value else None
else:
cmd.extend([f"-{key}", value])
cmd.extend([f"-{key}", value]) if value is not None else None
cmd.append(self.idfname)
return cmd

Expand Down
2 changes: 1 addition & 1 deletion archetypal/eplus_interface/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __str__(self):
try:
name = self.idf.idfname.abspath()
except Exception:
name = self.idf
name = self.idf.name
msg = ":\n".join([name, self.stderr])
return msg

Expand Down
4 changes: 2 additions & 2 deletions archetypal/eplus_interface/expand_objects.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""ExpandObjects module"""

import logging as lg
import platform
import shutil
import subprocess
import time
Expand Down Expand Up @@ -108,7 +107,8 @@ def run(self):
self.failure_callback()
except Exception as e:
self.exception = e
self.p.kill() # kill process to be sure
if self.p is not None:
self.p.kill() # kill process to be sure
return

def msg_callback(self, *args, **kwargs):
Expand Down
1 change: 0 additions & 1 deletion archetypal/eplus_interface/slab.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from path import Path
from tqdm import tqdm

from archetypal.eplus_interface.energy_plus import EnergyPlusProgram
from archetypal.eplus_interface.exceptions import (
EnergyPlusProcessError,
EnergyPlusVersionError,
Expand Down
4 changes: 2 additions & 2 deletions archetypal/eplus_interface/transition.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Transition module."""

import logging as lg
import os
import platform
import re
Expand All @@ -9,7 +10,6 @@
from io import StringIO
from subprocess import CalledProcessError
from threading import Thread
import logging as lg

from eppy.runner.run_functions import paths_from_version
from path import Path
Expand Down Expand Up @@ -122,7 +122,7 @@ def __str__(self):
return " ".join(self.__repr__())

def __repr__(self):
"""Return command as string."""
"""Return the command as a string."""
return self.cmd()

def cmd(self):
Expand Down
2 changes: 1 addition & 1 deletion archetypal/eplus_interface/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def __init__(self, version):
raise InvalidEnergyPlusVersion

def __repr__(self) -> str:
"""Return the string representation of the object."""
"""Return a representation of self."""
return "<EnergyPlusVersion({0})>".format(repr(str(self)))

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion archetypal/idfclass/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
from .idf import IDF
from .meters import Meters
from .outputs import Outputs
from .reports import get_ideal_loads_summary
from .util import hash_model
from .variables import Variables
from .reports import get_ideal_loads_summary
2 changes: 1 addition & 1 deletion archetypal/idfclass/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from eppy.EPlusInterfaceFunctions.eplusdata import Eplusdata, Idd, removecomment
from geomeppy.patches import EpBunch

from archetypal import extend_class, log
from archetypal.utils import extend_class, log


@extend_class(EpBunch)
Expand Down
Loading

0 comments on commit 2a7af34

Please sign in to comment.