Skip to content

Commit 5b1df64

Browse files
Fix incorrect unit conversion in hydro function in convert.py (#422)
* Fix incorrect unit conversion in hydro function in convert.py Removed unnecessary factor of 1000/24 from the runoff calculation, as pointed out by user JKALanger. The function now correctly calculates runoff in m3 per hour by directly multiplying the depth (in meters per hour) by the basin area (in square meters). * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update release_notes.rst --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 91e6e7c commit 5b1df64

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

atlite/convert.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,9 +1038,7 @@ def hydro(
10381038
# The hydrological parameters are in units of "m of water per day" and so
10391039
# they should be multiplied by 1000 and the basin area to convert to m3
10401040
# d-1 = m3 h-1 / 24
1041-
runoff *= (1000.0 / 24.0) * xr.DataArray(
1042-
basins.shapes.to_crs(dict(proj="cea")).area
1043-
)
1041+
runoff *= xr.DataArray(basins.shapes.to_crs(dict(proj="cea")).area)
10441042

10451043
return hydrom.shift_and_aggregate_runoff_for_plants(
10461044
basins, runoff, flowspeed, show_progress

doc/release_notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55

66
.. include:: ../RELEASE_NOTES.rst
77

8+
* In ``atlite/convert.py``, the function ``hydro`` is now correctly calculating the runoff in m3 per hour by multiplying the depth (in meters per hour) by the basin area (in m2).

0 commit comments

Comments
 (0)