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

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


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

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

Modified: grass/branches/develbranch_6/raster/r.sun2/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.sun2/main.c	2009-01-27 20:37:18 UTC (rev 35660)
+++ grass/branches/develbranch_6/raster/r.sun2/main.c	2009-01-27 20:37:39 UTC (rev 35661)
@@ -191,8 +191,6 @@
 
 
 
-
-
 int main(int argc, char *argv[])
 {
     double singleSlope;
@@ -742,8 +740,9 @@
 	ll_correction = 1;
     }
 
-
+    G_debug(3, "calculate starts...");
     calculate(singleSlope, singleAspect, singleAlbedo, singleLinke, gridGeom);
+    G_debug(3, "OUTGR starts...");
     OUTGR();
 
     return 1;
@@ -789,10 +788,7 @@
 
 
     if ((mapset = G_find_cell(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) {
@@ -803,7 +799,6 @@
 	    for (l = 0; l < numRows; l++) {
 		s[l] = (float *)G_malloc(sizeof(float) * (n));
 	    }
-
 	}
 	if ((mapset = G_find_cell(slopein, "")) == NULL)
 	       G_fatal_error(_("Raster map <%s> not found"),slopein);
@@ -828,7 +823,6 @@
 
     }
 
-
     if (linkein != NULL) {
 	cell4 = G_allocate_f_raster_buf();
 	if (li == NULL) {
@@ -839,7 +833,6 @@
 	}
 	if ((mapset = G_find_cell(linkein, "")) == NULL)
 	    G_fatal_error(_("Raster map <%s> not found"),linkein);
-
 	fd4 = G_open_cell_old(linkein, mapset);
     }
 
@@ -852,7 +845,6 @@
 	}
 	if ((mapset = G_find_cell(albedo, "")) == NULL)
 	    G_fatal_error(_("Raster map <%s> not found"),albedo);
-
 	fd5 = G_open_cell_old(albedo, mapset);
     }
 
@@ -865,7 +857,6 @@
 	}
 	if ((mapset = G_find_cell(latin, "")) == NULL)
 	    G_fatal_error(_("Raster map <%s> not found"),latin);
-
 	fd6 = G_open_cell_old(latin, mapset);
     }
 
@@ -877,15 +868,11 @@
 
 	if ((mapset = G_find_cell(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++)
@@ -893,7 +880,6 @@
 	}
 	if ((mapset = G_find_cell(coefbh, "")) == NULL)
 	    G_fatal_error(_("Raster map <%s> not found"),coefbh);
-
 	fr1 = G_open_cell_old(coefbh, mapset);
     }
 
@@ -906,13 +892,9 @@
 	}
 	if ((mapset = G_find_cell(coefdh, "")) == NULL)
 	    G_fatal_error(_("Raster map <%s> not found"),coefdh);
-
 	fr2 = G_open_cell_old(coefdh, mapset);
     }
 
-
-
-
     if (useHorizonData()) {
 	if (horizonarray == NULL) {
 	    horizonarray =
@@ -943,7 +925,6 @@
 	    sprintf(shad_filename, formatString, horizon, i);
 	    if ((mapset = G_find_cell(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);
 	}
     }
@@ -953,7 +934,6 @@
 
     if (useHorizonData()) {
 
-
 	for (i = 0; i < arrayNumInt; i++) {
 	    for (row = m - offset - 1; row >= finalRow; row--) {
 
@@ -967,7 +947,6 @@
 						    AMIN1(horizonbuf[i][j],
 							  256 * invScale)));
 		    horizonpointer += arrayNumInt;
-
 		}
 	    }
 	}
@@ -976,7 +955,6 @@
     }
 
 
-
     for (row = m - offset - 1; row >= finalRow; row--) {
 	G_get_f_raster_row(fd1, cell1, row);
 	if (aspin != NULL)
@@ -996,8 +974,6 @@
 	if (coefdh != NULL)
 	    G_get_f_raster_row(fr2, rast2, row);
 
-
-
 	row_rev = m - row - 1;
 	rowrevoffset = row_rev - offset;
 
@@ -1061,11 +1037,6 @@
 		else
 		    cdhr[rowrevoffset][j] = UNDEFZ;
 	    }
-
-
-
-
-
 	}
     }
 
@@ -1231,7 +1202,6 @@
 		    G_set_f_null_value(cell8 + j, 1);
 		else
 		    cell8[j] = (FCELL) beam[i][j];
-
 	    }
 	    G_put_f_raster_row(fd8, cell8);
 	}
@@ -1242,7 +1212,6 @@
 		    G_set_f_null_value(cell12 + j, 1);
 		else
 		    cell12[j] = (FCELL) globrad[i][j];
-
 	    }
 	    G_put_f_raster_row(fd12, cell12);
 	}
@@ -1309,41 +1278,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,
@@ -1411,16 +1348,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) {
@@ -1469,8 +1402,6 @@
 /*////////////////////////////////////////////////////////////////////// */
 
 
-
-
 /*
  * void where_is_point(void)
  * {
@@ -1814,7 +1745,6 @@
 
     numRows = m / numPartitions;
 
-
     if (useCivilTime()) {
 	/* We need to calculate the deviation of the local solar time from the 
 	 * "local clock time". */
@@ -1829,11 +1759,8 @@
     }
     else {
 	setTimeOffset(0.);
-
     }
 
-
-
     for (j = 0; j < m; j++) {
 	G_percent(j, m - 1, 2);
 
@@ -1852,11 +1779,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