[GRASS-SVN] r35660 - grass/trunk/raster/r.sun2

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 27 15:37:18 EST 2009


Author: neteler
Date: 2009-01-27 15:37:18 -0500 (Tue, 27 Jan 2009)
New Revision: 35660

Modified:
   grass/trunk/raster/r.sun2/main.c
Log:
i18n; reduced vertical space in code

Modified: grass/trunk/raster/r.sun2/main.c
===================================================================
--- grass/trunk/raster/r.sun2/main.c	2009-01-27 16:43:11 UTC (rev 35659)
+++ grass/trunk/raster/r.sun2/main.c	2009-01-27 20:37:18 UTC (rev 35660)
@@ -190,8 +190,6 @@
 
 
 
-
-
 int main(int argc, char *argv[])
 {
     double singleSlope;
@@ -741,8 +739,9 @@
 	ll_correction = 1;
     }
 
-
+    G_debug(3, "calculate starts...");
     calculate(singleSlope, singleAspect, singleAlbedo, singleLinke, gridGeom);
+    G_debug(3, "OUTGR starts...");
     OUTGR();
 
     return 1;
@@ -788,10 +787,9 @@
 
 
     if ((mapset = G_find_cell2(elevin, "")) == NULL)
-	G_fatal_error("Elevation raster file not found");
+	G_fatal_error(_("Raster map <%s> not found"),elevin);
 
 
-
     fd1 = G_open_cell_old(elevin, mapset);
 
     if (slopein != NULL) {
@@ -802,7 +800,6 @@
 	    for (l = 0; l < numRows; l++) {
 		s[l] = (float *)G_malloc(sizeof(float) * (n));
 	    }
-
 	}
 	if ((mapset = G_find_cell2(slopein, "")) == NULL)
 	       G_fatal_error(_("Raster map <%s> not found"),slopein);
@@ -827,7 +824,6 @@
 
     }
 
-
     if (linkein != NULL) {
 	cell4 = G_allocate_f_raster_buf();
 	if (li == NULL) {
@@ -838,7 +834,6 @@
 	}
 	if ((mapset = G_find_cell2(linkein, "")) == NULL)
 	    G_fatal_error(_("Raster map <%s> not found"),linkein);
-
 	fd4 = G_open_cell_old(linkein, mapset);
     }
 
@@ -851,7 +846,6 @@
 	}
 	if ((mapset = G_find_cell2(albedo, "")) == NULL)
 	    G_fatal_error(_("Raster map <%s> not found"),albedo);
-
 	fd5 = G_open_cell_old(albedo, mapset);
     }
 
@@ -864,7 +858,6 @@
 	}
 	if ((mapset = G_find_cell2(latin, "")) == NULL)
 	    G_fatal_error(_("Raster map <%s> not found"),latin);
-
 	fd6 = G_open_cell_old(latin, mapset);
     }
 
@@ -876,15 +869,11 @@
 
 	if ((mapset = G_find_cell2(longin, "")) == NULL)
 	    G_fatal_error(_("Raster map <%s> not found"),longin);
-
 	fd7 = G_open_cell_old(longin, mapset);
     }
 
-
-
     if (coefbh != NULL) {
 	rast1 = G_allocate_f_raster_buf();
-
 	if (cbhr == NULL) {
 	    cbhr = (float **)G_malloc(sizeof(float *) * (numRows));
 	    for (l = 0; l < numRows; l++)
@@ -892,7 +881,6 @@
 	}
 	if ((mapset = G_find_cell2(coefbh, "")) == NULL)
 	    G_fatal_error(_("Raster map <%s> not found"),coefbh);
-
 	fr1 = G_open_cell_old(coefbh, mapset);
     }
 
@@ -905,13 +893,9 @@
 	}
 	if ((mapset = G_find_cell2(coefdh, "")) == NULL)
 	    G_fatal_error(_("Raster map <%s> not found"),coefdh);
-
 	fr2 = G_open_cell_old(coefdh, mapset);
     }
 
-
-
-
     if (useHorizonData()) {
 	if (horizonarray == NULL) {
 	    horizonarray =
@@ -942,7 +926,6 @@
 	    sprintf(shad_filename, formatString, horizon, i);
 	    if ((mapset = G_find_cell2(shad_filename, "")) == NULL)
 		G_fatal_error(_("Horizon file no. %d <%s> not found"), i, shad_filename);
-
 	    fd_shad[i] = G_open_cell_old(shad_filename, mapset);
 	}
     }
@@ -952,7 +935,6 @@
 
     if (useHorizonData()) {
 
-
 	for (i = 0; i < arrayNumInt; i++) {
 	    for (row = m - offset - 1; row >= finalRow; row--) {
 
@@ -966,7 +948,6 @@
 						    AMIN1(horizonbuf[i][j],
 							  256 * invScale)));
 		    horizonpointer += arrayNumInt;
-
 		}
 	    }
 	}
@@ -975,7 +956,6 @@
     }
 
 
-
     for (row = m - offset - 1; row >= finalRow; row--) {
 	G_get_f_raster_row(fd1, cell1, row);
 	if (aspin != NULL)
@@ -995,8 +975,6 @@
 	if (coefdh != NULL)
 	    G_get_f_raster_row(fr2, rast2, row);
 
-
-
 	row_rev = m - row - 1;
 	rowrevoffset = row_rev - offset;
 
@@ -1060,11 +1038,6 @@
 		else
 		    cdhr[rowrevoffset][j] = UNDEFZ;
 	    }
-
-
-
-
-
 	}
     }
 
@@ -1230,7 +1203,6 @@
 		    G_set_f_null_value(cell8 + j, 1);
 		else
 		    cell8[j] = (FCELL) beam[i][j];
-
 	    }
 	    G_put_f_raster_row(fd8, cell8);
 	}
@@ -1241,7 +1213,6 @@
 		    G_set_f_null_value(cell12 + j, 1);
 		else
 		    cell12[j] = (FCELL) globrad[i][j];
-
 	    }
 	    G_put_f_raster_row(fd12, cell12);
 	}
@@ -1308,41 +1279,9 @@
     return 1;
 }
 
-/*  min(), max() are unused
- * int min(arg1, arg2)
- * int arg1;
- * int arg2;
- * {
- * int res;
- * if (arg1 <= arg2) {
- * res = arg1;
- * }
- * else {
- * res = arg2;
- * }
- * return res;
- * }
- * 
- * int max(arg1, arg2)
- * int arg1;
- * int arg2;
- * {
- * int res;
- * if (arg1 >= arg2) {
- * res = arg1;
- * }
- * else {
- * res = arg2;
- * }
- * return res;
- * }
- */
 
-
-
 /**********************************************************/
 
-
 void joules2(struct SunGeometryConstDay *sunGeom,
 	     struct SunGeometryVarDay *sunVarGeom,
 	     struct SunGeometryVarSlope *sunSlopeGeom,
@@ -1410,16 +1349,12 @@
 	firstAngle = (firstTime - 12) * HOURANGLE;
 	lastAngle = (sunGeom->sunset_time - 12) * HOURANGLE;
 
-
-
-
 	dfr_rad = step * HOURANGLE;
 
 	sunGeom->timeAngle = firstAngle;
 
 	varCount_global = 0;
 
-
 	dfr = step;
 
 	while (ss == 1) {
@@ -1468,8 +1403,6 @@
 /*////////////////////////////////////////////////////////////////////// */
 
 
-
-
 /*
  * void where_is_point(void)
  * {
@@ -1813,7 +1746,6 @@
 
     numRows = m / numPartitions;
 
-
     if (useCivilTime()) {
 	/* We need to calculate the deviation of the local solar time from the 
 	 * "local clock time". */
@@ -1828,11 +1760,8 @@
     }
     else {
 	setTimeOffset(0.);
-
     }
 
-
-
     for (j = 0; j < m; j++) {
 	G_percent(j, m - 1, 2);
 
@@ -1851,11 +1780,9 @@
 		longitTime = -longitArray[arrayOffset][i] / 15.;
 	    }
 
-
 	    gridGeom.xg0 = gridGeom.xx0 = (double)i *gridGeom.stepx;
 	    gridGeom.yg0 = gridGeom.yy0 = (double)j *gridGeom.stepy;
 
-
 	    gridGeom.xp = xmin + gridGeom.xx0;
 	    gridGeom.yp = ymin + gridGeom.yy0;
 



More information about the grass-commit mailing list