diff --git a/epanet_python/output/epanet/output/__init__.py b/epanet_python/output/epanet/output/__init__.py index 951bdd7..c877dac 100644 --- a/epanet_python/output/epanet/output/__init__.py +++ b/epanet_python/output/epanet/output/__init__.py @@ -2,7 +2,7 @@ # # __init__.py - EPANET output package -# +# # Date Created: August 15, 2018 # # Author: Michael E. Tryby @@ -19,7 +19,7 @@ __credits__ = "Maurizio Cingi" __license__ = "CC0 1.0 Universal" -__version__ = "0.1.1" +__version__ = "0.2.0" __date__ = "August 15, 2018" __maintainer__ = "Michael Tryby" @@ -29,7 +29,7 @@ from enum import Enum, auto -from epanet.output import output as oapi +from epanet.output import output as oapi class Units(Enum): @@ -41,10 +41,10 @@ class Units(Enum): HEADLOSS = auto() RX_RATE = auto() UNITLESS = auto() - NONE = auto() + NONE = auto() class RxUnits(Enum): - MGH = auto() + MGH = auto() UGH = auto() @@ -52,88 +52,88 @@ class OutputMetadata(): ''' Simple attribute name and unit lookup. ''' - + _unit_labels_us_ = { Units.HYD_HEAD: "ft", Units.VELOCITY: "ft/sec", - Units.HEADLOSS: "ft/1000ft", + Units.HEADLOSS: "ft/1000ft", Units.UNITLESS: "unitless", Units.NONE: "", - + RxUnits.MGH: "mg/hr", RxUnits.UGH: "ug/hr", - + oapi.FlowUnits.CFS: "cu ft/s", oapi.FlowUnits.GPM: "gal/min", oapi.FlowUnits.MGD: "M gal/day", oapi.FlowUnits.IMGD: "M Imp gal/day", oapi.FlowUnits.AFD: "ac ft/day", - - oapi.PressUnits.PSI: "psi", - - oapi.QualUnits.NONE: "", + + oapi.PressUnits.PSI: "psi", + + oapi.QualUnits.NONE: "", oapi.QualUnits.MGL: "mg/L", oapi.QualUnits.UGL: "ug/L", - oapi.QualUnits.HOURS: "hrs", + oapi.QualUnits.HOURS: "hrs", oapi.QualUnits.PRCNT: "%"} _unit_labels_si_ = { Units.HYD_HEAD: "m", Units.VELOCITY: "m/sec", - Units.HEADLOSS: "m/Km", + Units.HEADLOSS: "m/Km", Units.UNITLESS: "unitless", Units.NONE: "", - + RxUnits.MGH: "mg/hr", RxUnits.UGH: "ug/hr", - + oapi.FlowUnits.LPS: "L/sec", oapi.FlowUnits.LPM: "L/min", oapi.FlowUnits.MLD: "M L/day", oapi.FlowUnits.CMH: "cu m/hr", oapi.FlowUnits.CMD: "cu m/day", - + oapi.PressUnits.MTR: "meters", oapi.PressUnits.KPA: "kPa", - - oapi.QualUnits.NONE: "", + + oapi.QualUnits.NONE: "", oapi.QualUnits.MGL: "mg/L", oapi.QualUnits.UGL: "ug/L", - oapi.QualUnits.HOURS: "hrs", + oapi.QualUnits.HOURS: "hrs", oapi.QualUnits.PRCNT: "%"} - + def __init__(self, output_handle): - + self.units = list() # If outputhandle not initialized use default settings - if output_handle == None: - self.units = [oapi.FlowUnits.GPM.value, - oapi.PressUnits.PSI.value, + if output_handle == None: + self.units = [oapi.FlowUnits.GPM.value, + oapi.PressUnits.PSI.value, oapi.QualUnits.NONE.value] # Else quary the output api for unit settings else: - for u in oapi.Units: + for u in oapi.Units: self.units.append(oapi.getunits(output_handle, u)) - - # Convert unit settings to enums + + # Convert unit settings to enums self._flow = oapi.FlowUnits(self.units[0]) self._press = oapi.PressUnits(self.units[1]) self._qual = oapi.QualUnits(self.units[2]) - + # Determine unit system from flow setting if self._flow.value <= oapi.FlowUnits.AFD.value: self._unit_labels = type(self)._unit_labels_us_ else: - self._unit_labels = type(self)._unit_labels_si_ - + self._unit_labels = type(self)._unit_labels_si_ + # Determine mass units from quality settings if self._qual == oapi.QualUnits.MGL: self._rx_rate = RxUnits.MGH elif self._qual == oapi.QualUnits.UGL: self._rx_rate = RxUnits.UGH else: - self._rx_rate = Units.NONE + self._rx_rate = Units.NONE self._metadata = { @@ -141,7 +141,7 @@ def __init__(self, output_handle): oapi.NodeAttribute.HEAD: ("Head", self._unit_labels[Units.HYD_HEAD]), oapi.NodeAttribute.PRESSURE: ("Pressure", self._unit_labels[self._press]), oapi.NodeAttribute.QUALITY: ("Quality", self._unit_labels[self._qual]), - + oapi.LinkAttribute.FLOW: ("Flow", self._unit_labels[self._flow]), oapi.LinkAttribute.VELOCITY: ("Velocity", self._unit_labels[Units.VELOCITY]), oapi.LinkAttribute.HEADLOSS: ("Unit Headloss", self._unit_labels[Units.HEADLOSS]), @@ -152,7 +152,7 @@ def __init__(self, output_handle): oapi.LinkAttribute.FRCTN_FCTR: ("Friction Factor", self._unit_labels[Units.UNITLESS]) } - + def get_attribute_metadata(self, attribute): ''' Takes an attribute enum and returns a tuple with name and units. diff --git a/epanet_python/output/setup.py b/epanet_python/output/setup.py index 26d0119..6e38ef7 100644 --- a/epanet_python/output/setup.py +++ b/epanet_python/output/setup.py @@ -25,7 +25,7 @@ setup( name = 'epanet.output', - version = "0.1.2a0", + version = "0.2.0.dev0", ext_modules = [ Extension("epanet.output._output", sources = ['epanet/output/output_wrap.c'], diff --git a/epanet_python/toolkit/setup.py b/epanet_python/toolkit/setup.py index c010225..c4ec935 100644 --- a/epanet_python/toolkit/setup.py +++ b/epanet_python/toolkit/setup.py @@ -17,7 +17,7 @@ setup( name = 'epanet.toolkit', - version = "0.0.3a0", + version = "0.2.0.dev0", ext_modules = [ Extension("epanet.toolkit._toolkit", sources = ['epanet/toolkit/toolkit_wrap.c'], diff --git a/setup.py b/setup.py index fdd9ea2..bd62419 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,7 @@ def run(self): setup( name=PACKAGE_NAME, - version="0.2.0a", + version="0.3.0.dev0", cmdclass={ 'install': InstallCmd,