[GRASS-SVN] r60457 - grass-addons/grass6/display/d.barb
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri May 23 23:49:33 PDT 2014
Author: hamish
Date: 2014-05-23 23:49:33 -0700 (Fri, 23 May 2014)
New Revision: 60457
Modified:
grass-addons/grass6/display/d.barb/description.html
grass-addons/grass6/display/d.barb/grid.c
grass-addons/grass6/display/d.barb/legend.c
grass-addons/grass6/display/d.barb/local_proto.h
grass-addons/grass6/display/d.barb/main.c
grass-addons/grass6/display/d.barb/points.c
Log:
enable the peak= option
Modified: grass-addons/grass6/display/d.barb/description.html
===================================================================
--- grass-addons/grass6/display/d.barb/description.html 2014-05-23 22:15:55 UTC (rev 60456)
+++ grass-addons/grass6/display/d.barb/description.html 2014-05-24 06:49:33 UTC (rev 60457)
@@ -109,7 +109,6 @@
<ul>
<li>Scaling of legend does not yet match normal operation.
-<li>The peak option is not yet fully implemented.
</ul>
<h2>SEE ALSO</h2>
Modified: grass-addons/grass6/display/d.barb/grid.c
===================================================================
--- grass-addons/grass6/display/d.barb/grid.c 2014-05-23 22:15:55 UTC (rev 60456)
+++ grass-addons/grass6/display/d.barb/grid.c 2014-05-24 06:49:33 UTC (rev 60457)
@@ -8,8 +8,8 @@
/* load and plot barbs from data stored in two raster maps */
void do_barb_grid(char *dir_u_map, char *mag_v_map, int is_component,
- int color, int aspect_type, double scale, int skip,
- int style, int reverse)
+ int color, int aspect_type, double scale, double setpeak,
+ int skip, int style, int reverse)
{
/* from d.rast.arrow */
struct FPRange range;
@@ -32,6 +32,9 @@
G_fatal_error(_("Problem reading range file"));
G_get_fp_range_min_max(&range, &mag_min, &mag_max);
+ if (!isnan(setpeak))
+ mag_max = setpeak;
+
if (style == TYPE_ARROW || style == TYPE_STRAW) {
scale *= 1.5 / fabs(mag_max);
}
Modified: grass-addons/grass6/display/d.barb/legend.c
===================================================================
--- grass-addons/grass6/display/d.barb/legend.c 2014-05-23 22:15:55 UTC (rev 60456)
+++ grass-addons/grass6/display/d.barb/legend.c 2014-05-24 06:49:33 UTC (rev 60457)
@@ -6,7 +6,7 @@
#include "local_proto.h"
void do_legend(char **at_list, char **velo_list, int num_velos,
- double key_fontsize, int style, double scale, double peak,
+ double key_fontsize, int style, double scale, double setpeak,
int color)
{
double easting, northing, px, py, velo, angle;
Modified: grass-addons/grass6/display/d.barb/local_proto.h
===================================================================
--- grass-addons/grass6/display/d.barb/local_proto.h 2014-05-23 22:15:55 UTC (rev 60456)
+++ grass-addons/grass6/display/d.barb/local_proto.h 2014-05-24 06:49:33 UTC (rev 60457)
@@ -16,11 +16,11 @@
#define R2D(d) (double)(d / RpD) /* radians->degrees */
/* grid.c */
-void do_barb_grid(char *, char *, int, int, int, double, int, int, int);
+void do_barb_grid(char *, char *, int, int, int, double, double, int, int, int);
/* points.c */
-void do_barb_points(char *, int, char *, char *, int, int, int, double, int,
- int);
+void do_barb_points(char *, int, char *, char *, int, int, int, double, double,
+ int, int);
int count_pts_in_region(struct Map_info *);
void fill_arrays(struct Map_info *, int, char *, char *, int, double *,
double *, double *, double *);
Modified: grass-addons/grass6/display/d.barb/main.c
===================================================================
--- grass-addons/grass6/display/d.barb/main.c 2014-05-23 22:15:55 UTC (rev 60456)
+++ grass-addons/grass6/display/d.barb/main.c 2014-05-24 06:49:33 UTC (rev 60457)
@@ -7,7 +7,7 @@
* AUTHORS: Hamish Bowman, Dunedin, New Zealand
* Grid code derived from d.rast.arrow
*
- * COPYRIGHT: (c) 2008-2012 by Hamish Bowman, and The GRASS Development Team
+ * COPYRIGHT: (c) 2008-2014 by Hamish Bowman, and The GRASS Development Team
* This program is free software under the GNU General Public
* License (>=v2). Read the file COPYING that comes with GRASS
* for details.
@@ -196,6 +196,8 @@
vlayer = atoi(vlayer_opt->answer);
if (peak_opt->answer)
peak = atof(peak_opt->answer);
+ else
+ peak = 0./0.; /* NaN */
if (strcmp(type_opt->answer, "compass") == 0)
aspect_type = TYPE_COMPASS;
@@ -224,7 +226,8 @@
num_leg_velo++;
if (num_leg_at != num_leg_velo * 2)
- G_fatal_error(_("Unequal number of legend placement and velocity requests (%d vs. %d)"),
+ G_fatal_error(
+ _("Unequal number of legend placement and velocity requests (%d vs. %d)"),
num_leg_at, num_leg_velo);
key_fontsize = atof(keyfont_opt->answer);
@@ -253,10 +256,10 @@
if (is_vector)
do_barb_points(vinput_opt->answer, vlayer,
dir_u_map, mag_v_map, is_component, color,
- aspect_type, scale, style, from_to->answer);
+ aspect_type, scale, peak, style, from_to->answer);
else
do_barb_grid(dir_u_map, mag_v_map, is_component, color,
- aspect_type, scale, skip, style, from_to->answer);
+ aspect_type, scale, peak, skip, style, from_to->answer);
D_add_to_list(G_recreate_command());
Modified: grass-addons/grass6/display/d.barb/points.c
===================================================================
--- grass-addons/grass6/display/d.barb/points.c 2014-05-23 22:15:55 UTC (rev 60456)
+++ grass-addons/grass6/display/d.barb/points.c 2014-05-24 06:49:33 UTC (rev 60457)
@@ -9,7 +9,8 @@
/* load and plot barbs from data stored in a vector map's attribute table */
void do_barb_points(char *vinput_name, int vlayer, char *dir_u_col,
char *mag_v_col, int is_component, int color,
- int aspect_type, double scale, int style, int reverse)
+ int aspect_type, double scale, double setpeak,
+ int style, int reverse)
{
struct Map_info vMap;
@@ -76,14 +77,18 @@
}
}
- peak = max_magnitude(magn, num_pts);
+ if(!isnan(setpeak))
+ peak = setpeak;
+ else
+ peak = max_magnitude(magn, num_pts);
+
G_debug(2, " peak = %.2f", peak);
if (style == TYPE_BARB || style == TYPE_SMLBARB) {
if(peak > 150)
G_warning(_("Maximum wind barb displayed is 150 knots"));
}
- peak = 1.; // TODO: window width * 0.20
+ peak = 1.; // TODO: window width * 0.20
scale_fact = (peak) * scale;
for (i = 0; i < num_pts; i++) {
More information about the grass-commit
mailing list