OpenWaterAnalytics / epanet-python

python wrapper for epanet library
76 stars 40 forks source link

element counts are missing from python37 whl #44

Closed TongZhai closed 5 years ago

TongZhai commented 5 years ago

Just tried out the epanet.output-0.2.0.dev0-cp37-cp37m-win_amd64.whl in the PyQGIS EPANET ui project (issue 289), it installed correctly, but it is missing some general element count variables such as: ENR_nodeCount, ENR_linkCount etc, also, I hope the getnodeseries, getnodeattribute, and getnoderesult in the whl have the same api as the current ENR_get versions in the output api dll.

michaeltryby commented 5 years ago

@TongZhai I added this test that shows how the function can be used. One call returns a list with node, tank, link, pump, and valve counts.

def test_getnetsize(handle):

    # node, tank, link, pump, valve
    ref_array = np.array([11, 2, 13, 1, 0])

    netsize_list = oapi.getnetsize(handle)
    assert len(netsize_list) == 5

    assert np.array_equal(netsize_list, ref_array)

ENR_nodeCount, ENR_tankCount, ... were deprecated because they were no longer needed. You are welcome to add them to ENOutputWrapper.py if you want.