[GRASS-SVN] r34330 - in grass-addons/raster/r.sun_horizon:
r.horizon r.sun2
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Nov 16 07:05:02 EST 2008
Author: neteler
Date: 2008-11-16 07:05:02 -0500 (Sun, 16 Nov 2008)
New Revision: 34330
Modified:
grass-addons/raster/r.sun_horizon/r.horizon/main.c
grass-addons/raster/r.sun_horizon/r.sun2/description.html
grass-addons/raster/r.sun_horizon/r.sun2/main.c
Log:
cosmetics
Modified: grass-addons/raster/r.sun_horizon/r.horizon/main.c
===================================================================
--- grass-addons/raster/r.sun_horizon/r.horizon/main.c 2008-11-16 11:54:34 UTC (rev 34329)
+++ grass-addons/raster/r.sun_horizon/r.horizon/main.c 2008-11-16 12:05:02 UTC (rev 34330)
@@ -466,7 +466,7 @@
n /*n_cols */ = new_cellhd.cols;
m /*n_rows */ = new_cellhd.rows;
- /*printf("%lf %lf %lf %lf \n",ymax, ymin, xmin,xmax);
+ /*G_debug(3,"%lf %lf %lf %lf \n",ymax, ymin, xmin,xmax);
*/
n100 = ceil(n / 100.);
m100 = ceil(m / 100.);
@@ -587,7 +587,7 @@
}
}
z100[i][j] = zmax;
- //printf("%d %d %lf\n", i, j, z100[i][j]);
+ /* G_debug(3,"%d %d %lf\n", i, j, z100[i][j]); */
}
}
@@ -863,7 +863,7 @@
else if (printangle >= 360.)
printangle -= 360;
- printf("%lf, %lf\n", printangle, shadow_angle);
+ G_message("%lf, %lf", printangle, shadow_angle);
angle += dfr_rad;
@@ -931,14 +931,14 @@
jp100 = floor(jp / 100.);
/*test the new position with low resolution */
if ((ip100 != iold100) || (jp100 != jold100)) {
- //printf("%d %d %d %d\n",ip,jp, iold100,jold100);
+ /* G_debug(3,"%d %d %d %d\n",ip,jp, iold100,jold100); */
/* replace with approximate version
curvature_diff = EARTHRADIUS*(1.-cos(length/EARTHRADIUS));
*/
curvature_diff = 0.5 * length * length * invEarth;
z2 = z_orig + curvature_diff + length * tanh0;
zp100 = z100[jp100][ip100];
- //printf("%d %d %lf %lf \n",ip,jp,z2,zp100);
+ /*G_debug(3,"%d %d %lf %lf \n",ip,jp,z2,zp100); */
if (zp100 <= z2)
/*skip to the next lowres cell */
@@ -971,11 +971,11 @@
}
mindel = min(delx, dely);
- //printf("%d %d %d %lf %lf\n",ip, jp, mindel,xg0, yg0);
+ /*G_debug(3,"%d %d %d %lf %lf\n",ip, jp, mindel,xg0, yg0);*/
yy0 = yy0 + (mindel * stepsinangle);
xx0 = xx0 + (mindel * stepcosangle);
- //printf(" %lf %lf\n",xx0,yy0);
+ /*G_debug(3," %lf %lf\n",xx0,yy0);*/
return (3);
}
@@ -1141,7 +1141,7 @@
/*
com_par(angle);
*/
- printf("%01d from %01d angle %lf %s\n", (k + 1), arrayNumInt,
+ G_message(_("Calculating map %01d of %01d (angle %lf, raster map <%s>)"), (k + 1), arrayNumInt,
angle * rad2deg, shad_filename);
for (j = hor_row_start; j < hor_row_end; j++) {
@@ -1229,7 +1229,7 @@
fixedMaxLength) ? maxlength : fixedMaxLength;
if (z_orig != UNDEFZ) {
- /*printf("**************new line %d %d\n", i, j);
+ /*G_debug(3,"**************new line %d %d\n", i, j);
*/
shadow_angle = horizon_height();
if (degreeOutput) {
@@ -1239,7 +1239,7 @@
/*
if((j==1400)&&(i==1400))
{
- printf("coordinates=%f,%f, raster no. %d, horizon=%f\n",
+ G_debug(3, "coordinates=%f,%f, raster no. %d, horizon=%f\n",
xp, yp, k, shadow_angle);
}
*/
Modified: grass-addons/raster/r.sun_horizon/r.sun2/description.html
===================================================================
--- grass-addons/raster/r.sun_horizon/r.sun2/description.html 2008-11-16 11:54:34 UTC (rev 34329)
+++ grass-addons/raster/r.sun_horizon/r.sun2/description.html 2008-11-16 12:05:02 UTC (rev 34330)
@@ -192,18 +192,18 @@
Spearfish example (considering also cast shadows):
<div class="code"><pre>
-g.region rast=elevation.10m -p
+g.region rast=elevation.dem -p
# calculate horizons
# (we put a bufferzone of 10% of maxdistance around the study area)
-r.horizon elevin=elevation.10m step=30 bufferzone=200 horizon=horangle dist=0.7 maxdistance=2000
+r.horizon elevin=elevation.dem step=30 bufferzone=200 horizon=horangle dist=0.7 maxdistance=2000
# slope + aspect
-r.slope.aspect elevation=elevation.10m aspect=aspect.10m slope=slope.10m
+r.slope.aspect elevation=elevation.dem aspect=aspect.dem slope=slope.dem
# calculate global radiation for day 180 at 14:00hs
-r.sun2 -s elevation.10m horizon=horangle horizonstep=30 aspin=aspect.10m \
- slopein=slope.10m glob_rad=global_rad day=180 time=14
+r.sun2 -s elevation.dem horizon=horangle horizonstep=30 aspin=aspect.dem \
+ slopein=slope.dem glob_rad=global_rad day=180 time=14
</pre></div>
<h2>SEE ALSO</h2>
Modified: grass-addons/raster/r.sun_horizon/r.sun2/main.c
===================================================================
--- grass-addons/raster/r.sun_horizon/r.sun2/main.c 2008-11-16 11:54:34 UTC (rev 34329)
+++ grass-addons/raster/r.sun_horizon/r.sun2/main.c 2008-11-16 12:05:02 UTC (rev 34330)
@@ -615,22 +615,12 @@
* time is not defined, and if the step size *is* defined. */
/*
* if(parm.step->answer==NULL)
- * {
- * printf("If you want to use a time interval you must also define a step size.\n");
- * exit(1);
- * }
+ * G_fatal_error("If you want to use a time interval you must also define a step size.");
* if(parm.ltime->answer!=NULL)
- * {
- * printf("If you want to use a time interval you can't define a single time value.\n");
- * exit(1);
- * }
+ * G_fatal_error("If you want to use a time interval you can't define a single time value.\n");
* if((parm.startTime->answer==NULL)||(parm.endTime->answer==NULL))
- * {
- * printf("If you want to use a time interval\n");
- * printf("both the start and end times must be defined.\n");
- * exit(1);
+ * G_fatal_error("If you want to use a time interval both the start and end times must be defined.\n");
* }
- * }
*/
if (parm.linkein->answer == NULL)
sscanf(parm.lin->answer, "%lf", &singleLinke);
@@ -816,7 +806,7 @@
}
if ((mapset = G_find_cell(slopein, "")) == NULL)
- printf("cell file not found\n");
+ G_fatal_error(_("Raster map <%s> not found"),slopein);
fd3 = G_open_cell_old(slopein, mapset);
}
@@ -833,7 +823,7 @@
}
if ((mapset = G_find_cell(aspin, "")) == NULL)
- printf("cell file not found\n");
+ G_fatal_error(_("Raster map <%s> not found"),aspin);
fd2 = G_open_cell_old(aspin, mapset);
}
@@ -848,7 +838,7 @@
}
if ((mapset = G_find_cell(linkein, "")) == NULL)
- printf("cell file not found\n");
+ G_fatal_error(_("Raster map <%s> not found"),linkein);
fd4 = G_open_cell_old(linkein, mapset);
}
@@ -861,7 +851,7 @@
a[l] = (float *)G_malloc(sizeof(float) * (n));
}
if ((mapset = G_find_cell(albedo, "")) == NULL)
- printf("cell file not found\n");
+ G_fatal_error(_("Raster map <%s> not found"),albedo);
fd5 = G_open_cell_old(albedo, mapset);
}
@@ -874,7 +864,7 @@
la[l] = (float *)G_malloc(sizeof(float) * (n));
}
if ((mapset = G_find_cell(latin, "")) == NULL)
- printf("cell file not found\n");
+ G_fatal_error(_("Raster map <%s> not found"),latin);
fd6 = G_open_cell_old(latin, mapset);
}
@@ -886,7 +876,7 @@
longitArray[l] = (float *)G_malloc(sizeof(float) * (n));
if ((mapset = G_find_cell(longin, "")) == NULL)
- printf("cell file not found\n");
+ G_fatal_error(_("Raster map <%s> not found"),longin);
fd7 = G_open_cell_old(longin, mapset);
}
@@ -902,7 +892,7 @@
cbhr[l] = (float *)G_malloc(sizeof(float) * (n));
}
if ((mapset = G_find_cell(coefbh, "")) == NULL)
- printf("cell file not found\n");
+ G_fatal_error(_("Raster map <%s> not found"),coefbh);
fr1 = G_open_cell_old(coefbh, mapset);
}
@@ -915,7 +905,7 @@
cdhr[l] = (float *)G_malloc(sizeof(float) * (n));
}
if ((mapset = G_find_cell(coefdh, "")) == NULL)
- printf("cell file not found\n");
+ G_fatal_error(_("Raster map <%s> not found"),coefdh);
fr2 = G_open_cell_old(coefdh, mapset);
}
@@ -939,7 +929,7 @@
* horizonbuf[0]=G_allocate_f_raster_buf();
* sprintf(shad_filename, "%s_%02d", horizon, arrayNumInt);
* if((mapset=G_find_cell(shad_filename,""))==NULL)
- * printf("Horizon file no. %d not found\n", arrayNumInt);
+ * G_message("Horizon file no. %d not found\n", arrayNumInt);
*
* fd_shad[0] = G_open_cell_old(shad_filename,mapset);
* }
@@ -1141,7 +1131,7 @@
else
o[i][j] = 450. - o[i][j];
}
- /* printf("o,z = %d %d i,j, %d %d \n", o[i][j],z[i][j],i,j); */
+ /* G_debug(3,"o,z = %d %d i,j, %d %d \n", o[i][j],z[i][j],i,j); */
if ((aspin != NULL) && o[i][j] == UNDEFZ)
z[i][j] = UNDEFZ;
@@ -1171,67 +1161,47 @@
NULL, *cell12 = NULL;
int fd7 = -1, fd8 = -1, fd9 = -1, fd10 = -1, fd11 = -1, fd12 = -1;
int i, iarc, j;
- char msg[100];
-
if (incidout != NULL) {
cell7 = G_allocate_f_raster_buf();
fd7 = G_open_fp_cell_new(incidout);
- if (fd7 < 0) {
- sprintf(msg, "unable to create raster map %s", incidout);
- G_fatal_error(msg);
- exit(1);
- }
+ if (fd7 < 0)
+ G_fatal_error(_("Unable to create raster map <%s>"), incidout);
}
if (beam_rad != NULL) {
cell8 = G_allocate_f_raster_buf();
fd8 = G_open_fp_cell_new(beam_rad);
- if (fd8 < 0) {
- sprintf(msg, "unable to create raster map %s", beam_rad);
- G_fatal_error(msg);
- exit(1);
- }
+ if (fd8 < 0)
+ G_fatal_error(_("Unable to create raster map <%s>"), beam_rad);
}
if (insol_time != NULL) {
cell11 = G_allocate_f_raster_buf();
fd11 = G_open_fp_cell_new(insol_time);
- if (fd11 < 0) {
- sprintf(msg, "unable to create raster map %s", insol_time);
- G_fatal_error(msg);
- exit(1);
- }
+ if (fd11 < 0)
+ G_fatal_error(_("Unable to create raster map <%s>"), insol_time);
}
if (diff_rad != NULL) {
cell9 = G_allocate_f_raster_buf();
fd9 = G_open_fp_cell_new(diff_rad);
- if (fd9 < 0) {
- sprintf(msg, "unable to create raster map %s", diff_rad);
- G_fatal_error(msg);
- exit(1);
- }
+ if (fd9 < 0)
+ G_fatal_error(_("Unable to create raster map <%s>"), diff_rad);
}
if (refl_rad != NULL) {
cell10 = G_allocate_f_raster_buf();
fd10 = G_open_fp_cell_new(refl_rad);
- if (fd10 < 0) {
- sprintf(msg, "unable to create raster map %s", refl_rad);
- G_fatal_error(msg);
- exit(1);
- }
+ if (fd10 < 0)
+ G_fatal_error(_("Unable to create raster map <%s>"), refl_rad);
}
if (glob_rad != NULL) {
cell12 = G_allocate_f_raster_buf();
fd12 = G_open_fp_cell_new(glob_rad);
- if (fd12 < 0) {
- sprintf(msg, "unable to create raster map %s", glob_rad);
- G_fatal_error(msg);
- exit(1);
- }
+ if (fd12 < 0)
+ G_fatal_error(_("Unable to create raster map <%s>"), glob_rad);
}
@@ -2008,7 +1978,7 @@
beam[j][i] = (float)beam_e;
if (insol_time != NULL)
insol[j][i] = (float)insol_t;
- /* printf("\n %f",insol[j][i]); */
+ /* G_debug(3,"\n %f",insol[j][i]); */
if (diff_rad != NULL)
diff[j][i] = (float)diff_e;
if (refl_rad != NULL)
@@ -2148,7 +2118,7 @@
d1 = pi2 * no_of_day / 365.25;
decl = asin(0.3978 * sin(d1 - 1.4 + 0.0355 * sin(d1 - 0.0489)));
decl = -decl;
- /* printf(" declination : %lf\n", decl); */
+ /* G_debug(3," declination : %lf\n", decl); */
return (decl);
}
@@ -2160,11 +2130,11 @@
/* not finshed yet */
int dej;
- printf("\n ddd: %f", declin);
+ G_message("\n ddd: %f", declin);
dej = asin(-declin / 0.4093) * 365. / pi2 + 81;
/* dej = asin(-declin/23.35 * deg2rad) / 0.9856 - 284; */
/* dej = dej - 365; */
- printf("\n d: %d ", dej);
+ G_message("\n d: %d ", dej);
if (dej < day - 5 || dej > day + 5)
return 0;
else
More information about the grass-commit
mailing list