Skip to content

Commit

Permalink
Bumping version
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeltryby committed Feb 15, 2019
1 parent b576f7c commit c378423
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
70 changes: 35 additions & 35 deletions epanet_python/output/epanet/output/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#
# __init__.py - EPANET output package
#
#
# Date Created: August 15, 2018
#
# Author: Michael E. Tryby
Expand All @@ -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"
Expand All @@ -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):
Expand All @@ -41,107 +41,107 @@ class Units(Enum):
HEADLOSS = auto()
RX_RATE = auto()
UNITLESS = auto()
NONE = auto()
NONE = auto()

class RxUnits(Enum):
MGH = auto()
MGH = auto()
UGH = auto()


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 = {
oapi.NodeAttribute.DEMAND: ("Demand", self._unit_labels[self._flow]),
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]),
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion epanet_python/output/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
2 changes: 1 addition & 1 deletion epanet_python/toolkit/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def run(self):

setup(
name=PACKAGE_NAME,
version="0.2.0a",
version="0.3.0.dev0",

cmdclass={
'install': InstallCmd,
Expand Down

0 comments on commit c378423

Please sign in to comment.