[GRASS-SVN] r38181 - grass/branches/develbranch_6/raster/r.sun2

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jul 3 04:18:57 EDT 2009


Author: hamish
Date: 2009-07-03 04:18:57 -0400 (Fri, 03 Jul 2009)
New Revision: 38181

Modified:
   grass/branches/develbranch_6/raster/r.sun2/main.c
Log:
(Thomas Huld) Fixed problem with incidence angle being 0 when the sun isn't there. Now the value is null. Note that this is also the case if the pixel is in shadow.

Modified: grass/branches/develbranch_6/raster/r.sun2/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.sun2/main.c	2009-07-03 08:17:27 UTC (rev 38180)
+++ grass/branches/develbranch_6/raster/r.sun2/main.c	2009-07-03 08:18:57 UTC (rev 38181)
@@ -1922,9 +1922,13 @@
 		    lum =
 			lumcline2(&sunGeom, &sunVarGeom, &sunSlopeGeom,
 				  &gridGeom, horizonarray + shadowoffset);
-		    lum = rad2deg * asin(lum);
-		    lumcl[j][i] = (float)lum;
+		    if (lum > 0.) {
+			lum = rad2deg * asin(lum);
+			lumcl[j][i] = (float)lum;
+		    }
+		    else lumcl[j][i] = UNDEFZ;
 		}
+
 		if (someRadiation) {
 		    joules2(&sunGeom, &sunVarGeom, &sunSlopeGeom, &sunRadVar,
 			    &gridGeom, horizonarray + shadowoffset, latitude,
@@ -1946,7 +1950,6 @@
 	    shadowoffset += arrayNumInt;
 	}
 	arrayOffset++;
-
     }
 
     /* re-use &hist, but try all to initiate it for any case */



More information about the grass-commit mailing list