Skip to content

[Bug] i.evapo.mh: W/m² incorrectly converted to kJ instead of MJ #5520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jayneel-shah18 opened this issue Apr 8, 2025 · 1 comment · May be fixed by #5600
Open

[Bug] i.evapo.mh: W/m² incorrectly converted to kJ instead of MJ #5520

jayneel-shah18 opened this issue Apr 8, 2025 · 1 comment · May be fixed by #5600
Labels
bug Something isn't working

Comments

@jayneel-shah18
Copy link
Contributor

jayneel-shah18 commented Apr 8, 2025

The i.evapo.mh module incorrectly converts net radiation from W/m²/day to MJ/m²/day using the formula:

ra = ra * (24.0 * 60.0 * 60.0 / 1000.0); /* convert W -> MJ/d */ (Line 16 in mh_original.c)

This multiplies by 86.4, which actually converts W/m²/day to kJ/m²/day, not MJ/m²/day.

However, the module then applies the constant 0.408, which assumes radiation is in MJ/m²/day (Line 17 in mh_original.c). This inconsistency results in a ~1000× overestimation of evapotranspiration (ET), violating the physical energy balance. The comment in the code is also misleading, stating it converts to MJ/d when it does not.

To reproduce

Run the following commands:
r.mapcalc "netrad = 100"
r.mapcalc "avg_temp = 20"
r.mapcalc "min_temp = 10"
r.mapcalc "max_temp = 30"

i.evapo.mh -h \ netradiation_diurnal=netrad \ average_temperature=avg_temp \ minimum_temperature=min_temp \ maximum_temperature=max_temp \ output=i_evapo_mh_output

r.univar -g map=i_evapo_mh_output

Observed Output:
mean=1370.593094

Expected behavior

With:
Ra = 100 W/m²/day
Ra in MJ = 100 × 0.0864 = 8.64 MJ/m²/day
ET = 1.370593 (0.0023 * 0.408 * 8.64 * ((10+30/2)+ 17.8) * pow((30-10), 0.5)))

Screenshots

Image

System description

  • Operating System: Windows Subsystem for Linux (WSL)

  • GRASS GIS version: 8.4

  • details about further software components

    • version=8.5.0dev
    • python version=3.10.12

Additional context

I wrote a test to compare output ET from i.evapo.mh to a theoretical radiation-limited maximum using the formula in the cited paper. The module regularly exceeds this threshold by thousands of mm/day. Upon reviewing the C code, the unit mismatch became evident. I found the same error in the modified formula of Hargreaves approach in mh_samani.c file.

I would be happy to help prepare a patch.

@jayneel-shah18 jayneel-shah18 added the bug Something isn't working label Apr 8, 2025
@petrasovaa
Copy link
Contributor

I agree, could you please create a PR? @YannChemin, could you confirm?

@jayneel-shah18 jayneel-shah18 linked a pull request Apr 27, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants