From 00cf769a8f08d6e93a02028fd722dc137ca1d1c8 Mon Sep 17 00:00:00 2001 From: Chris Mackey Date: Mon, 18 Jan 2021 01:08:39 -0500 Subject: [PATCH] fix(cli): Add entry point for CLI It seems we forgot to add an entry point where we originally created the CLI. This should fix it. I also realized that the command doesn't give any indication of the simulation progress so I am adding a print statement so that people aren't left hanging for over a minute without any indication of how much longer the simulation will take. We should ass an option to silence this reporting for those who don't want it. CC: @saeranv --- uwg/__main__.py | 4 ++++ uwg/uwg.py | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 uwg/__main__.py diff --git a/uwg/__main__.py b/uwg/__main__.py new file mode 100644 index 00000000..2bb21541 --- /dev/null +++ b/uwg/__main__.py @@ -0,0 +1,4 @@ +from uwg.cli import main + +if __name__ == '__main__': + main() diff --git a/uwg/uwg.py b/uwg/uwg.py index eb37f107..0792a693 100644 --- a/uwg/uwg.py +++ b/uwg/uwg.py @@ -1207,7 +1207,10 @@ def simulate(self): '{} days from {}/{}.'.format(self.nday, self.month, self.day)) # iterate through every simulation time-step (i.e 5 min) defined by UWG + day_step = int((1 / self.ph) * 24) for it in range(1, self.simTime.nt, 1): + if it % day_step == 0: + print('Simulating Day {}'.format(int(it / day_step))) # Update water temperature (estimated) if self.nSoil < 3: # for BUBBLE/CAPITOUL/Singapore only