Skip to content

Commit b0dd2b4

Browse files
committed
fix in getComputedTimeSeries_ENepanet to accept arg
1 parent 4d75a6a commit b0dd2b4

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

epyt/epanet.py

+18-7
Original file line numberDiff line numberDiff line change
@@ -2387,14 +2387,25 @@ def getComputedTimeSeries(self):
23872387
value_final.Status = value_final.Status.astype(int)
23882388
return value_final
23892389

2390-
def getComputedTimeSeries_ENepanet(self):
2390+
def getComputedTimeSeries_ENepanet(self, tempfile=None, binfile=None, rptfile=None):
23912391
""" Run analysis using ENepanet function """
2392-
self.saveInputFile(self.TempInpFile)
2393-
uuID = ''.join(random.choices(string.ascii_letters +
2394-
string.digits, k=10))
2395-
rptfile = self.TempInpFile[0:-4] + '.txt'
2396-
binfile = '@#' + uuID + '.bin'
2397-
self.api.ENepanet(self.TempInpFile, rptfile, binfile)
2392+
2393+
if tempfile is not None:
2394+
self.saveInputFile(tempfile)
2395+
else:
2396+
self.saveInputFile(self.TempInpFile)
2397+
uuID = ''.join(random.choices(string.ascii_letters + string.digits, k=10))
2398+
2399+
if binfile is None:
2400+
binfile = '@#' + uuID + '.bin'
2401+
if rptfile is None:
2402+
rptfile = self.TempInpFile[:-4] + '.txt'
2403+
self.api.ENclose()
2404+
if tempfile is not None:
2405+
self.api.ENepanet(tempfile, rptfile, binfile)
2406+
else:
2407+
self.api.ENepanet(self.TempInpFile, rptfile, binfile)
2408+
23982409
fid = open(binfile, "rb")
23992410
value = self.__readEpanetBin(fid, binfile, 0)
24002411
value.WarnFlag = False

0 commit comments

Comments
 (0)