Skip to content

Commit 2c69dde

Browse files
vers-wvisr
authored andcommitted
area calculation wflow_hbv
replaced self.reallength with self.xl and self.yl for cell area calculations, for lat lon this is more precise.
1 parent 7be2031 commit 2c69dde

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

tests/test_wflow_hbv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def testapirun(self):
6666

6767
my_data = np.genfromtxt(os.path.join(caseName, runId, "run.csv"), delimiter=",")
6868
print("Checking discharge ....")
69-
self.assertAlmostEqual(1086.9438944498697, my_data[:, 2].mean(), places=4)
69+
self.assertAlmostEqual(1045.9400254567465, my_data[:, 2].mean(), places=4)
7070

7171
if __name__ == "__main__":
7272
unittest.main()

tests/test_wflow_hbv2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def testapirunhr(self):
6868

6969
my_data = np.genfromtxt(os.path.join(caseName, runId, "run.csv"), delimiter=",")
7070
print("Checking discharge ....")
71-
self.assertAlmostEqual(1811.1795022010804, my_data[:, 2].mean(), places=4)
71+
self.assertAlmostEqual(1671.0379650115967, my_data[:, 2].mean(), places=4)
7272

7373
if __name__ == "__main__":
7474
unittest.main()

wflow/wflow_hbv.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -893,10 +893,10 @@ def initial(self):
893893
Terrain_angle = pcr.scalar(pcr.atan(self.Slope))
894894
temp = (
895895
pcr.catchmenttotal(pcr.cover(1.0), self.TopoLdd)
896-
* self.reallength
896+
* self.xl
897897
* 0.001
898898
* 0.001
899-
* self.reallength
899+
* self.yl
900900
)
901901
self.QMMConvUp = pcr.cover(self.timestepsecs * 0.001) / temp
902902

@@ -987,10 +987,10 @@ def initial(self):
987987
# pcr.report(self.reallength,"rl.map")
988988
# pcr.report(catchmentcells,"kk.map")
989989
self.QMMConv = self.timestepsecs / (
990-
self.reallength * self.reallength * 0.001
990+
self.xl * self.yl * 0.001
991991
) # m3/s --> mm
992992
self.ToCubic = (
993-
self.reallength * self.reallength * 0.001
993+
self.xl * self.yl * 0.001
994994
) / self.timestepsecs # m3/s
995995
self.sumprecip = self.ZeroMap #: accumulated rainfall for water balance
996996
self.sumevap = self.ZeroMap #: accumulated evaporation for water balance

0 commit comments

Comments
 (0)