[GRASS-SVN] r53081 - grass-addons/grass7/raster/r.sun.angle
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Sep 4 04:41:54 PDT 2012
Author: mmetz
Date: 2012-09-04 04:41:54 -0700 (Tue, 04 Sep 2012)
New Revision: 53081
Added:
grass-addons/grass7/raster/r.sun.angle/r.sun.angle.html
Removed:
grass-addons/grass7/raster/r.sun.angle/description.html
Modified:
grass-addons/grass7/raster/r.sun.angle/Makefile
grass-addons/grass7/raster/r.sun.angle/main.c
Log:
r.sun.angle for GRASS 7
Modified: grass-addons/grass7/raster/r.sun.angle/Makefile
===================================================================
--- grass-addons/grass7/raster/r.sun.angle/Makefile 2012-09-04 11:19:19 UTC (rev 53080)
+++ grass-addons/grass7/raster/r.sun.angle/Makefile 2012-09-04 11:41:54 UTC (rev 53081)
@@ -2,8 +2,9 @@
PGM = r.sun.angle
-LIBES = $(GPROJLIB) $(GISLIB)
-DEPENDENCIES = $(GPROJDEP) $(GISDEP)
+LIBES = $(GPROJLIB) $(RASTERLIB) $(GISLIB)
+DEPENDENCIES = $(GPROJDEP) $(RASTERDEP) $(GISDEP)
+
EXTRA_INC = $(PROJINC)
include $(MODULE_TOPDIR)/include/Make/Module.make
Deleted: grass-addons/grass7/raster/r.sun.angle/description.html
===================================================================
--- grass-addons/grass7/raster/r.sun.angle/description.html 2012-09-04 11:19:19 UTC (rev 53080)
+++ grass-addons/grass7/raster/r.sun.angle/description.html 2012-09-04 11:41:54 UTC (rev 53081)
@@ -1,42 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>r.sun.angle</em> calculates sun elevation and sun azimuth angles for
-the given time of day and each grid cell in the current region.
-Additionally, the photoperiod (sunshine hours) can be calculated.
-
-<p>
-Sun elevation, height, height angle, or solar altitude angle is the
-angle in degrees between the horizon and a line that points from the
-site towards the centre of the sun.
-<p>
-The sun azimuth angle is here defined as the azimuth angle in degrees
-of the sun from due north in a clockwise direction.
-<p>
-The time used here is defined such that 12:00 (high noon) is the time
-when the sun has reached its highest point in the sky at the current site,
-unless the <em>-t</em> flag is used in which case time is interpreted as
-Greenwich standard time.
-<p>
-If a <em>sunhour</em> output map is specified, the module calculates
-sunshine hours for the given day. This option requires both Greenwhich
-standard time (<em>-t</em> flag) and the solpos algorithm of NREL
-(<em>-s</em> flag).
-
-<h2>EXAMPLES</h2>
-
-Calculate sun's elevation angle map for 2010-10-11 at 14:00h solar time:
-<div class="code"><pre>
-r.sun.angle elevation=sun_elev year=2010 month=10 day=11 hour=14 minute=00
-</pre></div>
-<p>
-
-Calculate photoperiod of day of year 1 (1st January) 2012
-<div class="code"><pre>
-r.sun.angle -s sunhour=photoperiod_doy_001 year=2012 day=1
-</pre></div>
-
-<h2>AUTHOR</h2>
-
-Markus Metz
-
-<p><i>Last changed: $Date$</i>
Modified: grass-addons/grass7/raster/r.sun.angle/main.c
===================================================================
--- grass-addons/grass7/raster/r.sun.angle/main.c 2012-09-04 11:19:19 UTC (rev 53080)
+++ grass-addons/grass7/raster/r.sun.angle/main.c 2012-09-04 11:41:54 UTC (rev 53081)
@@ -21,6 +21,7 @@
#include <string.h>
#include <math.h>
#include <grass/gis.h>
+#include <grass/raster.h>
#include <grass/gprojects.h>
#include <grass/glocale.h>
#include "solpos00.h"
@@ -66,7 +67,8 @@
G_gisinit(argv[0]);
module = G_define_module();
- module->keywords = _("raster");
+ G_add_keyword(_("raster"));
+ G_add_keyword(_("solar"));
module->label = _("Calculates solar elevation and azimuth.");
module->description = _("Solar elevation: the angle between the direction of the geometric center "
"of the sun's apparent disk and the (idealized) horizon. "
@@ -313,10 +315,10 @@
}
if (elev_name) {
- if ((elev_fd = G_open_raster_new(elev_name, FCELL_TYPE)) < 0)
+ if ((elev_fd = Rast_open_new(elev_name, FCELL_TYPE)) < 0)
G_fatal_error(_("Unable to create raster map <%s>"), elev_name);
- elevbuf = G_allocate_f_raster_buf();
+ elevbuf = Rast_allocate_f_buf();
}
else {
elevbuf = NULL;
@@ -324,10 +326,10 @@
}
if (azimuth_name) {
- if ((azimuth_fd = G_open_raster_new(azimuth_name, FCELL_TYPE)) < 0)
+ if ((azimuth_fd = Rast_open_new(azimuth_name, FCELL_TYPE)) < 0)
G_fatal_error(_("Unable to create raster map <%s>"), azimuth_name);
- azimuthbuf = G_allocate_f_raster_buf();
+ azimuthbuf = Rast_allocate_f_buf();
}
else {
azimuthbuf = NULL;
@@ -335,10 +337,10 @@
}
if (sunhour_name) {
- if ((sunhour_fd = G_open_raster_new(sunhour_name, FCELL_TYPE)) < 0)
+ if ((sunhour_fd = Rast_open_new(sunhour_name, FCELL_TYPE)) < 0)
G_fatal_error(_("Unable to create raster map <%s>"), sunhour_name);
- sunhourbuf = G_allocate_f_raster_buf();
+ sunhourbuf = Rast_allocate_f_buf();
}
else {
sunhourbuf = NULL;
@@ -355,8 +357,8 @@
G_message(_("Calculating solar azimuth..."));
}
- nrows = G_window_rows();
- ncols = G_window_cols();
+ nrows = Rast_window_rows();
+ ncols = Rast_window_cols();
ba2 = 6356752.3142 / 6378137.0;
ba2 = ba2 * ba2;
@@ -445,34 +447,34 @@
}
if (elev_name)
- G_put_f_raster_row(elev_fd, elevbuf);
+ Rast_put_f_row(elev_fd, elevbuf);
if (azimuth_name)
- G_put_f_raster_row(azimuth_fd, azimuthbuf);
+ Rast_put_f_row(azimuth_fd, azimuthbuf);
if (sunhour_name)
- G_put_f_raster_row(sunhour_fd, sunhourbuf);
+ Rast_put_f_row(sunhour_fd, sunhourbuf);
}
G_percent(1, 1, 2);
if (elev_name) {
- G_close_cell(elev_fd);
+ Rast_close(elev_fd);
/* writing history file */
- G_short_history(elev_name, "raster", &hist);
- G_command_history(&hist);
- G_write_history(elev_name, &hist);
+ Rast_short_history(elev_name, "raster", &hist);
+ Rast_command_history(&hist);
+ Rast_write_history(elev_name, &hist);
}
if (azimuth_name) {
- G_close_cell(azimuth_fd);
+ Rast_close(azimuth_fd);
/* writing history file */
- G_short_history(azimuth_name, "raster", &hist);
- G_command_history(&hist);
- G_write_history(azimuth_name, &hist);
+ Rast_short_history(azimuth_name, "raster", &hist);
+ Rast_command_history(&hist);
+ Rast_write_history(azimuth_name, &hist);
}
if (sunhour_name) {
- G_close_cell(sunhour_fd);
+ Rast_close(sunhour_fd);
/* writing history file */
- G_short_history(sunhour_name, "raster", &hist);
- G_command_history(&hist);
- G_write_history(sunhour_name, &hist);
+ Rast_short_history(sunhour_name, "raster", &hist);
+ Rast_command_history(&hist);
+ Rast_write_history(sunhour_name, &hist);
}
G_done_msg(" ");
Copied: grass-addons/grass7/raster/r.sun.angle/r.sun.angle.html (from rev 53080, grass-addons/grass7/raster/r.sun.angle/description.html)
===================================================================
--- grass-addons/grass7/raster/r.sun.angle/r.sun.angle.html (rev 0)
+++ grass-addons/grass7/raster/r.sun.angle/r.sun.angle.html 2012-09-04 11:41:54 UTC (rev 53081)
@@ -0,0 +1,42 @@
+<h2>DESCRIPTION</h2>
+
+<em>r.sun.angle</em> calculates sun elevation and sun azimuth angles for
+the given time of day and each grid cell in the current region.
+Additionally, the photoperiod (sunshine hours) can be calculated.
+
+<p>
+Sun elevation, height, height angle, or solar altitude angle is the
+angle in degrees between the horizon and a line that points from the
+site towards the centre of the sun.
+<p>
+The sun azimuth angle is here defined as the azimuth angle in degrees
+of the sun from due north in a clockwise direction.
+<p>
+The time used here is defined such that 12:00 (high noon) is the time
+when the sun has reached its highest point in the sky at the current site,
+unless the <em>-t</em> flag is used in which case time is interpreted as
+Greenwich standard time.
+<p>
+If a <em>sunhour</em> output map is specified, the module calculates
+sunshine hours for the given day. This option requires both Greenwhich
+standard time (<em>-t</em> flag) and the solpos algorithm of NREL
+(<em>-s</em> flag).
+
+<h2>EXAMPLES</h2>
+
+Calculate sun's elevation angle map for 2010-10-11 at 14:00h solar time:
+<div class="code"><pre>
+r.sun.angle elevation=sun_elev year=2010 month=10 day=11 hour=14 minute=00
+</pre></div>
+<p>
+
+Calculate photoperiod of day of year 1 (1st January) 2012
+<div class="code"><pre>
+r.sun.angle -s sunhour=photoperiod_doy_001 year=2012 day=1
+</pre></div>
+
+<h2>AUTHOR</h2>
+
+Markus Metz
+
+<p><i>Last changed: $Date$</i>
More information about the grass-commit
mailing list