Skip to content

Commit

Permalink
area calculation wflow_hbv
Browse files Browse the repository at this point in the history
replaced self.reallength with self.xl and self.yl for cell area calculations, for lat lon this is more precise.
  • Loading branch information
verseve authored and visr committed Nov 25, 2020
1 parent 7be2031 commit 2c69dde
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/test_wflow_hbv.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def testapirun(self):

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

if __name__ == "__main__":
unittest.main()
2 changes: 1 addition & 1 deletion tests/test_wflow_hbv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def testapirunhr(self):

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

if __name__ == "__main__":
unittest.main()
8 changes: 4 additions & 4 deletions wflow/wflow_hbv.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,10 +893,10 @@ def initial(self):
Terrain_angle = pcr.scalar(pcr.atan(self.Slope))
temp = (
pcr.catchmenttotal(pcr.cover(1.0), self.TopoLdd)
* self.reallength
* self.xl
* 0.001
* 0.001
* self.reallength
* self.yl
)
self.QMMConvUp = pcr.cover(self.timestepsecs * 0.001) / temp

Expand Down Expand Up @@ -987,10 +987,10 @@ def initial(self):
# pcr.report(self.reallength,"rl.map")
# pcr.report(catchmentcells,"kk.map")
self.QMMConv = self.timestepsecs / (
self.reallength * self.reallength * 0.001
self.xl * self.yl * 0.001
) # m3/s --> mm
self.ToCubic = (
self.reallength * self.reallength * 0.001
self.xl * self.yl * 0.001
) / self.timestepsecs # m3/s
self.sumprecip = self.ZeroMap #: accumulated rainfall for water balance
self.sumevap = self.ZeroMap #: accumulated evaporation for water balance
Expand Down

0 comments on commit 2c69dde

Please sign in to comment.