eppy3000 package¶
Subpackages¶
Submodules¶
eppy3000.epMunch module¶
subclass Munch
- class eppy3000.epMunch.EPMunch(*args, **kwargs)[source]¶
Bases:
Munch
Subclass of Munch for eppy3000
- eppy3000.epMunch.printkey(key, indent=0, formatstr=None, func=None)[source]¶
Prints the key in epMunch with the right indentation
Used internally by printmunch
- eppy3000.epMunch.printmunch(amunch, indent=0, index=None, func=None)[source]¶
This prints the epMunch object
In effect, it can print the epJSON file which may have nested epMunch objects in it. Or it can print a single epMunch object. printmunch is called recursively until all epMunch objects are exhausted. It will also print a list of epMunch objects that can occur within an epJSON file
It has been tested for epJSON files. The is no guarantee that will work on a more complex nesting of epMunch objects
An epJSON object such as:
"Heating Setpoint Schedule": { "data": [ { "field": "Through: 12/31" }, { "field": "For: AllDays" }, { "field": "Until: 24:00" }, { "field": 15.0 } ], "idf_max_extensible_fields": 4, "idf_max_fields": 6, "idf_order": 59, "schedule_type_limits_name": "Any Number" },
will print out as:
Schedule:Compact !- EP_KEY Heating Setpoint Schedule !- EPJOBJECT_NAME !- data Through: 12/31 !- field #1 For: AllDays !- field #2 Until: 24:00 !- field #3 15.0 !- field #4 4 !- idf_max_extensible_fields 6 !- idf_max_fields 59 !- idf_order Any Number !- schedule_type_limits_name
which is much more easy on human eyes
- Parameters:
amunch (epMunch) – an EpMunch object that may have more nested EpMunch objects within
indent (int) – Used internally to indent the output
index (int) – used internally to give index numbers to repeating items in a list
func (function) –
default func = print you can get a list by:
lines = [] printmunch(amunch, func=line.append) # lines will be a list of lines
- Return type:
None
eppy3000.epj_mmapping module¶
Subclass from collections.abc.MutableMapping to get finer control over a dict like object.
epj.epobjects is a dict and is not connected to epj.epj
There are 2 dicts:
epj.epj is the real dict where the epJSON data is held as a dict
in eppy3000 one does not work directly on epj.epj
one works on epj.epobjects that holds the same data as epj.epj
this means that any operations done on epj.epobjects should make
equivalent changes in epj.epj
This can be done thru subclassing collections.abc.MutableMapping, rather than subclassing dict
https://stackoverflow.com/questions/3387691/how-to-perfectly-override-a-dict
# Alex Martelli describes how to use collections.MutableSequence in # <http://stackoverflow.com/questions/3487434/overriding-append-method-after-inheriting-from-a-python-list>
- class eppy3000.epj_mmapping.EpjMapping(theepj)[source]¶
Bases:
MutableMapping
simple Mutable mapping to test out some stuff
- class eppy3000.epj_mmapping.EpjSequence(adict, theepj=None)[source]¶
Bases:
MutableSequence
simple Mutable Sequence to stes to ut some stuff
eppy3000.epjviewer module¶
HTML viewer for EPJ and epMunch
- eppy3000.epjviewer.epj2ipythonhtml(epj, fname='./eppy3000_deletethis.html')[source]¶
display the epj as HTML tables in jupyter notebook
- eppy3000.epjviewer.epjhtmllines(epj)[source]¶
return the number of rows in all the epmunch tables that make up the epj
- eppy3000.epjviewer.epmuchhtmllines(epmunch)[source]¶
return the rows in the html table made from epmunch
- eppy3000.epjviewer.epmunch2ipythonhtml(epmunch, fname='./eppy3000_deletethis.html')[source]¶
display the epmunch as HTML table in jupyter notebook
- eppy3000.epjviewer.epobjects2ipythonhtml(epobjects, fname='./eppy3000_deletethis.html')[source]¶
display the epobjects as HTML tables in jupyter notebook
eppy3000.eppy3000 module¶
Main module.
eppy3000.epschema module¶
class for the epschema file
- class eppy3000.epschema.EPSchema(epschemaname)[source]¶
Bases:
object
hold the data from the json epschema file
eppy3000.idfjsonconverter module¶
convertion functions - to convert from JSON to IDF and in reverse.
- eppy3000.idfjsonconverter.epjfile2idffile(epjpath, idfpath=None, schemapath=None)[source]¶
convert an EPJ file on disk to an IDF file on disk
- eppy3000.idfjsonconverter.getfilepaths(folder, ext)[source]¶
get file paths of files in folder that have extension ext
- eppy3000.idfjsonconverter.getidfversion(fhandle)[source]¶
get the idf version of this file
reads the Version object in the file and extract the version number
- Parameters:
fhandle (io.String, io.TextIOWrapper) – can be a file open for read or a io.StringIO object
- Returns:
Version number of the idf file
- Return type:
str
- eppy3000.idfjsonconverter.grouper(iterable, n, fillvalue=None)[source]¶
Collect data into fixed-length chunks or blocks
- eppy3000.idfjsonconverter.idf2json(idfhandle, epschemahandle)[source]¶
converts the E+ file in the old IDF format to the new JSON format
- Parameters:
jsonhandle (io.TextIOWrapper, io.StringIO) – This is the E+ file in the old IDF format
epschemahandle (io.TextIOWrapper, io.StringIO) – This is the epjson file (eqv. of the IDD file in the old format)
- Returns:
E+ file in the new JSON format
- Return type:
str
- eppy3000.idfjsonconverter.idffile2epjfile(idfpath, epjpath=None, schemapath=None, epjext=None)[source]¶
convert an IDF file on disk to an EPJ file on disk
reads the idf file at idfpath. Converts it to epj file Writes the epj file to epjpath
- Parameters:
idfpath (str, pathlib.Path) – idf file name or path to the idf file
epjpath (str, pathlib.Path) – epj file name or path to the epj file
schemapath (str, pathlib.Path) – path to Energy+.schema.epJSON usuallty found in the install location of EnergyPlus. If schemapah=None, the function will attempt to find the schema path in the standard install locations
- Returns:
the path to the saved EPJ file
- Return type:
pathlib.Path
- eppy3000.idfjsonconverter.idffolder2epjfolder(idffolder, epjfolder=None, idfext=None, epjext=None, schemapath=None, verbose=False)[source]¶
Convert all the idf files in idffolder into epj files and save them in epjfolder
The function finds the idf files by searching for the all files in the idffolder that have the extension ‘idf’. This extension can be overridden by giving a value to idfext
- Parameters:
idffolder (str, pathlib.Path) – This is the folder with the idf files
epjfolder (str, pathlib.Path) – This is the folder where you want to store the generated epj files. When epjfolder=None, the epj files are saved in the idffolder
idfext (str) – This is the extension of the idf files. Default value is idf
epjext (str) – This is the extension of the epj files. Default value is epJSON
schemapath (str, pathlib.Path) – path to Energy+.schema.epJSON usuallty found in the install location of EnergyPlus. If schemapah=None, the function will attempt to find the schema path in the standard install locations
verbose (Boolean) – When verbose=True, it will print file names on screen. The default for verbose is False
- Return type:
None
- eppy3000.idfjsonconverter.json2idf(jsonhandle, epschemahandle)[source]¶
converts the E+ file new JSON format to the old IDF format
- Parameters:
jsonhandle (io.TextIOWrapper, io.StringIO) – This is the E+ file in the new JSON format
epschemahandle (io.TextIOWrapper, io.StringIO) – This is the epjson file (eqv. of the IDD file in the old format)
- Returns:
E+ file in the old IDF format
- Return type:
str
eppy3000.installlocation module¶
functions to find the installation folder of a Energyplus version
- eppy3000.installlocation.installfolder(version, platform_system=None)[source]¶
return the install folder of this EnergyPlus version
eppy3000.modelmaker module¶
same as modelmaker in eppy
- class eppy3000.modelmaker.EPJ(epjname=None, epw=None, epschemaname=None)[source]¶
Bases:
object
- popepobject(key, index)[source]¶
Pop an EPJ object from the EPJ.
- Parameters:
key (str) – The type of EPJ object.
index (int) – The index of the object to pop.
- Return type:
EpBunch object.
- removeallepobjects(epjkey)[source]¶
Remove all epobjects of a certain type from the EPJ.
- Parameters:
epjkey (key of the epobjects to remove) –
eppy3000.rawidf module¶
read and save idf files without using eppy
eppy3000.readepj module¶
read epj json file and have eppy like functionality
- eppy3000.readepj.addeppykeys(epmunch)[source]¶
adds eppykeys needed by eppy3000
The way E+ json is structured:
the lowest branch on the json tree is the epobject
- once you are in the epobject:
- the epobject will not know:
Its own name
the type of object it is
it will know only its own fields
We add two new keys to the epobject that will let it store its name and object type These names start with eppy to make it clear that eppy300 has added them
eppykey -> stores the E+ object type (epkey)
eppyname -> stores the name of the object. its key in E+ json
- Parameters:
epmunch (eppy3000.epMunch.EPMunch) – This is the E+ file as seen by eppy3000
- Return type:
None
- eppy3000.readepj.readepjjson(fhandle)[source]¶
read an json epj
- Parameters:
fhandle (io.String, io.TextIOWrapper) – can be a file open for read or a io.StringIO object
- Return type:
eppy.EPMunch
- eppy3000.readepj.removeeppykeys(epmunch, rkeys=None)[source]¶
remove the eppykeys
This will remove all the additional keys that eppy added in addeppykeys(). This is usually called before saving
- Parameters:
epmunch (eppy3000.epMunch.EPMunch) – This is the E+ file as seen by eppy3000
rkeys (list) – These are the keys to be removed. if rkeys is None then rkeys is set to [‘eppykey’, ‘eppyname’, ‘eppy_objepschema’]
- Return type:
None
Module contents¶
Top-level package for eppy3000.
- eppy3000.newepj(version=None)[source]¶
open a new idf file
easy way to open a new idf file for particular version. Works only if Energyplus of that version is installed.
- Parameters:
version (string) – version of the new file you want to create. Will work only if this version of Energyplus has been installed.
- Returns:
file of type eppy.modelmake.IDF
- Return type:
idf