[GRASS-SVN] r55187 - grass/trunk/raster/r.sun
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Feb 25 00:22:45 PST 2013
Author: hamish
Date: 2013-02-25 00:22:45 -0800 (Mon, 25 Feb 2013)
New Revision: 55187
Modified:
grass/trunk/raster/r.sun/main.c
grass/trunk/raster/r.sun/r.sun.html
Log:
invert shading flag (#1241), g7ize various option names with underscores
Modified: grass/trunk/raster/r.sun/main.c
===================================================================
--- grass/trunk/raster/r.sun/main.c 2013-02-24 18:10:37 UTC (rev 55186)
+++ grass/trunk/raster/r.sun/main.c 2013-02-25 08:22:45 UTC (rev 55187)
@@ -7,6 +7,7 @@
(C) 2002 Copyright Jaro Hofierka, Gresaka 22, 085 01 Bardejov, Slovakia,
and GeoModel, s.r.o., Bratislava, Slovakia
email: hofierka at geomodel.sk,marcel.suri at jrc.it,suri at geomodel.sk Thomas.Huld at jrc.it
+(c) 2003-2013 by The GRASS Development Team
*******************************************************************************/
/*
* This program is free software; you can redistribute it and/or
@@ -88,7 +89,6 @@
const char *glob_rad = NULL;
const char *mapset = NULL;
const char *per;
-const char *shade;
struct Cell_head cellhd;
struct pj_info iproj;
@@ -216,7 +216,7 @@
struct
{
- struct Flag *shade, *saveMemory;
+ struct Flag *noshade, *saveMemory;
}
flag;
@@ -240,7 +240,7 @@
"the topography is optionally incorporated.");
parm.elevin = G_define_option();
- parm.elevin->key = "elevin";
+ parm.elevin->key = "elev_in";
parm.elevin->type = TYPE_STRING;
parm.elevin->required = YES;
parm.elevin->gisprompt = "old,cell,raster";
@@ -249,7 +249,7 @@
parm.elevin->guisection = _("Input options");
parm.aspin = G_define_option();
- parm.aspin->key = "aspin";
+ parm.aspin->key = "asp_in";
parm.aspin->type = TYPE_STRING;
parm.aspin->required = NO;
parm.aspin->gisprompt = "old,cell,raster";
@@ -267,7 +267,7 @@
parm.aspect->guisection = _("Input options");
parm.slopein = G_define_option();
- parm.slopein->key = "slopein";
+ parm.slopein->key = "slope_in";
parm.slopein->type = TYPE_STRING;
parm.slopein->required = NO;
parm.slopein->gisprompt = "old,cell,raster";
@@ -284,7 +284,7 @@
parm.slope->guisection = _("Input options");
parm.linkein = G_define_option();
- parm.linkein->key = "linkein";
+ parm.linkein->key = "linke_in";
parm.linkein->type = TYPE_STRING;
parm.linkein->required = NO;
parm.linkein->gisprompt = "old,cell,raster";
@@ -324,7 +324,7 @@
}
parm.latin = G_define_option();
- parm.latin->key = "latin";
+ parm.latin->key = "lat_in";
parm.latin->type = TYPE_STRING;
parm.latin->required = NO;
parm.latin->gisprompt = "old,cell,raster";
@@ -333,7 +333,7 @@
parm.latin->guisection = _("Input options");
parm.longin = G_define_option();
- parm.longin->key = "longin";
+ parm.longin->key = "long_in";
parm.longin->type = TYPE_STRING;
parm.longin->required = NO;
parm.longin->gisprompt = "old,cell,raster";
@@ -342,7 +342,7 @@
parm.longin->guisection = _("Input options");
parm.coefbh = G_define_option();
- parm.coefbh->key = "coefbh";
+ parm.coefbh->key = "coef_bh";
parm.coefbh->type = TYPE_STRING;
parm.coefbh->required = NO;
parm.coefbh->gisprompt = "old,cell,raster";
@@ -351,7 +351,7 @@
parm.coefbh->guisection = _("Input options");
parm.coefdh = G_define_option();
- parm.coefdh->key = "coefdh";
+ parm.coefdh->key = "coef_dh";
parm.coefdh->type = TYPE_STRING;
parm.coefdh->required = NO;
parm.coefdh->gisprompt = "old,cell,raster";
@@ -368,7 +368,7 @@
parm.horizon->guisection = _("Input options");
parm.horizonstep = G_define_option();
- parm.horizonstep->key = "horizonstep";
+ parm.horizonstep->key = "horizon_step";
parm.horizonstep->type = TYPE_DOUBLE;
parm.horizonstep->required = NO;
parm.horizonstep->description =
@@ -445,7 +445,7 @@
_("Time step when computing all-day radiation sums [decimal hours]");
parm.declin = G_define_option();
- parm.declin->key = "declin";
+ parm.declin->key = "declination";
parm.declin->type = TYPE_DOUBLE;
parm.declin->required = NO;
parm.declin->description =
@@ -462,20 +462,20 @@
/*
* parm.startTime = G_define_option();
- * parm.startTime->key = "starttime";
+ * parm.startTime->key = "start_time";
* parm.startTime->type = TYPE_DOUBLE;
* parm.startTime->required = NO;
* parm.startTime->description = _("Starting time for calculating results for several different times.");
*
* parm.endTime = G_define_option();
- * parm.endTime->key = "endtime";
+ * parm.endTime->key = "end_time";
* parm.endTime->type = TYPE_DOUBLE;
* parm.endTime->required = NO;
* parm.endTime->description = _("End time for calculating results for several different times.)";
*/
parm.dist = G_define_option();
- parm.dist->key = "dist";
+ parm.dist->key = "distance_step";
parm.dist->type = TYPE_DOUBLE;
parm.dist->answer = DIST;
parm.dist->required = NO;
@@ -483,7 +483,7 @@
_("Sampling distance step coefficient (0.5-1.5)");
parm.numPartitions = G_define_option();
- parm.numPartitions->key = "numpartitions";
+ parm.numPartitions->key = "num_partitions";
parm.numPartitions->type = TYPE_INTEGER;
parm.numPartitions->answer = NUM_PARTITIONS;
parm.numPartitions->required = NO;
@@ -491,17 +491,17 @@
_("Read the input files in this number of chunks");
parm.civilTime = G_define_option();
- parm.civilTime->key = "civiltime";
+ parm.civilTime->key = "civil_time";
parm.civilTime->type = TYPE_DOUBLE;
parm.civilTime->required = NO;
parm.civilTime->description =
_("Civil time zone value, if none, the time will be local solar time");
- flag.shade = G_define_flag();
- flag.shade->key = 's';
- flag.shade->description =
- _("Incorporate the shadowing effect of terrain");
+ flag.noshade = G_define_flag();
+ flag.noshade->key = 'p';
+ flag.noshade->description =
+ _("Do not incorporate the shadowing effect of terrain");
flag.saveMemory = G_define_flag();
flag.saveMemory->key = 'm';
@@ -528,14 +528,8 @@
gridGeom.deltx = fabs(cellhd.east - cellhd.west);
gridGeom.delty = fabs(cellhd.north - cellhd.south);
- setUseShadow(flag.shade->answer);
+ setUseShadow(!flag.noshade->answer);
- /*
- * if(shd)
- * {
- *
- * }
- */
saveMemory = flag.saveMemory->answer;
elevin = parm.elevin->answer;
Modified: grass/trunk/raster/r.sun/r.sun.html
===================================================================
--- grass/trunk/raster/r.sun/r.sun.html 2013-02-24 18:10:37 UTC (rev 55186)
+++ grass/trunk/raster/r.sun/r.sun.html 2013-02-25 08:22:45 UTC (rev 55187)
@@ -43,14 +43,15 @@
parameters are saved in the resultant maps' history files, which may be viewed
with the <a href="r.info.html">r.info</a> command.
-<p>The solar incidence angle raster map <i>incidout</i> is computed specifying
-elevation raster map <i>elevin</i>, aspect raster map <i>aspin</i>, slope
-steepness raster map <i>slopin,</i> given the day <i>day</i> and local time
+<p>
+The solar incidence angle raster map <i>incidout</i> is computed specifying
+elevation raster map <i>elev_in</i>, aspect raster map <i>asp_in</i>, slope
+steepness raster map <i>slope_in,</i> given the day <i>day</i> and local time
<i>time</i>. There is no need to define latitude for locations with known
and defined projection/coordinate system (check it with the <a href="g.proj.html">
g.proj</a>
command). If you have undefined projection, (x,y) system, etc. then the latitude
-can be defined explicitly for large areas by input raster map <i>latin</i>
+can be defined explicitly for large areas by input raster map <i>lat_in</i>
with interpolated latitude values. All input raster maps must
be floating point (FCELL) raster maps. Null data in maps are excluded from
the computation (and also speeding-up the computation), so each output raster
@@ -61,23 +62,28 @@
where January 1 is day no.1 and December 31 is 365. Time <i>time</i> must
be a local (solar) time (i.e. NOT a zone time, e.g. GMT, CET) in decimal system,
e.g. 7.5 (= 7h 30m A.M.), 16.1 = 4h 6m P.M..
-<p>Setting the solar declination <i>declin</i> by user is an option to override
+
+<p>
+The solar <i>declination</i> parameter is an option to override
the value computed by the internal routine for the day of the year. The value
of geographical latitude can be set as a constant for the whole computed
region or, as an option, a grid representing spatially distributed values
over a large region. The geographical latitude must be also in decimal system
with positive values for northern hemisphere and negative for southern one.
-In similar principle the Linke turbidity factor (<i>linkein</i>, <i>lin</i>
+In similar principle the Linke turbidity factor (<i>linke_in</i>, <i>lin</i>
) and ground albedo (<i>albedo</i>, <i>alb</i>) can be set.
<p>Besides clear-sky radiations, the user can compute a real-sky radiation (beam,
-diffuse) using <i>coefbh</i> and <i>coefdh </i>input raster maps defining
+diffuse) using <i>coef_bh</i> and <i>coef_dh</i> input raster maps defining
the fraction of the respective clear-sky radiations reduced by atmospheric
factors (e.g. cloudiness). The value is between 0-1. Usually these
coefficients can be obtained from a long-terms meteorological measurements
provided as raster maps with spatial distribution of these coefficients separately
-for beam and diffuse radiation (see Suri and Hofierka, 2004, section 3.2).<p>The solar irradiation or irradiance raster maps <i>beam_rad</i>, <i>diff_rad</i>,
-<i>refl_rad</i> are computed for a given day <i>day,</i> latitude <i>latin</i>,
-elevation <i>elevin</i>, slope <i>slopein</i> and aspect <i>aspin</i> raster maps.
+for beam and diffuse radiation (see Suri and Hofierka, 2004, section 3.2).
+
+<p>
+The solar irradiation or irradiance raster maps <i>beam_rad</i>, <i>diff_rad</i>,
+<i>refl_rad</i> are computed for a given day <i>day,</i> latitude <i>lat_in</i>,
+elevation <i>elev_in</i>, slope <i>slope_in</i> and aspect <i>asp_in</i> raster maps.
For convenience, the output raster given as <i>glob_rad</i>
will output the sum of the three radiation components. The program uses
the Linke atmosphere turbidity factor and ground albedo coefficient.
@@ -86,6 +92,7 @@
factor for an absolutely clear atmosphere is <i>lin</i>=1.0. See notes below
to learn more about this factor. The incidence solar angle is the angle between
horizon and solar beam vector.
+
<p>
The solar radiation maps for a given day are computed by integrating the
relevant irradiance between sunrise and sunset times for that day. The
@@ -100,30 +107,34 @@
to every 3 minutes. Of course setting the time step to be very fine
proportionally increases the module's running time.
<p>The output units are in Wh per squared meter per given
-day [Wh/(m*m)/day]. The incidence angle and irradiance/irradiation maps can
-be computed without shadowing influence of relief by default or they can
-be computed with this influence using the flag <i>-s</i>. In mountainous areas
-this can lead to very different results! The user should be aware that taken
-into account the shadowing effect of relief can slow
-down the speed of computing especially when the sun altitude is low.
- When considering shadowing effect (flag <i>-s</i>) speed and precision computing
-can be controlled by a parameter <i>dist</i> which defines the sampling density
+day [Wh/(m*m)/day]. The incidence angle and irradiance/irradiation maps are
+computed with the shadowing influence of relief by default. It is also possible
+for them to be computed without this influence using the planar flag (<i>-p</i>).
+In mountainous areas this can lead to very different results! The user should be
+aware that taking into account the shadowing effect of relief can slow
+down the speed of computation, especially when the sun altitude is low.
+
+<p>
+When considering the shadowing effect, speed and precision of computation
+can be controlled by the <i>distance_step</i> parameter, which defines the sampling density
at which the visibility of a grid cell is computed in the direction of a
path of the solar flow. It also defines the method by which the obstacle's
-altitude is computed. When choosing <i>dist</i> less than 1.0 (i.e. sampling
-points will be computed at <i>dist</i> * cellsize distance), r.sun takes
-altitude from the nearest grid point. Values above 1.0 will use the maximum
+altitude is computed. When choosing a <i>distance_step</i> less than 1.0 (i.e. sampling
+points will be computed at <i>distance_step</i> * cellsize distance), <em>r.sun</em> takes
+the altitude from the nearest grid point. Values above 1.0 will use the maximum
altitude value found in the nearest 4 surrounding grid points. The default
-value <i>dist</i>=1.0 should give reasonable results for most cases (e.g.
-on DEM). <i>Dist</i> value defines a multiplying coefficient for sampling
+value <i>distance_step</i>=1.0 should give reasonable results for most cases (e.g.
+on DEM). The <i>distance_step</i> value defines a multiplying coefficient for sampling
distance. This basic sampling distance equals to the arithmetic average of
both cell sizes. The reasonable values are in the range 0.5-1.5. The values
below 0.5 will decrease and values above 1.0 will increase the computing
speed. Values greater than 2.0 may produce estimates with lower accuracy
in highly dissected relief. The fully shadowed areas are written to the output
maps as zero values. Areas with NULL data are considered as no barrier with
-shadowing effect .
-<p>The maps' history files are generated containing the following listed
+shadowing effect.
+
+<p>
+The maps' history files are generated containing the following listed
parameters used in the computation: <br>
- Solar constant 1367 W.m-2 <br>
- Extraterrestrial irradiance on a plane perpendicular to the solar beam [W.m-2] <br>
@@ -194,13 +205,13 @@
On top of this, the offset varies during the year according to the Equation
of Time.
<p>
-To overcome this problem, the user can use the option <em>civiltime=<timezone_offset></em>
+To overcome this problem, the user can use the option <em>civil_time=<timezone_offset></em>
in r.sun to make it use real-world (wall clock) time. For example, for Central
Europe the timezone offset is +1, +2 when daylight saving time is in effect.
<p>
<!-- WE DON'T KNOW, check source code:
-If the user use the <em>civiltime</em> parameter, also the longitude needs to
-be supplied as a raster map with the <em>longin</em> parameter. Within a
+If the user use the <em>civil_time</em> parameter, also the longitude needs to
+be supplied as a raster map with the <em>long_in</em> parameter. Within a
latlon location, such a map can be easily made with:
<div class="code"><pre>
@@ -212,18 +223,18 @@
<h3>Shadow maps</h3>
A map of shadows can be extracted from the solar incidence angle map
-(incidout). Areas with zero values are shadowed. The <em>-s</em> flag
-has to be used.
+(incidout). Areas with zero values are shadowed. This will not work
+if the <em>-p</em> flag has been used.
<h3>Large maps and out of memory problems</h3>
With a large number or columns and rows, <b>r.sun</b> can consume
significant amount of memory. While output raster maps are not
-partitionable, the input raster maps are using the <em>numpartitions</em>
+partitionable, the input raster maps are using the <em>num_partitions</em>
parameter.
In case of out of memory error (<tt>ERROR: G_malloc: out of memory</tt>), the
-<em>numpartitions</em> parameter can be used to run a segmented calculation
+<em>num_partitions</em> parameter can be used to run a segmented calculation
which consumes less memory during the computations.
The amount of memory by <b>r.sun</b> is estimated as follows:
@@ -234,10 +245,10 @@
# rows,cols: rows and columns of current region (find out with g.region)
# IR: number of input raster maps without horizon maps
# OR: number of output raster maps
-memory_bytes = rows*cols*(IR*4 + horizonsteps + OR*4)
+memory_bytes = rows*cols*(IR*4 + horizon_steps + OR*4)
# with input raster map partitioning:
-memory_bytes = rows*cols*((IR*4+horizonsteps)/numpartitions + OR*4)
+memory_bytes = rows*cols*((IR*4+horizon_steps)/num_partitions + OR*4)
</pre></div>
<h2>EXAMPLES</h2>
@@ -248,14 +259,14 @@
# calculate horizons
# (we put a bufferzone of 10% of maxdistance around the study area)
-r.horizon elevin=elevation.dem horizonstep=30 bufferzone=200 horizon=horangle dist=0.7 maxdistance=2000
+r.horizon elev_in=elevation.dem horizon_step=30 bufferzone=200 horizon=horangle distance_step=0.7 maxdistance=2000
# slope + aspect
r.slope.aspect elevation=elevation.dem aspect=aspect.dem slope=slope.dem
# calculate global radiation for day 180 at 14:00hs
-r.sun -s elevation.dem horizon=horangle horizonstep=30 aspin=aspect.dem \
- slopein=slope.dem glob_rad=global_rad day=180 time=14
+r.sun elevation.dem horizon=horangle horizon_step=30 asp_in=aspect.dem \
+ slope_in=slope.dem glob_rad=global_rad day=180 time=14
</pre></div>
<p>
@@ -267,8 +278,8 @@
<div class="code"><pre>
g.region rast=elev_ned_30m -p
-# considering cast shadows (-s)
-r.sun -s elev_ned_30m lin=2.5 alb=0.2 day=172 \
+# considering cast shadows
+r.sun elev_ned_30m lin=2.5 alb=0.2 day=172 \
beam_rad=b172 diff_rad=d172 \
refl_rad=r172 insol_time=it172
More information about the grass-commit
mailing list