[GRASS-git] [OSGeo/grass] aac1c5: Incorrect beam radiation for some steep inclined s...
andrewg-cse
noreply at github.com
Thu Mar 23 06:30:54 PDT 2023
Branch: refs/heads/main
Home: https://github.com/OSGeo/grass
Commit: aac1c5a74ee5512d031132aebadee8aebf7c913f
https://github.com/OSGeo/grass/commit/aac1c5a74ee5512d031132aebadee8aebf7c913f
Author: andrewg-cse <38460980+andrewg-cse at users.noreply.github.com>
Date: 2023-03-23 (Thu, 23 Mar 2023)
Changed paths:
M raster/r.sun/main.c
M raster/r.sun/rsunlib.c
M raster/r.sun/sunradstruct.h
M raster/r.sun/testsuite/test_rsun.py
Log Message:
-----------
Incorrect beam radiation for some steep inclined surfaces (#2534)
Issue was that direct beam radiation falling on the back of some steep approx north facing (in northern hemisphere) inclined surfaces is included in direct beam results. This was caused by an incorrect value of sunSlopeGeom->longit_l in the rsunlib.c, lumcline2 function. In main.c, in the calculate() function at line 1953, the value of q1 changes sign as the slope increases for north (in northern hemisphere) facing surfaces. This causes tan_lam_l to also change sign and hence the result of atan stored in sunSlopeGeom.longit_l to jump from just less than pi/2 to just more than -pi/2. The required value is pi more than this (which is another correct atan result as the tan plot repeats every pi radians). The fix detects this situation and adds pi to the result. I've done this addition in the rsunlib.c, lumcline2 function, as this is where the time offset is used. Also, there is a possibility of a divide by zero error if q1 is zero. This fix also corrects this.
Co-authored-by: Anna Petrasova <kratochanna at gmail.com>
More information about the grass-commit
mailing list