|
@@ -190,8 +190,6 @@ double distance(double x1, double x2, double y1, double y2)
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
int main(int argc, char *argv[])
|
|
|
{
|
|
|
double singleSlope;
|
|
@@ -741,8 +739,9 @@ int main(int argc, char *argv[])
|
|
|
ll_correction = 1;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ G_debug(3, "calculate starts...");
|
|
|
calculate(singleSlope, singleAspect, singleAlbedo, singleLinke, gridGeom);
|
|
|
+ G_debug(3, "OUTGR starts...");
|
|
|
OUTGR();
|
|
|
|
|
|
return 1;
|
|
@@ -788,8 +787,7 @@ int INPUT_part(int offset, double *zmax)
|
|
|
|
|
|
|
|
|
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);
|
|
@@ -802,7 +800,6 @@ int INPUT_part(int offset, double *zmax)
|
|
|
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 @@ int INPUT_part(int offset, double *zmax)
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (linkein != NULL) {
|
|
|
cell4 = G_allocate_f_raster_buf();
|
|
|
if (li == NULL) {
|
|
@@ -838,7 +834,6 @@ int INPUT_part(int offset, double *zmax)
|
|
|
}
|
|
|
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 @@ int INPUT_part(int offset, double *zmax)
|
|
|
}
|
|
|
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 @@ int INPUT_part(int offset, double *zmax)
|
|
|
}
|
|
|
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 @@ int INPUT_part(int offset, double *zmax)
|
|
|
|
|
|
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 @@ int INPUT_part(int offset, double *zmax)
|
|
|
}
|
|
|
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 @@ int INPUT_part(int offset, double *zmax)
|
|
|
}
|
|
|
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 @@ int INPUT_part(int offset, double *zmax)
|
|
|
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 @@ int INPUT_part(int offset, double *zmax)
|
|
|
|
|
|
if (useHorizonData()) {
|
|
|
|
|
|
-
|
|
|
for (i = 0; i < arrayNumInt; i++) {
|
|
|
for (row = m - offset - 1; row >= finalRow; row--) {
|
|
|
|
|
@@ -966,7 +948,6 @@ int INPUT_part(int offset, double *zmax)
|
|
|
AMIN1(horizonbuf[i][j],
|
|
|
256 * invScale)));
|
|
|
horizonpointer += arrayNumInt;
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -975,7 +956,6 @@ int INPUT_part(int offset, double *zmax)
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
for (row = m - offset - 1; row >= finalRow; row--) {
|
|
|
G_get_f_raster_row(fd1, cell1, row);
|
|
|
if (aspin != NULL)
|
|
@@ -995,8 +975,6 @@ int INPUT_part(int offset, double *zmax)
|
|
|
if (coefdh != NULL)
|
|
|
G_get_f_raster_row(fr2, rast2, row);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
row_rev = m - row - 1;
|
|
|
rowrevoffset = row_rev - offset;
|
|
|
|
|
@@ -1060,11 +1038,6 @@ int INPUT_part(int offset, double *zmax)
|
|
|
else
|
|
|
cdhr[rowrevoffset][j] = UNDEFZ;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1230,7 +1203,6 @@ int OUTGR(void)
|
|
|
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 @@ int OUTGR(void)
|
|
|
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 @@ int OUTGR(void)
|
|
|
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 @@ void joules2(struct SunGeometryConstDay *sunGeom,
|
|
|
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 joules2(struct SunGeometryConstDay *sunGeom,
|
|
|
/*////////////////////////////////////////////////////////////////////// */
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/*
|
|
|
* void where_is_point(void)
|
|
|
* {
|
|
@@ -1813,7 +1746,6 @@ void calculate(double singleSlope, double singleAspect, double singleAlbedo,
|
|
|
|
|
|
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 @@ void calculate(double singleSlope, double singleAspect, double singleAlbedo,
|
|
|
}
|
|
|
else {
|
|
|
setTimeOffset(0.);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
for (j = 0; j < m; j++) {
|
|
|
G_percent(j, m - 1, 2);
|
|
|
|
|
@@ -1851,11 +1780,9 @@ void calculate(double singleSlope, double singleAspect, double singleAlbedo,
|
|
|
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;
|
|
|
|