[GRASS-dev] [GRASS GIS] #3052: Watts to MegaJoules/Day conversion issue

#3052: Watts to MegaJoules/Day conversion issue
---------------------+-------------------------
Reporter: cholmes | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.5
Component: Default | Version: unspecified
Keywords: | CPU: Unspecified
Platform: All |
---------------------+-------------------------
I think I may have found an error in a few files from the grass-ci repo.

A few files:

https://github.com/GRASS-GIS/grass-
ci/blob/f1a15d967611006e920b8dc2f191391e44392019/imagery/i.evapo.mh/mh_eto.c#L15
https://github.com/GRASS-GIS/grass-
ci/blob/f1a15d967611006e920b8dc2f191391e44392019/imagery/i.evapo.mh/mh_original.c#L14
https://github.com/GRASS-GIS/grass-
ci/blob/f1a15d967611006e920b8dc2f191391e44392019/imagery/i.evapo.mh/mh_samani.c#L14

contain a line like:

{{{
ra = ra * (84600.0 * 1000.0); /*convert W -> MJ/d */
}}}

I'm guessing the magic constant 84600 is intended to be the number of
seconds in a day, which is actually 86400. Also, Watts * Seconds gives
Joules. If you intend to get MegaJoules, you must divide by 1000, not
multiply (but maybe the comment is just wrong, and you wanted
milliJoules?).

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/3052&gt;
GRASS GIS <https://grass.osgeo.org>

#3052: Watts to MegaJoules/Day conversion issue
--------------------------+-------------------------
  Reporter: cholmes | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: Imagery | Version: unspecified
Resolution: | Keywords: i.evapo.mh
       CPU: Unspecified | Platform: All
--------------------------+-------------------------
Changes (by martinl):

* keywords: => i.evapo.mh
* component: Default => Imagery

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3052#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3052: Watts to MegaJoules/Day conversion issue
--------------------------+-------------------------
  Reporter: cholmes | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: Imagery | Version: unspecified
Resolution: | Keywords: i.evapo.mh
       CPU: Unspecified | Platform: All
--------------------------+-------------------------

Comment (by ychemin):

article is here for file mh_eto.c :

https://www.researchgate.net/profile/Peter_Droogers/publication/226830392_Estimating_Reference_Evapotranspiration_Under_Inaccurate_Data_Conditions/links/0f31753a0483fd97c0000000.pdf

ref to equation 5 page 40.

equation 1 page 36 references the units used: RA-> MJ / m2 / d

MegaJoules per meter square per day.

So the conversion is indeed wrong in the ticket.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3052#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3052: Watts to MegaJoules/Day conversion issue
--------------------------+-------------------------
  Reporter: cholmes | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.5
Component: Imagery | Version: unspecified
Resolution: fixed | Keywords: i.evapo.mh
       CPU: Unspecified | Platform: All
--------------------------+-------------------------
Changes (by ychemin):

* status: new => closed
* resolution: => fixed

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3052#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#3052: Watts to MegaJoules/Day conversion issue
--------------------------+-------------------------
  Reporter: cholmes | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.5
Component: Imagery | Version: unspecified
Resolution: fixed | Keywords: i.evapo.mh
       CPU: Unspecified | Platform: All
--------------------------+-------------------------

Comment (by neteler):

For reference: r68564

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3052#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>

#3052: Watts to MegaJoules/Day conversion issue
--------------------------+---------------------------------
  Reporter: cholmes | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: normal | Milestone: 7.0.5
Component: Imagery | Version: svn-releasebranch70
Resolution: | Keywords: i.evapo.mh
       CPU: Unspecified | Platform: All
--------------------------+---------------------------------
Changes (by neteler):

* cc: ychemin (added)
* status: closed => reopened
* version: unspecified => svn-releasebranch70
* resolution: fixed =>

Old description:

I think I may have found an error in a few files from the grass-ci repo.

A few files:

https://github.com/GRASS-GIS/grass-
ci/blob/f1a15d967611006e920b8dc2f191391e44392019/imagery/i.evapo.mh/mh_eto.c#L15
https://github.com/GRASS-GIS/grass-
ci/blob/f1a15d967611006e920b8dc2f191391e44392019/imagery/i.evapo.mh/mh_original.c#L14
https://github.com/GRASS-GIS/grass-
ci/blob/f1a15d967611006e920b8dc2f191391e44392019/imagery/i.evapo.mh/mh_samani.c#L14

contain a line like:

{{{
ra = ra * (84600.0 * 1000.0); /*convert W -> MJ/d */
}}}

I'm guessing the magic constant 84600 is intended to be the number of
seconds in a day, which is actually 86400. Also, Watts * Seconds gives
Joules. If you intend to get MegaJoules, you must divide by 1000, not
multiply (but maybe the comment is just wrong, and you wanted
milliJoules?).

New description:

I think I may have found an error in a few files from the grass-ci repo.

A few files:

  * https://github.com/GRASS-GIS/grass-
ci/blob/f1a15d967611006e920b8dc2f191391e44392019/imagery/i.evapo.mh/mh_eto.c#L15
  * https://github.com/GRASS-GIS/grass-
ci/blob/f1a15d967611006e920b8dc2f191391e44392019/imagery/i.evapo.mh/mh_original.c#L14
https://github.com/GRASS-GIS/grass-
ci/blob/f1a15d967611006e920b8dc2f191391e44392019/imagery/i.evapo.mh/mh_samani.c#L14

contain a line like:

{{{
ra = ra * (84600.0 * 1000.0); /*convert W -> MJ/d */
}}}

I'm guessing the magic constant 84600 is intended to be the number of
seconds in a day, which is actually 86400. Also, Watts * Seconds gives
Joules. If you intend to get MegaJoules, you must divide by 1000, not
multiply (but maybe the comment is just wrong, and you wanted
milliJoules?).

--

Comment:

Reopening for the issue: 84600 should be 86400 (?)

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3052#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>

#3052: Watts to MegaJoules/Day conversion issue
--------------------------+---------------------------------
  Reporter: cholmes | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: normal | Milestone: 7.0.5
Component: Imagery | Version: svn-releasebranch70
Resolution: | Keywords: i.evapo.mh
       CPU: Unspecified | Platform: All
--------------------------+---------------------------------

Comment (by neteler):

Backported changes for i.eb.* + i.evapo.*: fix for MegaJoules per meter
square per day (backport of r68564, r68572, r68573, r68574, r68579, trac
#3052); all sync'ed to trunk

Done in r68580 (releasebranch_7_2) and r68581 (releasebranch_7_0).

@cholmes: thanks for your important hint and please test.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3052#comment:6&gt;
GRASS GIS <https://grass.osgeo.org>

#3052: Watts to MegaJoules/Day conversion issue
--------------------------+---------------------------------
  Reporter: cholmes | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.5
Component: Imagery | Version: svn-releasebranch70
Resolution: fixed | Keywords: i.evapo.mh
       CPU: Unspecified | Platform: All
--------------------------+---------------------------------
Changes (by martinl):

* status: reopened => closed
* resolution: => fixed

Comment:

No activity, closing, feel free to reopen if needed.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3052#comment:7&gt;
GRASS GIS <https://grass.osgeo.org>