From svn_grass at osgeo.org Sat Oct 1 10:15:30 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 1 Oct 2016 10:15:30 -0700 Subject: [GRASS-SVN] r69616 - in grass-addons/grass7: imagery/i.fusion.hpf imagery/i.image.bathymetry misc/m.printws raster/r.area raster/r.object.geometry vector/v.civil vector/v.strds.stats Message-ID: <20161001171530.99DF03901D3@trac.osgeo.org> Author: neteler Date: 2016-10-01 10:15:30 -0700 (Sat, 01 Oct 2016) New Revision: 69616 Modified: grass-addons/grass7/imagery/i.fusion.hpf/Makefile grass-addons/grass7/imagery/i.image.bathymetry/Makefile grass-addons/grass7/imagery/i.image.bathymetry/i.image.bathymetry.html grass-addons/grass7/imagery/i.image.bathymetry/i.image.bathymetry.py grass-addons/grass7/misc/m.printws/Makefile grass-addons/grass7/misc/m.printws/m.printws.html grass-addons/grass7/misc/m.printws/m.printws.py grass-addons/grass7/raster/r.area/main.c grass-addons/grass7/raster/r.object.geometry/Makefile grass-addons/grass7/raster/r.object.geometry/r.object.geometry.html grass-addons/grass7/vector/v.civil/road_crosstools.py grass-addons/grass7/vector/v.civil/road_topotools.py grass-addons/grass7/vector/v.civil/v.civil.html grass-addons/grass7/vector/v.civil/v.civil.py grass-addons/grass7/vector/v.strds.stats/Makefile grass-addons/grass7/vector/v.strds.stats/v.strds.stats.html grass-addons/grass7/vector/v.strds.stats/v.strds.stats.py Log: r.area addon: msg fix; svn propset on various files Property changes on: grass-addons/grass7/imagery/i.fusion.hpf/Makefile ___________________________________________________________________ Added: svn:eol-style + native Property changes on: grass-addons/grass7/imagery/i.image.bathymetry/Makefile ___________________________________________________________________ Deleted: svn:executable - * Added: svn:mime-type + text/x-makefile Added: svn:eol-style + native Property changes on: grass-addons/grass7/imagery/i.image.bathymetry/i.image.bathymetry.html ___________________________________________________________________ Deleted: svn:executable - * Added: svn:mime-type + text/html Added: svn:keywords + Author Date Id Added: svn:eol-style + native Property changes on: grass-addons/grass7/imagery/i.image.bathymetry/i.image.bathymetry.py ___________________________________________________________________ Added: svn:mime-type + text/x-python Added: svn:eol-style + native Property changes on: grass-addons/grass7/misc/m.printws/Makefile ___________________________________________________________________ Added: svn:mime-type + text/x-makefile Added: svn:eol-style + native Property changes on: grass-addons/grass7/misc/m.printws/m.printws.html ___________________________________________________________________ Added: svn:mime-type + text/html Added: svn:keywords + Author Date Id Added: svn:eol-style + native Property changes on: grass-addons/grass7/misc/m.printws/m.printws.py ___________________________________________________________________ Added: svn:mime-type + text/x-python Added: svn:eol-style + native Modified: grass-addons/grass7/raster/r.area/main.c =================================================================== --- grass-addons/grass7/raster/r.area/main.c 2016-09-30 21:35:10 UTC (rev 69615) +++ grass-addons/grass7/raster/r.area/main.c 2016-10-01 17:15:30 UTC (rev 69616) @@ -53,7 +53,7 @@ _("Calculates area of clumped areas and remove areas smaller than given threshold."); input = G_define_standard_option(G_OPT_R_INPUT); - input->description = _("Map created with r.clump"); + input->description = _("Name of cell category map, e.g., maps created with r.clump"); output = G_define_standard_option(G_OPT_R_OUTPUT); output->description = _("Map with area size (in cells)"); Property changes on: grass-addons/grass7/raster/r.object.geometry/Makefile ___________________________________________________________________ Added: svn:mime-type + text/x-makefile Added: svn:eol-style + native Modified: grass-addons/grass7/raster/r.object.geometry/r.object.geometry.html =================================================================== --- grass-addons/grass7/raster/r.object.geometry/r.object.geometry.html 2016-09-30 21:35:10 UTC (rev 69615) +++ grass-addons/grass7/raster/r.object.geometry/r.object.geometry.html 2016-10-01 17:15:30 UTC (rev 69616) @@ -53,4 +53,4 @@ Markus Metz (diagonal clump tracing)

-Last changed: $Date: 2016-05-31 00:01:21 +0200 (Tue, 31 May 2016) $ +Last changed: $Date$ Property changes on: grass-addons/grass7/raster/r.object.geometry/r.object.geometry.html ___________________________________________________________________ Added: svn:mime-type + text/html Added: svn:keywords + Author Date Id Added: svn:eol-style + native Property changes on: grass-addons/grass7/vector/v.civil/road_crosstools.py ___________________________________________________________________ Added: svn:mime-type + text/x-python Added: svn:eol-style + native Property changes on: grass-addons/grass7/vector/v.civil/road_topotools.py ___________________________________________________________________ Added: svn:mime-type + text/x-python Added: svn:eol-style + native Property changes on: grass-addons/grass7/vector/v.civil/v.civil.html ___________________________________________________________________ Added: svn:mime-type + text/html Added: svn:keywords + Author Date Id Added: svn:eol-style + native Property changes on: grass-addons/grass7/vector/v.civil/v.civil.py ___________________________________________________________________ Added: svn:mime-type + text/x-python Added: svn:eol-style + native Property changes on: grass-addons/grass7/vector/v.strds.stats/Makefile ___________________________________________________________________ Added: svn:mime-type + text/x-makefile Added: svn:eol-style + native Modified: grass-addons/grass7/vector/v.strds.stats/v.strds.stats.html =================================================================== --- grass-addons/grass7/vector/v.strds.stats/v.strds.stats.html 2016-09-30 21:35:10 UTC (rev 69615) +++ grass-addons/grass7/vector/v.strds.stats/v.strds.stats.html 2016-10-01 17:15:30 UTC (rev 69616) @@ -24,4 +24,4 @@ Luca Delucchi, Fondazione Edmund Mach

-Last changed: $Date: 2014-03-27 17:21:58 +0100 (Thu, 27 Mar 2014) $ +Last changed: $Date$ Property changes on: grass-addons/grass7/vector/v.strds.stats/v.strds.stats.html ___________________________________________________________________ Added: svn:mime-type + text/html Added: svn:keywords + Author Date Id Added: svn:eol-style + native Property changes on: grass-addons/grass7/vector/v.strds.stats/v.strds.stats.py ___________________________________________________________________ Added: svn:mime-type + text/x-python Added: svn:eol-style + native From svn_grass at osgeo.org Sat Oct 1 10:50:07 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 1 Oct 2016 10:50:07 -0700 Subject: [GRASS-SVN] r69617 - in grass/branches/releasebranch_7_2/lib/python/script: . testsuite Message-ID: <20161001175007.2B9F23901D3@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-01 10:50:06 -0700 (Sat, 01 Oct 2016) New Revision: 69617 Modified: grass/branches/releasebranch_7_2/lib/python/script/testsuite/test_start_command_functions.py grass/branches/releasebranch_7_2/lib/python/script/testsuite/test_utils.py grass/branches/releasebranch_7_2/lib/python/script/utils.py Log: pythonlib: use isinstance to distinguish string types (meant to fix r65787, needed for r65804 according to #3171) Modified: grass/branches/releasebranch_7_2/lib/python/script/testsuite/test_start_command_functions.py =================================================================== --- grass/branches/releasebranch_7_2/lib/python/script/testsuite/test_start_command_functions.py 2016-10-01 17:15:30 UTC (rev 69616) +++ grass/branches/releasebranch_7_2/lib/python/script/testsuite/test_start_command_functions.py 2016-10-01 17:50:06 UTC (rev 69617) @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# the utf-8 is important because we do use the characters """Tests of start_command function family (location independent)""" from grass.gunittest.case import TestCase @@ -3,5 +5,5 @@ from grass.gunittest.main import test -from grass.script.core import start_command, PIPE +from grass.script.core import start_command, PIPE, run_command @@ -38,5 +40,28 @@ self.assertEquals(returncode, 1) self.assertIn(b'raster', stderr) + +class TestPythonModuleWithUnicodeParameters(TestCase): + """Tests if unicode works in parameters of Python modules + + This in fact tests also the `parser()` function (original motivation + for this tests). + + Using g.search.module because it takes any option values. + """ + + def test_python_module_ascii(self): + """This tests if Python module works""" + run_command('g.search.modules', keyword=b'Priserny kun') + + def test_python_module_czech_nonascii(self): + """This likely fails on non-UTF-8 systems (i.e. MS Win)""" + run_command('g.search.modules', keyword=b'Příšerný kůň') + + def test_python_module_czech_unicode(self): + """This likely fails on non-UTF-8 systems (i.e. MS Win)""" + run_command('g.search.modules', keyword=u'Příšerný kůň') + + if __name__ == '__main__': test() Modified: grass/branches/releasebranch_7_2/lib/python/script/testsuite/test_utils.py =================================================================== --- grass/branches/releasebranch_7_2/lib/python/script/testsuite/test_utils.py 2016-10-01 17:15:30 UTC (rev 69616) +++ grass/branches/releasebranch_7_2/lib/python/script/testsuite/test_utils.py 2016-10-01 17:50:06 UTC (rev 69617) @@ -39,7 +39,11 @@ def test_unicode(self): self.assertEqual(b'text', utils.encode(u'text')) + def test_bytes_grabage_in_out(self): + """If the input is bytes we should not touch it for encoding""" + self.assertEqual(b'Příšerný kůň', utils.encode(b'Příšerný kůň')) + class TestDecode(TestCase): """Tests function `encode` that convert value to unicode.""" Modified: grass/branches/releasebranch_7_2/lib/python/script/utils.py =================================================================== --- grass/branches/releasebranch_7_2/lib/python/script/utils.py 2016-10-01 17:15:30 UTC (rev 69616) +++ grass/branches/releasebranch_7_2/lib/python/script/utils.py 2016-10-01 17:50:06 UTC (rev 69617) @@ -150,26 +150,31 @@ self[key] = value -def decode(bytes): - """Decode bytes with default locale +def decode(bytes_): + """Decode bytes with default locale and return (unicode) string - :param bytes bytes: the bytes to decode + No-op if parameter is not bytes (assumed unicode string). + + :param bytes bytes_: the bytes to decode """ - enc = locale.getdefaultlocale()[1] - if hasattr(bytes, 'decode'): - return bytes.decode(enc) if enc else bytes.decode() - return bytes + if isinstance(bytes_, bytes): + enc = locale.getdefaultlocale()[1] + return bytes_.decode(enc) if enc else bytes_.decode() + return bytes_ def encode(string): - """Encode string with default locale -> bytes + """Encode string with default locale and return bytes with that encoding + No-op if parameter is bytes (assumed already encoded). + This ensures garbage in, garbage out. + :param str string: the string to encode """ + if isinstance(string, bytes): + return string enc = locale.getdefaultlocale()[1] - if hasattr(string, 'encode'): - return string.encode(enc) if enc else string.encode() - return string + return string.encode(enc) if enc else string.encode() def parse_key_val(s, sep='=', dflt=None, val_type=None, vsep=None): From svn_grass at osgeo.org Sat Oct 1 11:10:29 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 1 Oct 2016 11:10:29 -0700 Subject: [GRASS-SVN] r69618 - grass-addons/grass7/vector/v.surf.icw Message-ID: <20161001181029.8FEC83901D3@trac.osgeo.org> Author: annakrat Date: 2016-10-01 11:10:29 -0700 (Sat, 01 Oct 2016) New Revision: 69618 Modified: grass-addons/grass7/vector/v.surf.icw/v.surf.icw.py Log: v.surf.icw: write temporary maps into file instead of passing through command line (by mlennert), see #2574 Modified: grass-addons/grass7/vector/v.surf.icw/v.surf.icw.py =================================================================== --- grass-addons/grass7/vector/v.surf.icw/v.surf.icw.py 2016-10-01 17:50:06 UTC (rev 69617) +++ grass-addons/grass7/vector/v.surf.icw/v.surf.icw.py 2016-10-01 18:10:29 UTC (rev 69618) @@ -126,12 +126,14 @@ import grass.script as grass from grass.exceptions import CalledModuleError +TMP_FILE = None def cleanup(): grass.verbose(_("Cleanup..")) tmp_base = 'tmp_icw_' + str(os.getpid()) + '_' grass.run_command('g.remove', flags = 'f', type = 'raster', pattern = tmp_base + '*', quiet = True) + grass.try_remove(TMP_FILE) def main(): @@ -381,14 +383,19 @@ grass.message(_("Summation of cost weights ...")) input_maps = tmp_base + '1by_cost_site_sq.%05d' % 1 - for i in range(2, n+1): - input_maps += ',%s1by_cost_site_sq.%05d' % (tmp_base, i) + + global TMP_FILE + TMP_FILE = grass.tempfile() + with open(TMP_FILE, 'w') as maplist: + for i in range(2, n+1): + mapname = '%s1by_cost_site_sq.%05d' % (tmp_base, i) + maplist.write(mapname + '\n') #grass.run_command('g.list', type = 'raster', mapset = '.') sum_of_1by_cost_sqs = tmp_base + 'sum_of_1by_cost_sqs' try: - grass.run_command('r.series', method='sum', input=input_maps, + grass.run_command('r.series', method='sum', file=TMP_FILE, output=sum_of_1by_cost_sqs) except CalledModuleError: grass.fatal(_('Problem running %s') % 'r.series') From svn_grass at osgeo.org Sat Oct 1 12:51:11 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 1 Oct 2016 12:51:11 -0700 Subject: [GRASS-SVN] r69619 - grass/trunk/display/d.barscale Message-ID: <20161001195111.BB62D3903BE@trac.osgeo.org> Author: annakrat Date: 2016-10-01 12:51:11 -0700 (Sat, 01 Oct 2016) New Revision: 69619 Modified: grass/trunk/display/d.barscale/draw_scale.c grass/trunk/display/d.barscale/main.c grass/trunk/display/d.barscale/options.h Log: d.barscale: improve layout, use variables instead of magick numbers, add width_scale variable to scale barscale for different resolutions Modified: grass/trunk/display/d.barscale/draw_scale.c =================================================================== --- grass/trunk/display/d.barscale/draw_scale.c 2016-10-01 18:10:29 UTC (rev 69618) +++ grass/trunk/display/d.barscale/draw_scale.c 2016-10-01 19:51:11 UTC (rev 69619) @@ -63,7 +63,7 @@ }; int draw_scale(double east, double north, int length, int seg, int units, - char *label_cstm, int style, int text_posn, double fontsize) + char *label_cstm, int style, int text_posn, double width_scale, double fontsize) { double meters; double line_len; @@ -82,6 +82,8 @@ double symbol_size; char *label; double size; + double xspace_bf_N, x_pos_start, xspace_around_line, xsize_N; + double ysize, ysize_solid, ysize_checker, ysize_ticks; /* Establish text size */ @@ -133,70 +135,68 @@ D_setup_unity(0); + /* setup size variables */ + xspace_bf_N = 5 * width_scale; + xspace_around_line = 10 * width_scale; + xsize_N = 10 * width_scale; + x_pos_start = x_pos + (north_arrow ? (xspace_bf_N + xsize_N + xspace_around_line) : xspace_around_line); + ysize = 30 * width_scale; + ysize_solid = 8 * width_scale; + ysize_checker = 6 * width_scale; + ysize_ticks = 20 * width_scale; /* the length of the edge tick */ + if (do_background) { /* Blank out area with background color */ D_get_text_box(label, &tt, &tb, &tl, &tr); - + pl = x_pos + 0; + pr = x_pos + line_len + 2 * xspace_around_line + + (north_arrow ? xspace_bf_N + xsize_N : 0); if (text_posn == TEXT_OVER) { - pr = x_pos + 35 + line_len; - pl = x_pos + 0; - pt = y_pos + tb - 5; - pb = y_pos + 30; - if (style != STYLE_CLASSIC_BAR && style != STYLE_THIN_WITH_ENDS) - pl += 15; + pt = y_pos + tb - 5 * width_scale; + pb = y_pos + ysize; if (style == STYLE_TICKS_DOWN) - pb += 12; + pb += 12 * width_scale; } if (text_posn == TEXT_UNDER) { - pr = x_pos + 35 + line_len; - pl = x_pos + 0; pt = y_pos + 0; - pb = y_pos + 30 - tb + 5; - if (style != STYLE_CLASSIC_BAR && style != STYLE_THIN_WITH_ENDS) - pl += 15; + pb = y_pos + ysize - tb + 5 * width_scale; if (style == STYLE_TICKS_UP) - pt -= 12; + pt -= 12 * width_scale; } else if (text_posn == TEXT_RIGHT) { - pr = x_pos + 35 + line_len + tr + 5; - pl = x_pos + 0; + pr = pr + tr + xspace_around_line; pt = y_pos + 0; - pb = y_pos + 30; + pb = y_pos + ysize; if (style == STYLE_TICKS_UP) { - pt -= 12; - pb -= 6; - pl += 15; + pt -= 12 * width_scale; + pb -= 6 * width_scale; } if (style == STYLE_TICKS_DOWN) { - pt += 4; - pb += 12; - pl += 15; + pt += 4 * width_scale; + pb += 12 * width_scale; } } else if (text_posn == TEXT_LEFT) { - pr = x_pos + 35 + line_len; - pl = x_pos - tr - 13; + pl = x_pos - tr - 13 * width_scale; pt = y_pos + 0; - pb = y_pos + 30; + pb = y_pos + ysize; if (style == STYLE_TICKS_UP) { - pt -= 12; - pb -= 4; + pt -= 12 * width_scale; + pb -= 4 * width_scale; } if (style == STYLE_TICKS_DOWN) { - pt += 3; - pb += 11; + pt += 3 * width_scale; + pb += 11 * width_scale; } } if (fontsize < 0) { /* no text */ + pl = x_pos + 0; + pr = x_pos + line_len + 2 * xspace_around_line + + (north_arrow ? xspace_bf_N + xsize_N : 0); switch (style) { case STYLE_CLASSIC_BAR: case STYLE_THIN_WITH_ENDS: - pr = x_pos + 35 + line_len; - pl = x_pos + 0; - pt = y_pos + 0; - pb = y_pos + 30; - break; case STYLE_PART_CHECKER: case STYLE_FULL_CHECKER: case STYLE_MIXED_CHECKER: @@ -205,22 +205,16 @@ case STYLE_HOLLOW_BAR: case STYLE_TICKS_BOTH: case STYLE_ARROW_ENDS: - pr = x_pos + 35 + line_len; - pl = x_pos + 15; pt = y_pos + 0; - pb = y_pos + 30; + pb = y_pos + ysize; break; case STYLE_TICKS_UP: - pr = x_pos + 35 + line_len; - pl = x_pos + 15; - pt = y_pos - 12; - pb = y_pos + 25; + pt = y_pos - 12 * width_scale; + pb = y_pos + 25 * width_scale; break; case STYLE_TICKS_DOWN: - pr = x_pos + 35 + line_len; - pl = x_pos + 15; - pt = y_pos + 3; - pb = y_pos + 40; + pt = y_pos + 3 * width_scale; + pb = y_pos + 40 * width_scale; break; default: G_fatal_error(_("Programmer error")); @@ -236,7 +230,6 @@ pl = l; if (pr > r) pr = r; - D_use_color(bg_color); D_box_abs(pl, pt, pr, pb); } @@ -245,16 +238,16 @@ D_use_color(fg_color); if (north_arrow) { D_begin(); - D_move_abs(x_pos + 5, y_pos + 20); - D_cont_rel(0, -10); - D_cont_rel(10, 10); - D_cont_rel(0, -10); - D_move_rel(-5, 14); - D_cont_rel(0, -17); - D_cont_rel(-2.5, -0); - D_cont_rel(2.5, -4); - D_cont_rel(2.5, 4); - D_cont_rel(-2.5, -0); + D_move_abs(x_pos + xspace_bf_N, y_pos + 2 * ysize / 3); + D_cont_rel(0, -10 * width_scale); + D_cont_rel(10 * width_scale, 10 * width_scale); + D_cont_rel(0, -10 * width_scale); + D_move_rel(-5 * width_scale, 14 * width_scale); + D_cont_rel(0, -17 * width_scale); + D_cont_rel(-2.5 * width_scale, -0); + D_cont_rel(2.5 * width_scale, -4 * width_scale); + D_cont_rel(2.5 * width_scale, 4 * width_scale); + D_cont_rel(-2.5 * width_scale, -0); D_close(); D_end(); D_stroke(); @@ -264,87 +257,87 @@ and (x_pos + 25 + line_len, y_pos + 15) */ if (style == STYLE_CLASSIC_BAR) { D_begin(); - D_move_abs(x_pos + 25, y_pos + 17); - /* actual width is line_len-1+1=line_len and height is 4+1=5 */ + D_move_abs(x_pos_start, y_pos + ysize / 2 + ysize_checker / 2); + /* actual width is line_len-1+1=line_len */ D_cont_rel(line_len - 1, 0); - D_cont_rel(0, -4); + D_cont_rel(0, -ysize_checker); D_cont_rel(-line_len + 1, 0); - D_cont_rel(0, 4); + D_cont_rel(0, ysize_checker); D_end(); D_close(); D_stroke(); for (i = 1; i <= seg; i += 2) { /* width is seg_len and height is 5 */ - D_box_rel(seg_len, -4); + D_box_rel(seg_len, -ysize_checker); D_pos_rel(seg_len * 2, 0); } } else if (style == STYLE_THIN_WITH_ENDS) { /* draw simple line scale */ D_begin(); - D_move_abs(x_pos + 25, y_pos + 5); - D_cont_abs(x_pos + 25, y_pos + 25); - D_move_abs(x_pos + 25, y_pos + 15); - D_cont_abs(x_pos + 25 + line_len, y_pos + 15); - D_move_abs(x_pos + 25 + line_len, y_pos + 5); - D_cont_abs(x_pos + 25 + line_len, y_pos + 25); + D_move_abs(x_pos_start, y_pos + (ysize - ysize_ticks) / 2); + D_cont_abs(x_pos_start, y_pos + ysize - (ysize - ysize_ticks) / 2); + D_move_abs(x_pos_start, y_pos + ysize / 2); + D_cont_abs(x_pos_start + line_len, y_pos + ysize / 2); + D_move_abs(x_pos_start + line_len, y_pos + (ysize - ysize_ticks) / 2); + D_cont_abs(x_pos_start + line_len, y_pos + ysize - (ysize - ysize_ticks) / 2); D_close(); D_end(); /* no-op? */ } else if (style == STYLE_SOLID_BAR) { /* draw simple solid-bar scale */ xarr[0] = 0; - yarr[0] = +8; + yarr[0] = ysize_solid; xarr[1] = line_len; yarr[1] = 0; xarr[2] = 0; - yarr[2] = -8; + yarr[2] = -ysize_solid; xarr[3] = -line_len; yarr[3] = 0; xarr[4] = 0; - yarr[4] = +8; + yarr[4] = ysize_solid; - D_move_abs(x_pos + 25, y_pos + 15 - 4); + D_move_abs(x_pos_start, y_pos + ysize / 2 - ysize_solid / 2); D_polygon_rel(xarr, yarr, 5); } else if (style == STYLE_HOLLOW_BAR) { /* draw hollow-bar scale */ D_use_color(fg_color); D_begin(); - D_move_abs(x_pos + 25, y_pos + 15 - 4); - D_cont_rel(0, +8); + D_move_abs(x_pos_start, y_pos + ysize / 2 - ysize_solid / 2); + D_cont_rel(0, ysize_solid); D_cont_rel(line_len, 0); - D_cont_rel(0, -8); + D_cont_rel(0, -ysize_solid); D_cont_rel(-line_len, 0); - D_cont_rel(0, +8); + D_cont_rel(0, ysize_solid); D_close(); D_end(); /* no-op? */ } else if (style == STYLE_FULL_CHECKER) { D_begin(); - D_move_abs(x_pos + 25, y_pos + 15 + 6); + D_move_abs(x_pos_start, y_pos + ysize / 2 + ysize_checker); /* actual width is line_len-1+1=line_len and height is 7+1=8 */ D_cont_rel(line_len, 0); - D_cont_rel(0, -12); + D_cont_rel(0, -2 * ysize_checker); D_cont_rel(-line_len, 0); - D_cont_rel(0, +12); + D_cont_rel(0, +2 * ysize_checker); D_close(); D_end(); /* no-op? */ D_stroke(); - D_pos_rel(0, -6); + D_pos_rel(0, -ysize_checker); for (i = 1; i <= seg; i++) { xarr[0] = 0; yarr[0] = 0; xarr[1] = seg_len; yarr[1] = 0; xarr[2] = 0; - yarr[2] = (i % 2 ? -6 : 6); + yarr[2] = (i % 2 ? -ysize_checker : ysize_checker); xarr[3] = -seg_len; yarr[3] = 0; xarr[4] = 0; - yarr[4] = (i % 2 ? 6 : -6); + yarr[4] = (i % 2 ? ysize_checker : -ysize_checker); /* width is seg_len and height is 6 */ D_polygon_rel(xarr, yarr, 5); D_pos_rel(seg_len, 0); @@ -352,17 +345,17 @@ } else if (style == STYLE_PART_CHECKER) { D_begin(); - D_move_abs(x_pos + 25, y_pos + 15 + 6); + D_move_abs(x_pos_start, y_pos + ysize / 2 + ysize_checker); /* actual width is line_len-1+1=line_len and height is 7+1=8 */ D_cont_rel(line_len, 0); - D_cont_rel(0, -12); + D_cont_rel(0, -2 * ysize_checker); D_cont_rel(-line_len, 0); - D_cont_rel(0, +12); + D_cont_rel(0, +2 * ysize_checker); D_close(); D_end(); /* no-op? */ D_stroke(); - D_pos_rel(0, -6); + D_pos_rel(0, -ysize_checker); for (i = 1; i <= seg; i++) { if (i <= (seg == 5 ? 2 : 4)) { xarr[0] = 0; @@ -370,11 +363,11 @@ xarr[1] = seg_len / 2.; yarr[1] = 0; xarr[2] = 0; - yarr[2] = -6; + yarr[2] = -ysize_checker; xarr[3] = -seg_len / 2.; yarr[3] = 0; xarr[4] = 0; - yarr[4] = 6; + yarr[4] = ysize_checker; D_polygon_rel(xarr, yarr, 5); D_pos_rel(seg_len / 2., 0); @@ -383,11 +376,11 @@ xarr[1] = seg_len / 2.; yarr[1] = 0; xarr[2] = 0; - yarr[2] = 6; + yarr[2] = ysize_checker; xarr[3] = -seg_len / 2.; yarr[3] = 0; xarr[4] = 0; - yarr[4] = -6; + yarr[4] = -ysize_checker; D_polygon_rel(xarr, yarr, 5); D_pos_rel(seg_len / 2., 0); } @@ -397,11 +390,11 @@ xarr[1] = seg_len; yarr[1] = 0; xarr[2] = 0; - yarr[2] = (i % 2 ? -6 : 6); + yarr[2] = (i % 2 ? -ysize_checker : ysize_checker); xarr[3] = -seg_len; yarr[3] = 0; xarr[4] = 0; - yarr[4] = (i % 2 ? 6 : -6); + yarr[4] = (i % 2 ? ysize_checker : -ysize_checker); /* width is seg_len and height is 6 */ D_polygon_rel(xarr, yarr, 5); D_pos_rel(seg_len, 0); @@ -410,21 +403,21 @@ } else if (style == STYLE_MIXED_CHECKER) { D_begin(); - D_move_abs(x_pos + 25, y_pos + 15 + 6); + D_move_abs(x_pos_start, y_pos + ysize / 2 + ysize_checker); /* actual width is line_len-1+1=line_len and height is 7+1=8 */ D_cont_rel(line_len, 0); - D_cont_rel(0, -12); + D_cont_rel(0, -2 * ysize_checker); D_cont_rel(-line_len, 0); - D_cont_rel(0, +12); + D_cont_rel(0, +2 * ysize_checker); /* horizontal line across the middle to separate white from white */ - D_move_abs(x_pos + 25, y_pos + 15); + D_move_abs(x_pos_start, y_pos + ysize / 2); D_cont_rel(line_len, 0); D_end(); /* no-op? */ D_close(); D_stroke(); - D_move_abs(x_pos + 25, y_pos + 15); + D_move_abs(x_pos_start, y_pos + ysize / 2); for (i = 1; i <= seg; i++) { if (i <= (seg == 5 ? 2 : 6)) { @@ -434,11 +427,11 @@ xarr[1] = seg_len; yarr[1] = 0; xarr[2] = 0; - yarr[2] = -6; + yarr[2] = -ysize_checker; xarr[3] = -seg_len; yarr[3] = 0; xarr[4] = 0; - yarr[4] = +6; + yarr[4] = +ysize_checker; D_polygon_rel(xarr, yarr, 5); } @@ -447,11 +440,11 @@ xarr[1] = seg_len / 2.; yarr[1] = 0; xarr[2] = 0; - yarr[2] = +6; + yarr[2] = +ysize_checker; xarr[3] = -seg_len / 2.; yarr[3] = 0; xarr[4] = 0; - yarr[4] = -6; + yarr[4] = -ysize_checker; D_pos_rel(seg_len / 2., 0); D_polygon_rel(xarr, yarr, 5); D_pos_rel(seg_len / 2., 0); @@ -462,30 +455,30 @@ xarr[1] = seg_len; yarr[1] = 0; xarr[2] = 0; - yarr[2] = (i % 2 ? 6 : +6); + yarr[2] = (i % 2 ? ysize_checker : +ysize_checker); xarr[3] = -seg_len; yarr[3] = 0; xarr[4] = 0; - yarr[4] = (i % 2 ? -6 : 6); + yarr[4] = (i % 2 ? -ysize_checker : ysize_checker); /* width is seg_len and height is 6 */ D_polygon_rel(xarr, yarr, 5); - D_pos_rel(seg_len, -6); + D_pos_rel(seg_len, -ysize_checker); } } } else if (style == STYLE_TAIL_CHECKER) { /* first draw outside box */ D_begin(); - D_move_abs(x_pos + 25, y_pos + 15 + 6); + D_move_abs(x_pos_start, y_pos + ysize / 2 + ysize_checker); D_cont_rel(line_len, 0); - D_cont_rel(0, -12); + D_cont_rel(0, -2 * ysize_checker); D_cont_rel(-line_len, 0); - D_cont_rel(0, +12); + D_cont_rel(0, +2 * ysize_checker); D_close(); D_end(); /* no-op? */ D_stroke(); - D_pos_rel(0, -6); + D_pos_rel(0, -ysize_checker); for (i = 1; i <= (seg == 5 ? 3 : 5); i++) { /* width is seg_len and height is 6 */ xarr[0] = 0; @@ -493,23 +486,23 @@ xarr[1] = seg_len; yarr[1] = 0; xarr[2] = 0; - yarr[2] = (i % 2 ? -6 : 6); + yarr[2] = (i % 2 ? -ysize_checker : ysize_checker); xarr[3] = -seg_len; yarr[3] = 0; xarr[4] = 0; - yarr[4] = (i % 2 ? 6 : -6); + yarr[4] = (i % 2 ? ysize_checker : -ysize_checker); D_polygon_rel(xarr, yarr, 5); D_pos_rel(seg_len, 0); } /* draw a vertical cross line */ D_begin(); - D_move_rel(0, 6); - D_cont_rel(0, -12); + D_move_rel(0, ysize_checker); + D_cont_rel(0, -2 * ysize_checker); D_close(); D_end(); /* no-op? */ D_stroke(); - D_pos_rel(0, 6); + D_pos_rel(0, ysize_checker); xarr[0] = 0; yarr[0] = 0; xarr[1] = line_len / 2.; @@ -517,49 +510,49 @@ xarr[1] -= seg_len / 2.; yarr[1] = 0; xarr[2] = 0; - yarr[2] = 6; + yarr[2] = ysize_checker; xarr[3] = -line_len / 2.; if (seg == 5) xarr[3] += seg_len / 2.; yarr[3] = 0; xarr[4] = 0; - yarr[4] = -6; + yarr[4] = -ysize_checker; D_polygon_rel(xarr, yarr, 5); D_pos_rel(seg_len, 0); } else if (style == STYLE_TICKS_BOTH) { /* draw simple line scale with corssing ticks */ D_begin(); - D_move_abs(x_pos + 25, y_pos + 5); - D_cont_abs(x_pos + 25, y_pos + 25); - D_move_abs(x_pos + 25, y_pos + 15); - D_cont_abs(x_pos + 25 + line_len, y_pos + 15); - D_move_abs(x_pos + 25 + line_len, y_pos + 5); - D_cont_abs(x_pos + 25 + line_len, y_pos + 25); + D_move_abs(x_pos_start, y_pos + (ysize - ysize_ticks) / 2); + D_cont_abs(x_pos_start, y_pos + ysize - (ysize - ysize_ticks) / 2); + D_move_abs(x_pos_start, y_pos + ysize / 2); + D_cont_abs(x_pos_start + line_len, y_pos + ysize / 2); + D_move_abs(x_pos_start + line_len, y_pos + (ysize - ysize_ticks) / 2); + D_cont_abs(x_pos_start + line_len, y_pos + ysize - (ysize - ysize_ticks) / 2); - D_move_abs(x_pos + 25, y_pos + 15); - D_move_rel(0, +6); + D_move_abs(x_pos_start, y_pos + ysize / 2); + D_move_rel(0, ysize_ticks / 4); for (i = 0; i <= seg - 2; i++) { D_move_rel(seg_len, 0); - D_cont_rel(0, -11); /* 5 above, on px on line, and 5 below */ - D_move_rel(0, +11); + D_cont_rel(0, -ysize_ticks/2); /* 5 above, on px on line, and 5 below */ + D_move_rel(0, +ysize_ticks/2); } D_end(); /* no-op? */ } else if (style == STYLE_TICKS_UP) { /* draw simple line scale with up facing ticks */ D_begin(); - D_move_abs(x_pos + 25, y_pos - 2); - D_cont_abs(x_pos + 25, y_pos + 15); - D_cont_abs(x_pos + 25 + line_len, y_pos + 15); - D_move_abs(x_pos + 25 + line_len, y_pos - 2); - D_cont_abs(x_pos + 25 + line_len, y_pos + 15); + D_move_abs(x_pos_start, y_pos - 2 * width_scale); + D_cont_abs(x_pos_start, y_pos + ysize / 2); + D_cont_abs(x_pos_start + line_len, y_pos + ysize / 2); + D_move_abs(x_pos_start + line_len,y_pos - 2 * width_scale); + D_cont_abs(x_pos_start + line_len, y_pos + ysize / 2); - D_move_abs(x_pos + 25, y_pos + 15); + D_move_abs(x_pos_start, y_pos + ysize / 2); for (i = 0; i <= seg - 2; i++) { D_move_rel(seg_len, 0); - D_cont_rel(0, -7); /* 5 above, on px on line, and 5 below */ - D_move_rel(0, +7); + D_cont_rel(0, -ysize_ticks/2); /* 5 above, on px on line, and 5 below */ + D_move_rel(0, +ysize_ticks/2); } D_end(); /* no-op? */ D_close(); @@ -567,17 +560,17 @@ else if (style == STYLE_TICKS_DOWN) { /* draw simple line scale with down facing ticks */ D_begin(); - D_move_abs(x_pos + 25, y_pos + 15 + 17); - D_cont_abs(x_pos + 25, y_pos + 15); - D_cont_abs(x_pos + 25 + line_len, y_pos + 15); - D_move_abs(x_pos + 25 + line_len, y_pos + 15 + 17); - D_cont_abs(x_pos + 25 + line_len, y_pos + 15); + D_move_abs(x_pos_start, y_pos + ysize / 2 + 17 * width_scale); + D_cont_abs(x_pos_start, y_pos + ysize / 2); + D_cont_abs(x_pos_start + line_len, y_pos + ysize / 2); + D_move_abs(x_pos_start + line_len, y_pos + ysize / 2 + 17 * width_scale); + D_cont_abs(x_pos_start + line_len, y_pos + ysize / 2); - D_move_abs(x_pos + 25, y_pos + 15); + D_move_abs(x_pos_start, y_pos + ysize / 2); for (i = 0; i <= seg - 2; i++) { D_move_rel(seg_len, 0); - D_cont_rel(0, +7); /* 5 above, on px on line, and 5 below */ - D_move_rel(0, -7); + D_cont_rel(0, +ysize_ticks/2); /* 5 above, on px on line, and 5 below */ + D_move_rel(0, -ysize_ticks/2); } D_end(); /* no-op? */ D_close(); @@ -585,8 +578,8 @@ else if (style == STYLE_ARROW_ENDS) { /* draw line scale with |<--dimension arrows-->| on the ends */ D_begin(); - D_cont_abs(x_pos + 25, y_pos + 15); - D_cont_abs(x_pos + 25 + line_len, y_pos + 15); + D_cont_abs(x_pos_start, y_pos + ysize / 2); + D_cont_abs(x_pos_start + line_len, y_pos + ysize / 2); D_end(); /* display the symbol */ @@ -609,10 +602,10 @@ fill_color->b = (unsigned char)B; fill_color->a = RGBA_COLOR_OPAQUE; - symbol_size = 12; + symbol_size = 12 * width_scale; - x0 = D_d_to_u_col(x_pos + 25); - y0 = D_d_to_u_row(y_pos + 15); + x0 = D_d_to_u_col(x_pos_start); + y0 = D_d_to_u_row(y_pos + ysize / 2); Symb = S_read("extra/dim_arrow"); if (!Symb) G_fatal_error(_("Could not read symbol \"%s\""), @@ -621,8 +614,8 @@ D_symbol(Symb, x0, y0, line_color, fill_color); G_free(Symb); - x0 = D_d_to_u_col(x_pos + line_len + 25); - y0 = D_d_to_u_row(y_pos + 15); + x0 = D_d_to_u_col(line_len + x_pos_start); + y0 = D_d_to_u_row(y_pos + ysize / 2); Symb = S_read("extra/dim_arrow"); S_stroke(Symb, symbol_size, 180., 0); D_symbol(Symb, x0, y0, line_color, fill_color); @@ -633,8 +626,8 @@ /* draw simple line between the two ends */ D_begin(); - D_move_abs(x_pos + 25, y_pos + 15); - D_cont_abs(x_pos + 25 + line_len, y_pos + 15); + D_move_abs(x_pos_start, y_pos + ysize / 2); + D_cont_abs(x_pos_start + line_len, y_pos + ysize / 2); D_end(); /* no-op? */ } D_stroke(); @@ -648,34 +641,38 @@ D_get_text_box(label, &tt, &tb, &tl, &tr); if (text_posn == TEXT_OVER) { - D_pos_abs(x_pos + 25 + line_len / 2. - - strlen(label) * fontsize * 0.81 / 2, y_pos); + D_pos_abs(x_pos + line_len/2 + xspace_around_line + + (north_arrow ? xspace_bf_N + xsize_N : 0) - (tr - tl) / 2, + y_pos); D_text(label); } else if (text_posn == TEXT_UNDER) { - D_pos_abs(x_pos + 25 + line_len / 2. - - strlen(label) * fontsize * 0.81 / 2, y_pos + 43); + D_pos_abs(x_pos + line_len/2 + xspace_around_line + + (north_arrow ? xspace_bf_N + xsize_N : 0) - (tr - tl) / 2, + y_pos + 40 * width_scale); D_text(label); } else if (text_posn == TEXT_RIGHT) { if (style == STYLE_TICKS_UP) - y_pos -= 8; + y_pos -= 8 * width_scale; else if (style == STYLE_TICKS_DOWN) - y_pos += 9; + y_pos += 9 * width_scale; - D_pos_abs(x_pos + 35 + line_len, y_pos + 20); + D_pos_abs(x_pos + line_len + 2 * xspace_around_line + + (north_arrow ? xspace_bf_N + xsize_N : 0), + y_pos + ysize / 2 + (tt - tb) /2); D_text(label); } else if (text_posn == TEXT_LEFT) { if (style == STYLE_TICKS_UP) - y_pos -= 8; + y_pos -= 8 * width_scale; else if (style == STYLE_TICKS_DOWN) - y_pos += 9; + y_pos += 9 * width_scale; if (style == STYLE_CLASSIC_BAR || style == STYLE_THIN_WITH_ENDS) - x_pos -= 13; + x_pos -= 13 * width_scale; - D_pos_abs(x_pos + 5 - (tr - tl), y_pos + 20); + D_pos_abs(x_pos + 5 - (tr - tl), y_pos + ysize / 2 + (tt - tb) /2); D_text(label); } Modified: grass/trunk/display/d.barscale/main.c =================================================================== --- grass/trunk/display/d.barscale/main.c 2016-10-01 18:10:29 UTC (rev 69618) +++ grass/trunk/display/d.barscale/main.c 2016-10-01 19:51:11 UTC (rev 69619) @@ -12,8 +12,9 @@ * Glynn Clements , * Hamish Bowman , * Jan-Oliver Wagner - * Major rewrite for GRASS 7 by Hamish Bowman, June 2013 + * Major rewrite for GRASS 7 by Hamish Bowman, June 2013 * Adam Laza , GSoC 2016 + * Anna Petrasova , width_scale added * * PURPOSE: Displays a barscale on graphics monitor * @@ -43,7 +44,8 @@ { struct GModule *module; struct Option *bg_color_opt, *fg_color_opt, *coords, *fsize, *barstyle, - *text_placement, *length_opt, *segm_opt, *units_opt, *label_opt; + *text_placement, *length_opt, *segm_opt, *units_opt, *label_opt, + *width_scale_opt; struct Flag *feet, *no_text, *n_symbol; struct Cell_head W; double east, north; @@ -52,6 +54,7 @@ double length; int segm; char *label; + double width_scale; /* Initialize the GIS calls */ G_gisinit(argv[0]); @@ -161,6 +164,14 @@ text_placement->options = "under,over,left,right"; text_placement->answer = "right"; text_placement->guisection = _("Text"); + + width_scale_opt = G_define_option(); + width_scale_opt->key = "width_scale"; + width_scale_opt->type = TYPE_DOUBLE; + width_scale_opt->required = NO; + width_scale_opt->answer = "1"; + width_scale_opt->options = "0.5-100"; + width_scale_opt->description = _("Scale factor to change bar width"); fsize = G_define_option(); fsize->key = "fontsize"; @@ -293,6 +304,8 @@ if (no_text->answer) fontsize = -1; + width_scale = atof(width_scale_opt->answer); + /* Parse and select foreground color */ fg_color = D_parse_color(fg_color_opt->answer, 0); @@ -306,7 +319,7 @@ D_setup(0); - draw_scale(east, north, length, segm, units, label, bar_style, text_position, fontsize); + draw_scale(east, north, length, segm, units, label, bar_style, text_position, width_scale, fontsize); D_save_command(G_recreate_command()); D_close_driver(); Modified: grass/trunk/display/d.barscale/options.h =================================================================== --- grass/trunk/display/d.barscale/options.h 2016-10-01 18:10:29 UTC (rev 69618) +++ grass/trunk/display/d.barscale/options.h 2016-10-01 19:51:11 UTC (rev 69619) @@ -28,4 +28,4 @@ extern int north_arrow; /* draw_scale.c */ -int draw_scale(double, double, int, int, int, char *, int, int, double); +int draw_scale(double, double, int, int, int, char *, int, int, double, double); From svn_grass at osgeo.org Sat Oct 1 13:48:55 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 1 Oct 2016 13:48:55 -0700 Subject: [GRASS-SVN] r69620 - in grass/trunk/raster/r.sim: r.sim.sediment r.sim.water simlib Message-ID: <20161001204855.9DCFC3901D3@trac.osgeo.org> Author: annakrat Date: 2016-10-01 13:48:55 -0700 (Sat, 01 Oct 2016) New Revision: 69620 Modified: grass/trunk/raster/r.sim/r.sim.sediment/main.c grass/trunk/raster/r.sim/r.sim.water/main.c grass/trunk/raster/r.sim/simlib/simlib.h Log: simlib: give more control over seeding of random number generator Modified: grass/trunk/raster/r.sim/r.sim.sediment/main.c =================================================================== --- grass/trunk/raster/r.sim/r.sim.sediment/main.c 2016-10-01 19:51:11 UTC (rev 69619) +++ grass/trunk/raster/r.sim/r.sim.sediment/main.c 2016-10-01 20:48:55 UTC (rev 69620) @@ -101,10 +101,11 @@ { int ii; int ret_val; - static int rand1 = 12345; struct Cell_head cellhd; struct WaterParams wp; struct options parm; + struct flags flag; + long seed_value; G_gisinit(argv[0]); @@ -259,9 +260,42 @@ parm.diffc->description = _("Water diffusion constant"); parm.diffc->guisection = _("Parameters"); + + parm.seed = G_define_option(); + parm.seed->key = "random_seed"; + parm.seed->type = TYPE_INTEGER; + parm.seed->required = NO; + parm.seed->label = _("Seed for random number generator"); + parm.seed->description = + _("The same seed can be used to obtain same results" + " or random seed can be generated by other means."); + + flag.generateSeed = G_define_flag(); + flag.generateSeed->key = 's'; + flag.generateSeed->label = + _("Generate random seed"); + flag.generateSeed->description = + _("Automatically generates random seed for random number" + " generator (use when you don't want to provide the seed option)"); + if (G_parser(argc, argv)) exit(EXIT_FAILURE); + if (flag.generateSeed->answer) { + seed_value = G_srand48_auto(); + G_verbose_message(_("Generated random seed (-s): %ld"), seed_value); + } + else if (parm.seed->answer) { + seed_value = atol(parm.seed->answer); + G_srand48(seed_value); + G_verbose_message(_("Read random seed from %s option: %ld"), + parm.seed->key, seed_value); + } + else { + /* default as it used to be */ + G_srand48(12345); + } + G_get_set_window(&cellhd); WaterParams_init(&wp); @@ -365,7 +399,6 @@ alloc_grids_sediment(); - G_srand48(rand1); grad_check(); init_grids_sediment(); /* treba dat output pre topoerdep */ Modified: grass/trunk/raster/r.sim/r.sim.water/main.c =================================================================== --- grass/trunk/raster/r.sim/r.sim.water/main.c 2016-10-01 19:51:11 UTC (rev 69619) +++ grass/trunk/raster/r.sim/r.sim.water/main.c 2016-10-01 20:48:55 UTC (rev 69620) @@ -100,12 +100,12 @@ int ii; int ret_val; double x_orig, y_orig; - static int rand1 = 12345; struct GModule *module; struct Cell_head cellhd; struct WaterParams wp; struct options parm; struct flags flag; + long seed_value; G_gisinit(argv[0]); @@ -297,9 +297,41 @@ flag.tserie->description = _("Time-series output"); flag.tserie->guisection = _("Output"); + parm.seed = G_define_option(); + parm.seed->key = "random_seed"; + parm.seed->type = TYPE_INTEGER; + parm.seed->required = NO; + parm.seed->label = _("Seed for random number generator"); + parm.seed->description = + _("The same seed can be used to obtain same results" + " or random seed can be generated by other means."); + + flag.generateSeed = G_define_flag(); + flag.generateSeed->key = 's'; + flag.generateSeed->label = + _("Generate random seed"); + flag.generateSeed->description = + _("Automatically generates random seed for random number" + " generator (use when you don't want to provide the seed option)"); + if (G_parser(argc, argv)) exit(EXIT_FAILURE); + if (flag.generateSeed->answer) { + seed_value = G_srand48_auto(); + G_verbose_message(_("Generated random seed (-s): %ld"), seed_value); + } + else if (parm.seed->answer) { + seed_value = atol(parm.seed->answer); + G_srand48(seed_value); + G_verbose_message(_("Read random seed from %s option: %ld"), + parm.seed->key, seed_value); + } + else { + /* default as it used to be */ + G_srand48(12345); + } + G_get_set_window(&cellhd); WaterParams_init(&wp); @@ -476,8 +508,6 @@ alloc_grids_water(); - G_debug(1, "seeding randoms"); - G_srand48(rand1); grad_check(); main_loop(); Modified: grass/trunk/raster/r.sim/simlib/simlib.h =================================================================== --- grass/trunk/raster/r.sim/simlib/simlib.h 2016-10-01 19:51:11 UTC (rev 69619) +++ grass/trunk/raster/r.sim/simlib/simlib.h 2016-10-01 20:48:55 UTC (rev 69620) @@ -85,12 +85,12 @@ *observation, *depth, *disch, *err, *outwalk, *nwalk, *niter, *outiter, *density, *diffc, *hmax, *halpha, *hbeta, *wdepth, *detin, *tranin, *tauin, *tc, *et, *conc, *flux, *erdep, *rainval, *maninval, - *infilval, *logfile; + *infilval, *logfile, *seed; }; struct flags { - struct Flag *mscale, *tserie; + struct Flag *mscale, *tserie, *generateSeed; }; #endif /* __SIMLIB_H__ */ From svn_grass at osgeo.org Sat Oct 1 13:59:34 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 1 Oct 2016 13:59:34 -0700 Subject: [GRASS-SVN] r69621 - grass/trunk/display/d.linegraph Message-ID: <20161001205934.0FFCF3903BE@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-01 13:59:33 -0700 (Sat, 01 Oct 2016) New Revision: 69621 Modified: grass/trunk/display/d.linegraph/Makefile grass/trunk/display/d.linegraph/main.c Log: d.linegraph: support color table for individual variables Modified: grass/trunk/display/d.linegraph/Makefile =================================================================== --- grass/trunk/display/d.linegraph/Makefile 2016-10-01 20:48:55 UTC (rev 69620) +++ grass/trunk/display/d.linegraph/Makefile 2016-10-01 20:59:33 UTC (rev 69621) @@ -2,8 +2,8 @@ PGM = d.linegraph -LIBES = $(DISPLAYLIB) $(GISLIB) -DEPENDENCIES = $(DISPLAYDEP) $(GISDEP) +LIBES = $(DISPLAYLIB) $(GISLIB) $(RASTERLIB) +DEPENDENCIES = $(DISPLAYDEP) $(GISDEP) $(RASTERDEP) include $(MODULE_TOPDIR)/include/Make/Module.make Modified: grass/trunk/display/d.linegraph/main.c =================================================================== --- grass/trunk/display/d.linegraph/main.c 2016-10-01 20:48:55 UTC (rev 69620) +++ grass/trunk/display/d.linegraph/main.c 2016-10-01 20:59:33 UTC (rev 69621) @@ -86,6 +86,7 @@ { int num_pnts; /* number of lines in file */ int color; /* color to use for y lines */ + int r, g, b; float max; /* maximum value in file */ float min; /* minimum value in file */ float value; /* current value read in */ @@ -112,6 +113,7 @@ struct Option *dir_opt, *x_opt, *y_opt; struct Option *y_color_opt; + struct Option *color_table_opt; struct Option *title[3]; struct Option *t_color_opt; struct Option *y_min, *y_max; @@ -156,6 +158,10 @@ y_color_opt->gisprompt = "old_color,color,color"; y_color_opt->answers = NULL; + color_table_opt = G_define_standard_option(G_OPT_M_COLR); + color_table_opt->key = "color_table"; + color_table_opt->guisection = _("Define"); + t_color_opt = G_define_option(); t_color_opt->key = "title_color"; t_color_opt->description = _("Color for axis, tics, numbers, and title"); @@ -271,6 +277,29 @@ G_fatal_error(_("Only <%d> colors given for <%d> lines"), j, num_y_files); } + else if (color_table_opt->answer) { + struct Colors colors; + Rast_init_colors(&colors); + Rast_make_colors(&colors, color_table_opt->answer, 1, num_y_files); + int* values = G_malloc(sizeof(int)); + unsigned char* r = G_malloc(sizeof(unsigned char)); + unsigned char* g = G_malloc(sizeof(unsigned char)); + unsigned char* b = G_malloc(sizeof(unsigned char)); + unsigned char* set = G_malloc(sizeof(unsigned char)); + for (i = 0; i < num_y_files; i++) + values[i] = i + 1; + Rast_lookup_c_colors(values, r, g, b, set, num_y_files, &colors); + for (i = 0; i < num_y_files; i++) { + /* the in list is indexed from 1 */ + in[i + 1].r = r[i]; + in[i + 1].g = g[i]; + in[i + 1].b = b[i]; + } + G_free(r); + G_free(g); + G_free(b); + G_free(set); + } else /* no colors given on command line, use default list */ { @@ -417,7 +446,10 @@ /* draw increment of each Y file's data */ - D_use_color(in[i].color); + if (color_table_opt->answer) + D_RGB_color(in[i].r, in[i].g, in[i].b); + else + D_use_color(in[i].color); /* find out position of where Y should be drawn. */ /* if our minimum value of y is not negative, this is easy */ From svn_grass at osgeo.org Sat Oct 1 14:01:59 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 1 Oct 2016 14:01:59 -0700 Subject: [GRASS-SVN] r69622 - grass/trunk/display/d.linegraph Message-ID: <20161001210159.80AE43903BE@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-01 14:01:59 -0700 (Sat, 01 Oct 2016) New Revision: 69622 Modified: grass/trunk/display/d.linegraph/d.linegraph.html Log: d.linegraph: example with two variables Modified: grass/trunk/display/d.linegraph/d.linegraph.html =================================================================== --- grass/trunk/display/d.linegraph/d.linegraph.html 2016-10-01 20:59:33 UTC (rev 69621) +++ grass/trunk/display/d.linegraph/d.linegraph.html 2016-10-01 21:01:59 UTC (rev 69622) @@ -75,6 +75,52 @@ (You can make GNUplot output pretty by using its SVG or PostScript output driver and converting that back into a rasterized image in a paint program) +

EXAMPLE

+ +The following can be executed in Bash to create the input data for this +example. The user can just create these files in a text editor, save +them and specify path to them. + +
+cat > x.txt <<EOF
+1
+3
+4
+6
+9
+EOF
+cat > y1.txt <<EOF
+50
+58
+65
+34
+27
+EOF
+cat > y2.txt <<EOF
+10
+20
+35
+50
+45
+EOF
+
+ + + +The series of commands creates a file plot.png in the current +directory which is the drawing make by d.linegraph. + +
+d.mon start=cairo output=plot.png width=400 height=400
+d.linegraph x_file=x.txt y_file=y1.txt,y2.txt
+d.mon stop=cairo
+
+ +

SEE ALSO

d.frame, From svn_grass at osgeo.org Sun Oct 2 06:11:07 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 06:11:07 -0700 Subject: [GRASS-SVN] r69623 - grass/trunk/lib/init Message-ID: <20161002131107.135253903BE@trac.osgeo.org> Author: neteler Date: 2016-10-02 06:11:06 -0700 (Sun, 02 Oct 2016) New Revision: 69623 Modified: grass/trunk/lib/init/helptext.html Log: helptext: PERMANENT is a mapset, not a location (found by veroandreo) Modified: grass/trunk/lib/init/helptext.html =================================================================== --- grass/trunk/lib/init/helptext.html 2016-10-01 21:01:59 UTC (rev 69622) +++ grass/trunk/lib/init/helptext.html 2016-10-02 13:11:06 UTC (rev 69623) @@ -96,8 +96,8 @@ found in another MAPSET of the same LOCATION in the g.mapsets documentation. -

The role of the "PERMANENT" LOCATION

-When creating a new LOCATION, GRASS automatically creates a special +

The role of the "PERMANENT" MAPSET

+When creating a new LOCATION, GRASS GIS automatically creates a special MAPSET called PERMANENT where the core data for the project can be stored. Data in the PERMANENT MAPSET can only be added, modified or removed by the owner of the PERMANENT MAPSET; however, they can be From svn_grass at osgeo.org Sun Oct 2 06:11:41 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 06:11:41 -0700 Subject: [GRASS-SVN] r69624 - grass/branches/releasebranch_7_2/lib/init Message-ID: <20161002131141.B11403903BE@trac.osgeo.org> Author: neteler Date: 2016-10-02 06:11:41 -0700 (Sun, 02 Oct 2016) New Revision: 69624 Modified: grass/branches/releasebranch_7_2/lib/init/helptext.html Log: helptext: PERMANENT is a mapset, not a location (found by veroandreo) Modified: grass/branches/releasebranch_7_2/lib/init/helptext.html =================================================================== --- grass/branches/releasebranch_7_2/lib/init/helptext.html 2016-10-02 13:11:06 UTC (rev 69623) +++ grass/branches/releasebranch_7_2/lib/init/helptext.html 2016-10-02 13:11:41 UTC (rev 69624) @@ -96,8 +96,8 @@ found in another MAPSET of the same LOCATION in the g.mapsets documentation. -

The role of the "PERMANENT" LOCATION

-When creating a new LOCATION, GRASS automatically creates a special +

The role of the "PERMANENT" MAPSET

+When creating a new LOCATION, GRASS GIS automatically creates a special MAPSET called PERMANENT where the core data for the project can be stored. Data in the PERMANENT MAPSET can only be added, modified or removed by the owner of the PERMANENT MAPSET; however, they can be From svn_grass at osgeo.org Sun Oct 2 06:12:29 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 06:12:29 -0700 Subject: [GRASS-SVN] r69625 - grass/branches/releasebranch_7_0/lib/init Message-ID: <20161002131229.D3C443903BE@trac.osgeo.org> Author: neteler Date: 2016-10-02 06:12:29 -0700 (Sun, 02 Oct 2016) New Revision: 69625 Modified: grass/branches/releasebranch_7_0/lib/init/helptext.html Log: helptext: PERMANENT is a mapset, not a location (found by veroandreo) Modified: grass/branches/releasebranch_7_0/lib/init/helptext.html =================================================================== --- grass/branches/releasebranch_7_0/lib/init/helptext.html 2016-10-02 13:11:41 UTC (rev 69624) +++ grass/branches/releasebranch_7_0/lib/init/helptext.html 2016-10-02 13:12:29 UTC (rev 69625) @@ -96,8 +96,8 @@ found in another MAPSET of the same LOCATION in the g.mapsets documentation. -

The role of the "PERMANENT" LOCATION

-When creating a new LOCATION, GRASS automatically creates a special +

The role of the "PERMANENT" MAPSET

+When creating a new LOCATION, GRASS GIS automatically creates a special MAPSET called PERMANENT where the core data for the project can be stored. Data in the PERMANENT MAPSET can only be added, modified or removed by the owner of the PERMANENT MAPSET; however, they can be From svn_grass at osgeo.org Sun Oct 2 06:19:05 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 06:19:05 -0700 Subject: [GRASS-SVN] r69626 - grass/branches/releasebranch_6_4/lib/init Message-ID: <20161002131906.0B4B03903BE@trac.osgeo.org> Author: neteler Date: 2016-10-02 06:19:05 -0700 (Sun, 02 Oct 2016) New Revision: 69626 Modified: grass/branches/releasebranch_6_4/lib/init/helptext.html Log: G6 helptext: minor fixes (for online manual, no more G6 releases planned Modified: grass/branches/releasebranch_6_4/lib/init/helptext.html =================================================================== --- grass/branches/releasebranch_6_4/lib/init/helptext.html 2016-10-02 13:12:29 UTC (rev 69625) +++ grass/branches/releasebranch_6_4/lib/init/helptext.html 2016-10-02 13:19:05 UTC (rev 69626) @@ -89,7 +89,7 @@
[GRASS GIS Location structure]
- Fig. 1: GRASS GIS location structure + Fig. 1: GRASS GIS 6 location structure

Creating and maintaining MAPSETs

@@ -97,8 +97,8 @@ related to project issues or subregions. Another motivation is to support simultaneous access of several users to the map layers stored within the same LOCATION, i.e. teams working on the same -project. For teams a centralized GRASS DATABASE would be defined -in a network file system (e.g. NFS). Besides access to his/her own +project. For teams, a centralized GRASS DATABASE would be defined +in a shared network file system (e.g. NFS). Besides access to his/her own MAPSET, each user can also read map layers in other users' MAPSETs, but s/he can modify or remove only the map layers in his/her own MAPSET. @@ -107,8 +107,8 @@ found in another MAPSET of the same LOCATION in the g.mapsets documentation. -

The role of the "PERMANENT" LOCATION

-When creating a new LOCATION, GRASS automatically creates a special +

The role of the "PERMANENT" MAPSET

+When creating a new LOCATION, GRASS GIS automatically creates a special MAPSET called PERMANENT where the core data for the project can be stored. Data in the PERMANENT MAPSET can only be added, modified or removed by the owner of the PERMANENT MAPSET; however, they can be @@ -119,7 +119,7 @@ To manipulate or add data to PERMANENT, the owner would start GRASS and choose the relevant LOCATION and the PERMANENT MAPSET. This mapset also contains the DEFAULT_WIND file, which holds the default -region boundary coordinate values for the location (which all users +region boundary coordinate values for the LOCATION (which all users will inherit when they start using the database). Additionally, in all mapsets a WIND file is kept, for storing the current boundary coordinate values and the currently selected raster resolution. Users @@ -138,32 +138,34 @@

-Sample data such as the "Spearfish" or the "North Carolina" sample datasets -may be downloaded from -http://grass.osgeo.org/download/data.php -and the compressed data package(s) extracted into this new database directory. +Sample data such as the "North Carolina" or the +"Spearfish" sample datasets may be downloaded from +http://grass.osgeo.org/download/sample-data/ +and the compressed data package(s) extracted into this new database +directory.

Now you are ready to select a sample dataset in the GRASS GIS startup screen (see above) and start the session. -

4. Creating A New Location with the Location Wizard

+

4. Creating a New Location with the Location Wizard

The wxGUI graphical user interface provides a -graphical "Location Wizard" which let's you easily create a +graphical "Location Wizard" which lets you easily create a new LOCATION for own data. You will be guided through a series of dialogues to browse and select predefined projections (also via EPSG code) or to define individual projections. The rules to define the resolution as described above also apply here.

-Hint: You can create new location easily from a georeferenced data file. +Hint: You can create new LOCATION easily from a georeferenced data file +(e.g., SHAPE file or GeoTIFF file with the related metadata properly included). In this case you are asked whether the data itself should be imported -into the new location. The default region is then set to match imported map +into the new LOCATION. The default region is then set to match imported map and the GRASS GIS session is opened.

-After defining new location, wxGUI starts automatically. +After defining new LOCATION, wxGUI starts automatically. If data were already imported, you can add them into the Layer Manager now -and display them. If your location is empty you can import your data from +and display them. If your LOCATION is empty you can import your data from the menu: Go to "File" -> "Import raster/vector data" (see also the related Wiki page on Importing data). @@ -183,6 +185,6 @@

Last changed: $Date$


GRASS GIS 6 Reference Manual Help Index -

© 2005-2012 GRASS Development Team +

© 1999-2016 GRASS Development Team From svn_grass at osgeo.org Sun Oct 2 09:26:21 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 09:26:21 -0700 Subject: [GRASS-SVN] r69627 - grass/trunk/lib/vector/Vlib Message-ID: <20161002162622.286703901D3@trac.osgeo.org> Author: martinl Date: 2016-10-02 09:26:21 -0700 (Sun, 02 Oct 2016) New Revision: 69627 Modified: grass/trunk/lib/vector/Vlib/open_pg.c Log: vlib/pg: disable any settings defined for pg driver (can be problem when running local/remote db clusters) Modified: grass/trunk/lib/vector/Vlib/open_pg.c =================================================================== --- grass/trunk/lib/vector/Vlib/open_pg.c 2016-10-02 13:19:05 UTC (rev 69626) +++ grass/trunk/lib/vector/Vlib/open_pg.c 2016-10-02 16:26:21 UTC (rev 69627) @@ -522,9 +522,11 @@ /* try connection settings for given database first, then try * any settings defined for pg driver */ db_get_login2("pg", dbname, &user, &passwd, &host, &port); + /* any settings defined for pg driver disabled - can cause + problems when running multiple local/remote db clusters if (strlen(dbname) > 0 && !user && !passwd) db_get_login2("pg", NULL, &user, &passwd, &host, &port); - + */ if (user || passwd || host || port) { char conninfo[DB_SQL_MAX]; From svn_grass at osgeo.org Sun Oct 2 09:30:30 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 09:30:30 -0700 Subject: [GRASS-SVN] r69628 - grass/branches/releasebranch_7_2/lib/vector/Vlib Message-ID: <20161002163030.AB1D43901D3@trac.osgeo.org> Author: martinl Date: 2016-10-02 09:30:30 -0700 (Sun, 02 Oct 2016) New Revision: 69628 Modified: grass/branches/releasebranch_7_2/lib/vector/Vlib/open_pg.c Log: vlib/pg: disable any settings defined for pg driver (can be problem when running local/remote db clusters) (relbr72: merge r69627 from trunk) Modified: grass/branches/releasebranch_7_2/lib/vector/Vlib/open_pg.c =================================================================== --- grass/branches/releasebranch_7_2/lib/vector/Vlib/open_pg.c 2016-10-02 16:26:21 UTC (rev 69627) +++ grass/branches/releasebranch_7_2/lib/vector/Vlib/open_pg.c 2016-10-02 16:30:30 UTC (rev 69628) @@ -522,9 +522,11 @@ /* try connection settings for given database first, then try * any settings defined for pg driver */ db_get_login2("pg", dbname, &user, &passwd, &host, &port); + /* any settings defined for pg driver disabled - can cause + problems when running multiple local/remote db clusters if (strlen(dbname) > 0 && !user && !passwd) db_get_login2("pg", NULL, &user, &passwd, &host, &port); - + */ if (user || passwd || host || port) { char conninfo[DB_SQL_MAX]; From svn_grass at osgeo.org Sun Oct 2 11:08:39 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 11:08:39 -0700 Subject: [GRASS-SVN] r69629 - grass/trunk/lib/init Message-ID: <20161002180839.C2D4F3901D3@trac.osgeo.org> Author: neteler Date: 2016-10-02 11:08:39 -0700 (Sun, 02 Oct 2016) New Revision: 69629 Modified: grass/trunk/lib/init/grass7.html Log: grass7 helptext: explain -e flag; fix --exec flag (contributed by veroandreo) Modified: grass/trunk/lib/init/grass7.html =================================================================== --- grass/trunk/lib/init/grass7.html 2016-10-02 16:30:30 UTC (rev 69628) +++ grass/trunk/lib/init/grass7.html 2016-10-02 18:08:39 UTC (rev 69629) @@ -30,6 +30,9 @@

-c EPSG:code:datum_trans
Creates new GRASS projected location in specified GISDBASE with given EPSG code and datum transform parameters +
-e +
Exit after creation of location or mapset. Only with -c flag +
-f
Forces removal of .gislock if exists (use with care!). Only with -text flag @@ -46,7 +49,7 @@
--config
Prints GRASS configuration parameters (options: arch, build, compiler, path, revision) -
-exec EXECUTABLE +
--exec EXECUTABLE
Execute GRASS module or script. The provided executable will be executed in a GRASS GIS non-interactive session. @@ -271,7 +274,8 @@ Region issues ignored. --> -Create a new Location based on a projection of a file: +Create a new Location based on a geodata file's projection (-c) +and exit (-e):
 grass73 -c elevation.tiff -e /path/to/grassdata/test1/


From svn_grass at osgeo.org  Sun Oct  2 11:10:26 2016
From: svn_grass at osgeo.org (svn_grass at osgeo.org)
Date: Sun,  2 Oct 2016 11:10:26 -0700
Subject: [GRASS-SVN] r69630 - grass/branches/releasebranch_7_2/lib/init
Message-ID: <20161002181026.76FFE3901D3@trac.osgeo.org>

Author: neteler
Date: 2016-10-02 11:10:26 -0700 (Sun, 02 Oct 2016)
New Revision: 69630

Modified:
   grass/branches/releasebranch_7_2/lib/init/grass7.html
Log:
grass7 helptext: explain -e flag; fix --exec flag (contributed by veroandreo)

Modified: grass/branches/releasebranch_7_2/lib/init/grass7.html
===================================================================
--- grass/branches/releasebranch_7_2/lib/init/grass7.html	2016-10-02 18:08:39 UTC (rev 69629)
+++ grass/branches/releasebranch_7_2/lib/init/grass7.html	2016-10-02 18:10:26 UTC (rev 69630)
@@ -30,6 +30,9 @@
 
-c EPSG:code:datum_trans
Creates new GRASS projected location in specified GISDBASE with given EPSG code and datum transform parameters +
-e +
Exit after creation of location or mapset. Only with -c flag +
-f
Forces removal of .gislock if exists (use with care!). Only with -text flag @@ -46,7 +49,7 @@
--config
Prints GRASS configuration parameters (options: arch, build, compiler, path, revision) -
-exec EXECUTABLE +
--exec EXECUTABLE
Execute GRASS module or script. The provided executable will be executed in a GRASS GIS non-interactive session. @@ -271,7 +274,8 @@ Region issues ignored. --> -Create a new Location based on a projection of a file: +Create a new Location based on a geodata file's projection (-c) +and exit (-e):
 grass72 -c elevation.tiff -e /path/to/grassdata/test1/


From svn_grass at osgeo.org  Sun Oct  2 12:16:55 2016
From: svn_grass at osgeo.org (svn_grass at osgeo.org)
Date: Sun,  2 Oct 2016 12:16:55 -0700
Subject: [GRASS-SVN] r69631 - grass/trunk/lib/init
Message-ID: <20161002191655.6FC8C3901F6@trac.osgeo.org>

Author: neteler
Date: 2016-10-02 12:16:55 -0700 (Sun, 02 Oct 2016)
New Revision: 69631

Modified:
   grass/trunk/lib/init/grass7.html
Log:
grass7 helptext: 'Sample data' section added

Modified: grass/trunk/lib/init/grass7.html
===================================================================
--- grass/trunk/lib/init/grass7.html	2016-10-02 18:10:26 UTC (rev 69630)
+++ grass/trunk/lib/init/grass7.html	2016-10-02 19:16:55 UTC (rev 69631)
@@ -96,6 +96,17 @@
 these checks fail then grass73 will automatically switch back
 to the text user interface mode.
 
+

SAMPLE DATA

+ +The GRASS GIS project provides several free sample geospatial datasets +as ready-to-use locations. They are available to download at +https://grass.osgeo.org/download/sample-data/. + +The "North Carolina data set" is a modern package of geospatial data from +North Carolina (USA), and it includes raster, vector, LiDAR and satellite +data. This is the most extensively used data set in the documentation and +the examples throughout the user manual pages are based upon it. +

ENVIRONMENT VARIABLES

A number of environment variables are available at GRASS startup to From svn_grass at osgeo.org Sun Oct 2 12:17:10 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 12:17:10 -0700 Subject: [GRASS-SVN] r69632 - grass/branches/releasebranch_7_2/lib/init Message-ID: <20161002191710.B7D943901F6@trac.osgeo.org> Author: neteler Date: 2016-10-02 12:17:10 -0700 (Sun, 02 Oct 2016) New Revision: 69632 Modified: grass/branches/releasebranch_7_2/lib/init/grass7.html Log: grass7 helptext: 'Sample data' section added Modified: grass/branches/releasebranch_7_2/lib/init/grass7.html =================================================================== --- grass/branches/releasebranch_7_2/lib/init/grass7.html 2016-10-02 19:16:55 UTC (rev 69631) +++ grass/branches/releasebranch_7_2/lib/init/grass7.html 2016-10-02 19:17:10 UTC (rev 69632) @@ -96,6 +96,17 @@ these checks fail then grass72 will automatically switch back to the text user interface mode. +

SAMPLE DATA

+ +The GRASS GIS project provides several free sample geospatial datasets +as ready-to-use locations. They are available to download at +https://grass.osgeo.org/download/sample-data/. + +The "North Carolina data set" is a modern package of geospatial data from +North Carolina (USA), and it includes raster, vector, LiDAR and satellite +data. This is the most extensively used data set in the documentation and +the examples throughout the user manual pages are based upon it. +

ENVIRONMENT VARIABLES

A number of environment variables are available at GRASS startup to From svn_grass at osgeo.org Sun Oct 2 12:17:18 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 12:17:18 -0700 Subject: [GRASS-SVN] r69633 - grass/branches/releasebranch_7_0/lib/init Message-ID: <20161002191718.ED5A93901F6@trac.osgeo.org> Author: neteler Date: 2016-10-02 12:17:18 -0700 (Sun, 02 Oct 2016) New Revision: 69633 Modified: grass/branches/releasebranch_7_0/lib/init/grass7.html Log: grass7 helptext: 'Sample data' section added Modified: grass/branches/releasebranch_7_0/lib/init/grass7.html =================================================================== --- grass/branches/releasebranch_7_0/lib/init/grass7.html 2016-10-02 19:17:10 UTC (rev 69632) +++ grass/branches/releasebranch_7_0/lib/init/grass7.html 2016-10-02 19:17:18 UTC (rev 69633) @@ -84,6 +84,17 @@ these checks fail then grass70 will automatically switch back to the text user interface mode. +

SAMPLE DATA

+ +The GRASS GIS project provides several free sample geospatial datasets +as ready-to-use locations. They are available to download at +https://grass.osgeo.org/download/sample-data/. + +The "North Carolina data set" is a modern package of geospatial data from +North Carolina (USA), and it includes raster, vector, LiDAR and satellite +data. This is the most extensively used data set in the documentation and +the examples throughout the user manual pages are based upon it. +

ENVIRONMENT VARIABLES

A number of environment variables are available at GRASS startup to @@ -186,7 +197,7 @@
LOCATION
A fully qualified path to a mapset - (eg /usr/local/share/grassdata/spearfish60/PERMANENT). This + (eg /usr/local/share/grassdata/spearfish70/PERMANENT). This environment variable overrides the GISDBASE, LOCATION_NAME, and MAPSET variables.
GISDBASE @@ -264,9 +275,9 @@ The environment variables are defined as follows:
-LOCATION = /usr/local/share/grassdata/spearfish60/PERMANENT
+LOCATION = /usr/local/share/grassdata/spearfish70/PERMANENT
 GISDBASE = /usr/local/share/grassdata
-LOCATION_NAME = spearfish60
+LOCATION_NAME = spearfish70
 MAPSET = PERMANENT
 
From svn_grass at osgeo.org Sun Oct 2 12:54:40 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 12:54:40 -0700 Subject: [GRASS-SVN] r69634 - in grass/branches/releasebranch_7_0: include mswindows/osgeo4w Message-ID: <20161002195440.95FBA3901F6@trac.osgeo.org> Author: neteler Date: 2016-10-02 12:54:40 -0700 (Sun, 02 Oct 2016) New Revision: 69634 Modified: grass/branches/releasebranch_7_0/include/VERSION grass/branches/releasebranch_7_0/mswindows/osgeo4w/setup.hint Log: GRASS GIS 7.0.5 Modified: grass/branches/releasebranch_7_0/include/VERSION =================================================================== --- grass/branches/releasebranch_7_0/include/VERSION 2016-10-02 19:17:18 UTC (rev 69633) +++ grass/branches/releasebranch_7_0/include/VERSION 2016-10-02 19:54:40 UTC (rev 69634) @@ -1,4 +1,4 @@ 7 0 -5svn +5 2016 Modified: grass/branches/releasebranch_7_0/mswindows/osgeo4w/setup.hint =================================================================== --- grass/branches/releasebranch_7_0/mswindows/osgeo4w/setup.hint 2016-10-02 19:17:18 UTC (rev 69633) +++ grass/branches/releasebranch_7_0/mswindows/osgeo4w/setup.hint 2016-10-02 19:54:40 UTC (rev 69634) @@ -3,6 +3,5 @@ category: Desktop requires: liblas avce00 gpsbabel gs gdal-python matplotlib msvcrt iconv libtiff gdal proj freetype-mingw pdcurses zlib fftw libpng wxpython python-numpy python-pil pyopengl cairo psycopg2 maintainer: MartinLanda -curr: 7.0.4-1 -prev: 7.0.3-1 -test: 7.0.5RC2-1 +curr: 7.0.5-1 +prev: 7.0.4-1 From svn_grass at osgeo.org Sun Oct 2 13:10:34 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 13:10:34 -0700 Subject: [GRASS-SVN] r69635 - grass-addons/tools/wingrass-packager Message-ID: <20161002201034.EA1943901D3@trac.osgeo.org> Author: martinl Date: 2016-10-02 13:10:34 -0700 (Sun, 02 Oct 2016) New Revision: 69635 Modified: grass-addons/tools/wingrass-packager/cronjob.sh Log: wingrass server ip changed Modified: grass-addons/tools/wingrass-packager/cronjob.sh =================================================================== --- grass-addons/tools/wingrass-packager/cronjob.sh 2016-10-02 19:54:40 UTC (rev 69634) +++ grass-addons/tools/wingrass-packager/cronjob.sh 2016-10-02 20:10:34 UTC (rev 69635) @@ -75,7 +75,7 @@ } download_unzip() { - wget -q http://147.32.131.91/wingrass/wingrass.zip + wget -q http://147.32.131.147/wingrass/wingrass.zip unzip -o -q wingrass.zip rm wingrass.zip } From svn_grass at osgeo.org Sun Oct 2 13:11:49 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 13:11:49 -0700 Subject: [GRASS-SVN] r69636 - grass/tags Message-ID: <20161002201149.B23563901D3@trac.osgeo.org> Author: neteler Date: 2016-10-02 13:11:49 -0700 (Sun, 02 Oct 2016) New Revision: 69636 Added: grass/tags/release_20161002_grass_7_0_5/ Log: Tagging release grass_7_0_5 From svn_grass at osgeo.org Sun Oct 2 13:12:45 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 13:12:45 -0700 Subject: [GRASS-SVN] r69637 - grass/branches/releasebranch_7_0/include Message-ID: <20161002201245.D29863901D3@trac.osgeo.org> Author: neteler Date: 2016-10-02 13:12:45 -0700 (Sun, 02 Oct 2016) New Revision: 69637 Modified: grass/branches/releasebranch_7_0/include/VERSION Log: back to SVN Modified: grass/branches/releasebranch_7_0/include/VERSION =================================================================== --- grass/branches/releasebranch_7_0/include/VERSION 2016-10-02 20:11:49 UTC (rev 69636) +++ grass/branches/releasebranch_7_0/include/VERSION 2016-10-02 20:12:45 UTC (rev 69637) @@ -1,4 +1,4 @@ 7 0 -5 +6svn 2016 From svn_grass at osgeo.org Sun Oct 2 13:13:49 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 13:13:49 -0700 Subject: [GRASS-SVN] r69638 - grass-addons/tools/wingrass-packager Message-ID: <20161002201349.E75223901D3@trac.osgeo.org> Author: martinl Date: 2016-10-02 13:13:49 -0700 (Sun, 02 Oct 2016) New Revision: 69638 Modified: grass-addons/tools/wingrass-packager/grass_addons.sh grass-addons/tools/wingrass-packager/grass_copy_wwwroot.sh grass-addons/tools/wingrass-packager/grass_packager_release.bat Log: wingrass: prepare for 7.0.5 Modified: grass-addons/tools/wingrass-packager/grass_addons.sh =================================================================== --- grass-addons/tools/wingrass-packager/grass_addons.sh 2016-10-02 20:12:45 UTC (rev 69637) +++ grass-addons/tools/wingrass-packager/grass_addons.sh 2016-10-02 20:13:49 UTC (rev 69638) @@ -69,7 +69,7 @@ #compile ${SVN_PATH}/grass7 ${GISBASE_PATH}/grass702 ${ADDON_PATH}/grass702/addons compile ${SVN_PATH}/grass7 ${GISBASE_PATH}/grass703 ${ADDON_PATH}/grass703/${PLATFORM_DIR}/addons compile ${SVN_PATH}/grass7 ${GISBASE_PATH}/grass704 ${ADDON_PATH}/grass704/${PLATFORM_DIR}/addons - compile ${SVN_PATH}/grass7 ${GISBASE_PATH}/grass705RC2 ${ADDON_PATH}/grass705RC2/${PLATFORM_DIR}/addons + compile ${SVN_PATH}/grass7 ${GISBASE_PATH}/grass705 ${ADDON_PATH}/grass705/${PLATFORM_DIR}/addons compile ${SVN_PATH}/grass7 ${GISBASE_PATH}/grass70_release ${ADDON_PATH}/grass70/${PLATFORM_DIR}/addons compile ${SVN_PATH}/grass7 ${GISBASE_PATH}/grass72_release ${ADDON_PATH}/grass72/${PLATFORM_DIR}/addons compile ${SVN_PATH}/grass7 ${GISBASE_PATH}/grass_trunk ${ADDON_PATH}/grass73/${PLATFORM_DIR}/addons Modified: grass-addons/tools/wingrass-packager/grass_copy_wwwroot.sh =================================================================== --- grass-addons/tools/wingrass-packager/grass_copy_wwwroot.sh 2016-10-02 20:12:45 UTC (rev 69637) +++ grass-addons/tools/wingrass-packager/grass_copy_wwwroot.sh 2016-10-02 20:13:49 UTC (rev 69638) @@ -88,7 +88,7 @@ #copy_addon 702 7.0.2 copy_addon 703 7.0.3 copy_addon 704 7.0.4 - copy_addon 705RC2 7.0.5RC2 + copy_addon 705 7.0.5 else copy $2 $3 fi Modified: grass-addons/tools/wingrass-packager/grass_packager_release.bat =================================================================== --- grass-addons/tools/wingrass-packager/grass_packager_release.bat 2016-10-02 20:12:45 UTC (rev 69637) +++ grass-addons/tools/wingrass-packager/grass_packager_release.bat 2016-10-02 20:13:49 UTC (rev 69638) @@ -13,7 +13,7 @@ set MAJOR=7 set MINOR=0 -set PATCH=5RC2 +set PATCH=5 set REV=1 set GVERSION=%MAJOR%%MINOR%%PATCH% From svn_grass at osgeo.org Sun Oct 2 14:07:57 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 14:07:57 -0700 Subject: [GRASS-SVN] r69639 - grass/trunk/doc Message-ID: <20161002210757.567FE39048A@trac.osgeo.org> Author: neteler Date: 2016-10-02 14:07:56 -0700 (Sun, 02 Oct 2016) New Revision: 69639 Modified: grass/trunk/doc/howto_release.txt Log: howto_release.txt: better document how to batch modify tickets; minor fixes Modified: grass/trunk/doc/howto_release.txt =================================================================== --- grass/trunk/doc/howto_release.txt 2016-10-02 20:13:49 UTC (rev 69638) +++ grass/trunk/doc/howto_release.txt 2016-10-02 21:07:56 UTC (rev 69639) @@ -63,7 +63,7 @@ rm -f include/VERSION~ - Update OSGeo4W setup.hint file - mswindows/osgeo4w/setup.hint + vim mswindows/osgeo4w/setup.hint for RC candidates use 'test' keyword for final version use 'curr' keyword @@ -176,14 +176,13 @@ o Trac updates: - Add new release to https://trac.osgeo.org/grass/admin/ticket/versions - - Set "complete" flag in https://trac.osgeo.org/grass/milestone/7.0.x --> Edit Milestone - (this ideally batch-migrates assigned tickets to next milestone) - - batch modify tickets, set to next milestone (update this query accordingly) + - Set "complete" flag in https://trac.osgeo.org/grass/milestone/7.2.x --> Edit Milestone + - Batch modify tickets, set to next milestone (update this query accordingly: two entries to change) https://trac.osgeo.org/grass/query?status=assigned&status=new&status=reopened&milestone=7.2.0&milestone=7.2.1&group=status&col=id&col=summary&col=owner&col=type&col=priority&col=component&col=version&order=priority - - under "Comment" add Field "Milestone" and set to next version - - Select all shown tickets via Status: assigned/new/reopened - - then "Change ticket" button - - Only in case of new release branch + - Set max items to 1000, then select all shown tickets via Status: assigned/new/reopened sections + - Scroll down to "Batch modify": under the "Comment" section, add Field "Milestone" and set to next version + - then use "Change ticket" button, done. + - Only in case of new release branch being created: Add Wiki Macro definitions for manual pages G7X:modulename - Edit: https://trac.osgeo.org/grass/wiki/InterMapTxt @@ -289,4 +288,5 @@ svn copy https://svn.osgeo.org/grass/grass/trunk/ \ https://svn.osgeo.org/grass/grass/branches/releasebranch_7_2 \ - -m "Creating the GRASS GIS 7.2 release branch" + -m "Creating the GRASS GIS 7.2 release branch (branch started in 05/2016, r68500)" + From svn_grass at osgeo.org Sun Oct 2 14:08:51 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 14:08:51 -0700 Subject: [GRASS-SVN] r69640 - grass/branches/releasebranch_7_2/doc Message-ID: <20161002210851.5BE0339048A@trac.osgeo.org> Author: neteler Date: 2016-10-02 14:08:51 -0700 (Sun, 02 Oct 2016) New Revision: 69640 Modified: grass/branches/releasebranch_7_2/doc/howto_release.txt Log: howto_release.txt: better document how to batch modify tickets; minor fixes Modified: grass/branches/releasebranch_7_2/doc/howto_release.txt =================================================================== --- grass/branches/releasebranch_7_2/doc/howto_release.txt 2016-10-02 21:07:56 UTC (rev 69639) +++ grass/branches/releasebranch_7_2/doc/howto_release.txt 2016-10-02 21:08:51 UTC (rev 69640) @@ -63,7 +63,7 @@ rm -f include/VERSION~ - Update OSGeo4W setup.hint file - mswindows/osgeo4w/setup.hint + vim mswindows/osgeo4w/setup.hint for RC candidates use 'test' keyword for final version use 'curr' keyword @@ -176,14 +176,13 @@ o Trac updates: - Add new release to https://trac.osgeo.org/grass/admin/ticket/versions - - Set "complete" flag in https://trac.osgeo.org/grass/milestone/7.0.x --> Edit Milestone - (this ideally batch-migrates assigned tickets to next milestone) - - batch modify tickets, set to next milestone (update this query accordingly) + - Set "complete" flag in https://trac.osgeo.org/grass/milestone/7.2.x --> Edit Milestone + - Batch modify tickets, set to next milestone (update this query accordingly: two entries to change) https://trac.osgeo.org/grass/query?status=assigned&status=new&status=reopened&milestone=7.2.0&milestone=7.2.1&group=status&col=id&col=summary&col=owner&col=type&col=priority&col=component&col=version&order=priority - - under "Comment" add Field "Milestone" and set to next version - - Select all shown tickets via Status: assigned/new/reopened - - then "Change ticket" button - - Only in case of new release branch + - Set max items to 1000, then select all shown tickets via Status: assigned/new/reopened sections + - Scroll down to "Batch modify": under the "Comment" section, add Field "Milestone" and set to next version + - then use "Change ticket" button, done. + - Only in case of new release branch being created: Add Wiki Macro definitions for manual pages G7X:modulename - Edit: https://trac.osgeo.org/grass/wiki/InterMapTxt @@ -289,4 +288,5 @@ svn copy https://svn.osgeo.org/grass/grass/trunk/ \ https://svn.osgeo.org/grass/grass/branches/releasebranch_7_2 \ - -m "Creating the GRASS GIS 7.2 release branch" + -m "Creating the GRASS GIS 7.2 release branch (branch started in 05/2016, r68500)" + From svn_grass at osgeo.org Sun Oct 2 14:09:52 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 14:09:52 -0700 Subject: [GRASS-SVN] r69641 - grass/branches/releasebranch_7_0/doc Message-ID: <20161002210952.D5DEE39048A@trac.osgeo.org> Author: neteler Date: 2016-10-02 14:09:52 -0700 (Sun, 02 Oct 2016) New Revision: 69641 Modified: grass/branches/releasebranch_7_0/doc/howto_release.txt Log: howto_release.txt: better document how to batch modify tickets; minor fixes Modified: grass/branches/releasebranch_7_0/doc/howto_release.txt =================================================================== --- grass/branches/releasebranch_7_0/doc/howto_release.txt 2016-10-02 21:08:51 UTC (rev 69640) +++ grass/branches/releasebranch_7_0/doc/howto_release.txt 2016-10-02 21:09:52 UTC (rev 69641) @@ -58,12 +58,12 @@ #example: 7 0 -5RC1 +6RC1 2016 rm -f include/VERSION~ - Update OSGeo4W setup.hint file - mswindows/osgeo4w/setup.hint + vim mswindows/osgeo4w/setup.hint for RC candidates use 'test' keyword for final version use 'curr' keyword @@ -119,7 +119,7 @@ #example 7 0 -5svn +6svn 2016 rm -f include/VERSION~ @@ -177,13 +177,12 @@ o Trac updates: - Add new release to https://trac.osgeo.org/grass/admin/ticket/versions - Set "complete" flag in https://trac.osgeo.org/grass/milestone/7.0.x --> Edit Milestone - (this ideally batch-migrates assigned tickets to next milestone) - - batch modify tickets, set to next milestone (update this query accordingly) + - Batch modify tickets, set to next milestone (update this query accordingly: two entries to change) https://trac.osgeo.org/grass/query?status=assigned&status=new&status=reopened&milestone=7.0.4&milestone=7.0.5&group=status&col=id&col=summary&col=owner&col=type&col=priority&col=component&col=version&order=priority - - under "Comment" add Field "Milestone" and set to next version - - Select all shown tickets via Status: assigned/new/reopened - - then "Change ticket" button - - Only in case of new release branch + - Set max items to 1000, then select all shown tickets via Status: assigned/new/reopened sections + - Scroll down to "Batch modify": under the "Comment" section, add Field "Milestone" and set to next version + - then use "Change ticket" button, done. + - Only in case of new release branch being created: Add Wiki Macro definitions for manual pages G7X:modulename - Edit: https://trac.osgeo.org/grass/wiki/InterMapTxt @@ -194,15 +193,15 @@ set MAJOR=7 set MINOR=0 - set PATCH=5RC1 + set PATCH=6RC1 Update addons (grass_addons.sh) rules, eg. - compile $SVN_PATH/grass7 $GISBASE_PATH/grass705RC1 $ADDON_PATH/grass705RC1/addons + compile $SVN_PATH/grass7 $GISBASE_PATH/grass706RC1 $ADDON_PATH/grass706RC1/addons Modify grass_copy_wwwroot.sh accordingly, eg. - copy_addon 705RC1 7.0.5RC1 + copy_addon 706RC1 7.0.6RC1 o Launchpad notes: From svn_grass at osgeo.org Sun Oct 2 16:01:30 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 16:01:30 -0700 Subject: [GRASS-SVN] r69642 - grass-addons/grass7/imagery/i.image.bathymetry Message-ID: <20161002230130.3B7C13902C0@trac.osgeo.org> Author: neteler Date: 2016-10-02 16:01:30 -0700 (Sun, 02 Oct 2016) New Revision: 69642 Modified: grass-addons/grass7/imagery/i.image.bathymetry/i.image.bathymetry.html grass-addons/grass7/imagery/i.image.bathymetry/i.image.bathymetry.py Log: i.image.bathymetry addon: minor Python indentation fixes; HTML page cleaned up Modified: grass-addons/grass7/imagery/i.image.bathymetry/i.image.bathymetry.html =================================================================== --- grass-addons/grass7/imagery/i.image.bathymetry/i.image.bathymetry.html 2016-10-02 21:09:52 UTC (rev 69641) +++ grass-addons/grass7/imagery/i.image.bathymetry/i.image.bathymetry.html 2016-10-02 23:01:30 UTC (rev 69642) @@ -1,32 +1,111 @@

DESCRIPTION

-i.image.bathymetry is used to estimate near-shore depth from optical satellite images. Module estimates bathymetry over near-shore region using limited reference depth points. The maximum depth can be estimated by the module is depending up on many factors such as quality of the water and suspended materials etc. (Lyzenga et al., 2006, Kanno and Tanaka, 2012). Our experiments with several multi-spectral optical images indicate that the depth estimates are reliable for when water column is below 20 meter. -

-Delineation of land and water area are based on combining the result of NDVI and band ratio. NDVI has used to delineate water from land, band ratio between green band and infrared band used to separate the delineated water from clouds, ice etc. Atmospheric and water column correction applied according to the Lyzenga et al., 2006. Corrected spectral bands will be used for weighted multiple regression to estimate depth. R library GWmodel has been used to compute the Geographically Weighted Regression used for depth estimation. +i.image.bathymetry is used to estimate near-shore depth from +optical satellite images. Module estimates bathymetry over near-shore +region using limited reference depth points. The maximum depth can be +estimated by the module is depending up on many factors such as quality +of the water and suspended materials etc. (Lyzenga et al., 2006, Kanno +and Tanaka, 2012). Our experiments with several multi-spectral optical +images indicate that the depth estimates are reliable for when water +column is below 20 meter. + +

+Delineation of land and water area are based on combining the +result of NDVI and band ratio. NDVI has used to delineate water from +land, band ratio between green band and infrared band used to separate +the delineated water from clouds, ice etc. Atmospheric and water column +correction applied according to the Lyzenga et al., 2006. Corrected +spectral bands will be used for weighted multiple regression to +estimate depth. R library GWmodel has been used to compute the +Geographically Weighted Regression used for depth estimation. + +

NOTES

-The input image must include deep water pixels (far away from the coast) which are used to assist water surface and water column correction. Sparse depth points extracted from hydrographic charts or depth pints derived from LiDAR survey or derived from Sonar survey can be used as reference depth for calibration. -

- The tide height at the time of reference depth collection and satellite imagery capture should be normalized if it is not. An option is available in the module to provide tide hieght at the tide of image captured and the module will correct the reference depth accordingly. This option asuumes that the reference depth given is corrected zero tide height. The tide lower than zero can be added as negative value. -

-The GWmodel adaptive GWR model is memory intensive and cannot be used to process large images. For large images, the estimation is carried out by using non-adaptive GWR implemented in r.gwr module in GRASS GIS. R > 3.1 should be installed to run GWmodel in order to proccess adaptive GWR model for better depth estimation. Default gaussian kernel will be used to estimate geographically weighted regression coefficients.The flag 'b' can be used to change the kernel function gaussian to bi-square. -

+ +The input image must include deep water pixels (far away from the +coast) which are used to assist water surface and water column +correction. Sparse depth points extracted from hydrographic charts or +depth pints derived from LiDAR survey or derived from Sonar survey can +be used as reference depth for calibration. + +

+The tide height at the time of reference depth collection and satellite +imagery capture should be normalized if it is not. An option is +available in the module to provide tide hieght at the tide of image +captured and the module will correct the reference depth accordingly. +This option asuumes that the reference depth given is corrected zero +tide height. The tide lower than zero can be added as negative value + +

+The GWmodel adaptive GWR model is memory intensive and cannot +be used to process large images. For large images, the estimation is +carried out by using non-adaptive GWR implemented in r.gwr +module in GRASS GIS. R > 3.1 should be installed to run +GWmodel in order to proccess adaptive GWR model for better +depth estimation. Default gaussian kernel will be used to estimate +geographically weighted regression coefficients.The flag -b can be +used to change the kernel function gaussian to bi-square. + +

EXAMPLES

-In i.image.bathymetry green band, red band, near-infrared band, band for correction and calibration depth points are mandatory input. Additional bands available in the visible wavelength can be used for better depth estimation as optional input. Short Wave Infrared (SWIR) band is suggested to use as "band_for_correction" if it is available (for e.g. satellite images like Landsat-7, Landsat-8 and Sentinel-2).An example of depth estimation using Sentinel-2 (MSI) image is shown below, where depth value is stored in column named 'Z' -

-i.image.bathymetry blue_band='B2' green_band='B3' red_band='B4' nir_band='B8' band_for_correction='B11' calibration_points='Calibration_points' calibration_column='Z' depth_estimate='output' -

-If SWIR band is not available near-infrared band can be used as "band_for_correction" (for e.g. satellite images like RapidEye and ALOS AVINIR-2). An example of depth estimation using RapidEye image is shown below image is shown below, where depth value is stored in column named 'value'. -

-i.image.bathymetry blue_band='B1' green_band='B2' red_band='B3' Additional_band1='B4' nir_band='B5' band_for_correction='B5' calibration_points='Calibration_points' calibration_column='value' depth_estimate='output' + +In i.image.bathymetry green band, red band, near-infrared +band, band for correction and calibration depth points are mandatory +input. Additional bands available in the visible wavelength can be used +for better depth estimation as optional input. Short Wave Infrared +(SWIR) band is suggested to use as "band_for_correction" if it is +available (for e.g. satellite images like Landsat-7, Landsat-8 and +Sentinel-2). An example of depth estimation using Sentinel-2 (MSI) +image is shown below, where depth value is stored in column named 'Z'. + +

+

	
+i.image.bathymetry blue_band='B2' green_band='B3' red_band='B4' nir_band='B8' \
+  band_for_correction='B11' calibration_points='Calibration_points'
+  calibration_column='Z' depth_estimate='output' 
+
+ +

+If SWIR band is not available near-infrared band can be used as +"band_for_correction" (for e.g. satellite images like RapidEye and ALOS +AVINIR-2). An example of depth estimation using RapidEye image is shown +below image is shown below, where depth value is stored in column named +'value'. + +

+

	
+i.image.bathymetry blue_band='B1' green_band='B2' red_band='B3' \
+ additional_band1='B4' nir_band='B5' band_for_correction='B5' \
+ calibration_points='Calibration_points'  calibration_column='value' \
+ depth_estimate='output'
+
+ +

AUTHORS

-Vinayaraj Poliyapram (email:vinay223333 at gmail.com), Luca Delucchi and Venkatesh Raghavan +Vinayaraj Poliyapram (email:vinay223333 at gmail.com), Luca Delucchi +and Venkatesh Raghavan +

SEE ALSO

-r.gwr and r.regression.multi + + +r.gwr, +r.regression.multi + +

REFERENCES

+
    -
  • Lyzenga, D. R., Malinas, N. R. and Tanis, F. J., 2006, Multispectral Bathymetry using a Simple Physically Based Algorithm. IEEE Trans. Geosci. Remote Sensing, 44(8): 2251-2259. +
  • Lyzenga, D. R., Malinas, N. R. and Tanis, F. J., 2006, Multispectral +Bathymetry using a Simple Physically Based Algorithm. IEEE Trans. Geosci. +Remote Sensing, 44(8): 2251-2259. -
  • Su, H., Liu, H., Lei, W., Philipi, M., Heyman, W., and Beck, A., 2013, Geographically Adaptive Inversion Model for Improving Bathymetric Retrieval from Multispectral satellite Imagery. IEEE Transaction on Geosciences and Remote Sensing, 52(1) : 465-476, Accessed January 2013, doi:10.1109/TGRS.2013.2241772. +
  • Su, H., Liu, H., Lei, W., Philipi, M., Heyman, W., and Beck, A., 2013, +Geographically Adaptive Inversion Model for Improving Bathymetric Retrieval +from Multispectral satellite Imagery. IEEE Transaction on Geosciences and +Remote Sensing, 52(1) : 465-476, Accessed January 2013, doi:10.1109/TGRS.2013.2241772. -
  • Vinayaraj, P., Raghavan, V., Masumoto, S. and Glejin, J., 2015, Comparative Evaluation and Refinement of Algorithm for Water Depth Estimation using Medium Resolution Remote Sensing Data. International Journal of geoinformatics, 11(3):17-29 - +
  • Vinayaraj, P., Raghavan, V., Masumoto, S. and Glejin, J., 2015, +Comparative Evaluation and Refinement of Algorithm for Water Depth Estimation +using Medium Resolution Remote Sensing Data. International Journal of +Geoinformatics, 11(3):17-29 +
Modified: grass-addons/grass7/imagery/i.image.bathymetry/i.image.bathymetry.py =================================================================== --- grass-addons/grass7/imagery/i.image.bathymetry/i.image.bathymetry.py 2016-10-02 21:09:52 UTC (rev 69641) +++ grass-addons/grass7/imagery/i.image.bathymetry/i.image.bathymetry.py 2016-10-02 23:01:30 UTC (rev 69642) @@ -15,70 +15,71 @@ ############################################################################# #%module -#% description: Satellite Derived Bathymetry (SDB) from multispectral images -#% keyword: Bathymetry -#% keyword: Satellite +#% description: Satellite Derived Bathymetry (SDB) from multispectral images. +#% keywords: imagery +#% keywords: bathymetry +#% keywords: satellite #%end #%option G_OPT_R_INPUT #% key: blue_band -#%required: no +#% required: no #%end #%option G_OPT_R_INPUT #% key: green_band -#%required: yes +#% required: yes #%end #%option G_OPT_R_INPUT #% key: red_band -#%required: yes +#% required: yes #%end #%option G_OPT_R_INPUT #% key: nir_band -#%required: yes +#% required: yes #%end #%option G_OPT_R_INPUT #% key: band_for_correction -#%required: yes +#% required: yes #%end #%option G_OPT_V_INPUT #% key: calibration_points -#%required: yes +#% required: yes #%end #%option G_OPT_R_INPUT #% key: additional_band1 -#%required: no +#% required: no #%end #%option G_OPT_R_INPUT #% key: additional_band2 -#%required: no +#% required: no #%end #%option G_OPT_R_INPUT #% key: additional_band3 -#%required: no +#% required: no #%end #%option G_OPT_R_INPUT #% key: additional_band4 -#%required: no +#% required: no #%end #%option G_OPT_R_OUTPUT #% key: depth_estimate -#%required: yes +#% required: yes #%end #%option #% key: tide_height -#%type: double -#%multiple: no -#%required: no -#%description: Tide correction to the time of satellite image capture +#% type: double +#% multiple: no +#% required: no +#% description: Tide correction to the time of satellite image capture #%end #%option #% key: calibration_column -#%type: string -#%multiple: no -#%required: yes -#%description: Name of the column which stores depth values +#% type: string +#% multiple: no +#% required: yes +#% description: Name of the column which stores depth values #%end #%flag -#%key: b +#% key: b #% description: select kernel function as bi-square #%end @@ -322,3 +323,4 @@ if __name__ == '__main__': atexit.register(cleanup) main() + From svn_grass at osgeo.org Sun Oct 2 17:44:59 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 17:44:59 -0700 Subject: [GRASS-SVN] r69643 - grass/trunk/display/d.legend.vect Message-ID: <20161003004459.F2BE63901D3@trac.osgeo.org> Author: annakrat Date: 2016-10-02 17:44:59 -0700 (Sun, 02 Oct 2016) New Revision: 69643 Modified: grass/trunk/display/d.legend.vect/main.c Log: d.legend.vect: separator option currently works only for user provided input file - make it explicit in the code Modified: grass/trunk/display/d.legend.vect/main.c =================================================================== --- grass/trunk/display/d.legend.vect/main.c 2016-10-02 23:01:30 UTC (rev 69642) +++ grass/trunk/display/d.legend.vect/main.c 2016-10-03 00:44:59 UTC (rev 69643) @@ -167,6 +167,10 @@ fl_bg->description = _("Display legend background"); fl_bg->guisection = _("Background"); + opt_sep = G_define_standard_option(G_OPT_F_SEP); + opt_sep->guisection = _("In/Out"); + opt_sep->label = _("Field separator for input file"); + opt_input = G_define_standard_option(G_OPT_F_INPUT); opt_input->label = _("Input legend file"); opt_input->description = _("Path to legend file "); @@ -180,8 +184,6 @@ opt_output->required = NO; opt_output->guisection = _("In/Out"); - opt_sep = G_define_standard_option(G_OPT_F_SEP); - opt_sep->guisection = _("In/Out"); /* Check command line */ if (G_parser(argc, argv)) { @@ -250,14 +252,14 @@ fontcolor = D_parse_color(opt_fontcolor->answer, FALSE); /*default color: black */ /* I/O */ - sep = G_option_to_separator(opt_sep); - if (opt_input->answer) { + sep = G_option_to_separator(opt_sep); file_name = opt_input->answer; if (!file_name) G_fatal_error(_("Unable to open input file <%s>"), file_name); } else { + sep = "|"; file_name = getenv("GRASS_LEGEND_FILE"); if (!file_name) G_fatal_error("No legend file defined."); From svn_grass at osgeo.org Sun Oct 2 17:46:40 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 17:46:40 -0700 Subject: [GRASS-SVN] r69644 - grass/branches/releasebranch_7_2/display/d.legend.vect Message-ID: <20161003004640.BEB1B3901D3@trac.osgeo.org> Author: annakrat Date: 2016-10-02 17:46:40 -0700 (Sun, 02 Oct 2016) New Revision: 69644 Modified: grass/branches/releasebranch_7_2/display/d.legend.vect/main.c Log: d.legend.vect: separator option currently works only for user provided input file - make it explicit in the code (merge from trunk, r69643) Modified: grass/branches/releasebranch_7_2/display/d.legend.vect/main.c =================================================================== --- grass/branches/releasebranch_7_2/display/d.legend.vect/main.c 2016-10-03 00:44:59 UTC (rev 69643) +++ grass/branches/releasebranch_7_2/display/d.legend.vect/main.c 2016-10-03 00:46:40 UTC (rev 69644) @@ -167,6 +167,10 @@ fl_bg->description = _("Display legend background"); fl_bg->guisection = _("Background"); + opt_sep = G_define_standard_option(G_OPT_F_SEP); + opt_sep->guisection = _("In/Out"); + opt_sep->label = _("Field separator for input file"); + opt_input = G_define_standard_option(G_OPT_F_INPUT); opt_input->label = _("Input legend file"); opt_input->description = _("Path to legend file "); @@ -180,8 +184,6 @@ opt_output->required = NO; opt_output->guisection = _("In/Out"); - opt_sep = G_define_standard_option(G_OPT_F_SEP); - opt_sep->guisection = _("In/Out"); /* Check command line */ if (G_parser(argc, argv)) { @@ -250,14 +252,14 @@ fontcolor = D_parse_color(opt_fontcolor->answer, FALSE); /*default color: black */ /* I/O */ - sep = G_option_to_separator(opt_sep); - if (opt_input->answer) { + sep = G_option_to_separator(opt_sep); file_name = opt_input->answer; if (!file_name) G_fatal_error(_("Unable to open input file <%s>"), file_name); } else { + sep = "|"; file_name = getenv("GRASS_LEGEND_FILE"); if (!file_name) G_fatal_error("No legend file defined."); From svn_grass at osgeo.org Sun Oct 2 18:17:12 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 18:17:12 -0700 Subject: [GRASS-SVN] r69645 - grass/trunk/raster/r.info Message-ID: <20161003011712.22F093902C0@trac.osgeo.org> Author: annakrat Date: 2016-10-02 18:17:11 -0700 (Sun, 02 Oct 2016) New Revision: 69645 Modified: grass/trunk/raster/r.info/main.c Log: r.info: make category title the primary also when using -e flag, see #3035 Modified: grass/trunk/raster/r.info/main.c =================================================================== --- grass/trunk/raster/r.info/main.c 2016-10-03 00:46:40 UTC (rev 69644) +++ grass/trunk/raster/r.info/main.c 2016-10-03 01:17:11 UTC (rev 69645) @@ -129,23 +129,25 @@ out = stdout; + if (eflag->answer || (!gflag->answer && !rflag->answer && !hflag->answer)) { + title = ""; + /* empty title by default */ + /* use title from category file as the primary (and only) title */ + if (cats_ok) + title = cats.title; + /* only use hist file title if there is none in the category file */ + if ((!title || title[0] == '\0') && hist_ok) { + title = Rast_get_history(&hist, HIST_TITLE); + /* if the title is the same as name of the map, don't use it */ + if (strcmp(title, name) == 0) + title = ""; + } + } + if (!gflag->answer && !rflag->answer && !eflag->answer && !hflag->answer) { divider('+'); - /* empty title by default */ - title = ""; - /* use title from category file as the primary (and only) title */ - if (cats_ok) - title = cats.title; - /* only use hist file title if there is none in the category file */ - if ((!title || title[0] == '\0') && hist_ok) { - title = Rast_get_history(&hist, HIST_TITLE); - /* if the title is the same as name of the map, don't use it */ - if (strcmp(title, name) == 0) - title = ""; - } - compose_line(out, "Map: %-29.29s Date: %s", name, hist_ok ? Rast_get_history(&hist, HIST_MAPID) : "??"); compose_line(out, "Mapset: %-29.29s Login of Creator: %s", @@ -380,8 +382,7 @@ fprintf(out, "database=%s\n", G_gisdbase()); fprintf(out, "date=\"%s\"\n", hist_ok ? Rast_get_history(&hist, HIST_MAPID) : "??"); fprintf(out, "creator=\"%s\"\n", hist_ok ? Rast_get_history(&hist, HIST_CREATOR) : "??"); - fprintf(out, "title=\"%s (%s)\"\n", cats_ok ? cats.title : - "??", hist_ok ? Rast_get_history(&hist, HIST_TITLE) : "??"); + fprintf(out, "title=\"%s\"\n", title); if (time_ok && (first_time_ok || second_time_ok)) { G_format_timestamp(&ts, timebuff); From svn_grass at osgeo.org Sun Oct 2 18:33:42 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 18:33:42 -0700 Subject: [GRASS-SVN] r69646 - grass/trunk/display/d.linegraph Message-ID: <20161003013342.BBD423902C0@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-02 18:33:42 -0700 (Sun, 02 Oct 2016) New Revision: 69646 Modified: grass/trunk/display/d.linegraph/d.linegraph.html grass/trunk/display/d.linegraph/main.c Log: d.linegraph: rewrite the manual Modified: grass/trunk/display/d.linegraph/d.linegraph.html =================================================================== --- grass/trunk/display/d.linegraph/d.linegraph.html 2016-10-03 01:17:11 UTC (rev 69645) +++ grass/trunk/display/d.linegraph/d.linegraph.html 2016-10-03 01:33:42 UTC (rev 69646) @@ -1,8 +1,11 @@

DESCRIPTION

d.linegraph is a primitive program to draw simple x,y line graphs -based on numerical data contained in separate files. -

Data file format
+(plots) based on numerical data contained in separate files. + + +

Data format

+ The X and Y data files for the graph are essentially a column of numbers in each file, with one input number per line. The program expects that each X value will have a corresponding Y value, therefore the number of lines in @@ -16,65 +19,98 @@ with dissimilar units, the graph produced comparing the two will be deceptive. -

-
directoryname -
Path to the directory where the input files are located. -
Example format: /usr/grass/data/graph -
ycoloroption[,option,...]] -
Color to be used for drawing the lines in the graph. If multiple Y data -files are used, an equal number of colors may be used to control the colors -of the lines. Colors will be assigned to Y data in respect to the sequence -of instantiation on the command line. Options are listed below. By -default, a series of colors will be chosen by the program if none are -provided upon invocation. -
Order of default colors: yellow, red, green, violet, blue, orange, gray, -brown, magenta, white, indigo). +

File inputs

-
titlecoloroption -
The color to be used for titles, axis lines, tics, and scale numbers. -
Default: "white" -
Color options: red, orange, yellow, green, blue, indigo, violet, -magenta, brown, gray, white, and black. +

+If directory option is provided, the paths to files can (and +should) be only relative paths to the files. This is not recommended +for scripting, but it can be advantageous when typing the paths +manually. For example when all the files are stored in the directory +/home/john/data, use can provide the following in the command +line: -

xtitlevalue -
Title to describe X data. Will be centered beneath the graph. Default -is no title unless the need for a unit descriptor is computed by the program -(i.e. X: title in hundreds). Also, see NOTES section (below) for a format -caveat for multi-word titles. +
+d.linegraph directory=/home/john/data x_file=x.txt y_file=y1.txt,y2.txt
+
-
ytitlevalue -
Title to describe Y data. Will be centered beneath the X data title. -Default is no title unless the need for a unit descriptor is computed by -the program (i.e. Y: ttiittllee in thousands). Also, see NOTES section -(below) for a format caveat for multi-word titles. In the case of graphs -with multiple lines, one may wish to use more specific title placement by -using the d.text or v.label programs. -
titlevalue -
Title to describe the graph. Will be centered over the top of graph. -Default is no title. See NOTES section (below) for a format caveat for -multi-word titles. -
+

Managing colors

+User can specify the y_color option, the color_table +option or just leave the defaults to influence the color of the +plotted lines. + +

+Color specified by y_color option is used for drawing the lines +in the graph. If multiple Y data files are used, an equal number of +colors may be used to control the colors of the lines. Colors will be +assigned to Y data in respect to the sequence of instantiation on the +command line. It can be one of GRASS GIS named colors or the RGB +values from 0-255 separated by colon. + +

+Alternatively, user can use color_table option to specify one +of the GRASS GIS predefined color tables. + +

+By default, a series of colors will be chosen by the program if none are +provided upon invocation. Order of default colors is red, green, +violet, blue, orange, gray, brown, magenta, white, and indigo. User is +advised not to rely on the order of default colors and use y_color +or color_table option to obtain predictable and reproducible +results. + +

+The color to be used for titles, axis lines, tics, and scale numbers +is determined by the title_color option. +User can provide one of the GRASS GIS named colors (such as gray, white, or black) +or use the GRASS GIS colon-separated format for RGB. + +

Titles, labels, and tics

+ +The title option specifies the text for the title of the graph. +It will be centered over the top of graph. + +The x_title option is a text to describe data for X axis. It will be +centered beneath the graph. Default is no text unless there is a need +for a unit descriptor determined by the d.linegraph module, +then string such as "in hundreds" is generated. + +The y_title option is a text to describe data for Y axis. It +will be centered beneath the X data description. Similarly, to the +x_title option, default is no text unless there is a need for an +auto-generated description. In the case of graphs with multiple lines +(multiple inputs for Y axis), user may wish to use more specific text +placement using the d.text or +v.label programs. + +

NOTES

-Since the command line parser is not amiable to multiple word inputs, to -input titles of more than one word, use the underscore character ("") to -represent spaces (" "). -

Example: "titleCensusdata1990" would be printed over the graph as "Census -data 1990". -

The way the program locates and labels tic marks is less than perfect: 1) + +For historical reasons, the d.linegraph module accepts +titles of more than one word where the underscore character ("_") +is used to represent spaces (" "). For example "Census_data_1990" +would be printed over the graph as "Census data 1990". This is not +necessary to use as long as the parameter is quoted in the command line. +In general, this is not recommended to use and there is no need to use +it at all in Python or GUI. + +

+The way the program locates and labels tic marks is less than perfect: 1) although distances between Y tics is proportional to the value, they are not proportional on the X axis; 2) decimal values between -1 and 1 can be printed on the X axis, but not on Y. (With respect to the later, the input for Y values can all be multiplied by a factor of 10 before graphing). -

It might be easier to use a 3rd party tool such as xgraph or GNUplot instead -of d.linegraph. -. -(You can make GNUplot output pretty by using its SVG or PostScript output -driver and converting that back into a rasterized image in a paint program) +

+Depending on the user needs, it might be easier or more appropriate +to use a 3rd party tool such as xgraph, gnuplot, Matplotlib in Python, +or R instead of d.linegraph. +For a more general solution for plotting in GRASS GIS, user is +advised to use the d.graph module. +

EXAMPLE

The following can be executed in Bash to create the input data for this @@ -125,9 +161,12 @@ d.frame, d.text, -v.label +v.label, +d.graph, +d.histogram +

AUTHOR

Chris Rewerts, Agricultural Engineering, Purdue University Modified: grass/trunk/display/d.linegraph/main.c =================================================================== --- grass/trunk/display/d.linegraph/main.c 2016-10-03 01:17:11 UTC (rev 69645) +++ grass/trunk/display/d.linegraph/main.c 2016-10-03 01:33:42 UTC (rev 69646) @@ -143,7 +143,9 @@ dir_opt = G_define_option(); dir_opt->key = "directory"; - dir_opt->description = _("Path to file location"); + dir_opt->label = _("Path to files"); + dir_opt->description = + _("Path to the directory where the input files are located"); dir_opt->type = TYPE_STRING; dir_opt->required = NO; /* Remove answer because create problem with full path */ From svn_grass at osgeo.org Sun Oct 2 18:50:33 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 2 Oct 2016 18:50:33 -0700 Subject: [GRASS-SVN] r69647 - grass/trunk/vector/v.what Message-ID: <20161003015033.5016B3902C0@trac.osgeo.org> Author: annakrat Date: 2016-10-02 18:50:33 -0700 (Sun, 02 Oct 2016) New Revision: 69647 Modified: grass/trunk/vector/v.what/what.c Log: v.what: use layer information (by mlennert), see #3172 Modified: grass/trunk/vector/v.what/what.c =================================================================== --- grass/trunk/vector/v.what/what.c 2016-10-03 01:33:42 UTC (rev 69646) +++ grass/trunk/vector/v.what/what.c 2016-10-03 01:50:33 UTC (rev 69647) @@ -538,13 +538,16 @@ } /* if area > 0 */ if (Cats->n_cats > 0) { - int j; + int j, k; char *formbuf1; char *formbuf2; if (json) { fprintf(stdout, ",\n\"Categories\": ["); } + k = 0; for (j = 0; j < Cats->n_cats; j++) { + if (field[i] == -1 || Cats->field[j] == field[i]) { + k++; G_debug(2, "field = %d category = %d\n", Cats->field[j], Cats->cat[j]); if (script) { @@ -552,7 +555,7 @@ Cats->cat[j]); } else if (json) { - fprintf(stdout, "%s\n{\"Layer\": %d, \"Category\": %d", j == 0 ? "": ",", + fprintf(stdout, "%s\n{\"Layer\": %d, \"Category\": %d", k == 1 ? "": ",", Cats->field[j], Cats->cat[j]); } else { @@ -597,6 +600,7 @@ if (json) { fprintf(stdout, "}"); /* for cat */ } + } } if (json) { fprintf(stdout, "]"); /* for list of cats */ From svn_grass at osgeo.org Mon Oct 3 01:54:37 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 01:54:37 -0700 Subject: [GRASS-SVN] r69648 - grass/trunk/display/d.linegraph Message-ID: <20161003085438.06A9F3901D3@trac.osgeo.org> Author: neteler Date: 2016-10-03 01:54:37 -0700 (Mon, 03 Oct 2016) New Revision: 69648 Modified: grass/trunk/display/d.linegraph/d.linegraph.html Log: d.linegraph manual: language fixes Modified: grass/trunk/display/d.linegraph/d.linegraph.html =================================================================== --- grass/trunk/display/d.linegraph/d.linegraph.html 2016-10-03 01:50:33 UTC (rev 69647) +++ grass/trunk/display/d.linegraph/d.linegraph.html 2016-10-03 08:54:37 UTC (rev 69648) @@ -1,6 +1,6 @@

DESCRIPTION

-d.linegraph is a primitive program to draw simple x,y line graphs +d.linegraph is a module to draw simple x,y line graphs (plots) based on numerical data contained in separate files. @@ -22,12 +22,11 @@

File inputs

-

-If directory option is provided, the paths to files can (and -should) be only relative paths to the files. This is not recommended -for scripting, but it can be advantageous when typing the paths -manually. For example when all the files are stored in the directory -/home/john/data, use can provide the following in the command +If the directory option is provided, the paths to files can (and +should) be only relative paths to these files. WHile this is not recommended +for scripting, it can be advantageous when typing the paths +manually. For example when all files are stored in the directory +/home/john/data, the user can provide the following in the command line:

@@ -37,35 +36,35 @@
 
 

Managing colors

-User can specify the y_color option, the color_table +The user can specify the y_color option, the color_table option or just leave the defaults to influence the color of the plotted lines.

-Color specified by y_color option is used for drawing the lines +Colors specified by y_color option are used for drawing the lines in the graph. If multiple Y data files are used, an equal number of colors may be used to control the colors of the lines. Colors will be assigned to Y data in respect to the sequence of instantiation on the command line. It can be one of GRASS GIS named colors or the RGB -values from 0-255 separated by colon. +values from 0-255 separated by colons (RRR:GGG:BBB).

-Alternatively, user can use color_table option to specify one +Alternatively, the user can use the color_table option to specify one of the GRASS GIS predefined color tables.

-By default, a series of colors will be chosen by the program if none are -provided upon invocation. Order of default colors is red, green, -violet, blue, orange, gray, brown, magenta, white, and indigo. User is -advised not to rely on the order of default colors and use y_color -or color_table option to obtain predictable and reproducible -results. +By default, a series of colors will be chosen by the module if none are +provided upon invocation. The order of default colors is red, green, +violet, blue, orange, gray, brown, magenta, white, and indigo. The user is +advised not to rely on the order of default colors but to either use the +y_color or the color_table option to obtain predictable and +reproducible results.

The color to be used for titles, axis lines, tics, and scale numbers -is determined by the title_color option. -User can provide one of the GRASS GIS named colors (such as gray, white, or black) -or use the GRASS GIS colon-separated format for RGB. +is determined by the title_color option. The user can provide +one of the GRASS GIS named colors (such as gray, white, or black) +or use the GRASS GIS colon-separated format for RGB (RRR:GGG:BBB).

Titles, labels, and tics

@@ -90,24 +89,27 @@ For historical reasons, the d.linegraph module accepts titles of more than one word where the underscore character ("_") -is used to represent spaces (" "). For example "Census_data_1990" -would be printed over the graph as "Census data 1990". This is not +is used to represent spaces (" "). For example "Census_data_1990" would be +printed over the graph as "Census data 1990". The use of underscores is not necessary to use as long as the parameter is quoted in the command line. -In general, this is not recommended to use and there is no need to use -it at all in Python or GUI. +In general, use of underscores is not recommended and there is no need to use +it at all in the GUI or when using d.linegraph in Python scripts.

-The way the program locates and labels tic marks is less than perfect: 1) -although distances between Y tics is proportional to the value, they are -not proportional on the X axis; 2) decimal values between -1 and 1 can be -printed on the X axis, but not on Y. (With respect to the later, the input -for Y values can all be multiplied by a factor of 10 before graphing). +The way the program locates and labels tic marks is less than perfect: +
+1) although distances between Y tics is proportional to the value, they are +not proportional on the X axis; +
+2) decimal values between -1 and 1 can be printed on the X axis, but not +on Y. (With respect to the later, the input for Y values can all be +multiplied by a factor of 10 before graphing).

-Depending on the user needs, it might be easier or more appropriate +Depending on the user's needs, it might be easier or more appropriate to use a 3rd party tool such as xgraph, gnuplot, Matplotlib in Python, or R instead of d.linegraph. -For a more general solution for plotting in GRASS GIS, user is +For a more general solution for plotting in GRASS GIS, the user is advised to use the d.graph module. @@ -147,8 +149,9 @@ d.erase # previous image is not cleaned --> -The series of commands creates a file plot.png in the current -directory which is the drawing make by d.linegraph. +

+The next command sequence creates a file plot.png in the current +directory which is the drawing made by d.linegraph.

 d.mon start=cairo output=plot.png width=400 height=400


From svn_grass at osgeo.org  Mon Oct  3 08:08:44 2016
From: svn_grass at osgeo.org (svn_grass at osgeo.org)
Date: Mon,  3 Oct 2016 08:08:44 -0700
Subject: [GRASS-SVN] r69649 - grass/trunk/vector/v.external
Message-ID: <20161003150844.42BFA3903C2@trac.osgeo.org>

Author: martinl
Date: 2016-10-03 08:08:44 -0700 (Mon, 03 Oct 2016)
New Revision: 69649

Modified:
   grass/trunk/vector/v.external/args.c
   grass/trunk/vector/v.external/list.c
   grass/trunk/vector/v.external/local_proto.h
   grass/trunk/vector/v.external/main.c
Log:
v.external: change layer option to be not required

Modified: grass/trunk/vector/v.external/args.c
===================================================================
--- grass/trunk/vector/v.external/args.c	2016-10-03 08:54:37 UTC (rev 69648)
+++ grass/trunk/vector/v.external/args.c	2016-10-03 15:08:44 UTC (rev 69649)
@@ -29,7 +29,7 @@
 				    "\t\tESRI Shapefile: shapefile name\n"
 				    "\t\tMapInfo File: mapinfo file name\n"
 				    "\t\tPostGIS database: table name");
-    options->layer->required = YES;
+    options->layer->required = NO;
     options->layer->key_desc = "name";
     options->layer->gisprompt = "old,datasource_layer,datasource_layer";
         

Modified: grass/trunk/vector/v.external/list.c
===================================================================
--- grass/trunk/vector/v.external/list.c	2016-10-03 08:54:37 UTC (rev 69648)
+++ grass/trunk/vector/v.external/list.c	2016-10-03 15:08:44 UTC (rev 69649)
@@ -18,10 +18,10 @@
 static char **format_list(int *, size_t *);
 static char *feature_type(const char *);
 #ifdef HAVE_OGR
-static int list_layers_ogr(FILE *, const char *, const char *, int);
+static int list_layers_ogr(FILE *, const char *, char **, int);
 #endif /* HAVE_OGR */
 #ifdef HAVE_POSTGRES
-static int list_layers_pg(FILE *, const char *, const char *, int);
+static int list_layers_pg(FILE *, const char *, char **, int);
 #endif /* HAVE_POSTGRES */
 
 int cmp(const void *a, const void *b)
@@ -102,7 +102,7 @@
     G_free(list);
 }
 
-int list_layers(FILE *fd, const char *dsn, const char *layer, int print_types, int use_ogr)
+int list_layers(FILE *fd, const char *dsn, char **layer, int print_types, int use_ogr)
 {
     if (!use_ogr) {
 #ifdef HAVE_POSTGRES
@@ -139,7 +139,7 @@
 }
 
 #ifdef HAVE_POSTGRES
-int list_layers_pg(FILE *fd, const char *conninfo, const char *table, int print_types)
+int list_layers_pg(FILE *fd, const char *conninfo, char **table, int print_types)
 {
     int   row, ntables, ret, print_schema;
     char *value_schema, *value_table, *value_type, *value_column;
@@ -171,7 +171,7 @@
     /* get schema & table_name */
     table_name = schema_name = NULL;
     if (table)
-	get_table_name(table, &table_name, &schema_name);
+	get_table_name(*table, &table_name, &schema_name);
     
     ntables = PQntuples(res);
     G_debug(3, "   nrows = %d", ntables);
@@ -235,7 +235,7 @@
 #endif /* HAVE_POSTGRES */
 
 #ifdef HAVE_OGR
-int list_layers_ogr(FILE *fd, const char *dsn, const char *layer, int print_types)
+int list_layers_ogr(FILE *fd, const char *dsn, char **layer, int print_types)
 {
     int i, ret;
     int nlayers;
@@ -263,12 +263,22 @@
     /* Make a list of available layers */
     nlayers = OGR_DS_GetLayerCount(Ogr_ds);
 
-    if (fd)
+    if (fd) {
 	G_message(n_("Data source <%s> (format '%s') contains %d layer:",
                      "Data source <%s> (format '%s') contains %d layers:",
                      nlayers),
 		  dsn, OGR_Dr_GetName(OGR_DS_GetDriver(Ogr_ds)), nlayers);
-    
+    }
+    else if (layer && !(*layer)) {
+        /* return first layer by default (if layer not defined) */
+        if (nlayers > 0) {
+            Ogr_layer = OGR_DS_GetLayer(Ogr_ds, 0);
+            Ogr_featuredefn = OGR_L_GetLayerDefn(Ogr_layer);
+            *layer = G_store((char *) OGR_FD_GetName(Ogr_featuredefn));
+            return 0;
+        }
+        return -1;
+    }
 
     G_get_default_window(&loc_wind);
     if (print_types && loc_wind.proj != PROJECTION_XY) {
@@ -333,7 +343,7 @@
 	    }
 	}
 	if (layer)
-	    if (strcmp(layer_name, layer) == 0) {
+	    if (strcmp(layer_name, *layer) == 0) {
 		ret = i;
 	    }
     }

Modified: grass/trunk/vector/v.external/local_proto.h
===================================================================
--- grass/trunk/vector/v.external/local_proto.h	2016-10-03 08:54:37 UTC (rev 69648)
+++ grass/trunk/vector/v.external/local_proto.h	2016-10-03 15:08:44 UTC (rev 69649)
@@ -18,7 +18,7 @@
 
 /* list.c */
 void list_formats();
-int list_layers(FILE *, const char *, const char *, int, int);
+int list_layers(FILE *, const char *, char **, int, int);
 void get_table_name(const char *, char **, char **);
 
 #endif

Modified: grass/trunk/vector/v.external/main.c
===================================================================
--- grass/trunk/vector/v.external/main.c	2016-10-03 08:54:37 UTC (rev 69648)
+++ grass/trunk/vector/v.external/main.c	2016-10-03 15:08:44 UTC (rev 69649)
@@ -41,7 +41,7 @@
     FILE *fd;
     
     int ilayer, use_ogr;
-    char buf[GPATH_MAX], *dsn;
+    char buf[GPATH_MAX], *dsn, *layer;
     const char *output;
     
     G_gisinit(argv[0]);
@@ -108,22 +108,26 @@
         exit(EXIT_SUCCESS);
     }
 
+    /* get layer index/name */
+    layer = NULL;
+    if (options.layer->answer)
+        layer = G_store(options.layer->answer);
+    ilayer = list_layers(NULL, dsn, &layer,
+                         FALSE, use_ogr);
+    if (ilayer == -1) {
+        if (options.layer->answer)
+            G_fatal_error(_("Layer <%s> not available"), options.layer->answer);
+        else
+            G_fatal_error(_("No layer defined"));
+    }
+    G_debug(2, "layer '%s' was found", layer);
+
     /* define name for output */
     if (!options.output->answer)
-        output = options.layer->answer;
+        output = layer;
     else
         output = options.output->answer;
-    
 
-    /* get layer index */
-    ilayer = list_layers(NULL, dsn, options.layer->answer,
-                         FALSE, use_ogr);
-    if (ilayer == -1) {
-        G_fatal_error(_("Layer <%s> not available"), options.layer->answer);
-    }
-    
-    G_debug(2, "layer '%s' was found", options.layer->answer);
-
     if (G_find_vector2(output, G_mapset()) && !G_check_overwrite(argc, argv)) {
         G_fatal_error(_("option <%s>: <%s> exists. To overwrite, use the --overwrite flag"),
                       options.output->key, output);
@@ -254,7 +258,7 @@
     if (!use_ogr) {
         char *table_name, *schema_name;
         
-        get_table_name(options.layer->answer, &table_name, &schema_name);
+        get_table_name(layer, &table_name, &schema_name);
         
         fprintf(fd, "format: postgis\n");
         fprintf(fd, "conninfo: %s\n", dsn);
@@ -268,7 +272,7 @@
     else {
         fprintf(fd, "format: ogr\n");
         fprintf(fd, "dsn: %s\n", dsn);
-        fprintf(fd, "layer: %s\n", options.layer->answer);
+        fprintf(fd, "layer: %s\n", layer);
     }
     fclose(fd);
     


From svn_grass at osgeo.org  Mon Oct  3 08:11:43 2016
From: svn_grass at osgeo.org (svn_grass at osgeo.org)
Date: Mon,  3 Oct 2016 08:11:43 -0700
Subject: [GRASS-SVN] r69650 -
	grass/branches/releasebranch_7_2/vector/v.external
Message-ID: <20161003151143.E60FB3903C2@trac.osgeo.org>

Author: martinl
Date: 2016-10-03 08:11:43 -0700 (Mon, 03 Oct 2016)
New Revision: 69650

Modified:
   grass/branches/releasebranch_7_2/vector/v.external/args.c
   grass/branches/releasebranch_7_2/vector/v.external/list.c
   grass/branches/releasebranch_7_2/vector/v.external/local_proto.h
   grass/branches/releasebranch_7_2/vector/v.external/main.c
Log:
v.external: change layer option to be not required (relbr72: merge r69649 from trunk)

Modified: grass/branches/releasebranch_7_2/vector/v.external/args.c
===================================================================
--- grass/branches/releasebranch_7_2/vector/v.external/args.c	2016-10-03 15:08:44 UTC (rev 69649)
+++ grass/branches/releasebranch_7_2/vector/v.external/args.c	2016-10-03 15:11:43 UTC (rev 69650)
@@ -29,7 +29,7 @@
 				    "\t\tESRI Shapefile: shapefile name\n"
 				    "\t\tMapInfo File: mapinfo file name\n"
 				    "\t\tPostGIS database: table name");
-    options->layer->required = YES;
+    options->layer->required = NO;
     options->layer->key_desc = "name";
     options->layer->gisprompt = "old,datasource_layer,datasource_layer";
         

Modified: grass/branches/releasebranch_7_2/vector/v.external/list.c
===================================================================
--- grass/branches/releasebranch_7_2/vector/v.external/list.c	2016-10-03 15:08:44 UTC (rev 69649)
+++ grass/branches/releasebranch_7_2/vector/v.external/list.c	2016-10-03 15:11:43 UTC (rev 69650)
@@ -18,10 +18,10 @@
 static char **format_list(int *, size_t *);
 static char *feature_type(const char *);
 #ifdef HAVE_OGR
-static int list_layers_ogr(FILE *, const char *, const char *, int);
+static int list_layers_ogr(FILE *, const char *, char **, int);
 #endif /* HAVE_OGR */
 #ifdef HAVE_POSTGRES
-static int list_layers_pg(FILE *, const char *, const char *, int);
+static int list_layers_pg(FILE *, const char *, char **, int);
 #endif /* HAVE_POSTGRES */
 
 int cmp(const void *a, const void *b)
@@ -102,7 +102,7 @@
     G_free(list);
 }
 
-int list_layers(FILE *fd, const char *dsn, const char *layer, int print_types, int use_ogr)
+int list_layers(FILE *fd, const char *dsn, char **layer, int print_types, int use_ogr)
 {
     if (!use_ogr) {
 #ifdef HAVE_POSTGRES
@@ -139,7 +139,7 @@
 }
 
 #ifdef HAVE_POSTGRES
-int list_layers_pg(FILE *fd, const char *conninfo, const char *table, int print_types)
+int list_layers_pg(FILE *fd, const char *conninfo, char **table, int print_types)
 {
     int   row, ntables, ret, print_schema;
     char *value_schema, *value_table, *value_type, *value_column;
@@ -171,7 +171,7 @@
     /* get schema & table_name */
     table_name = schema_name = NULL;
     if (table)
-	get_table_name(table, &table_name, &schema_name);
+	get_table_name(*table, &table_name, &schema_name);
     
     ntables = PQntuples(res);
     G_debug(3, "   nrows = %d", ntables);
@@ -235,7 +235,7 @@
 #endif /* HAVE_POSTGRES */
 
 #ifdef HAVE_OGR
-int list_layers_ogr(FILE *fd, const char *dsn, const char *layer, int print_types)
+int list_layers_ogr(FILE *fd, const char *dsn, char **layer, int print_types)
 {
     int i, ret;
     int nlayers;
@@ -263,12 +263,22 @@
     /* Make a list of available layers */
     nlayers = OGR_DS_GetLayerCount(Ogr_ds);
 
-    if (fd)
+    if (fd) {
 	G_message(n_("Data source <%s> (format '%s') contains %d layer:",
                      "Data source <%s> (format '%s') contains %d layers:",
                      nlayers),
 		  dsn, OGR_Dr_GetName(OGR_DS_GetDriver(Ogr_ds)), nlayers);
-    
+    }
+    else if (layer && !(*layer)) {
+        /* return first layer by default (if layer not defined) */
+        if (nlayers > 0) {
+            Ogr_layer = OGR_DS_GetLayer(Ogr_ds, 0);
+            Ogr_featuredefn = OGR_L_GetLayerDefn(Ogr_layer);
+            *layer = G_store((char *) OGR_FD_GetName(Ogr_featuredefn));
+            return 0;
+        }
+        return -1;
+    }
 
     G_get_default_window(&loc_wind);
     if (print_types && loc_wind.proj != PROJECTION_XY) {
@@ -333,7 +343,7 @@
 	    }
 	}
 	if (layer)
-	    if (strcmp(layer_name, layer) == 0) {
+	    if (strcmp(layer_name, *layer) == 0) {
 		ret = i;
 	    }
     }

Modified: grass/branches/releasebranch_7_2/vector/v.external/local_proto.h
===================================================================
--- grass/branches/releasebranch_7_2/vector/v.external/local_proto.h	2016-10-03 15:08:44 UTC (rev 69649)
+++ grass/branches/releasebranch_7_2/vector/v.external/local_proto.h	2016-10-03 15:11:43 UTC (rev 69650)
@@ -18,7 +18,7 @@
 
 /* list.c */
 void list_formats();
-int list_layers(FILE *, const char *, const char *, int, int);
+int list_layers(FILE *, const char *, char **, int, int);
 void get_table_name(const char *, char **, char **);
 
 #endif

Modified: grass/branches/releasebranch_7_2/vector/v.external/main.c
===================================================================
--- grass/branches/releasebranch_7_2/vector/v.external/main.c	2016-10-03 15:08:44 UTC (rev 69649)
+++ grass/branches/releasebranch_7_2/vector/v.external/main.c	2016-10-03 15:11:43 UTC (rev 69650)
@@ -41,7 +41,7 @@
     FILE *fd;
     
     int ilayer, use_ogr;
-    char buf[GPATH_MAX], *dsn;
+    char buf[GPATH_MAX], *dsn, *layer;
     const char *output;
     
     G_gisinit(argv[0]);
@@ -108,22 +108,26 @@
         exit(EXIT_SUCCESS);
     }
 
+    /* get layer index/name */
+    layer = NULL;
+    if (options.layer->answer)
+        layer = G_store(options.layer->answer);
+    ilayer = list_layers(NULL, dsn, &layer,
+                         FALSE, use_ogr);
+    if (ilayer == -1) {
+        if (options.layer->answer)
+            G_fatal_error(_("Layer <%s> not available"), options.layer->answer);
+        else
+            G_fatal_error(_("No layer defined"));
+    }
+    G_debug(2, "layer '%s' was found", layer);
+
     /* define name for output */
     if (!options.output->answer)
-        output = options.layer->answer;
+        output = layer;
     else
         output = options.output->answer;
-    
 
-    /* get layer index */
-    ilayer = list_layers(NULL, dsn, options.layer->answer,
-                         FALSE, use_ogr);
-    if (ilayer == -1) {
-        G_fatal_error(_("Layer <%s> not available"), options.layer->answer);
-    }
-    
-    G_debug(2, "layer '%s' was found", options.layer->answer);
-
     if (G_find_vector2(output, G_mapset()) && !G_check_overwrite(argc, argv)) {
         G_fatal_error(_("option <%s>: <%s> exists. To overwrite, use the --overwrite flag"),
                       options.output->key, output);
@@ -254,7 +258,7 @@
     if (!use_ogr) {
         char *table_name, *schema_name;
         
-        get_table_name(options.layer->answer, &table_name, &schema_name);
+        get_table_name(layer, &table_name, &schema_name);
         
         fprintf(fd, "format: postgis\n");
         fprintf(fd, "conninfo: %s\n", dsn);
@@ -268,7 +272,7 @@
     else {
         fprintf(fd, "format: ogr\n");
         fprintf(fd, "dsn: %s\n", dsn);
-        fprintf(fd, "layer: %s\n", options.layer->answer);
+        fprintf(fd, "layer: %s\n", layer);
     }
     fclose(fd);
     


From svn_grass at osgeo.org  Mon Oct  3 08:47:31 2016
From: svn_grass at osgeo.org (svn_grass at osgeo.org)
Date: Mon,  3 Oct 2016 08:47:31 -0700
Subject: [GRASS-SVN] r69651 - grass/trunk/vector/v.external
Message-ID: <20161003154731.467EB3903C2@trac.osgeo.org>

Author: martinl
Date: 2016-10-03 08:47:30 -0700 (Mon, 03 Oct 2016)
New Revision: 69651

Added:
   grass/trunk/vector/v.external/proj.c
Modified:
   grass/trunk/vector/v.external/local_proto.h
   grass/trunk/vector/v.external/main.c
Log:
v.external: fix check projection

Modified: grass/trunk/vector/v.external/local_proto.h
===================================================================
--- grass/trunk/vector/v.external/local_proto.h	2016-10-03 15:11:43 UTC (rev 69650)
+++ grass/trunk/vector/v.external/local_proto.h	2016-10-03 15:47:30 UTC (rev 69651)
@@ -21,4 +21,6 @@
 int list_layers(FILE *, const char *, char **, int, int);
 void get_table_name(const char *, char **, char **);
 
+/* proj.c */
+void check_projection(const char *, int);
 #endif

Modified: grass/trunk/vector/v.external/main.c
===================================================================
--- grass/trunk/vector/v.external/main.c	2016-10-03 15:11:43 UTC (rev 69650)
+++ grass/trunk/vector/v.external/main.c	2016-10-03 15:47:30 UTC (rev 69651)
@@ -135,100 +135,7 @@
 
     /* check projection match */
     if (!flags.override->answer) {
-	int err = 0;
-        char error_msg[8192];
-
-        struct Cell_head cellhd, loc_wind;
-        struct Key_Value *loc_proj_info, *loc_proj_units;
-        struct Key_Value *proj_info, *proj_units;
-
-        proj_info = proj_units = NULL;
-        loc_proj_info = G_get_projinfo();
-        loc_proj_units = G_get_projunits();
-
-        G_get_default_window(&loc_wind);
-        G_get_window(&cellhd);
-        
-        if ((err =
-             G_compare_projections(loc_proj_info, loc_proj_units,
-                                   proj_info, proj_units)) != TRUE) {
-	    int i_value;
-            
-	    strcpy(error_msg,
-		   _("Projection of dataset does not"
-		     " appear to match current location.\n\n"));
-            
-	    /* TODO: output this info sorted by key: */
-	    if (loc_wind.proj != cellhd.proj || err != -2) {
-		if (loc_proj_info != NULL) {
-		    strcat(error_msg, _("GRASS LOCATION PROJ_INFO is:\n"));
-		    for (i_value = 0; i_value < loc_proj_info->nitems;
-			 i_value++)
-			sprintf(error_msg + strlen(error_msg), "%s: %s\n",
-				loc_proj_info->key[i_value],
-				loc_proj_info->value[i_value]);
-		    strcat(error_msg, "\n");
-		}
-
-		if (proj_info != NULL) {
-		    strcat(error_msg, _("Import dataset PROJ_INFO is:\n"));
-		    for (i_value = 0; i_value < proj_info->nitems; i_value++)
-			sprintf(error_msg + strlen(error_msg), "%s: %s\n",
-				proj_info->key[i_value],
-				proj_info->value[i_value]);
-		}
-		else {
-		    strcat(error_msg, _("Import dataset PROJ_INFO is:\n"));
-		    if (cellhd.proj == PROJECTION_XY)
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (unreferenced/unknown)\n",
-				cellhd.proj);
-		    else if (cellhd.proj == PROJECTION_LL)
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (lat/long)\n",
-				cellhd.proj);
-		    else if (cellhd.proj == PROJECTION_UTM)
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (UTM), zone = %d\n",
-				cellhd.proj, cellhd.zone);
-		    else
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (unknown), zone = %d\n",
-				cellhd.proj, cellhd.zone);
-		}
-	    }
-	    else {
-		if (loc_proj_units != NULL) {
-		    strcat(error_msg, "GRASS LOCATION PROJ_UNITS is:\n");
-		    for (i_value = 0; i_value < loc_proj_units->nitems;
-			 i_value++)
-			sprintf(error_msg + strlen(error_msg), "%s: %s\n",
-				loc_proj_units->key[i_value],
-				loc_proj_units->value[i_value]);
-		    strcat(error_msg, "\n");
-		}
-
-		if (proj_units != NULL) {
-		    strcat(error_msg, "Import dataset PROJ_UNITS is:\n");
-		    for (i_value = 0; i_value < proj_units->nitems; i_value++)
-			sprintf(error_msg + strlen(error_msg), "%s: %s\n",
-				proj_units->key[i_value],
-				proj_units->value[i_value]);
-		}
-	    }
-	    sprintf(error_msg + strlen(error_msg),
-		    _("\nIn case of no significant differences in the projection definitions,"
-		      " use the -o flag to ignore them and use"
-		      " current location definition.\n"));
-	    strcat(error_msg,
-		   _("Consider generating a new location with 'location' parameter"
-		    " from input data set.\n"));
-            G_fatal_error("%s", error_msg);
-	}
-	else {
-            G_verbose_message(_("Projection of input dataset and current location "
-                                "appear to match"));
-	}
+        check_projection(dsn, ilayer);
     }
     
     /* create new vector map */

Added: grass/trunk/vector/v.external/proj.c
===================================================================
--- grass/trunk/vector/v.external/proj.c	                        (rev 0)
+++ grass/trunk/vector/v.external/proj.c	2016-10-03 15:47:30 UTC (rev 69651)
@@ -0,0 +1,126 @@
+#include 
+#include 
+#include 
+
+#ifdef HAVE_OGR
+#include "ogr_api.h"
+#endif
+
+void check_projection(const char *dsn, int ilayer)
+{
+#ifdef HAVE_OGR
+    int err = 0;
+    char error_msg[8192];
+    
+    struct Cell_head cellhd, loc_wind;
+    struct Key_Value *loc_proj_info, *loc_proj_units;
+    struct Key_Value *proj_info, *proj_units;
+    
+    OGRDataSourceH Ogr_ds;
+    OGRLayerH Ogr_layer;
+    OGRSpatialReferenceH Ogr_projection;
+    
+    proj_info = proj_units = NULL;
+    loc_proj_info = G_get_projinfo();
+    loc_proj_units = G_get_projunits();
+    
+    G_get_default_window(&loc_wind);
+    G_get_window(&cellhd);
+    
+    Ogr_ds = OGROpen(dsn, FALSE, NULL);
+    if (!Ogr_ds) {
+	G_fatal_error(_("Unable to open data source '%s'"), dsn);
+    }
+    if (ilayer > OGR_DS_GetLayerCount(Ogr_ds))
+        return;
+    Ogr_layer = OGR_DS_GetLayer(Ogr_ds, ilayer);
+    Ogr_projection = OGR_L_GetSpatialRef(Ogr_layer);
+    
+    if (GPJ_osr_to_grass(&cellhd, &proj_info,
+                         &proj_units, Ogr_projection, 0) < 0)
+        G_warning(_("Unable to convert input map projection information to "
+                    "GRASS format for checking"));
+    OGR_DS_Destroy(Ogr_ds);
+    
+    if ((err =
+         G_compare_projections(loc_proj_info, loc_proj_units,
+                               proj_info, proj_units)) != TRUE) {
+        int i_value;
+        
+        strcpy(error_msg,
+               _("Projection of dataset does not"
+                 " appear to match current location.\n\n"));
+        
+        /* TODO: output this info sorted by key: */
+        if (loc_wind.proj != cellhd.proj || err != -2) {
+            if (loc_proj_info != NULL) {
+                strcat(error_msg, _("GRASS LOCATION PROJ_INFO is:\n"));
+                for (i_value = 0; i_value < loc_proj_info->nitems;
+                     i_value++)
+                    sprintf(error_msg + strlen(error_msg), "%s: %s\n",
+                            loc_proj_info->key[i_value],
+                            loc_proj_info->value[i_value]);
+                strcat(error_msg, "\n");
+            }
+            
+            if (proj_info != NULL) {
+                strcat(error_msg, _("Import dataset PROJ_INFO is:\n"));
+                for (i_value = 0; i_value < proj_info->nitems; i_value++)
+                    sprintf(error_msg + strlen(error_msg), "%s: %s\n",
+                            proj_info->key[i_value],
+                            proj_info->value[i_value]);
+            }
+            else {
+                strcat(error_msg, _("Import dataset PROJ_INFO is:\n"));
+                if (cellhd.proj == PROJECTION_XY)
+                    sprintf(error_msg + strlen(error_msg),
+                            "Dataset proj = %d (unreferenced/unknown)\n",
+                            cellhd.proj);
+                else if (cellhd.proj == PROJECTION_LL)
+                    sprintf(error_msg + strlen(error_msg),
+                            "Dataset proj = %d (lat/long)\n",
+                            cellhd.proj);
+                else if (cellhd.proj == PROJECTION_UTM)
+                    sprintf(error_msg + strlen(error_msg),
+                            "Dataset proj = %d (UTM), zone = %d\n",
+                            cellhd.proj, cellhd.zone);
+                else
+                    sprintf(error_msg + strlen(error_msg),
+                            "Dataset proj = %d (unknown), zone = %d\n",
+                            cellhd.proj, cellhd.zone);
+            }
+        }
+        else {
+            if (loc_proj_units != NULL) {
+                strcat(error_msg, "GRASS LOCATION PROJ_UNITS is:\n");
+                for (i_value = 0; i_value < loc_proj_units->nitems;
+                     i_value++)
+                    sprintf(error_msg + strlen(error_msg), "%s: %s\n",
+                            loc_proj_units->key[i_value],
+                            loc_proj_units->value[i_value]);
+                strcat(error_msg, "\n");
+            }
+            
+            if (proj_units != NULL) {
+                strcat(error_msg, "Import dataset PROJ_UNITS is:\n");
+                for (i_value = 0; i_value < proj_units->nitems; i_value++)
+                    sprintf(error_msg + strlen(error_msg), "%s: %s\n",
+                            proj_units->key[i_value],
+                            proj_units->value[i_value]);
+            }
+        }
+        sprintf(error_msg + strlen(error_msg),
+                _("\nIn case of no significant differences in the projection definitions,"
+                  " use the -o flag to ignore them and use"
+                  " current location definition.\n"));
+        strcat(error_msg,
+               _("Consider generating a new location with 'location' parameter"
+                 " from input data set.\n"));
+        G_fatal_error("%s", error_msg);
+    }
+    else {
+        G_verbose_message(_("Projection of input dataset and current location "
+                            "appear to match"));
+    }
+#endif
+}


Property changes on: grass/trunk/vector/v.external/proj.c
___________________________________________________________________
Added: svn:mime-type
   + text/x-csrc
Added: svn:eol-style
   + native


From svn_grass at osgeo.org  Mon Oct  3 08:52:37 2016
From: svn_grass at osgeo.org (svn_grass at osgeo.org)
Date: Mon,  3 Oct 2016 08:52:37 -0700
Subject: [GRASS-SVN] r69652 -
	grass/branches/releasebranch_7_2/vector/v.external
Message-ID: <20161003155237.3F0273903C2@trac.osgeo.org>

Author: martinl
Date: 2016-10-03 08:52:37 -0700 (Mon, 03 Oct 2016)
New Revision: 69652

Added:
   grass/branches/releasebranch_7_2/vector/v.external/proj.c
Modified:
   grass/branches/releasebranch_7_2/vector/v.external/local_proto.h
   grass/branches/releasebranch_7_2/vector/v.external/main.c
Log:
 v.external: fix check projection (relbr72: merge r69651 from trunk)

Modified: grass/branches/releasebranch_7_2/vector/v.external/local_proto.h
===================================================================
--- grass/branches/releasebranch_7_2/vector/v.external/local_proto.h	2016-10-03 15:47:30 UTC (rev 69651)
+++ grass/branches/releasebranch_7_2/vector/v.external/local_proto.h	2016-10-03 15:52:37 UTC (rev 69652)
@@ -21,4 +21,6 @@
 int list_layers(FILE *, const char *, char **, int, int);
 void get_table_name(const char *, char **, char **);
 
+/* proj.c */
+void check_projection(const char *, int);
 #endif

Modified: grass/branches/releasebranch_7_2/vector/v.external/main.c
===================================================================
--- grass/branches/releasebranch_7_2/vector/v.external/main.c	2016-10-03 15:47:30 UTC (rev 69651)
+++ grass/branches/releasebranch_7_2/vector/v.external/main.c	2016-10-03 15:52:37 UTC (rev 69652)
@@ -135,100 +135,7 @@
 
     /* check projection match */
     if (!flags.override->answer) {
-	int err = 0;
-        char error_msg[8192];
-
-        struct Cell_head cellhd, loc_wind;
-        struct Key_Value *loc_proj_info, *loc_proj_units;
-        struct Key_Value *proj_info, *proj_units;
-
-        proj_info = proj_units = NULL;
-        loc_proj_info = G_get_projinfo();
-        loc_proj_units = G_get_projunits();
-
-        G_get_default_window(&loc_wind);
-        G_get_window(&cellhd);
-        
-        if ((err =
-             G_compare_projections(loc_proj_info, loc_proj_units,
-                                   proj_info, proj_units)) != TRUE) {
-	    int i_value;
-            
-	    strcpy(error_msg,
-		   _("Projection of dataset does not"
-		     " appear to match current location.\n\n"));
-            
-	    /* TODO: output this info sorted by key: */
-	    if (loc_wind.proj != cellhd.proj || err != -2) {
-		if (loc_proj_info != NULL) {
-		    strcat(error_msg, _("GRASS LOCATION PROJ_INFO is:\n"));
-		    for (i_value = 0; i_value < loc_proj_info->nitems;
-			 i_value++)
-			sprintf(error_msg + strlen(error_msg), "%s: %s\n",
-				loc_proj_info->key[i_value],
-				loc_proj_info->value[i_value]);
-		    strcat(error_msg, "\n");
-		}
-
-		if (proj_info != NULL) {
-		    strcat(error_msg, _("Import dataset PROJ_INFO is:\n"));
-		    for (i_value = 0; i_value < proj_info->nitems; i_value++)
-			sprintf(error_msg + strlen(error_msg), "%s: %s\n",
-				proj_info->key[i_value],
-				proj_info->value[i_value]);
-		}
-		else {
-		    strcat(error_msg, _("Import dataset PROJ_INFO is:\n"));
-		    if (cellhd.proj == PROJECTION_XY)
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (unreferenced/unknown)\n",
-				cellhd.proj);
-		    else if (cellhd.proj == PROJECTION_LL)
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (lat/long)\n",
-				cellhd.proj);
-		    else if (cellhd.proj == PROJECTION_UTM)
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (UTM), zone = %d\n",
-				cellhd.proj, cellhd.zone);
-		    else
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (unknown), zone = %d\n",
-				cellhd.proj, cellhd.zone);
-		}
-	    }
-	    else {
-		if (loc_proj_units != NULL) {
-		    strcat(error_msg, "GRASS LOCATION PROJ_UNITS is:\n");
-		    for (i_value = 0; i_value < loc_proj_units->nitems;
-			 i_value++)
-			sprintf(error_msg + strlen(error_msg), "%s: %s\n",
-				loc_proj_units->key[i_value],
-				loc_proj_units->value[i_value]);
-		    strcat(error_msg, "\n");
-		}
-
-		if (proj_units != NULL) {
-		    strcat(error_msg, "Import dataset PROJ_UNITS is:\n");
-		    for (i_value = 0; i_value < proj_units->nitems; i_value++)
-			sprintf(error_msg + strlen(error_msg), "%s: %s\n",
-				proj_units->key[i_value],
-				proj_units->value[i_value]);
-		}
-	    }
-	    sprintf(error_msg + strlen(error_msg),
-		    _("\nIn case of no significant differences in the projection definitions,"
-		      " use the -o flag to ignore them and use"
-		      " current location definition.\n"));
-	    strcat(error_msg,
-		   _("Consider generating a new location with 'location' parameter"
-		    " from input data set.\n"));
-            G_fatal_error("%s", error_msg);
-	}
-	else {
-            G_verbose_message(_("Projection of input dataset and current location "
-                                "appear to match"));
-	}
+        check_projection(dsn, ilayer);
     }
     
     /* create new vector map */

Copied: grass/branches/releasebranch_7_2/vector/v.external/proj.c (from rev 69651, grass/trunk/vector/v.external/proj.c)
===================================================================
--- grass/branches/releasebranch_7_2/vector/v.external/proj.c	                        (rev 0)
+++ grass/branches/releasebranch_7_2/vector/v.external/proj.c	2016-10-03 15:52:37 UTC (rev 69652)
@@ -0,0 +1,126 @@
+#include 
+#include 
+#include 
+
+#ifdef HAVE_OGR
+#include "ogr_api.h"
+#endif
+
+void check_projection(const char *dsn, int ilayer)
+{
+#ifdef HAVE_OGR
+    int err = 0;
+    char error_msg[8192];
+    
+    struct Cell_head cellhd, loc_wind;
+    struct Key_Value *loc_proj_info, *loc_proj_units;
+    struct Key_Value *proj_info, *proj_units;
+    
+    OGRDataSourceH Ogr_ds;
+    OGRLayerH Ogr_layer;
+    OGRSpatialReferenceH Ogr_projection;
+    
+    proj_info = proj_units = NULL;
+    loc_proj_info = G_get_projinfo();
+    loc_proj_units = G_get_projunits();
+    
+    G_get_default_window(&loc_wind);
+    G_get_window(&cellhd);
+    
+    Ogr_ds = OGROpen(dsn, FALSE, NULL);
+    if (!Ogr_ds) {
+	G_fatal_error(_("Unable to open data source '%s'"), dsn);
+    }
+    if (ilayer > OGR_DS_GetLayerCount(Ogr_ds))
+        return;
+    Ogr_layer = OGR_DS_GetLayer(Ogr_ds, ilayer);
+    Ogr_projection = OGR_L_GetSpatialRef(Ogr_layer);
+    
+    if (GPJ_osr_to_grass(&cellhd, &proj_info,
+                         &proj_units, Ogr_projection, 0) < 0)
+        G_warning(_("Unable to convert input map projection information to "
+                    "GRASS format for checking"));
+    OGR_DS_Destroy(Ogr_ds);
+    
+    if ((err =
+         G_compare_projections(loc_proj_info, loc_proj_units,
+                               proj_info, proj_units)) != TRUE) {
+        int i_value;
+        
+        strcpy(error_msg,
+               _("Projection of dataset does not"
+                 " appear to match current location.\n\n"));
+        
+        /* TODO: output this info sorted by key: */
+        if (loc_wind.proj != cellhd.proj || err != -2) {
+            if (loc_proj_info != NULL) {
+                strcat(error_msg, _("GRASS LOCATION PROJ_INFO is:\n"));
+                for (i_value = 0; i_value < loc_proj_info->nitems;
+                     i_value++)
+                    sprintf(error_msg + strlen(error_msg), "%s: %s\n",
+                            loc_proj_info->key[i_value],
+                            loc_proj_info->value[i_value]);
+                strcat(error_msg, "\n");
+            }
+            
+            if (proj_info != NULL) {
+                strcat(error_msg, _("Import dataset PROJ_INFO is:\n"));
+                for (i_value = 0; i_value < proj_info->nitems; i_value++)
+                    sprintf(error_msg + strlen(error_msg), "%s: %s\n",
+                            proj_info->key[i_value],
+                            proj_info->value[i_value]);
+            }
+            else {
+                strcat(error_msg, _("Import dataset PROJ_INFO is:\n"));
+                if (cellhd.proj == PROJECTION_XY)
+                    sprintf(error_msg + strlen(error_msg),
+                            "Dataset proj = %d (unreferenced/unknown)\n",
+                            cellhd.proj);
+                else if (cellhd.proj == PROJECTION_LL)
+                    sprintf(error_msg + strlen(error_msg),
+                            "Dataset proj = %d (lat/long)\n",
+                            cellhd.proj);
+                else if (cellhd.proj == PROJECTION_UTM)
+                    sprintf(error_msg + strlen(error_msg),
+                            "Dataset proj = %d (UTM), zone = %d\n",
+                            cellhd.proj, cellhd.zone);
+                else
+                    sprintf(error_msg + strlen(error_msg),
+                            "Dataset proj = %d (unknown), zone = %d\n",
+                            cellhd.proj, cellhd.zone);
+            }
+        }
+        else {
+            if (loc_proj_units != NULL) {
+                strcat(error_msg, "GRASS LOCATION PROJ_UNITS is:\n");
+                for (i_value = 0; i_value < loc_proj_units->nitems;
+                     i_value++)
+                    sprintf(error_msg + strlen(error_msg), "%s: %s\n",
+                            loc_proj_units->key[i_value],
+                            loc_proj_units->value[i_value]);
+                strcat(error_msg, "\n");
+            }
+            
+            if (proj_units != NULL) {
+                strcat(error_msg, "Import dataset PROJ_UNITS is:\n");
+                for (i_value = 0; i_value < proj_units->nitems; i_value++)
+                    sprintf(error_msg + strlen(error_msg), "%s: %s\n",
+                            proj_units->key[i_value],
+                            proj_units->value[i_value]);
+            }
+        }
+        sprintf(error_msg + strlen(error_msg),
+                _("\nIn case of no significant differences in the projection definitions,"
+                  " use the -o flag to ignore them and use"
+                  " current location definition.\n"));
+        strcat(error_msg,
+               _("Consider generating a new location with 'location' parameter"
+                 " from input data set.\n"));
+        G_fatal_error("%s", error_msg);
+    }
+    else {
+        G_verbose_message(_("Projection of input dataset and current location "
+                            "appear to match"));
+    }
+#endif
+}


From svn_grass at osgeo.org  Mon Oct  3 09:39:47 2016
From: svn_grass at osgeo.org (svn_grass at osgeo.org)
Date: Mon,  3 Oct 2016 09:39:47 -0700
Subject: [GRASS-SVN] r69653 - grass-addons/grass7/vector/v.kriging
Message-ID: <20161003163947.92ACF3901D3@trac.osgeo.org>

Author: evas
Date: 2016-10-03 09:39:47 -0700 (Mon, 03 Oct 2016)
New Revision: 69653

Modified:
   grass-addons/grass7/vector/v.kriging/v.kriging.html
Log:
v.kriging: html modified

Modified: grass-addons/grass7/vector/v.kriging/v.kriging.html
===================================================================
--- grass-addons/grass7/vector/v.kriging/v.kriging.html	2016-10-03 15:52:37 UTC (rev 69652)
+++ grass-addons/grass7/vector/v.kriging/v.kriging.html	2016-10-03 16:39:47 UTC (rev 69653)
@@ -1,952 +1,68 @@
 

DESCRIPTION

-v.kriging interpolates unknown values using method ordinary -kriging. Output can be 2D or 3D. +v.kriging constructs 2D / 3D raster from the values located on discrete points using interpolation method ordinary kriging. In order to let the user decide on the process and necessary parameters, the module performance is divided into three phases: +
    +
  • initial phase computes experimental variogram. +
      +
    • Please set up a name of the report file. The file will be created automatically in working directory to enable import of parameters from current to following phases. If the file has been deleted during the module performance, the user is asked to start interpolation again from the initial phase.
    • +
    • Warning about particular point and "less than 2 neighbours in its closest surrounding. The perimeter of the surrounding will be increased..." indicates that variogram range should be shortened.
    • +
    • There will appear some temporary files during variogram computation. They will be deleted automatically in following phase. If missing, the user is asked to repeat initial phase.
    • +
    • It is not necessary to save experimental variogram plots. They just help to estimate parameters of theoretical variogram that will be computed in following step (output contains experimental and theoretical variogram plotted together).
    • +
    +
  • +
  • in the middle phase, the user estimates theoretical variogram setting up the range (if necessary, the sill and the nugget effect as well) to fit the experimental variogram from previous phase. +
      +
    • Default sill is calculated from variogram values, more details in (Stopkova, 2014).
    • +
    • Save horizontal and vertical variogram plots using file=extension.
    • +
    • Experimental anisotropic / bivariate variogram is plotted as a base for final theoretical variogram parameters estimation in final phase.
    • +
    +
  • +
  • final phase performs interpolation based on parameters of theoretical variogram. +
      +
    • Save anisotropic or bivariate variogram plot using file=extension.
    • +
    +
  • +
+

EXAMPLES

-Two case studies have been prepared to outline that there is no universal rule how to use the module v.kriging. -Bahaviour of the phenomena is quite variable and this influences how to interpolate the dataset properly. Every point -dataset is special and requires trying different anisotropic ratios, variogram functions and careful analysis of -the results to get relevant interpolated (2D / 3D) raster model. +To get optimal results, it is necessary to test various initial settings, anisotropic ratios and variogram functions. Input (2D or 3D point layer) must contain values to be interpolated in the attribute table. +

3D kriging

-Input layer should contain 3D coordinates (xyz) and -values to be interpolated (in attribute table). The commands can look -like this: +General commands
 v.kriging phase=initial in=input_layer icol=name report=report_file.txt file=png
 
-v.kriging in=input_layer phase=middle hz_fun=exponential vert_fun=exponential ic=name file=png hz_range=double vert_range=double -b
+v.kriging in=input_layer phase=middle hz_fun=exponential vert_fun=exponential ic=name file=png  \
+hz_range=double vert_range=double [hz_sill=double vert_sill=double hz_nugget=double vert_nugget=double] -u
 
-v.kriging in=input_layer phase=final final_fun=bivariate icol=name file=png out=name crossval=crossval_file.txt
+v.kriging in=input_layer phase=final final_fun=exponential final_range=double \ 
+[final_sill=double final_nugget=double] icol=name file=png out=name crossval=crossval_file.txt
 
-

In the middle phase, there is possible also to modify nugget effect (default: 0.0) and sill (default: calculated from -variogram values, more details in (Stopkova, 2014). - -

Case study: Slovakia 3D precipitation

-The case study is based on the input points of annual precipitation -dataset. -Although positions of the points are given in three-dimensional space, the points are concentrated at the terrain and thus -interpolation above and below the terrain would become imprecise in deeper / higher areas of the dataset. That is the reason -to test just cross-section from interpolated 3D raster comparing it with cross-section from the RST result obtained using -v.vol.rst according to (Neteler and Mitasova, 2004). +Commands based on the dataset of Slovakia 3D precipitation (Mitasova and Hofierka, 2004). Another examples of 3D interpolation are available in (Stopkova, 2014). -

As the algorithm still needs to be optimized for large datasets, the original region was used with lower resolution -(hz: 5000 m, vert: 500 m). To test also original resolution, the points in smaller region (Tab. 1) were extracted. - -

- - - - - - - - - - - - - - - - -
N = 5 468 000 m
W = 4 361 000 mE = 4 465 500 m
S = 5 374 500 m
top: 2 250 mbottom: 200 m
- Tab. 1: Smaller region extent (resolution hz: 500 m, vert: 50 m) -
- -

-In the initial phase, experimental variograms (horizontal and vertical) were computed:

 v.kriging phase=initial in=precip3d at PERMANENT ic=precip report=precip3d.txt file=png --o
 
- -In the middle phase, there were empirically estimated types of the function and coefficients of theoretical variograms:
 v.kriging in=precip3d at PERMANENT phase=middle hz_fun=exponential vert_fun=gaussian ic=precip file=png hz_range=100000. vert_range=1600 --o -u 
 
- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Fig. 1: Experimental and theoretical variograms in horizontal and vertical direction
-
- a) whole region (horizontal direction): -
- var_hz_initial -
- b) small region (horizontal direction): -
- var_hz_small_initial -
- c) small region with modified horizontal range (horizontal direction): -
- var_hz_small_add -
- d) whole region (vertical direction): -
- var_vert -
- e) small region (vertical direction): -
- var_vert_add -
- -The final phase results into theoretical variogram and interpolated values of the 3D raster:

 v.kriging in=precip3d at PERMANENT phase=middle hz_fun=exponential vert_fun=gaussian ic=precip \
 file=png hz_range=100000. vert_range=1600 --o -u 
 
-Cross validation results of all the interpolated 3D rasters were compared. RST interpolation was performed using -modified settings according to (Neteler and Mitasova, 2004, page 173) - different tension and smoothing parameters were set up to obtain more accurate cross -validation results: +Note: 3D points in this example are concentrated on the Earth's surface. Thus the deeper / higher, the less accurate result of interpolation. -
-v.vol.rst -c input="precip3d at PERMANENT" wcolumn="precip" tension=100. smooth=0. \
-cvdev="cxvalidation_rst_final" segmax=50 npmin=200 npmax=700 wscale=1.0 zscale=50
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- a) linear -
- linear -
- b) exponential -
- exponential -
- c) spherical -
- spherical -
- d) Gaussian -
- gaussian -
- Fig. 2: Variogram modelling of the whole region with horizontal range of 100 000 m and vertical range of 1 600 m -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
v.vol.rstLinearExponentialSphericalGaussian
Minimum [mm]-816.805-684.258-686.063-683.580-741.081
Maximum [mm]175.831429.597424.419424.228444.747
Mean [mm]0.1710.1310.6990.6530.721
Variance [mm2]9876.695740.895926.625950.705979.79
Std. deviation [mm]99.38175.76976.98577.14177.329
- Tab. 2: Cross validation of the whole region with horizontal range of 100 000 m and vertical range of 1 600 m -
- -

- - - - - - - - - - - - - - - - - - - - - - - - - - -
- a) linear: -
- small_linear -
- b) exponential: -
- small_exp -
- c) spherical: -
- small_spher -
- d) Gaussian: -
- small_gauss -
- Fig. 3: Variogram modelling of small region with horizontal range of 20 000 m and vertical range of 1 200 m -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
v.vol.rstLinearExponentialSphericalGaussian
Minimum [mm]-908.303-709.02-755.531-678.237-786.613
Maximum [mm]257.69420.689340.874384.109315.248
Mean [mm]0.5540.908-0.3101.102-0.739
Variance [mm2]28891.615638.721259.519754.821243.2
Std. deviation [mm]169.975125.055145.806140.552145.751
- Tab. 3: Cross validation of small region
with horizontal range of 20 000 m and vertical range of 1 200 m -
- -

- - - - - - - - - - - - - - - - - - - - - - - - - - -
- a) linear -
- small_linear_1 -
- b) exponential -
- small_exp_1 -
- c) spherical -
- small_spher_1 -
- d) Gaussian -
- small_gauss_1 -
- Fig. 4: Variogram modelling of small region with horizontal range of 15 000 m and vertical range of 1 200 m -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
v.vol.rstLinearExponentialSphericalGaussian
Minimum [mm]-908.303-711.755-756.805-687.44-529.702
Maximum [mm]257.69397.666326.057357.990425.637
Mean [mm]0.5540.208-1.7751.8230.008
Variance [mm2]28891.61587321438.520930.920473.1
Std. deviation [mm]169.975125.988146.419144.675143.084
- Tab. 4: Cross validation of small region
with horizontal range of 15 000 m and vertical range of 1 200 m -
- -

-

- - - - - -
- small_exp_2 - small_spher_2 - small_gauss_2 -
- Fig. 5: Variogram modelling of small region with horizontal range of 15 000 m and vertical range of 1 200 m -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
v.vol.rstExponentialSphericalGaussian
Minimum [mm]-908.303-812.347-792.391-783.897
Maximum [mm]257.69279.905284.76293.146
Mean [mm]0.5542.5302.2292.054
Variance [mm2]28891.62398322586.922209.2
Std. deviation [mm]169.975154.865150.289149.028
- Tab. 5: Cross validation of small region
with horizontal range of 15000 m and vertical range of 1200 m
- with different settings of theoretical variogram -
- -

-The results were compared just using cross sections because of the distribution of the points. The column RST - in following tables summarize statistical characteristics of the cross section by v.vol.rst. Other columns represent - statistical characteristics of the cross section values and of the differences (between RST and kriging cross sections) - produced by each type of variogram. - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
v.vol.rstLinearExponentialSphericalGaussian
ValueDiff.ValueDiff.ValueDiff.ValueDiff.
# of cells196105196105196105196105196105
Minimum [mm]491.985551.835-643.783543.503-603.59536.309-629.652550.935-622.887
Maximum [mm]1563.6601580.700317.0111572.000316.9381578.820320.2191548.51356.881
Mean [mm]722.036744.689-22.657740.308-18.271740.968-18.932747.655-25.6238
Variance mm214472.929200.57978.7628614.76978.3529263.97338.5631396.19139.46
Std. deviation [mm]120.303170.88289.324169.15983.5365171.06785.665177.18995.601
- Tab. 6: Statistical characteristics of the results for the whole region
with horizontal range of 100 000 m and vertical range of 1 600 m -
- -

- - - - - - - - -
left: linear variogram; right: exponential variogram
- res_lin - res_exp -
- Fig. 6: Interpolated rasters in the whole region -
- - - - - - - -
left: spherical variogram; right: Gaussian variogram
- res_spher - res_gauss -
- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
v.vol.rstLinearExponentialSphericalGaussian
ValueDiff.ValueDiff.ValueDiff.ValueDiff.
# of cells3763937639376393763937639
Minimum [mm]600.922580.245-669.397595.692-513.497591.531-639.105608.913-378.109
Maximum [mm]1675.0901916.93203.6661837.18172.8581936.17217.1891545.81244.875
Mean [mm]883.909893.167-9.258869.08314.826863.90120.0083871.36412.5451
Variance mm21110239059.111442.722743.83941.7326359.95983.3920350.43796.5
Std. deviation [mm]105.366197.634106.97150.81162.7832162.35777.352142.65561.616
- Tab. 7: Statistical characteristics of the results for the small region
with horizontal range of 20 000 m and vertical range of 1 200 m -
- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
v.vol.rstLinearExponentialSphericalGaussian
ValueDiff.ValueDiff.ValueDiff.ValueDiff.
# of cells3763937639376393763937639
Minimum [mm]600.922576.625-709.196595.284-580.65594.467-665.563556.744-937.124
Maximum [mm]1675.0901920.29217.8441847.160199.3501925.91209.5442218.170249.345
Mean [mm]883.909886.734-2.82485865.27218.6376860.77223.137860.29423.615
Variance mm21110237500.310985.423111.14697.9525530.46226.343257510525.7
Std. deviation [mm]105.366193.65104.811152.02368.5416159.78278.907180.485102.595
- Tab. 8: Statistical characteristics of the results for the small region
with horizontal range of 15 000 m and vertical range of 1 200 m -
- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
v.vol.rstExponentialSphericalGaussian
ValueDiff.ValueDiff.ValueDiff.
# of cells37639376393763937639
Minimum [mm]600.922618.417-453.562600.733-665.563608.602-415.753
Maximum [mm]1675.0901687.83177.5121586.71209.5441571.55238.521
Mean [mm]883.909867.07116.8376867.04723.137867.07516.834
Variance mm21110218570.33191.8919377.56226.3419744.44155.31
Std. deviation [mm]105.366136.27341.737139.20378.907140.51564.462
- Tab. 9: Statistical characteristics of the results for the small region
with horizontal range of 15 000 m and vertical range of 1 200 m
with different settings of the theoretical variogram -
- -

- - - - - - - - -
Gaussian variogram from Tab. 4 vs. Exponential variogram from Tab. 5
- res_gauss_1 - res_exponential_2 -
- Fig. 7: Interpolated rasters with the best (on the left) and the worse (on the right) cross validation results. -
- - - - - - - -
Linear variogram from Tab. 4 vs. Spherical variogram from Tab. 5
- res_linear_1 - res_spherical_2 -
- - - - - - - -
Exponential variogram from Tab. 3 vs. Gaussian variogram from Tab. 5
- res_exponential - res_gauss_2 -
- -

-More case studies on 3D data are described in (Stopkova, 2014). -

2D kriging

-Input layer should contain 2D coordinates (xy) and values to be interpolated (in attribute table). The commands can in general look like this: +

General commands +

 v.kriging phase=initial in=input_layer icol=name report=report_file.txt file=png -2
 
@@ -955,276 +71,36 @@ out=name crossval=crossval_file.txt -2
-

Case study: elev_lid792_randpts

-

-The case study is based on 500 random points that were extracted from input points of Digital Elevation Model (DEM) -elev_lid792_randpts from the North Carolina -dataset. - -

In initial phase, temporary experimental variogram was computed: +

Commands based on 500 random points extracted from input points of Digital Elevation Model (DEM) elev_lid792_randpts from the North Carolina dataset (Neteler and Mitasova, 2004). +

 v.kriging phase=initial in=elev_lid792_selected ic=value azimuth=45. td=45. \
 report=lid792_500_linear.txt -2 --o
 
- -Then, in final phase (middle phase is skipped in 2D kriging) the theoretical variogram was computed and -interpolation of unknown values was performed: -
 v.kriging in=elev_lid792_selected phase=final final_function=linear ic=value \
 file=png out=lid792_500_linear crossval=lid792_500_xval_linear.txt -2 --o
 
-Variogram modelling was compared with the result of variogram analysis in Surfer (Golden Software, Inc.). -

- - - - - -
- variogram_500_linear - variogram_500_surfer -
- Fig. 8: Experimental and theoretical variogram (left: by v.kriging; right: by Surfer (Golden Software, Inc.)) -
-The difference in coefficient of the linear function might be caused by using slightly different lag size or by different approach to the computation (spatial index in v.kriging, optimization algorithms in Surfer (Golden Software, Inc.) etc.). +

TODO

+
    +
  • final phase still needs optimization
  • +
  • anisotropy in horizontal direction missing +
  • current version is suitable just for metric coordinate systems +
  • enable mask usage +
  • bivariate variogram needs to be rebuilt (theory) +
  • 2D interpolation from 3D input layer needs to be rebuilt (especially in case that there are too many points located on identical horizontal coordinates with different elevation) +
-

The results were compared with the values interpolated using the module v.surf.rst and kriging tool of Surfer (Golden Software, Inc.). Fig. 9a - 9c show interpolated DEM and the comparisons with the results of another interpolation tools. Statistical characteristics of the results are summarized in Tab. 10. -

- - - - - - - -
- elev_kriging - elev_diff_rst - elev_diff_surfer -
- Fig. 9: a - the DEM interpolated using v.kriging, b - the difference between v.kriging and v.surf.rst, c - the difference between v.kriging and Surfer (Golden Software, Inc.)) -
+

REFERENCES

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Resultsv.krigingv.surf.rstSurfer (Golden Software, Inc.)
ValuesDifferencesValuesDifferences
Minimum [m]105.114105.061-1.065105.090-1.181
Maximum [m]131.510131.5702.072131.5100.522
Mean [m]120.763120.7810.018120.584-0.178
Variance [m2]43.736743.27010.04558144.23890.027244
Standard deviation [m]6.6136.5780.1656.6510.213
95% quantile [m]130.115130.1090.225130.0880.213
75% quantile [m]126.580126.5870.046126.434-0.047
50% quantile [m]121.315121.3250.000121.080-0.190
25% quantile [m]115.749115.786-0.047115.489-0.328
5% quantile [m]109.004109.115-0.139108.800-0.487
- Tab. 10: Comparison of statistical characteristics of interpolated rasters -
- -
- -Also cross validation results of all the methods mentioned above and their statistical -characteristics have been compared. Cross validation using v.surf.rst -was performed with these settings: -
-v.surf.rst -c input="elev_lid792_selected at test_kriging" layer="1" zcolumn="value" \
-cvdev="lid792_500_rst_xval" tension=40 segmax=30 npmin=120 dmin=5.000000 dmax=25.000000 zscale=1.0
-
- -Cross validation points are shown in Fig. 10 (bigger circles represent kriging results, -smaller circles represent the results of RST). Statistical characteristics of the cross validation -are summarized in Tab. 11. - -
- - - - - - - - -
- xval -
- Fig. 10: Cross validation by v.kriging and v.surf.rst -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cross validationv.krigingv.surf.rstSurfer (Golden Software, Inc.)
Minimum [m]-2.990-1.593-2.344
Maximum [m]2.3993.3623.011
Mean [m]-0.0040.0040.003
Variance [m2]0.1324900.1437420.133809
Standard deviation [m]0.3640.3790.366
95% quantile [m]0.4340.5570.584
50% quantile [m]0.018-0.013-0.020
25% quantile [m]-0.113-0.144-0.126
5% quantile [m]-0.587-0.499-0.445
- Tab. 11: Statistical characteristics
of the cross validation results -
-

- -
-

- Recommendations - +
- - -
- In case of too much warnings about input points that have - "less than 2 neighbours in its closest surrounding. The perimeter of the surrounding will be increased...", please - consider shorter variogram range. + Mitasova, H. and Hofierka, J. (2004). Slovakia Precipitation data. Available at https://grass.osgeo.org/download/sample-data/.
- Save just figures with theoretical variogram (using file=extension in the middle and final phase). - Experimental variograms are included in the theoretical variogram plot and separate "experimental" plots - can be just temporal. -
- -

- References -
Neteler, M. and Mitasova, H. (2004). Open Source GIS: A GRASS GIS Approach. @@ -1240,21 +116,6 @@
-

TODO

-
    -
  • still need optimization for large datasets
  • -
  • anisotropy in horizontal direction missing -
  • current version is suitable just for metric coordinate systems -
  • enable mask usage -
  • bivariate variogram needs to be rebuilt (theory) -
  • 2D interpolation from 3D input layer needs to be rebuilt (especially in case that there are too many points located on identical horizontal coordinates with different elevation) -
- -

BUGS

-
    -
  • bivariate variogram - too inaccurate results -
-

SEE ALSO

From svn_grass at osgeo.org Mon Oct 3 10:13:06 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 10:13:06 -0700 Subject: [GRASS-SVN] r69654 - grass-addons/grass7/raster/r.basin Message-ID: <20161003171306.BD0623903C2@trac.osgeo.org> Author: neteler Date: 2016-10-03 10:13:06 -0700 (Mon, 03 Oct 2016) New Revision: 69654 Added: grass-addons/grass7/raster/r.basin/r_basin1.png grass-addons/grass7/raster/r.basin/r_basin2.png Removed: grass-addons/grass7/raster/r.basin/r.basin1.gif grass-addons/grass7/raster/r.basin/r.basin2.gif Modified: grass-addons/grass7/raster/r.basin/r.basin.html Log: r.basin addon manual: gif -> png Modified: grass-addons/grass7/raster/r.basin/r.basin.html =================================================================== --- grass-addons/grass7/raster/r.basin/r.basin.html 2016-10-03 16:39:47 UTC (rev 69653) +++ grass-addons/grass7/raster/r.basin/r.basin.html 2016-10-03 17:13:06 UTC (rev 69654) @@ -61,7 +61,7 @@
-mean slope +mean slope

where N is the topological diameter, i.e. the number of links @@ -83,7 +83,7 @@
-concentration time +concentration time

Where A is the area, L the length of the main channel and H the @@ -172,7 +172,7 @@ Di Leo Margherita, Di Stefano Massimo (2013) An Open-Source Approach for Catchment's Physiographic Characterization, Abstract H52E-06 presented at 2013 Fall Meeting, AGU, San Francisco, CA, USA 9-13 Dec. - +abstract

REFERENCES

    Deleted: grass-addons/grass7/raster/r.basin/r.basin1.gif =================================================================== (Binary files differ) Deleted: grass-addons/grass7/raster/r.basin/r.basin2.gif =================================================================== (Binary files differ) Added: grass-addons/grass7/raster/r.basin/r_basin1.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.basin/r_basin1.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass-addons/grass7/raster/r.basin/r_basin2.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.basin/r_basin2.png ___________________________________________________________________ Added: svn:mime-type + image/png From svn_grass at osgeo.org Mon Oct 3 10:22:50 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 10:22:50 -0700 Subject: [GRASS-SVN] r69655 - grass-addons/grass7/raster/r.basin Message-ID: <20161003172250.6C7FF3903C2@trac.osgeo.org> Author: neteler Date: 2016-10-03 10:22:50 -0700 (Mon, 03 Oct 2016) New Revision: 69655 Added: grass-addons/grass7/raster/r.basin/r_basin_map.png Modified: grass-addons/grass7/raster/r.basin/r.basin.html Log: r.basin addon manual: example screenshot added Modified: grass-addons/grass7/raster/r.basin/r.basin.html =================================================================== --- grass-addons/grass7/raster/r.basin/r.basin.html 2016-10-03 17:13:06 UTC (rev 69654) +++ grass-addons/grass7/raster/r.basin/r.basin.html 2016-10-03 17:22:50 UTC (rev 69655) @@ -137,6 +137,13 @@ d.his i=aspect h=my_basin_elevation_dist2out
+

+

+ +r.basin results + +
+

Dependencies

  • Matplotlib
  • Added: grass-addons/grass7/raster/r.basin/r_basin_map.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.basin/r_basin_map.png ___________________________________________________________________ Added: svn:mime-type + image/png From svn_grass at osgeo.org Mon Oct 3 11:14:04 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 11:14:04 -0700 Subject: [GRASS-SVN] r69656 - grass-addons/grass7/raster/r.basin Message-ID: <20161003181404.23B243901D3@trac.osgeo.org> Author: neteler Date: 2016-10-03 11:14:03 -0700 (Mon, 03 Oct 2016) New Revision: 69656 Modified: grass-addons/grass7/raster/r.basin/r.basin.html Log: r.basin addon manual: link to Wiki page added Modified: grass-addons/grass7/raster/r.basin/r.basin.html =================================================================== --- grass-addons/grass7/raster/r.basin/r.basin.html 2016-10-03 17:22:50 UTC (rev 69655) +++ grass-addons/grass7/raster/r.basin/r.basin.html 2016-10-03 18:14:03 UTC (rev 69656) @@ -172,6 +172,8 @@ r.stream.stats (Addon), r.watershed, r.width.funct (Addon) +

    +Related Wiki page

    CITE AS

    From svn_grass at osgeo.org Mon Oct 3 11:40:15 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 11:40:15 -0700 Subject: [GRASS-SVN] r69657 - grass/trunk/gui/wxpython/modules Message-ID: <20161003184015.9DCF43901D3@trac.osgeo.org> Author: annakrat Date: 2016-10-03 11:40:15 -0700 (Mon, 03 Oct 2016) New Revision: 69657 Modified: grass/trunk/gui/wxpython/modules/import_export.py Log: wxGUI/reprojection dialog: fix for Mac, StaticBox must be defined before the widgets Modified: grass/trunk/gui/wxpython/modules/import_export.py =================================================================== --- grass/trunk/gui/wxpython/modules/import_export.py 2016-10-03 18:14:03 UTC (rev 69656) +++ grass/trunk/gui/wxpython/modules/import_export.py 2016-10-03 18:40:15 UTC (rev 69657) @@ -862,6 +862,9 @@ columns = [_('Layer id'), _('Name for output GRASS map')] + self.layerBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY) + self.layerSizer = wx.StaticBoxSizer(self.layerBox, wx.HORIZONTAL) + self.list = GListCtrl(parent=self.panel) for i in range(len(columns)): @@ -874,8 +877,6 @@ self.list.LoadData(data) - self.layerBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY) - self.labelText = wx.StaticText(parent=self.panel, id=wx.ID_ANY, label=_( "Projection of following layers do not match with projection of current location. ")) @@ -906,13 +907,11 @@ dialogSizer.Add(item=self.labelText, flag=wx.ALL | wx.EXPAND, border=5) - layerSizer = wx.StaticBoxSizer(self.layerBox, wx.HORIZONTAL) + self.layerSizer.Add(item=self.list, proportion=1, + flag=wx.ALL | wx.EXPAND, border=5) - layerSizer.Add(item=self.list, proportion=1, - flag=wx.ALL | wx.EXPAND, border=5) - dialogSizer.Add( - item=layerSizer, + item=self.layerSizer, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=5) From svn_grass at osgeo.org Mon Oct 3 14:09:59 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 14:09:59 -0700 Subject: [GRASS-SVN] r69658 - grass/trunk/raster/r.stream.extract Message-ID: <20161003210959.DD3553903C2@trac.osgeo.org> Author: neteler Date: 2016-10-03 14:09:59 -0700 (Mon, 03 Oct 2016) New Revision: 69658 Added: grass/trunk/raster/r.stream.extract/r_stream_extract_accum_orig_zoom.png grass/trunk/raster/r.stream.extract/r_stream_extract_accum_weighted_zoom.png grass/trunk/raster/r.stream.extract/r_stream_extract_streams_noweight.png grass/trunk/raster/r.stream.extract/r_stream_extract_weights_zoom.png Modified: grass/trunk/raster/r.stream.extract/r.stream.extract.html Log: r.stream.extract manual: screenshots added Modified: grass/trunk/raster/r.stream.extract/r.stream.extract.html =================================================================== --- grass/trunk/raster/r.stream.extract/r.stream.extract.html 2016-10-03 18:40:15 UTC (rev 69657) +++ grass/trunk/raster/r.stream.extract/r.stream.extract.html 2016-10-03 21:09:59 UTC (rev 69658) @@ -110,7 +110,7 @@

    Another possibility is to restrict channel initiation to valleys determined from terrain morphology. Valleys can be determined with -r.param.scale param=crosc +r.param.scale method=crosc (cross-sectional or tangential curvature). Curvature values < 0 indicate concave features, i.e. valleys. The size of the processing window determines whether narrow or broad valleys will be identified @@ -166,18 +166,18 @@ r.watershed ele=elev_ned_30m at PERMANENT acc=elevation.10m.acc # curvature to get narrow valleys -r.param.scale input=elev_ned_30m at PERMANENT output=tangential_curv_5 size=5 param=crosc +r.param.scale input=elev_ned_30m at PERMANENT output=tangential_curv_5 size=5 method=crosc # curvature to get a bit broader valleys -r.param.scale input=elev_ned_30m at PERMANENT output=tangential_curv_7 size=7 param=crosc +r.param.scale input=elev_ned_30m at PERMANENT output=tangential_curv_7 size=7 method=crosc # curvature to get broad valleys -r.param.scale input=elev_ned_30m at PERMANENT output=tangential_curv_11 size=11 param=crosc +r.param.scale input=elev_ned_30m at PERMANENT output=tangential_curv_11 size=11 method=crosc # create weight map -r.mapcalc "weight = if(tangential_curv_5 < 0, -100 * tangential_curv_5, \ - if(tangential_curv_7 < 0, -100 * tangential_curv_7, \ - if(tangential_curv_11 < 0, -100 * tangential_curv_11, 0.000001)))" +r.mapcalc "weight = if(tangential_curv_5 < 0, -100 * tangential_curv_5, \ + if(tangential_curv_7 < 0, -100 * tangential_curv_7, \ + if(tangential_curv_11 < 0, -100 * tangential_curv_11, 0.000001)))" # weigh accumulation map r.mapcalc expr="elev_ned_30m.acc.weighed = elev_ned_30m.acc * weight" @@ -186,11 +186,27 @@ r.colors map=elev_ned_30m.acc.weighed raster=elev_ned_30m.acc

+

+ +
+Weight map (spatial subset with lake in the southern half) + +

+ +
+Original flow accumulation map (spatial subset with lake in the southern half) + +

+ +
+Weighed flow accumulation map (spatial subset with lake in the southern half) +

+ Display both the original and the weighed accumulation map. Compare them and proceed if the weighed accumulation map makes sense.

-# extract streams
+# extract streams from weighed map
 r.stream.extract elevation=elev_ned_30m at PERMANENT \
                  accumulation=elev_ned_30m.acc.weighed \
 		 threshold=1000 \
@@ -203,8 +219,24 @@
 		 stream_rast=elev_ned_30m.streams.noweight
 
+

Now display both stream maps and decide which one is more realistic. + +

+ +
+Extracted streams from original flow accumulation map + +

REFERENCES

    Added: grass/trunk/raster/r.stream.extract/r_stream_extract_accum_orig_zoom.png =================================================================== (Binary files differ) Property changes on: grass/trunk/raster/r.stream.extract/r_stream_extract_accum_orig_zoom.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass/trunk/raster/r.stream.extract/r_stream_extract_accum_weighted_zoom.png =================================================================== (Binary files differ) Property changes on: grass/trunk/raster/r.stream.extract/r_stream_extract_accum_weighted_zoom.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass/trunk/raster/r.stream.extract/r_stream_extract_streams_noweight.png =================================================================== (Binary files differ) Property changes on: grass/trunk/raster/r.stream.extract/r_stream_extract_streams_noweight.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass/trunk/raster/r.stream.extract/r_stream_extract_weights_zoom.png =================================================================== (Binary files differ) Property changes on: grass/trunk/raster/r.stream.extract/r_stream_extract_weights_zoom.png ___________________________________________________________________ Added: svn:mime-type + image/png From svn_grass at osgeo.org Mon Oct 3 14:11:31 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 14:11:31 -0700 Subject: [GRASS-SVN] r69659 - grass/branches/releasebranch_7_2/raster/r.stream.extract Message-ID: <20161003211131.78A213903C2@trac.osgeo.org> Author: neteler Date: 2016-10-03 14:11:31 -0700 (Mon, 03 Oct 2016) New Revision: 69659 Added: grass/branches/releasebranch_7_2/raster/r.stream.extract/r_stream_extract_accum_orig_zoom.png grass/branches/releasebranch_7_2/raster/r.stream.extract/r_stream_extract_accum_weighted_zoom.png grass/branches/releasebranch_7_2/raster/r.stream.extract/r_stream_extract_streams_noweight.png grass/branches/releasebranch_7_2/raster/r.stream.extract/r_stream_extract_weights_zoom.png Modified: grass/branches/releasebranch_7_2/raster/r.stream.extract/r.stream.extract.html Log: r.stream.extract manual: screenshots added (trunk, r69658) Modified: grass/branches/releasebranch_7_2/raster/r.stream.extract/r.stream.extract.html =================================================================== --- grass/branches/releasebranch_7_2/raster/r.stream.extract/r.stream.extract.html 2016-10-03 21:09:59 UTC (rev 69658) +++ grass/branches/releasebranch_7_2/raster/r.stream.extract/r.stream.extract.html 2016-10-03 21:11:31 UTC (rev 69659) @@ -110,7 +110,7 @@

    Another possibility is to restrict channel initiation to valleys determined from terrain morphology. Valleys can be determined with -r.param.scale param=crosc +r.param.scale method=crosc (cross-sectional or tangential curvature). Curvature values < 0 indicate concave features, i.e. valleys. The size of the processing window determines whether narrow or broad valleys will be identified @@ -166,18 +166,18 @@ r.watershed ele=elev_ned_30m at PERMANENT acc=elevation.10m.acc # curvature to get narrow valleys -r.param.scale input=elev_ned_30m at PERMANENT output=tangential_curv_5 size=5 param=crosc +r.param.scale input=elev_ned_30m at PERMANENT output=tangential_curv_5 size=5 method=crosc # curvature to get a bit broader valleys -r.param.scale input=elev_ned_30m at PERMANENT output=tangential_curv_7 size=7 param=crosc +r.param.scale input=elev_ned_30m at PERMANENT output=tangential_curv_7 size=7 method=crosc # curvature to get broad valleys -r.param.scale input=elev_ned_30m at PERMANENT output=tangential_curv_11 size=11 param=crosc +r.param.scale input=elev_ned_30m at PERMANENT output=tangential_curv_11 size=11 method=crosc # create weight map -r.mapcalc "weight = if(tangential_curv_5 < 0, -100 * tangential_curv_5, \ - if(tangential_curv_7 < 0, -100 * tangential_curv_7, \ - if(tangential_curv_11 < 0, -100 * tangential_curv_11, 0.000001)))" +r.mapcalc "weight = if(tangential_curv_5 < 0, -100 * tangential_curv_5, \ + if(tangential_curv_7 < 0, -100 * tangential_curv_7, \ + if(tangential_curv_11 < 0, -100 * tangential_curv_11, 0.000001)))" # weigh accumulation map r.mapcalc expr="elev_ned_30m.acc.weighed = elev_ned_30m.acc * weight" @@ -186,11 +186,27 @@ r.colors map=elev_ned_30m.acc.weighed raster=elev_ned_30m.acc

+

+ +
+Weight map (spatial subset with lake in the southern half) + +

+ +
+Original flow accumulation map (spatial subset with lake in the southern half) + +

+ +
+Weighed flow accumulation map (spatial subset with lake in the southern half) +

+ Display both the original and the weighed accumulation map. Compare them and proceed if the weighed accumulation map makes sense.

-# extract streams
+# extract streams from weighed map
 r.stream.extract elevation=elev_ned_30m at PERMANENT \
                  accumulation=elev_ned_30m.acc.weighed \
 		 threshold=1000 \
@@ -203,8 +219,24 @@
 		 stream_rast=elev_ned_30m.streams.noweight
 
+

Now display both stream maps and decide which one is more realistic. + +

+ +
+Extracted streams from original flow accumulation map + +

REFERENCES

    Copied: grass/branches/releasebranch_7_2/raster/r.stream.extract/r_stream_extract_accum_orig_zoom.png (from rev 69658, grass/trunk/raster/r.stream.extract/r_stream_extract_accum_orig_zoom.png) =================================================================== (Binary files differ) Copied: grass/branches/releasebranch_7_2/raster/r.stream.extract/r_stream_extract_accum_weighted_zoom.png (from rev 69658, grass/trunk/raster/r.stream.extract/r_stream_extract_accum_weighted_zoom.png) =================================================================== (Binary files differ) Copied: grass/branches/releasebranch_7_2/raster/r.stream.extract/r_stream_extract_streams_noweight.png (from rev 69658, grass/trunk/raster/r.stream.extract/r_stream_extract_streams_noweight.png) =================================================================== (Binary files differ) Copied: grass/branches/releasebranch_7_2/raster/r.stream.extract/r_stream_extract_weights_zoom.png (from rev 69658, grass/trunk/raster/r.stream.extract/r_stream_extract_weights_zoom.png) =================================================================== (Binary files differ) From svn_grass at osgeo.org Mon Oct 3 14:51:25 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 14:51:25 -0700 Subject: [GRASS-SVN] r69660 - grass-addons/grass7/raster/r.randomforest Message-ID: <20161003215125.8AD353903C2@trac.osgeo.org> Author: spawley Date: 2016-10-03 14:51:25 -0700 (Mon, 03 Oct 2016) New Revision: 69660 Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.html grass-addons/grass7/raster/r.randomforest/r.randomforest.py Log: Major update to the r.randomforest addon. Several other classifiers have been included. Also bug fixes to the ROC_AUC options which previously was just displaying classification accuracy Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.html =================================================================== --- grass-addons/grass7/raster/r.randomforest/r.randomforest.html 2016-10-03 21:11:31 UTC (rev 69659) +++ grass-addons/grass7/raster/r.randomforest/r.randomforest.html 2016-10-03 21:51:25 UTC (rev 69660) @@ -1,33 +1,39 @@

    DESCRIPTION

    -r.randomforest performs Random forests classification and regression on a suite of predictors within a GRASS imagery group. Random forest (Breiman, 2001) is an ensemble classification tree method which constructs a forest of uncorrelated decision trees based on a random subset of predictor variables, which occurs independently at every node split in each tree. Each tree produces a prediction probability, and the final classification result is obtained by averaging of the prediction probabilities across all of the trees. The probability of membership to the individual classes (class_probabilities flag) can also be output using the -p flag. The scikit-learn (python-sklearn) randomforest implementation differs from the original Breiman (2001) reference which uses majority voting rather than averaging. +r.randomforest represents a front-end to the scikit learn machine learning python package for the purpose of performing classification and regression on a suite of predictors within a GRASS imagery group. The module also provides access random forest classification, and several other classifiers that are commonly used in remote sensing and spatial modelling. For more information concerning the details of any of the algorithms, consult the scikit-learn documentation directly. The choice of classifier is set using the model parameter. -

    Random forests offers a number of advantages over traditional statistical classifiers because it is non-parametric and can deal with non-linear relationships and categorical data, and no rescaling is required. Random forests also require relatively few user-specified parameter choices, principally consisting of the number of trees in the forest (ntrees), and the number of variables that are allowed to be chosen from at each node split (mfeatures), which controls the degree of correlation between the trees. There is no accuracy penalty in having a large number of trees apart from increased computational time. For randomforest classification, the default ntrees is 500 and the default setting of mfeatures is equal to the square root of the number of predictors. +

    The RandomForestsClassifier and RandomForestsRegressor (Breiman, 2001) options represent ensemble classification and regression tree methods, respectively. These methods construct a forest of uncorrelated decision trees based on a random subset of predictor variables, which occurs independently at every node split in each tree. Each tree produces a prediction probability, and the final classification result is obtained by averaging of the prediction probabilities across all of the trees. Random forests require relatively few user-specified parameter choices, principally consisting of the number of trees in the forest (ntrees_rf), and the number of variables that are allowed to be chosen from at each node split (m_features_rf), which controls the degree of correlation between the trees. Random forests also includes built-in accuracy assessment, termed the 'out-of-bag' (OOB) error. This is computed through bagging, where 33% of the training data are held-out duri ng the construction of each tree, and then OOB data are used to evaluate the prediction accuracy. -

    Random forests includes built-in accuracy assessment and variable selection. Random forests uses bagging, where a randomly selected 66% subset of the training data are held-out 'out-of-bag' (OOB) in the construction of each tree, and then OOB data are used to evaluate the prediction accuracy. The OOB error has been shown to provide a reliable estimate of classification error. However, the -cv can be set to > 1 to perform k-fold cross validation as an external method of accuracy assessment, and a number of global performance metrics are used. +

    LogisticRegression, despite its name, represents a linear model for classification rather than regression. This module provides access to two parameters, C_lr the inverse of the regularization strength, and i which specifies if a constant (a.k.a. bias or intercept) should be added to the decision function. -

    Note: the performance are applied on a pixel-basis in the module and assume that the training data are not spatially correlated. This assumption is unlikely to be true of the training data represent rasterized polygons rather than points. In this case, an independent set of polygons should be used to test the accuracy of the classification using i.kappa. +

    LinearDiscriminantAnalysis and QuadraticDiscriminantAnalysis are two classifiers with a linear and a quadratic decision surface, respectively. These classifiers do not take any parameters. -

    The random forests scikit-learn implementation includes a measure of variable importance based on the Gini impurity criterion, which measures how each variable contributes to the homogeneity of the nodes, with important variables causing a larger decrease in the Gini coefficient in successive node splits. This variable importance allows the contributions of the individual predictors to be determined. The feature importance scores are displayed in the command output. +

    GaussianNB implements the Gaussian Naive Bayes algorithm for classification. Naive Bayes methods are a set of supervised learning algorithms based on applying Bayes’ theorem with the “naive” assumption of independence between every pair of features. This classifier does not take any parameters. -

    Random forests does not perform well in the case of a large class imbalance. In this case, the classifier will seek to reduce the overall model error, but this will occur by predicting the majority class with a very high accuracy, but at the expense of the minority class. If you have a highly imbalanced dataset, the 'balanced' flag can be set. The scikit-learn implementation balanced mode then automatically adjust weights inversely proportional to class frequencies. +

    The DecisionTreeClassifier and DecisionTreeRegressor represent non-parametric supervised learning methods used for classification and regression, respectively. Several parameter choices are available, relating to the node splitting method, the number of features to consider at each split, and the minimum number of samples in a split or leaf node. -

    Random forest can also be run in regression mode by setting the mode to the regression option. In this case, the mean square error (mse) is used to measure the quality of each decision split in the tree. Additionally, the the default mfeatures is equal to the number of predictors, and the coefficient of determination R^2 of the prediction is used as the performance measure. The generalization ability of the classifier can also be increased using minsplit, which represents the minimum number of samples required in order to split a node. The balanced and class_probabilities options are ignored for regression. +

    The GradientBoostingClassifier and GradientBoostingRegressor use an ensemble of boosted decision trees for classification and regression, respectively. Gradient tree boosting produces a prediction model in the form of an ensemble of weak prediction models from decision trees, but the model is built in a stage-wise fashion. Gradient tree boosting includes many parameter choices, although the module provides access to the most common parameters that may require tuning for optimal performance. -

    The module also offers the ability to save and load a random forests model. The model is saved as a list of filenames (starting with the extension .pkl which is added automatically) for each numpy array. This list can involve a large number of files, so it makes sense to save each model in a separate directory. To load the model, you need to select the .pkl file that was saved. Saving and loading a model represents a useful feature because it allows a model to be built on one imagery group (ie. set of predictor variables), and then the prediction can be performed on other imagery groups. This approach is commonly employed in species prediction modelling, or landslide susceptibility modelling, where a classification or regression model is built with one set of predictors (e.g. which include present-day climatic variables) and then predictions can be performed on other imagery groups containing forecasted climatic variables. The names of the GRASS rasters in the imagery groups do not matter because scikit learn saves the model as a series of numpy arrays. However, the new imagery group must contain the same number of rasters, and they should be in the same order as in the imagery group upon which the model was built. As an example, the new imagery group may have a raster named 'mean_precipitation_2050' which substitutes the 'mean_precipitation_2016' in the imagery group that was used to build the model. +

    The tree-based classifiers include a measure of variable importance based on the Gini impurity criterion, which measures how each variable contributes to the homogeneity of the nodes, with important variables causing a larger decrease in the Gini coefficient in successive node splits. This variable importance allows the contributions of the individual predictors to be determined. The feature importance scores are displayed in the command output. +

    Most machine learning algorithms do not perform well in the case of a large class imbalance. In this case, the classifier will seek to reduce the overall model error, but this will occur by predicting the majority class with a very high accuracy, but at the expense of the minority class. If you have a highly imbalanced dataset, the 'balanced' b flag can be set. The scikit-learn implementation balanced mode then automatically adjust weights inversely proportional to class frequencies. This only applies to the LogisticRegression, DecisionTree, RandomForest, and GradientBoostingClassifiers. + +

    The module also offers the ability to save and load a classification or regression model. The model is saved as a list of filenames (starting with the extension .pkl which is added automatically) for each numpy array. This list can involve a large number of files, so it makes sense to save each model in a separate directory. To load the model, you need to select the .pkl file that was saved. Saving and loading a model represents a useful feature because it allows a model to be built on one imagery group (ie. set of predictor variables), and then the prediction can be performed on other imagery groups. This approach is commonly employed in species prediction modelling, or landslide susceptibility modelling, where a classification or regression model is built with one set of predictors (e.g. which include present-day climatic variables) and then predictions can be performed on other imagery groups containing forecasted climatic variables. + +

    For convenience when performing repeated classifications using different classifiers or parameters, the training data can be saved to a csv file using the save_training option. This data can then be loaded into subsequent classification runs, saving time by avoiding the need to repeatedly query the predictors. +

    NOTES

    r.randomforest uses the "scikit-learn" machine learning python package. This python package needs to be installed within your GRASS GIS Python environment for r.randomforest to work.
    For Linux users, this package should be available through the linux package manager in most distributions (named for example "python-scikit-learn").
    -For MS-Windows users, the easiest way of installing the packages is by using the precompiled binaries from Christoph Gohlke and by using the OSGeo4W installation method of GRASS, where the python setuptools can also be installed. You can then use 'easy_install pip' to install the pip package manager. Then, you can download the NumPy-1.10+MKL and scikit-learn .whl files and install them using 'pip install packagename.whl'. +For MS-Windows users using a 64 bit GRASS, the easiest way of installing the packages is by using the precompiled binaries from Christoph Gohlke and by using the OSGeo4W installation method of GRASS, where the python setuptools can also be installed. You can then use 'easy_install pip' to install the pip package manager. Then, you can download the NumPy-1.10+MKL and scikit-learn .whl files and install them using 'pip install packagename.whl'. For MS-Windows with a 32 bit GRASS, scikit-learn is available in the OSGeo4W installer.

    -r.randomforest is designed to keep system memory requirements relatively low. For this purpose, the rasters are read from the disk row-by-row, using the RasterRow method in PyGRASS. This however does not represent an efficient volume of data to pass to the classifier, which is multithreaded by default. Therefore, groups of rows specified by the lines parameter are passed to the classifier, and the reclassified image is reconstructed and written row-by-row back to the disk. Lines=25 should be reasonable for most systems with 4-8 GB of ram. However, if you have a workstation with much larger resources, then lines could be set to a much larger size (including to a value that is equal or greater than the number of rows in the current region setting) in which case the entire image will be loaded into memory to classification. +r.randomforest is designed to keep system memory requirements relatively low. For this purpose, the rasters are read from the disk row-by-row, using the RasterRow method in PyGRASS. This however does not represent an efficient volume of data to pass to the classifier, which is multithreaded by default. Therefore, groups of rows specified by the lines parameter are passed to the classifier, and the reclassified image is reconstructed and written row-by-row back to the disk. Lines=25 should be reasonable for most systems with 4-8 GB of ram. However, the sampling of the training data set is slow using a row-by-row basis, and the default approach requires enough memory to load one predictor into memory at a time. If this still exceeds the system memory then the l flag can be set to perform row-by-row sampling. -

    The bootstrapping process involved within random forests also causes a small amount of variation in the classification results, out-of-bag error, and feature importances. To enable reproducible results, a seed is supplied to the classifier. This can be changed using the randst parameter. +

    Many of the classifiers involve a random process which can causes a small amount of variation in the classification results, out-of-bag error, and feature importances. To enable reproducible results, a seed is supplied to the classifier. This can be changed using the randst parameter.

    TODO

    @@ -54,7 +60,7 @@

    Then we can use these training pixels to perform a classification on the more recently obtained landsat 7 image:
     r.randomforest igroup=lsat7_2000 roi=landclass96_roi output=rf_classification \
    -  mode=classification ntrees=500 mfeatures=-1 minsplit=2 randst=1 lines=25
    +  model=RandomForestClassifier ntrees_rf=500 m_features_rf=-1 minsplit_rf=2 randst=1 lines=25
     
     # copy category labels from landclass training map to result
     r.category rf_classification raster=landclass96_roi
    
    Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.py
    ===================================================================
    --- grass-addons/grass7/raster/r.randomforest/r.randomforest.py	2016-10-03 21:11:31 UTC (rev 69659)
    +++ grass-addons/grass7/raster/r.randomforest/r.randomforest.py	2016-10-03 21:51:25 UTC (rev 69660)
    @@ -1,29 +1,29 @@
     #!/usr/bin/env python
     ############################################################################
     #
    -# MODULE:       r.randomforest
    +# MODULE:       r.scikit.learn
     # AUTHOR:       Steven Pawley
    -# PURPOSE:    Provides supervised random forest classification and regression
    -#                      using python scikit-learn)
    +# PURPOSE:      Supervised classification and regression of GRASS rasters using the 
    +#               python scikit-learn package
     #
    -# COPYRIGHT: (c) 2015 Steven Pawley, 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.
    +# COPYRIGHT: (c) 2016 Steven Pawley, 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.
     #
     #############################################################################
     
     #%module
    -#% description: Provides supervised random forest classification
    +#% description: Supervised classification and regression of GRASS rasters using the python scikit-learn package
     #% keyword: classification
    +#% keyword: regression
     #% keyword: machine learning
     #% keyword: scikit-learn
    -#% keyword: random forests
     #%end
     
     #%option G_OPT_I_GROUP
     #% key: igroup
    -#% label: Imagery group to be classified (predictors)
    +#% label: Imagery group to be classified
     #% description: Series of raster maps to be used in the random forest classification
     #% required: yes
     #% multiple: no
    @@ -31,7 +31,7 @@
     
     #%option G_OPT_R_INPUT
     #% key: roi
    -#% label: Raster map with labelled pixels
    +#% label: Labelled pixels
     #% description: Raster map with labelled pixels
     #% required: no
     #% guisection: Required
    @@ -41,50 +41,174 @@
     #% key: output
     #% required: yes
     #% label: Output Map
    +#% description: Prediction surface result from classification or regression model
     #%end
     
     #%option string
    -#% key: mode
    +#% key: model
     #% required: yes
    -#% label: Classification or regression mode
    -#% answer: classification
    -#% options: classification,regression
    +#% label: Classifier
    +#% description: Supervised learning model to use
    +#% answer: RandomForestClassifier
    +#% options: LogisticRegression,LinearDiscriminantAnalysis,QuadraticDiscriminantAnalysis,DecisionTreeClassifier,DecisionTreeRegressor,RandomForestClassifier,RandomForestRegressor,GradientBoostingClassifier,GradientBoostingRegressor,GaussianNB
     #%end
     
    +# Logistic regression options
    +
    +#%option double
    +#% key: c_lr
    +#% description: Inverse of regularization strength
    +#% answer: 1.0
    +#% guisection: Logistic Regression
    +#%end
    +
    +#%flag
    +#% key: i
    +#% description: Fit intercept in logistic regression
    +#% guisection: Logistic Regression
    +#%end
    +
    +# Decision tree options
    +#%option string
    +#% key: splitter_dt
    +#% description: The strategy used to choose the split at each node
    +#% answer: best
    +#% options: best,random
    +#% guisection: Decision Tree
    +#%end
    +
     #%option
    -#% key: ntrees
    +#% key: m_features_dt
     #% type: integer
    +#% description: The number of features to consider when looking for the best split. Default -1 is sqrt(n_features) for classification, and n_features for regression
    +#% answer: -1
    +#% guisection: Decision Tree
    +#%end
    +
    +#%option
    +#% key: min_samples_split_dt
    +#% type: integer
    +#% description: The minimum number of samples required to split an internal node
    +#% answer: 2
    +#% guisection: Decision Tree
    +#%end
    +
    +#%option
    +#% key: min_samples_leaf_dt
    +#% type: integer
    +#% description: The minimum number of samples required to be at a leaf node
    +#% answer: 1
    +#% guisection: Decision Tree
    +#%end
    +
    +#%option
    +#% key: min_weight_fraction_leaf_dt
    +#% type: integer
    +#% description: The minimum weighted fraction of the input samples required to be at a leaf node
    +#% answer: 0
    +#% guisection: Decision Tree
    +#%end
    +
    +# Random Forest Options
    +
    +#%option
    +#% key: ntrees_rf
    +#% type: integer
     #% description: Number of trees in the forest
     #% answer: 500
    -#% required: yes
    -#% guisection: Random Forest Options
    +#% guisection: Random Forest
     #%end
     
     #%option
    -#% key: mfeatures
    +#% key: m_features_rf
     #% type: integer
    -#% description: The number of features allowed at each split. Sqrt(n_features) is used by default
    +#% description: The number of features allowed at each split. Default -1 is sqrt(n_features) for classification, and n_features for regression
     #% answer: -1
    -#% required: yes
    -#% guisection: Random Forest Options
    +#% guisection: Random Forest
     #%end
     
     #%option
    -#% key: minsplit
    +#% key: minsplit_rf
     #% type: integer
    +#% description: The minimum number of samples required to split a node
    +#% answer: 2
    +#% guisection: Random Forest
    +#%end
    +
    +# Gradient tree boosting options
    +
    +#%option
    +#% key: learning_rate_gtb
    +#% type: double
    +#% description: learning rate shrinks the contribution of each tree
    +#% answer: 0.1
    +#% guisection: Gradient Boosted Trees
    +#%end
    +
    +#%option
    +#% key: n_estimators_gtb
    +#% type: integer
    +#% description: The number of boosting stages to perform
    +#% answer: 100
    +#% guisection: Gradient Boosted Trees
    +#%end
    +
    +#%option
    +#% key: max_depth_gtb
    +#% type: integer
    +#% description: The maximum depth limits the number of nodes in the tree
    +#% answer: 3
    +#% guisection: Gradient Boosted Trees
    +#%end
    +
    +#%option
    +#% key: min_samples_split_gtb
    +#% type: integer
     #% description: The minimum number of samples required to split an internal node
     #% answer: 2
    -#% required: yes
    -#% guisection: Random Forest Options
    +#% guisection: Gradient Boosted Trees
     #%end
     
     #%option
    +#% key: min_samples_leaf_gtb
    +#% type: integer
    +#% description: The minimum number of samples required to be at a leaf node
    +#% answer: 1
    +#% guisection: Gradient Boosted Trees
    +#%end
    +
    +#%option
    +#% key: min_weight_fraction_leaf_gtb
    +#% type: double
    +#% description: The minimum weighted fraction of the input samples required to be at a leaf node
    +#% answer: 0.
    +#% guisection: Gradient Boosted Trees
    +#%end
    +
    +#%option
    +#% key: subsample_gtb
    +#% type: double
    +#% description: The fraction of samples to be used for fitting the individual base learners
    +#% answer: 1.0
    +#% guisection: Gradient Boosted Trees
    +#%end
    +
    +#%option
    +#% key: max_features_gtb
    +#% type: integer
    +#% description: The number of features to consider during splitting. Default -1 is sqrt(n_features) for classification mode, and n_features for regression mode
    +#% answer: -1
    +#% guisection: Gradient Boosted Trees
    +#%end
    +
    +# General options
    +
    +#%option
     #% key: cv
     #% type: integer
     #% description: Use k-fold cross-validation when cv > 1
     #% answer: 1
    -#% required: yes
    -#% guisection: Random Forest Options
    +#% guisection: Optional
     #%end
     
     #%option
    @@ -92,8 +216,7 @@
     #% type: integer
     #% description: Seed to pass onto the random state for reproducible results
     #% answer: 1
    -#% required: yes
    -#% guisection: Random Forest Options
    +#% guisection: Optional
     #%end
     
     #%option
    @@ -101,26 +224,37 @@
     #% type: integer
     #% description: Processing block size in terms of number of rows
     #% answer: 25
    -#% required: yes
    -#% guisection: Random Forest Options
    +#% guisection: Optional
     #%end
     
     #%flag
     #% key: p
     #% label: Output class membership probabilities
    -#% guisection: Random Forest Options
    +#% guisection: Optional
     #%end
     
     #%flag
    +#% key: m
    +#% description: Build model only - do not perform prediction
    +#% guisection: Optional
    +#%end
    +
    +#%flag
    +#% key: f
    +#% description: Output feature importances for ensemble tree-based models
    +#% guisection: Optional
    +#%end
    +
    +#%flag
     #% key: b
    -#% description: Balance classes by weighting
    -#% guisection: Random Forest Options
    +#% description: Balance number of observations by weighting for logistic regression and tree-based classifiers
    +#% guisection: Optional
     #%end
     
     #%flag
    -#% key: m
    -#% description: Build model only - do not perform prediction
    -#% guisection: Random Forest Options
    +#% key: l
    +#% description: Low memory version - samples predictors row-by-row (slower)
    +#% guisection: Optional
     #%end
     
     #%option G_OPT_F_OUTPUT
    @@ -137,395 +271,198 @@
     #% guisection: Optional
     #%end
     
    +#%option G_OPT_F_OUTPUT
    +#% key: save_training
    +#% label: Save training data to csv file
    +#% required: no
    +#% guisection: Optional
    +#%end
    +
    +#%option G_OPT_F_INPUT
    +#% key: load_training
    +#% label: Load training data from file
    +#% required: no
    +#% guisection: Optional
    +#%end
    +
     #%rules
     #% exclusive: roi,loadfile
    +#% exclusive: save_training,load_training
     #%end
     
     # import standard modules
     import atexit, random, string, re, os
    +import numpy as np
    +from subprocess import PIPE
    +
    +import grass.script as grass
     from grass.pygrass.raster import RasterRow
     from grass.pygrass.gis.region import Region
     from grass.pygrass.raster.buffer import Buffer
    -import grass.script as grass
    -import numpy as np
    +from grass.pygrass.modules.shortcuts import imagery as im
            
     def cleanup():
    -    # close the GRASS raster objects and the roi raster object
    -    for i in range(nbands): rasstack[i].close()
    -    roi_raster.close()
    -    if rfmask != '': grass.run_command("g.remove", name=rfmask, flags="f",
    -                                       type="raster")
     
    -def score_classification_results(X, y, clf, kfolds, rstate):
    -    # PURPOSE: custom function performs cross validation on a classification model,
    -    # RETURNS: a 1D list representing accuracy, AUROC, precision, recall, kappa and specificity
    +    grass.run_command("g.remove", name='clfmasktmp', flags="f", type="raster", quiet=True)
    +
    +def sample_predictors_byrow(response, predictors):
    +
    +    # create response rasterrow and open
    +    roi_raster = RasterRow(response)
    +    roi_raster.open('r')
         
    -    # lazy import of sklearn
    -    try:
    -        from sklearn import cross_validation, metrics
    -    except:
    -        grass.fatal("Scikit-learn python module (python-sklearn) is not installed.....exiting")
    +    # create a list of rasterrow objects
    +    # Then each GRASS rasterrow can be referred to by rastack[band][row]:
    +    n_features = len(predictors)
    +    rasstack = [0] * n_features
    +    for i in range(n_features):
    +        rasstack[i] = RasterRow(predictors[i])
    +        if rasstack[i].exist() == True:
    +            rasstack[i].open('r')
    +        else:
    +            grass.fatal("GRASS raster " + maplist[i] + " does not exist.... exiting")
             
    -    kf = cross_validation.KFold(len(y), n_folds=kfolds, shuffle=True, random_state=rstate)
    +    # use grass.pygrass.gis.region to get information about the current region, particularly
    +    current = Region()
     
    -    acc, auc, kappa = [], [], []
    +    # determine cell storage type of training roi raster
    +    roi_type = grass.read_command("r.info", map=response, flags='g')
    +    roi_list = str(roi_type).split(os.linesep)
    +    dtype = roi_list[9].split('=')[1]
     
    -    for train_index, test_index in kf:
    -        X_train, X_test =  X[train_index], X[test_index]
    -        y_train, y_test = y[train_index], y[test_index]
    -        fit = clf.fit(X_train, y_train)
    -        y_pred = fit.predict(X_test)
    +    # Count number of labelled pixels
    +    roi_stats = str(grass.read_command("r.univar", flags=("g"), map=response))
    +    roi_stats = roi_stats.split(os.linesep)[0]
    +    nlabel_pixels = int(str(roi_stats).split('=')[1])
     
    -        acc = np.append(acc, metrics.accuracy_score(y_test, y_pred))
    -        classes_in_fold = np.unique(y_test)
    +    # Create a zero numpy array with the dimensions of the number of columns in the region
    +    # and the number of bands plus an additional band to attach the labels
    +    tindex = 0
    +    training_labels = []
    +    training_data = np.zeros((nlabel_pixels, n_features+1))
    +    training_data[:] = np.NAN
     
    -        # check if the response variable is binary, then calculate roc_auc and set average to binary
    -        if len(np.unique(y)) == 2:
    -            statmethod = 'binary'
    -            auc = np.append(auc, metrics.roc_auc_score(y_test, y_pred))
    -        else:
    -            auc=0
    -            statmethod = 'micro'
    +    # Loop through each row of the raster
    +    for row in range(current.rows):
    +        # get the pixels from that row in the ROI raster
    +        roi_row_np = roi_raster[row]
     
    -        kappa = np.append(kappa, metrics.cohen_kappa_score(y_test, y_pred))
    -        
    -    return(acc, auc, kappa)
    +        # check if any of those pixels are labelled (not equal to nodata)
    +        # can use even if roi is FCELL because nodata will be nan and this is not returned anyway
    +        is_train = np.nonzero(roi_row_np > -2147483648)
    +        training_labels = np.append(training_labels, roi_row_np[is_train])
    +        nlabels_in_row = np.array(is_train).shape[1]
     
    -def score_regression_results(X, y, clf, kfolds, rstate):
    -    # PURPOSE: performs cross validation on a regression model
    -    # RETURNS: single value of R2
    -    
    -    try:
    -        from sklearn import cross_validation, metrics
    -    except:
    -        grass.fatal("Scikit-learn python module (python-sklearn) is not installed.....exiting") 
    -        
    -    kf = cross_validation.KFold(len(y), n_folds=kfolds, shuffle=True, random_state=rstate)
    +        # if there are any labelled pixels
    +        # loop through each imagery band for that row and put the data into the img_row_band_np array
    +        if np.isnan(roi_row_np).all() != True:
     
    -    pr = []
    +            for band in range(n_features):
    +                imagerow_np = rasstack[band][row]
     
    -    for train_index, test_index in kf:
    -        X_train, X_test =  X[train_index], X[test_index]
    -        y_train, y_test = y[train_index], y[test_index]
    -        fit = clf.fit(X_train, y_train)
    -        y_pred = fit.predict(X_test)
    -        
    -        pr = np.append(pr, metrics.r2_score(y_test, y_pred))
    +                # attach the label values onto the last column
    +                training_data[tindex : tindex+nlabels_in_row, band] = imagerow_np[is_train]
     
    -    return(pr)
    +            tindex = tindex + nlabels_in_row
     
    -def cv_performance_byClass(X, y, clf, kfolds, rstate):
    -    # PURPOSE: k-fold cross-validation performance measures by class
    -    # RETURNS: 2D list of CLASS and mean performance measure result
    -    # RETURNS: 2D list of CLASS and standard deviation of performance measure result
    -    # Performance measures are sensitivity, recall
    -    
    -    # lazy import of sklearn
    -    try:
    -        from sklearn import cross_validation, metrics
    -    except:
    -        grass.fatal("Scikit-learn python module (python-sklearn) is not installed.....exiting")
    +    # attach training label values onto last dimension of numpy array
    +    training_data[0:nlabel_pixels, n_features] = training_labels
     
    -    class_list = np.unique(y)
    -    nclasses = len(np.unique(y))
    +    # convert any CELL maps no data vals to NaN in the training data
    +    for i in range(n_features):
    +        training_data[training_data[:, i] == -2147483648] = np.nan
     
    -    kf = cross_validation.KFold(len(y), n_folds=kfolds, shuffle=True,
    -                                random_state=rstate)
    +    # Remove nan rows from training data
    +        training_data = training_data[~np.isnan(training_data).any(axis=1)]
     
    -    # Store performance measures per class
    -    recall = np.zeros((nclasses, kfolds))
    -    precision = np.zeros((nclasses, kfolds))
    +    # Split the numpy array into training_labels and training_data arrays
    +    training_labels = training_data[:, n_features]
    +    training_data = training_data[:, 0:n_features]
     
    -    classmeans = np.zeros((nclasses, 2))
    -    classstds = np.zeros((nclasses, 2))
    +    # close maps
    +    roi_raster.close()
    +    
    +    for i in range(n_features):
    +        rasstack[i].close()
    +    
    +    return(training_data, training_labels)
     
    -    # Loop through CV partitions
    -    fold=0
    -    for train_index, test_index in kf:
    -        X_train, X_test =  X[train_index], X[test_index]
    -        y_train, y_test = y[train_index], y[test_index]
    -        fit = clf.fit(X_train, y_train)
    -        y_pred = fit.predict(X_test)
    +def sample_predictors(response, predictors):
    +    
    +    # open response raster as rasterrow and read as np array
    +    if RasterRow(response).exist() == True:
    +        roi_gr = RasterRow(response)
    +        roi_gr.open('r')
    +        response_np = np.array(roi_gr)
    +    else:
    +        grass.fatal("GRASS response raster does not exist.... exiting")
     
    -        # Get performance measures by class     
    -        for cindex in range(nclasses):
    -            recall[cindex, fold] = metrics.recall_score(y_test, y_pred, labels = [class_list[cindex]], average = 'macro')
    -            precision[cindex, fold] = metrics.precision_score(y_test, y_pred, labels = [class_list[cindex]], average = 'macro')
    -        fold+= 1
    +    # check to see if all predictors exist
    +    n_features = len(predictors)
    +    
    +    for i in range(n_features):
    +        if RasterRow(predictors[i]).exist() != True:
    +            grass.fatal("GRASS raster " + predictors[i] + " does not exist.... exiting")
     
    -    for cindex in range(nclasses):
    -        classmeans[cindex, 0] = recall[cindex, :].mean()
    -        classmeans[cindex, 1] = precision[cindex, :].mean()
    +    # check if any of those pixels are labelled (not equal to nodata)
    +    # can use even if roi is FCELL because nodata will be nan and this is not returned anyway
    +    is_train = np.nonzero(response_np > -2147483648)
    +    training_labels = response_np[is_train]
    +    n_labels = np.array(is_train).shape[1]
     
    -        classstds[cindex, 0] = recall[cindex, :].std()
    -        classstds[cindex, 1] = precision[cindex,:].std()
    +    # Create a zero numpy array of len training labels and n_features+1 for y
    +    training_data = np.zeros((n_labels, n_features+1))
    +
    +    # Loop through each raster and sample pixel values at training indexes
    +    for f in range(n_features):
    +        predictor_gr = RasterRow(predictors[f])
    +        predictor_gr.open('r')
    +        feature_np = np.array(predictor_gr)
    +        training_data[0:n_labels, f] = feature_np[is_train]
    +        predictor_gr.close()
         
    -    return(classmeans, classstds)
    +    # attach training labels to last column
    +    training_data[0:n_labels, n_features] = training_labels
     
    -def main():
    -    igroup = options['igroup']
    -    roi = options['roi']
    -    output = options['output']
    -    mode = options['mode']
    -    ntrees = options['ntrees']
    -    cv = int(options['cv'])
    -    balanced = flags['b']
    -    modelonly = flags['m']
    -    class_probabilities = flags['p']
    -    rowincr = int(options['lines'])
    -    mfeatures = int(options['mfeatures'])
    -    minsplit = int(options['minsplit'])
    -    randst = int(options['randst'])
    -    model_save = options['savefile']
    -    model_load = options['loadfile']
    +    # convert any CELL maps no datavals to NaN in the training data
    +    for i in range(n_features):
    +        training_data[training_data[:, i] == -2147483648] = np.nan
     
    -    """
    -    Error checking for valid input parameters
    -    """
    -   
    -    if mfeatures == -1:
    -        mfeatures = str('auto')
    -    if mfeatures == 0:
    -        grass.fatal("mfeatures must be greater than zero, or -1 which uses the sqrt(nfeatures)...exiting")
    -        exit()
    -    if minsplit == 0:
    -        grass.fatal("minsplit must be greater than zero.....exiting")
    -        exit()
    -    if rowincr <= 0:
    -        grass.fatal("rowincr must be greater than zero....exiting")
    -        exit()
    -    if ntrees < 1:
    -        grass.fatal("ntrees must be greater than zero.....exiting")
    -        exit()
    -    if mode == 'regression' and balanced == True:
    -        grass.warning(_("balanced mode is ignored in Random Forests in regression mode....continuing"))
    -    if mode == 'regression' and class_probabilities == True:
    -        grass.warning(_("option to output class probabiltities is ignored in regression mode....continuing"))
    -    if model_save != '' and model_load != '':
    -        grass.fatal("Cannot save and load a model at the same time.....exiting")
    -    if model_load == '' and roi == '':
    -        grass.fatal("Require labelled pixels regions of interest.....exiting")
    +    # Remove nan rows from training data
    +    training_data = training_data[~np.isnan(training_data).any(axis=1)]
     
    -    """
    -    Obtain information about GRASS rasters to be classified
    -    """
    +    roi_gr.close()
    +    
    +    # return X and y data
    +    return(training_data[:, 0:n_features], training_data[:, n_features])
     
    -   # fetch individual raster names from group
    +def prediction(clf, predictors, class_probabilities, rowincr, output, mode, labels):
         
    -    groupmaps = grass.read_command("i.group", group=igroup, flags="g")
    -    maplist = groupmaps.split(os.linesep)
    -    maplist = maplist[0:len(maplist)-1]
    -
    -    # determine number of bands and then create a list of GRASS rasterrow objects
    -    global nbands
    -    nbands = len(maplist)
    -
    -    global rasstack
    -    rasstack = [0] * nbands
    -    for i in range(nbands):
    -        rasstack[i] = RasterRow(maplist[i])
    -
    -    # check to see if each raster in the list exists
    -    for i in range(nbands):
    +    class_list = np.unique(labels)
    +    nclasses = len(class_list)
    +    
    +    # create a list of rasterrow objects for predictors
    +    n_features = len(predictors)
    +    rasstack = [0] * n_features
    +    for i in range(n_features):
    +        rasstack[i] = RasterRow(predictors[i])
             if rasstack[i].exist() == True:
                 rasstack[i].open('r')
             else:
                 grass.fatal("GRASS raster " + maplist[i] + " does not exist.... exiting")
    -
    +    
         # use grass.pygrass.gis.region to get information about the current region, particularly
         current = Region()
    -
    -    # Define name of mask raster
    -    global rfmask
    -    rfmask = ''
    -
    -    # lazy import of sklearn
    -    try:
    -        from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
    -        from sklearn.externals import joblib
    -        from sklearn import cross_validation, metrics
    -        import warnings
    -        warnings.filterwarnings("ignore")
    -    except:
    -        grass.fatal("Scikit-learn python module (python-sklearn) is not installed.....exiting")
         
    -    """
    -    Sample training data using training ROI
    -    """
    -    
    -    global roi_raster
    -    roi_raster = RasterRow(roi)
    -
    -    # load the model
    -    if model_load != '':
    -        rf = joblib.load(model_load)
    -    else:
    -        # Check if ROI raster exists if model is not loaded
    -        if roi_raster.exist() == True:
    -            roi_raster.open('r')
    -        else:
    -            grass.fatal("ROI raster does not exist.... exiting")
    -            
    -        # determine cell storage type of training roi raster
    -        roi_type = grass.read_command("r.info", map=roi, flags='g')
    -        roi_list = str(roi_type).split(os.linesep)
    -        roi_type.split('\n')
    -        dtype = roi_list[9].split('=')[1]
    -
    -        # check if training rois are valid for classification and regression
    -        if mode == 'classification' and dtype != 'CELL':
    -            grass.fatal("Classification mode requires an integer CELL type training roi map.....exiting")
    -
    -        # Count number of labelled pixels
    -        roi_stats = str(grass.read_command("r.univar", flags=("g"), map=roi))
    -        roi_stats = roi_stats.split(os.linesep)[0]
    -        ncells = str(roi_stats).split('=')[1]
    -        nlabel_pixels = int(ncells)
    -
    -        # Create a zero numpy array with the dimensions of the number of columns in the region
    -        # and the number of bands plus an additional band to attach the labels
    -        tindex = 0
    -        training_labels = []
    -        training_data = np.zeros((nlabel_pixels, nbands+1))
    -        training_data[:] = np.NAN
    -
    -        # Loop through each row of the raster, get the pixels from that row in the ROI raster
    -        # and check if any of those pixels are labelled (i.e. they are not nan).
    -        # If labelled pixels are encountered, loop through each band for that row and put the data
    -        # into the img_row_band_np array. Also attach the label values onto the last column
    -
    -        for row in range(current.rows):
    -            roi_row_np = roi_raster[row]
    -            is_train = np.nonzero(roi_row_np > -2147483648)
    -            training_labels = np.append(training_labels, roi_row_np[is_train])
    -            nlabels_in_row = np.array(is_train).shape[1]
    -            if np.isnan(roi_row_np).all() != True:
    -                for band in range(nbands):
    -                    imagerow_np = rasstack[band][row]
    -                    training_data[tindex : tindex+nlabels_in_row, band] = imagerow_np[is_train]
    -                tindex = tindex + nlabels_in_row
    -
    -        # Determine the number of class labels using np.unique
    -        nclasses = len(np.unique(training_labels))
    -        class_list = np.unique(training_labels)
    -
    -        # attach training label values onto last dimension of numpy array
    -        training_data[0:nlabel_pixels, nbands] = training_labels
    -
    -        # Remove nan rows from numpy array
    -        training_data = training_data[~np.isnan(training_data).any(axis=1)]
    -
    -        # Split the numpy array into training_labels and training_data arrays
    -        training_labels = training_data[:, nbands]
    -        training_data = training_data[:, 0:nbands]
    -
    -    """
    -    Train the randomforest classifier and perform cross-validation
    -    """
    -
    -    # define classifier for classification or regression mode, and balanced or unbalanced datasets
    -    if model_load == '':
    -        if mode == 'classification':
    -            if balanced == True:
    -                rf = RandomForestClassifier(n_jobs=-1, n_estimators=int(ntrees), oob_score=True, \
    -                                            class_weight='balanced', max_features=mfeatures, min_samples_split=minsplit, \
    -                                            random_state=randst)
    -            else:
    -                rf = RandomForestClassifier(n_jobs=-1, n_estimators=int(ntrees), oob_score=True, \
    -                                            max_features=mfeatures, min_samples_split=minsplit, random_state=randst)
    -        else:
    -            rf = RandomForestRegressor(n_jobs=-1, n_estimators=int(ntrees), oob_score=False, \
    -                                       max_features=mfeatures, min_samples_split=minsplit, random_state=randst)
    -
    -        # train classifier
    -        rf = rf.fit(training_data, training_labels)
    -        
    -        # output internal performance measures
    -        grass.message(_("\r\n"))
    -        if mode == 'classification':
    -            grass.message(_('RF OOB prediction  accuracy: \t {oob}%'.format(oob=rf.oob_score_ * 100)))
    -        else:
    -            grass.message(_('Rf coefficient of determination R^2: \t {r2}%'.format \
    -                            (r2=rf.score(X=training_data, y=training_labels))))
    -       
    -        # use cross-validation
    -        if cv > 1:
    -            grass.message(_('\r\n'))
    -            grass.message(_("Cross validation global performance measures......:"))
    -        
    -            if mode == 'classification':
    -                acc, auc, kappa  = score_classification_results(training_data, training_labels, rf, cv, randst)
    -                
    -                grass.message(_("Acc:\t{mean}\t+/-2SD\t{error}".format(mean=round(acc.mean(),3), error=round(acc.std() * 2,3))))
    -                
    -                if len(np.unique(training_labels)) == 2:
    -                    grass.message(_("AUROC:\t{mean}\t+/-2SD\t{error}".format(mean=round(auc.mean(),3), error=round(auc.std() * 2,3))))
    -                
    -                grass.message(_("Kappa:\t{mean}\t+/-2SD\t{error}".format(mean=round(kappa.mean(),3), error=round(kappa.std() * 2,3))))
    -                        
    -                # calculate scores by class
    -                Cmean, Cstd = cv_performance_byClass(training_data, training_labels, rf, cv, randst)
    -    
    -                grass.message(_("\r\n"))
    -                grass.message(_("Performance measures by class......:"))
    -                grass.message(_("CLASS\tRecall\t2SD\tPrecision\t2SD"))
    -                for i in range(nclasses):
    -                    row = str(int(class_list[i])) + '\t'
    -                    for j in range(2):
    -                        row += str( round(Cmean[i,j],3) ) + '\t' +  str( round(Cstd[i,j]*2,3) ) + '\t'
    -                    grass.message(_(row))
    -                
    -            else:
    -                scores = score_regression_results(training_data, training_labels, rf, cv, randst)
    -                grass.message(_("R2:\t{mean}\t+/-\t{error}".format(mean=scores[:].mean(), error=scores[:].std() * 2)))
    -        
    -        # diagnostics
    -        rfimp = rf.feature_importances_
    -        grass.message(_("\r\n"))
    -        grass.message(_("Random forest feature importance"))
    -        grass.message(_("id" + "\t" + "Raster" + "\t" + "Importance"))
    -        for i in range(len(rfimp)):
    -             grass.message(_(str(i) + "\t" + maplist[i] + "\t" + str(rfimp[i])))
    -        
    -        # save the model
    -        if model_save != '':
    -            joblib.dump(rf, model_save + ".pkl")
    -        
    -        if modelonly == True:
    -            grass.fatal("Model built and now exiting")
    -
    -    """
    -    Prediction on the rest of the GRASS rasters in the imagery group
    -    """
    -
         # create a imagery mask
         # the input rasters might have different dimensions in terms of value and non-value pixels.
         # r.series used to automatically create a mask by propagating the null values
    -    rfmask = 'tmp_' + ''.join([random.choice(string.ascii_letters + string.digits) \
    -                               for n in xrange(8)])
    -    grass.run_command("r.series", output=rfmask, input=maplist, method='count', flags='n')
    +    clfmask = 'clfmasktmp'
    +    grass.run_command("r.series", output=clfmask, input=predictors, method='count', flags='n')
     
    -    global mask_raster
    -    mask_raster = RasterRow(rfmask)
    +    mask_raster = RasterRow(clfmask)
         mask_raster.open('r')
         
    -    """
    -    PROCEDURE
    -    1. Create a np.array that can store each raster row for all of the bands
    -    2. Loop through the raster, row-by-row and get the row values for each band
    -        adding these to the img_np_row np.array,
    -        which bundles rowincr rows together to pass to the classifier
    -    3. The scikit learn predict function expects a list of pixels, not an NxM matrix.
    -        We therefore need to reshape each row matrix into a list.
    -        The total matrix size = cols * nbands.
    -        Therefore we can use the np.reshape function to convert the image into a list
    -        with the number of rows = n_samples, and the number of columns = the number of bands.
    -    4. Then we remove any NaN values because the scikit-learn predict function cannot handle NaNs.
    -        Here we replace them with a small value using the np.nan_to_num function.
    -    5. The flat_pixels is then passed onto the prediction function.
    -    6. After the prediction is performed on the row, to save keeping
    -        anything in memory, we save it to a GRASS raster object, row-by-row.
    -    """
         # create and open RasterRow objects for classification
         classification = RasterRow(output)
         if mode == 'classification':
    @@ -535,9 +472,9 @@
             ftype = 'FCELL'
             nodata = np.nan
         classification.open('w', ftype, overwrite=True)
    -
    +    
         # create and open RasterRow objects for  probabilities if enabled
    -    if class_probabilities == True and mode == 'classification':
    +    if class_probabilities == True:
             prob_out_raster = [0] * nclasses
             prob = [0] * nclasses
             for iclass in range(nclasses):
    @@ -548,17 +485,18 @@
         """
         Prediction using row blocks
         """
    -
    +            
         for rowblock in range(0, current.rows, rowincr):
             # check that the row increment does not exceed the number of rows
    -        if rowblock+rowincr > current.rows: rowincr = current.rows - rowblock
    -        img_np_row = np.zeros((rowincr, current.cols, nbands))
    +        if rowblock+rowincr > current.rows:
    +            rowincr = current.rows - rowblock
    +        img_np_row = np.zeros((rowincr, current.cols, n_features))
             mask_np_row = np.zeros((rowincr, current.cols))
     
             # loop through each row, and each band and add these values to the 2D array img_np_row
             for row in range(rowblock, rowblock+rowincr, 1):
                 mask_np_row[row-rowblock, :] = np.array(mask_raster[row])
    -            for band in range(nbands):
    +            for band in range(n_features):
                     img_np_row[row-rowblock, :, band] = np.array(rasstack[band][row])
     
             mask_np_row[mask_np_row == -2147483648] = np.nan
    @@ -566,11 +504,11 @@
     
             # reshape each row-band matrix into a list
             nsamples = rowincr * current.cols
    -        flat_pixels = img_np_row.reshape((nsamples, nbands))
    +        flat_pixels = img_np_row.reshape((nsamples, n_features))
     
             # remove NaN values and perform the prediction
             flat_pixels = np.nan_to_num(flat_pixels)
    -        result = rf.predict(flat_pixels)
    +        result = clf.predict(flat_pixels)
             result = result.reshape((rowincr, current.cols))
     
             # replace NaN values so that the prediction surface does not have a border
    @@ -587,7 +525,7 @@
     
             # same for probabilities
             if class_probabilities == True and mode == 'classification':
    -            result_proba = rf.predict_proba(flat_pixels)
    +            result_proba = clf.predict_proba(flat_pixels)
                 for iclass in range(nclasses):
                     result_proba_class = result_proba[:, iclass]
                     result_proba_class = result_proba_class.reshape((rowincr, current.cols))
    @@ -604,6 +542,355 @@
         if class_probabilities == True and mode == 'classification':
             for iclass in range(nclasses): prob[iclass].close()
     
    +def shuffle_data(X, y, rstate):
    +
    +    from sklearn.utils import shuffle
    +
    +    # combine XY data into a single numpy array
    +    XY = np.empty((X.shape[0], X.shape[1]+1))
    +    XY[:,0] = y
    +    XY[:,1:] = X
    +    
    +    XY = shuffle(XY, random_state=rstate)
    +
    +    # split XY into train_xs and train_y
    +    X = XY[:,1:]
    +    y = XY[:,0]
    +    
    +    return(X, y)
    +
    +def save_training_data(X, y, file):
    +    # append X and y and save to csv
    +    training_data = np.zeros((y.shape[0], X.shape[1]+1))
    +    training_data[:, 0:X.shape[1]] = X
    +    training_data[:, X.shape[1]] = y
    +    np.savetxt(file, training_data, delimiter = ',')
    +
    +def load_training_data(file):
    +    training_data = np.loadtxt(file, delimiter = ',')
    +    n_features = training_data.shape[1]
    +    X = training_data[:, 0:n_features-1]
    +    y = training_data[:, n_features-1]
    +    return(X, y)
    +
    +def main():
    +    """
    +    GRASS options and flags
    +    """
    +    # General options and flags
    +    igroup = options['igroup']
    +    roi = options['roi']
    +    output = options['output']
    +    model = options['model']
    +    cv = int(options['cv'])
    +    modelonly = flags['m']
    +    class_probabilities = flags['p']
    +    rowincr = int(options['lines'])
    +    randst = int(options['randst'])
    +    model_save = options['savefile']
    +    model_load = options['loadfile']
    +    save_training = options['save_training']
    +    load_training = options['load_training']
    +    importances = flags['f']
    +    weighting = flags['b']
    +    lowmem = flags['l']
    +
    +    # logistic regression
    +    c_lr = float(options['c_lr'])
    +    fi = flags['i']
    +    
    +    # decision trees
    +    splitter_dt = options['splitter_dt']
    +    m_features_dt = int(options['m_features_dt'])
    +    min_samples_split_dt = int(options['min_samples_split_dt'])
    +    min_samples_leaf_dt = int(options['min_samples_leaf_dt'])
    +    min_weight_fraction_leaf_dt = float(options['min_weight_fraction_leaf_dt'])
    +    
    +    # random forests
    +    ntrees_rf = int(options['ntrees_rf'])
    +    m_features_rf = int(options['m_features_rf'])
    +    minsplit_rf = int(options['minsplit_rf'])
    +    
    +    # gradient tree boosting
    +    learning_rate_gtb = float(options['learning_rate_gtb'])
    +    n_estimators_gtb = int(options['n_estimators_gtb'])
    +    max_depth_gtb = int(options['max_depth_gtb'])
    +    min_samples_split_gtb = int(options['min_samples_split_gtb'])
    +    min_samples_leaf_gtb = int(options['min_samples_leaf_gtb'])
    +    min_weight_fraction_leaf_gtb = float(options['min_weight_fraction_leaf_gtb'])
    +    subsample_gtb = float(options['subsample_gtb'])
    +    max_features_gtb = int(options['max_features_gtb'])
    +    
    +    # classification or regression
    +    if model == 'LogisticRegression' \
    +    or model == 'DecisionTreeClassifier' \
    +    or model == 'RandomForestClassifier' \
    +    or model == 'GradientBoostingClassifier' \
    +    or model == 'GaussianNB' \
    +    or model == 'LinearDiscriminantAnalysis' \
    +    or model == 'QuadraticDiscriminantAnalysis':
    +
    +        mode = 'classification'
    +    else:
    +        mode = 'regression'
    +
    +    """
    +    Error checking for valid input parameters
    +    """
    +
    +    # decision trees
    +    if model == 'DecisionTreeClassifier' or model == 'DecisionTreeRegressor':
    +        if m_features_dt == -1:
    +            m_features_dt = str('auto')
    +        if m_features_dt == 0:
    +            grass.fatal("m_features_dt must be greater than zero, or -1 which uses the sqrt(nfeatures)...exiting")
    +        if min_samples_split_dt < 1:
    +            grass.fatal("min_samples_split_dt must be >=1.....exiting")
    +        if min_samples_leaf_dt < 1:
    +            grass.fatal("min_samples_leaf_dt must be >=1.....exiting")
    +
    +    # random forests
    +    if model == 'RandomForestClassifier' or model == 'RandomForestRegressor':
    +        if m_features_rf == -1:
    +            m_features_rf = str('auto')
    +        if m_features_rf == 0:
    +            grass.fatal("mfeatures must be greater than zero, or -1 which uses the sqrt(nfeatures)...exiting")
    +        if minsplit_rf < 1:
    +            grass.fatal("minsplit must be greater than zero.....exiting")
    +        if ntrees_rf < 1:
    +            grass.fatal("ntrees must be greater than zero.....exiting")
    +
    +    # gradient tree boosting
    +    if model == 'GradientBoostingClassifier' or model == 'GradientBoostingRegressor':
    +        if n_estimators_gtb < 1:
    +            grass.fatal("n_estimators_gtb must be greater than zero...exiting")
    +        if max_depth_gtb < 1:
    +            grass.fatal("max_depth_gtb must be greater than zero...exiting")
    +        if min_samples_split_gtb < 1:
    +            grass.fatal("min_samples_split_gtb must be greater than zero...exiting")
    +        if min_samples_leaf_gtb < 1:
    +            grass.fatal("min_samples_leaf_gtb must be greater than zero...exiting")
    +        if max_features_gtb == -1:
    +            max_features_gtb = str('auto')
    +        if max_features_gtb == 0:
    +            grass.fatal("max_features_gtb must be greater than zero, or -1 which uses the sqrt(nfeatures)...exiting")
    +
    +    # general options
    +    if rowincr <= 0:
    +        grass.fatal("rowincr must be greater than zero....exiting")
    +    if model_save != '' and model_load != '':
    +        grass.fatal("Cannot save and load a model at the same time.....exiting")
    +    if model_load == '' and roi == '':
    +        grass.fatal("Require labelled pixels regions of interest.....exiting")
    +    if weighting == True:
    +        weighting = 'balanced'
    +    else:
    +        weighting = None
    +
    +    """
    +    Obtain information about GRASS rasters to be classified
    +    """
    +    
    +    # fetch individual raster names from group
    +    groupmaps = im.group(group=igroup, flags="g", quiet = True, stdout_=PIPE).outputs.stdout
    +    maplist = groupmaps.split(os.linesep)
    +    maplist = maplist[0:len(maplist)-1]
    +    n_features = len(maplist)
    +
    +    # use grass.pygrass.gis.region to get information about the current region
    +    current = Region()
    +
    +    # lazy import of sklearn
    +    try:
    +        from sklearn.externals import joblib
    +        import warnings
    +        warnings.filterwarnings("ignore")
    +    except:
    +        grass.fatal("Scikit-learn python module is not installed...exiting")
    +    
    +    """
    +    Sample training data using training ROI
    +    """
    +    
    +    # load the model or training data
    +    if model_load != '':
    +        clf = joblib.load(model_load)
    +    else:
    +        if load_training != '':
    +            X, y = load_training_data(load_training)
    +        else:
    +            # query predictor rasters with training features
    +            if lowmem != True:
    +                X, y = sample_predictors(roi, maplist)
    +            else:
    +                X, y = sample_predictors_byrow(roi, maplist)
    +            
    +            # shuffle the training data
    +            X, y = shuffle_data(X, y, rstate=randst)
    +            
    +            # use GRASS option to save the training data
    +            if save_training != '': save_training_data(X, y, save_training)
    +
    +        # determine the number of class labels using np.unique
    +        nclasses = len(np.unique(y))
    +        class_list = np.unique(y)
    +    
    +    # Error checking for m_features settings
    +    if m_features_dt > n_features: m_features_dt = n_features
    +    if m_features_rf > n_features: m_features_rf = n_features
    +    if max_features_gtb > n_features: max_features_gtb = n_features
    +    
    +    """
    +    Train the classifier
    +    """
    +
    +    # define classifier unless model is to be loaded from file
    +    if model_load == '':
    +        
    +        # classifiers
    +        from sklearn.linear_model import LogisticRegression
    +        from sklearn.tree import DecisionTreeClassifier
    +        from sklearn.ensemble import RandomForestClassifier
    +        from sklearn.ensemble import GradientBoostingClassifier
    +        from sklearn.naive_bayes import GaussianNB
    +        from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
    +        from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis
    +        
    +        from sklearn.neighbors import KNeighborsRegressor
    +        from sklearn.tree import DecisionTreeRegressor
    +        from sklearn.ensemble import RandomForestRegressor
    +        from sklearn.ensemble import GradientBoostingRegressor
    +        
    +        classifiers = {
    +            'LogisticRegression': LogisticRegression(C=c_lr, fit_intercept=fi, n_jobs=-1, class_weight=weighting),
    +            'DecisionTreeClassifier': DecisionTreeClassifier(splitter=splitter_dt,
    +                                                             max_features=m_features_dt,
    +                                                             min_samples_split=min_samples_split_dt,
    +                                                             min_samples_leaf=min_samples_leaf_dt,
    +                                                             min_weight_fraction_leaf=min_weight_fraction_leaf_dt,
    +                                                             random_state=randst,
    +                                                             class_weight=weighting),
    +            'DecisionTreeRegressor': DecisionTreeRegressor(splitter=splitter_dt,
    +                                                           max_features=m_features_dt,
    +                                                           min_samples_split=min_samples_split_dt,
    +                                                           min_samples_leaf=min_samples_leaf_dt,
    +                                                           min_weight_fraction_leaf=min_weight_fraction_leaf_dt,
    +                                                           random_state=randst),
    +            'RandomForestClassifier': RandomForestClassifier(n_estimators=ntrees_rf,
    +                                                             oob_score=True,
    +                                                             max_features=m_features_rf,
    +                                                             min_samples_split=minsplit_rf,
    +                                                             random_state=randst,
    +                                                             n_jobs=-1,
    +                                                             class_weight=weighting),
    +            'RandomForestRegressor': RandomForestRegressor(n_jobs=-1,
    +                                                           n_estimators=ntrees_rf,
    +                                                           oob_score=False,
    +                                                           max_features=m_features_rf,
    +                                                           min_samples_split=minsplit_rf,
    +                                                           random_state=randst),
    +            'GradientBoostingClassifier': GradientBoostingClassifier(learning_rate=learning_rate_gtb,
    +                                                                     n_estimators=n_estimators_gtb,
    +                                                                     max_depth=max_depth_gtb,
    +                                                                     min_samples_split=min_samples_split_gtb,
    +                                                                     min_samples_leaf=min_samples_leaf_gtb,
    +                                                                     min_weight_fraction_leaf=min_weight_fraction_leaf_gtb,
    +                                                                     subsample=subsample_gtb,
    +                                                                     max_features=max_features_gtb,
    +                                                                     random_state=randst),
    +            'GradientBoostingRegressor': GradientBoostingRegressor(learning_rate=learning_rate_gtb,
    +                                                                   n_estimators=n_estimators_gtb,
    +                                                                   max_depth=max_depth_gtb,
    +                                                                   min_samples_split=min_samples_split_gtb,
    +                                                                   min_samples_leaf=min_samples_leaf_gtb,
    +                                                                   min_weight_fraction_leaf=min_weight_fraction_leaf_gtb,
    +                                                                   subsample=subsample_gtb,
    +                                                                   max_features=max_features_gtb,
    +                                                                   random_state=randst),
    +            'GaussianNB': GaussianNB(),
    +            'LinearDiscriminantAnalysis': LinearDiscriminantAnalysis(),
    +            'QuadraticDiscriminantAnalysis': QuadraticDiscriminantAnalysis(),
    +        }
    +        
    +        # define classifier
    +        clf = classifiers[model]
    +        
    +        # train classifier
    +        clf.fit(X, y)
    +        grass.message(_("Model built with: " + model))
    +        
    +        """
    +        Cross Validation
    +        """
    +
    +        # output internal performance measures for random forests
    +        if model == 'RandomForestClassifier':
    +            grass.message(_("\r\n"))
    +            grass.message(_('RF OOB prediction  accuracy: \t %0.3f' %
    +                            (clf.oob_score_ * 100)))
    +        if model == 'RandomForestRegressor':
    +            grass.message(_("\r\n"))
    +            grass.message(_('Coefficient of determination R^2: \t %0.3f' %
    +                         (clf.score(X=training_data, y=training_labels))))
    +       
    +        # If cv > 1 then use cross-validation to generate performance measures
    +        if cv > 1:
    +            from sklearn.cross_validation import cross_val_score
    +            from sklearn.metrics import classification_report
    +            from sklearn.cross_validation import cross_val_predict
    +
    +            grass.message(_('\r\n'))
    +            grass.message(_("Cross validation global performance measures......:"))
    +
    +            if mode == 'classification':
    +                accuracy = cross_val_score(clf, X, y, scoring='accuracy', cv=cv, n_jobs=-1)
    +                grass.message(_("Accuracy   :\t%0.2f\t+/-2SD\t%0.2f" %(accuracy.mean(), accuracy.std() * 2)))
    +                if len(np.unique(y)) == 2:
    +                    auc = cross_val_score(clf, X, y, cv=cv, scoring='roc_auc', n_jobs=-1)
    +                    grass.message(_("ROC AUC    :\t%0.2f\t+/-2SD\t%0.2f" % (auc.mean(), auc.std() * 2)))
    +                
    +                # calculate scores by class using classification report
    +                y_pred = cross_val_predict(clf, X, y, cv=cv, n_jobs=-1)
    +                grass.message(_("\n"))
    +                grass.message(_("Classification report:"))
    +                grass.message(_(classification_report(y, y_pred)))
    +                
    +            else:
    +                r2 = cross_val_score(clf, X, y, cv=cv, scoring='r2', n_jobs=-1)
    +                grass.message(_("R2:\t%0.2f\t+/-\t%0.2f" % (r2.mean(), r2.std() * 2)))
    +                
    +
    +        # diagnostics
    +        if importances == True:
    +            if (model == 'RandomForestClassifier' or 
    +                model == 'GradientBoostingClassifier' or
    +                model == 'RandomForestRegressor' or
    +                model == 'GradientBoostingRegressor' or
    +                model == 'DecisionTreeClassifier' or
    +                model == 'DecisionTreeRegressor'):
    +                    
    +                    clfimp = clf.feature_importances_
    +                    grass.message(_("\r\n"))
    +                    grass.message(_("Feature importances"))
    +                    grass.message(_("id" + "\t" + "Raster" + "\t" + "Importance"))
    +                    
    +                    for i in range(len(clfimp)):
    +                         grass.message(_(str(i) + "\t" + maplist[i] + "\t" + str(round(clfimp[i], 4))))
    +        
    +        # save the model
    +        if model_save != '':
    +            joblib.dump(clf, model_save + ".pkl")
    +        
    +        if modelonly == True:
    +            grass.fatal("Model built and now exiting")
    +
    +    """
    +    Prediction on the rest of the GRASS rasters in the imagery group
    +    """
    +    
    +    prediction(clf, maplist, class_probabilities, rowincr, output, mode, y)
    +    
    +
     if __name__ == "__main__":
         options, flags = grass.parser()
         atexit.register(cleanup)
    
    
    From svn_grass at osgeo.org  Mon Oct  3 14:53:14 2016
    From: svn_grass at osgeo.org (svn_grass at osgeo.org)
    Date: Mon,  3 Oct 2016 14:53:14 -0700
    Subject: [GRASS-SVN] r69661 - grass-addons/grass7/raster/r.randomforest
    Message-ID: <20161003215314.E73643903C2@trac.osgeo.org>
    
    Author: spawley
    Date: 2016-10-03 14:53:14 -0700 (Mon, 03 Oct 2016)
    New Revision: 69661
    
    Modified:
       grass-addons/grass7/raster/r.randomforest/r.randomforest.html
    Log:
    Major update to the r.randomforest addon. Several other classifiers have been included. Also bug fixes to the ROC_AUC options which previously was just displaying classification accuracy
    
    Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.html
    ===================================================================
    --- grass-addons/grass7/raster/r.randomforest/r.randomforest.html	2016-10-03 21:51:25 UTC (rev 69660)
    +++ grass-addons/grass7/raster/r.randomforest/r.randomforest.html	2016-10-03 21:53:14 UTC (rev 69661)
    @@ -1,6 +1,6 @@
     

    DESCRIPTION

    -r.randomforest represents a front-end to the scikit learn machine learning python package for the purpose of performing classification and regression on a suite of predictors within a GRASS imagery group. The module also provides access random forest classification, and several other classifiers that are commonly used in remote sensing and spatial modelling. For more information concerning the details of any of the algorithms, consult the scikit-learn documentation directly. The choice of classifier is set using the model parameter. +r.randomforest represents a front-end to the scikit learn machine learning python package for the purpose of performing classification and regression on a suite of predictors within a GRASS imagery group. The module also provides access random forest classification, and several other classifiers that are commonly used in remote sensing and spatial modelling. For more information concerning the details of any of the algorithms, consult the scikit-learn documentation directly. The choice of classifier is set using the model parameter.

    The RandomForestsClassifier and RandomForestsRegressor (Breiman, 2001) options represent ensemble classification and regression tree methods, respectively. These methods construct a forest of uncorrelated decision trees based on a random subset of predictor variables, which occurs independently at every node split in each tree. Each tree produces a prediction probability, and the final classification result is obtained by averaging of the prediction probabilities across all of the trees. Random forests require relatively few user-specified parameter choices, principally consisting of the number of trees in the forest (ntrees_rf), and the number of variables that are allowed to be chosen from at each node split (m_features_rf), which controls the degree of correlation between the trees. Random forests also includes built-in accuracy assessment, termed the 'out-of-bag' (OOB) error. This is computed through bagging, where 33% of the training data are held-out duri ng the construction of each tree, and then OOB data are used to evaluate the prediction accuracy. From svn_grass at osgeo.org Mon Oct 3 14:57:57 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 14:57:57 -0700 Subject: [GRASS-SVN] r69662 - grass-addons/grass7/raster/r.randomforest Message-ID: <20161003215757.EDE443903C2@trac.osgeo.org> Author: spawley Date: 2016-10-03 14:57:57 -0700 (Mon, 03 Oct 2016) New Revision: 69662 Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.py Log: Major update to the r.randomforest addon. Several other classifiers have been included. Also bug fixes to the ROC_AUC options which previously was just displaying classification accuracy Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.py =================================================================== --- grass-addons/grass7/raster/r.randomforest/r.randomforest.py 2016-10-03 21:53:14 UTC (rev 69661) +++ grass-addons/grass7/raster/r.randomforest/r.randomforest.py 2016-10-03 21:57:57 UTC (rev 69662) @@ -831,7 +831,7 @@ if model == 'RandomForestRegressor': grass.message(_("\r\n")) grass.message(_('Coefficient of determination R^2: \t %0.3f' % - (clf.score(X=training_data, y=training_labels)))) + (clf.score(X, y)))) # If cv > 1 then use cross-validation to generate performance measures if cv > 1: From svn_grass at osgeo.org Mon Oct 3 14:58:49 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 14:58:49 -0700 Subject: [GRASS-SVN] r69663 - grass/trunk/raster/r.stream.extract Message-ID: <20161003215850.0253039029E@trac.osgeo.org> Author: neteler Date: 2016-10-03 14:58:49 -0700 (Mon, 03 Oct 2016) New Revision: 69663 Added: grass/trunk/raster/r.stream.extract/r_stream_extract_streams_weighed.png Modified: grass/trunk/raster/r.stream.extract/r.stream.extract.html Log: r.stream.extract manual: screenshot added Modified: grass/trunk/raster/r.stream.extract/r.stream.extract.html =================================================================== --- grass/trunk/raster/r.stream.extract/r.stream.extract.html 2016-10-03 21:57:57 UTC (rev 69662) +++ grass/trunk/raster/r.stream.extract/r.stream.extract.html 2016-10-03 21:58:49 UTC (rev 69663) @@ -93,6 +93,12 @@ adjustment or weighing should not convert valid accumulation values to NULL (nodata) values. +

    +In case of getting the error message +ERROR: Accumulation raster map is NULL but elevation map is not NULL +the computational region must be carefully adjusted to exclude NULL pixels +in the accumulation raster map prior to stream extraction. +

    Weighed flow accumulation

    Flow accumulation can be calculated first, e.g. with @@ -206,17 +212,17 @@ Compare them and proceed if the weighed accumulation map makes sense.
    +# extract streams using the original accumulation map
    +r.stream.extract elevation=elev_ned_30m at PERMANENT \
    +                 accumulation=elev_ned_30m.acc \
    +		 threshold=1000 \
    +		 stream_rast=elev_ned_30m.streams.noweight
    +
     # extract streams from weighed map
     r.stream.extract elevation=elev_ned_30m at PERMANENT \
                      accumulation=elev_ned_30m.acc.weighed \
     		 threshold=1000 \
     		 stream_rast=elev_ned_30m.streams
    -
    -# extract streams using the original accumulation map
    -r.stream.extract elevation=elev_ned_30m at PERMANENT \
    -                 accumulation=elev_ned_30m.acc \
    -		 threshold=1000 \
    -		 stream_rast=elev_ned_30m.streams.noweight
     

    @@ -229,14 +235,12 @@
    Extracted streams from original flow accumulation map - +

    REFERENCES

      Added: grass/trunk/raster/r.stream.extract/r_stream_extract_streams_weighed.png =================================================================== (Binary files differ) Property changes on: grass/trunk/raster/r.stream.extract/r_stream_extract_streams_weighed.png ___________________________________________________________________ Added: svn:mime-type + image/png From svn_grass at osgeo.org Mon Oct 3 14:59:37 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 14:59:37 -0700 Subject: [GRASS-SVN] r69664 - grass/branches/releasebranch_7_2/raster/r.stream.extract Message-ID: <20161003215937.C981939029E@trac.osgeo.org> Author: neteler Date: 2016-10-03 14:59:37 -0700 (Mon, 03 Oct 2016) New Revision: 69664 Added: grass/branches/releasebranch_7_2/raster/r.stream.extract/r_stream_extract_streams_weighed.png Modified: grass/branches/releasebranch_7_2/raster/r.stream.extract/r.stream.extract.html Log: r.stream.extract manual: screenshot added (trunk r69663) Modified: grass/branches/releasebranch_7_2/raster/r.stream.extract/r.stream.extract.html =================================================================== --- grass/branches/releasebranch_7_2/raster/r.stream.extract/r.stream.extract.html 2016-10-03 21:58:49 UTC (rev 69663) +++ grass/branches/releasebranch_7_2/raster/r.stream.extract/r.stream.extract.html 2016-10-03 21:59:37 UTC (rev 69664) @@ -93,6 +93,12 @@ adjustment or weighing should not convert valid accumulation values to NULL (nodata) values. +

      +In case of getting the error message +ERROR: Accumulation raster map is NULL but elevation map is not NULL +the computational region must be carefully adjusted to exclude NULL pixels +in the accumulation raster map prior to stream extraction. +

      Weighed flow accumulation

      Flow accumulation can be calculated first, e.g. with @@ -206,17 +212,17 @@ Compare them and proceed if the weighed accumulation map makes sense.
      +# extract streams using the original accumulation map
      +r.stream.extract elevation=elev_ned_30m at PERMANENT \
      +                 accumulation=elev_ned_30m.acc \
      +		 threshold=1000 \
      +		 stream_rast=elev_ned_30m.streams.noweight
      +
       # extract streams from weighed map
       r.stream.extract elevation=elev_ned_30m at PERMANENT \
                        accumulation=elev_ned_30m.acc.weighed \
       		 threshold=1000 \
       		 stream_rast=elev_ned_30m.streams
      -
      -# extract streams using the original accumulation map
      -r.stream.extract elevation=elev_ned_30m at PERMANENT \
      -                 accumulation=elev_ned_30m.acc \
      -		 threshold=1000 \
      -		 stream_rast=elev_ned_30m.streams.noweight
       

      @@ -229,14 +235,12 @@
      Extracted streams from original flow accumulation map - +

      REFERENCES

        Copied: grass/branches/releasebranch_7_2/raster/r.stream.extract/r_stream_extract_streams_weighed.png (from rev 69663, grass/trunk/raster/r.stream.extract/r_stream_extract_streams_weighed.png) =================================================================== (Binary files differ) From svn_grass at osgeo.org Mon Oct 3 16:06:40 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 16:06:40 -0700 Subject: [GRASS-SVN] r69665 - grass/trunk/display/d.linegraph Message-ID: <20161003230640.941023903C2@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-03 16:06:40 -0700 (Mon, 03 Oct 2016) New Revision: 69665 Modified: grass/trunk/display/d.linegraph/main.c Log: d.linegraph: specify width for the lines Modified: grass/trunk/display/d.linegraph/main.c =================================================================== --- grass/trunk/display/d.linegraph/main.c 2016-10-03 21:59:37 UTC (rev 69664) +++ grass/trunk/display/d.linegraph/main.c 2016-10-03 23:06:40 UTC (rev 69665) @@ -87,6 +87,7 @@ int num_pnts; /* number of lines in file */ int color; /* color to use for y lines */ int r, g, b; + double width; float max; /* maximum value in file */ float min; /* minimum value in file */ float value; /* current value read in */ @@ -114,6 +115,7 @@ struct Option *dir_opt, *x_opt, *y_opt; struct Option *y_color_opt; struct Option *color_table_opt; + struct Option *line_width_opt; struct Option *title[3]; struct Option *t_color_opt; struct Option *y_min, *y_max; @@ -164,6 +166,13 @@ color_table_opt->key = "color_table"; color_table_opt->guisection = _("Define"); + line_width_opt = G_define_option(); + line_width_opt->key = "width"; + line_width_opt->description = _("Width of the lines"); + line_width_opt->type = TYPE_INTEGER; + line_width_opt->required = NO; + line_width_opt->multiple = YES; + t_color_opt = G_define_option(); t_color_opt->key = "title_color"; t_color_opt->description = _("Color for axis, tics, numbers, and title"); @@ -310,12 +319,37 @@ } } + if (line_width_opt->answer) { + i = 0; + while (line_width_opt->answers[i]) { + if (i + 1 > num_y_files) + G_fatal_error(_("Number of widths (%d) is higher then" + " the number of files (%d)"), i + 1, num_y_files); + /* TODO: remove indexing from 1 in the whole file */ + in[i + 1].width = atof(line_width_opt->answers[i]); + i++; + } + if (i == 1) { + for (j = 1; j <= num_y_files; j++) { + in[j].width = atof(line_width_opt->answer); + } + } + else if (num_y_files != i) + G_fatal_error(_("Number of widths (%d) is lower then" + " the number of files (%d)"), i, num_y_files); + } + /* get coordinates of current screen window, in pixels */ D_open_driver(); D_setup_unity(0); D_get_src(&t, &b, &l, &r); + /* this seems to be the width when none set */ + double default_width = 2; + + D_line_width(default_width); + /* create axis lines, to be drawn later */ height = b - t; width = r - l; @@ -452,6 +486,8 @@ D_RGB_color(in[i].r, in[i].g, in[i].b); else D_use_color(in[i].color); + if (line_width_opt->answer) + D_line_width(in[i].width); /* find out position of where Y should be drawn. */ /* if our minimum value of y is not negative, this is easy */ @@ -486,6 +522,9 @@ /* draw x-axis tic-marks and numbers */ + /* default width for the tics */ + D_line_width(default_width); + if (rem((long int)in[0].value, tic_every) == 0.0) { /* draw a numbered tic-mark */ @@ -530,6 +569,9 @@ } } + /* reset so the following doesn't use the special width */ + D_line_width(default_width); + /* close all input files */ for (i = 0; i <= num_y_files; i++) { fclose(in[i].fp); From svn_grass at osgeo.org Mon Oct 3 16:14:30 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 16:14:30 -0700 Subject: [GRASS-SVN] r69666 - grass/trunk/display/d.linegraph Message-ID: <20161003231430.1DAC03903C2@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-03 16:14:30 -0700 (Mon, 03 Oct 2016) New Revision: 69666 Modified: grass/trunk/display/d.linegraph/main.c Log: d.linegraph: color count check was off by one Modified: grass/trunk/display/d.linegraph/main.c =================================================================== --- grass/trunk/display/d.linegraph/main.c 2016-10-03 23:06:40 UTC (rev 69665) +++ grass/trunk/display/d.linegraph/main.c 2016-10-03 23:14:30 UTC (rev 69666) @@ -283,10 +283,11 @@ color_name[c++] = y_color_opt->answer[i]; } } - /* this is lame. I could come up with a color or prompt for one or something */ - if (j < num_y_files) - G_fatal_error(_("Only <%d> colors given for <%d> lines"), j, - num_y_files); + /* in theory we could repeat the colors but that may seem random */ + /* TODO: repeat the colors if only one provided (as with width) */ + if (j - 1 < num_y_files) + G_fatal_error(_("Only <%d> colors given for <%d> lines"), + j - 1, num_y_files); } else if (color_table_opt->answer) { struct Colors colors; @@ -322,6 +323,7 @@ if (line_width_opt->answer) { i = 0; while (line_width_opt->answers[i]) { + /* we could relax this and just stop/warn reading as with the colors */ if (i + 1 > num_y_files) G_fatal_error(_("Number of widths (%d) is higher then" " the number of files (%d)"), i + 1, num_y_files); From svn_grass at osgeo.org Mon Oct 3 16:28:49 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 16:28:49 -0700 Subject: [GRASS-SVN] r69667 - grass/trunk/display/d.linegraph Message-ID: <20161003232849.28AF93903C2@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-03 16:28:48 -0700 (Mon, 03 Oct 2016) New Revision: 69667 Modified: grass/trunk/display/d.linegraph/main.c Log: d.linegraph: fix bad allocation in r69621 and GCC -Wshadow Modified: grass/trunk/display/d.linegraph/main.c =================================================================== --- grass/trunk/display/d.linegraph/main.c 2016-10-03 23:14:30 UTC (rev 69666) +++ grass/trunk/display/d.linegraph/main.c 2016-10-03 23:28:48 UTC (rev 69667) @@ -291,25 +291,29 @@ } else if (color_table_opt->answer) { struct Colors colors; + Rast_init_colors(&colors); Rast_make_colors(&colors, color_table_opt->answer, 1, num_y_files); - int* values = G_malloc(sizeof(int)); - unsigned char* r = G_malloc(sizeof(unsigned char)); - unsigned char* g = G_malloc(sizeof(unsigned char)); - unsigned char* b = G_malloc(sizeof(unsigned char)); - unsigned char* set = G_malloc(sizeof(unsigned char)); + + int* values = G_malloc(num_y_files * sizeof(int)); + unsigned char* rbuf = G_malloc(num_y_files * sizeof(unsigned char)); + unsigned char* gbuf = G_malloc(num_y_files * sizeof(unsigned char)); + unsigned char* bbuf = G_malloc(num_y_files * sizeof(unsigned char)); + unsigned char* set = G_malloc(num_y_files * sizeof(unsigned char)); + for (i = 0; i < num_y_files; i++) values[i] = i + 1; - Rast_lookup_c_colors(values, r, g, b, set, num_y_files, &colors); + Rast_lookup_c_colors(values, rbuf, gbuf, bbuf, set, num_y_files, &colors); + /* no need to check 'set' because we generated the range */ for (i = 0; i < num_y_files; i++) { /* the in list is indexed from 1 */ - in[i + 1].r = r[i]; - in[i + 1].g = g[i]; - in[i + 1].b = b[i]; + in[i + 1].r = rbuf[i]; + in[i + 1].g = gbuf[i]; + in[i + 1].b = bbuf[i]; } - G_free(r); - G_free(g); - G_free(b); + G_free(rbuf); + G_free(gbuf); + G_free(bbuf); G_free(set); } else From svn_grass at osgeo.org Mon Oct 3 16:39:22 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 16:39:22 -0700 Subject: [GRASS-SVN] r69668 - grass/trunk/display/d.linegraph Message-ID: <20161003233922.DBB4A3903C2@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-03 16:39:22 -0700 (Mon, 03 Oct 2016) New Revision: 69668 Modified: grass/trunk/display/d.linegraph/main.c Log: d.linegraph: do not draw from 0,0 There is no data at 0,0 (xoffset,yoffset), so there is no reason to draw the a from there. We start with the first actual data point. Modified: grass/trunk/display/d.linegraph/main.c =================================================================== --- grass/trunk/display/d.linegraph/main.c 2016-10-03 23:28:48 UTC (rev 69667) +++ grass/trunk/display/d.linegraph/main.c 2016-10-03 23:39:22 UTC (rev 69668) @@ -516,11 +516,9 @@ } new_x = xoffset + (line * xscale); - if (line == 0) { - prev_x = xoffset; - prev_y[i] = yoffset; - } - D_line_abs(prev_x, prev_y[i], new_x, new_y[i]); + /* draw only when we the previous point to start from */ + if (line > 0) + D_line_abs(prev_x, prev_y[i], new_x, new_y[i]); prev_y[i] = new_y[i]; } } From svn_grass at osgeo.org Mon Oct 3 16:50:16 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 16:50:16 -0700 Subject: [GRASS-SVN] r69669 - grass/trunk/display/d.linegraph Message-ID: <20161003235016.7D1CF3903C2@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-03 16:50:16 -0700 (Mon, 03 Oct 2016) New Revision: 69669 Modified: grass/trunk/display/d.linegraph/d.linegraph.html grass/trunk/display/d.linegraph/main.c Log: d.linegraph: fix typo in r69648 and include todos Modified: grass/trunk/display/d.linegraph/d.linegraph.html =================================================================== --- grass/trunk/display/d.linegraph/d.linegraph.html 2016-10-03 23:39:22 UTC (rev 69668) +++ grass/trunk/display/d.linegraph/d.linegraph.html 2016-10-03 23:50:16 UTC (rev 69669) @@ -23,7 +23,7 @@

        File inputs

        If the directory option is provided, the paths to files can (and -should) be only relative paths to these files. WHile this is not recommended +should) be only relative paths to these files. While this is not recommended for scripting, it can be advantageous when typing the paths manually. For example when all files are stored in the directory /home/john/data, the user can provide the following in the command @@ -98,7 +98,7 @@

        The way the program locates and labels tic marks is less than perfect:
        -1) although distances between Y tics is proportional to the value, they are +1) although distances between Y tics are proportional to the value, they are not proportional on the X axis;
        2) decimal values between -1 and 1 can be printed on the X axis, but not Modified: grass/trunk/display/d.linegraph/main.c =================================================================== --- grass/trunk/display/d.linegraph/main.c 2016-10-03 23:39:22 UTC (rev 69668) +++ grass/trunk/display/d.linegraph/main.c 2016-10-03 23:50:16 UTC (rev 69669) @@ -217,6 +217,7 @@ if (G_parser(argc, argv)) exit(EXIT_FAILURE); + /* TODO: put this to variables, and avoid -Wsign-compare */ for (i = 0; i < 3; i++) { for (j = 0; j < strlen(title[i]->answer); j++) if (title[i]->answer[j] == '_') @@ -263,6 +264,7 @@ title_color = D_translate_color(t_color_opt->answer); + /* TODO: use parser for the following and avoid -Wsign-compare */ /* I had an argument with the parser, and couldn't get a neat list of the input colors as I thought I should. I did a quick hack to get my list from the answer var, which gives us the colors input From svn_grass at osgeo.org Mon Oct 3 17:25:50 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 17:25:50 -0700 Subject: [GRASS-SVN] r69670 - grass/trunk/display/d.linegraph Message-ID: <20161004002550.AA2DA39029E@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-03 17:25:50 -0700 (Mon, 03 Oct 2016) New Revision: 69670 Modified: grass/trunk/display/d.linegraph/main.c Log: d.linegraph: merge y min max options from r69614 to range to follow d.legend and others Modified: grass/trunk/display/d.linegraph/main.c =================================================================== --- grass/trunk/display/d.linegraph/main.c 2016-10-03 23:50:16 UTC (rev 69669) +++ grass/trunk/display/d.linegraph/main.c 2016-10-04 00:25:50 UTC (rev 69670) @@ -7,6 +7,8 @@ * Roberto Flor , Bernhard Reiter , * Huidae Cho , Glynn Clements , * Hamish Bowman + * Vaclav Petras (various features) + * * PURPOSE: * COPYRIGHT: (C) 1999-2016 by the GRASS Development Team * @@ -118,7 +120,7 @@ struct Option *line_width_opt; struct Option *title[3]; struct Option *t_color_opt; - struct Option *y_min, *y_max; + struct Option *y_range_opt; /* Initialize the GIS calls */ G_gisinit(argv[0]); @@ -202,18 +204,13 @@ title[2]->required = NO; title[2]->answer = ""; - y_min = G_define_option(); - y_min->key = "y_min"; - y_min->description = _("Minimum value for Y axis"); - y_min->type = TYPE_DOUBLE; - y_min->required = NO; + y_range_opt = G_define_option(); + y_range_opt->key = "y_range"; + y_range_opt->description = _("Minimum and maximun value for Y axis (min,max)"); + y_range_opt->type = TYPE_DOUBLE; + y_range_opt->key_desc = "min,max"; + y_range_opt->required = NO; - y_max = G_define_option(); - y_max->key = "y_max"; - y_max->description = _("Maximum value for Y axis"); - y_max->type = TYPE_DOUBLE; - y_max->required = NO; - if (G_parser(argc, argv)) exit(EXIT_FAILURE); @@ -410,11 +407,20 @@ } } - if (y_min->answer) - min_y = atof(y_min->answer); - if (y_max->answer) - max_y = atof(y_max->answer); + /* parse and set y min max */ + if (y_range_opt->answer != NULL) { + /* all checks should be done by the parser */ + sscanf(y_range_opt->answers[0], "%f", &min_y); + sscanf(y_range_opt->answers[1], "%f", &max_y); + if (min_y > max_y) { + /* swap values to tolerate some errors */ + double d_tmp = max_y; + max_y = min_y; + min_y = d_tmp; + } + } + /* close all files */ for (i = 0; i <= num_y_files; i++) From svn_grass at osgeo.org Mon Oct 3 22:01:52 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 3 Oct 2016 22:01:52 -0700 Subject: [GRASS-SVN] r69671 - grass-addons/grass7/raster/r.randomforest Message-ID: <20161004050152.C57ED3903C2@trac.osgeo.org> Author: spawley Date: 2016-10-03 22:01:52 -0700 (Mon, 03 Oct 2016) New Revision: 69671 Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.html grass-addons/grass7/raster/r.randomforest/r.randomforest.py Log: Enhanced accuracy metrics Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.html =================================================================== --- grass-addons/grass7/raster/r.randomforest/r.randomforest.html 2016-10-04 00:25:50 UTC (rev 69670) +++ grass-addons/grass7/raster/r.randomforest/r.randomforest.html 2016-10-04 05:01:52 UTC (rev 69671) @@ -16,6 +16,8 @@

        The tree-based classifiers include a measure of variable importance based on the Gini impurity criterion, which measures how each variable contributes to the homogeneity of the nodes, with important variables causing a larger decrease in the Gini coefficient in successive node splits. This variable importance allows the contributions of the individual predictors to be determined. The feature importance scores are displayed in the command output. +

        Cross validation can be performed by setting the cv parameters to > 1. Cross-validation is performed using stratified kfolds, and multiple global and per-class accuracy measures are produced, consisting of accuracy, kappa, precision, recall, f1 measure, and if the response variable is binary (0,1), area under the receiver operating curve (auc). Note in a multiclass classification, the global precision, recall and f1 measures represent a weighted average of the per-class metrics (weighted by number of samples per class). Also note that this cross-validation is performed on a pixel basis. If there is a strong autocorrelation between pixels (i.e. the pixels represent polygons) then the training/test splits will not represent independent samples and will overestimate the accuracy. In this case you should train/split manually and use i.kappa. +

        Most machine learning algorithms do not perform well in the case of a large class imbalance. In this case, the classifier will seek to reduce the overall model error, but this will occur by predicting the majority class with a very high accuracy, but at the expense of the minority class. If you have a highly imbalanced dataset, the 'balanced' b flag can be set. The scikit-learn implementation balanced mode then automatically adjust weights inversely proportional to class frequencies. This only applies to the LogisticRegression, DecisionTree, RandomForest, and GradientBoostingClassifiers.

        The module also offers the ability to save and load a classification or regression model. The model is saved as a list of filenames (starting with the extension .pkl which is added automatically) for each numpy array. This list can involve a large number of files, so it makes sense to save each model in a separate directory. To load the model, you need to select the .pkl file that was saved. Saving and loading a model represents a useful feature because it allows a model to be built on one imagery group (ie. set of predictor variables), and then the prediction can be performed on other imagery groups. This approach is commonly employed in species prediction modelling, or landslide susceptibility modelling, where a classification or regression model is built with one set of predictors (e.g. which include present-day climatic variables) and then predictions can be performed on other imagery groups containing forecasted climatic variables. Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.py =================================================================== --- grass-addons/grass7/raster/r.randomforest/r.randomforest.py 2016-10-04 00:25:50 UTC (rev 69670) +++ grass-addons/grass7/raster/r.randomforest/r.randomforest.py 2016-10-04 05:01:52 UTC (rev 69671) @@ -559,6 +559,69 @@ return(X, y) +def cross_val_classification(clf, X, y, cv, rstate): + # custom function to calculate classification metrics + # eliminated need to calculate each metric separately using cross_val_score function + # returns: a 1D list of accuracy, kappa and auc scores + # returns: mean precision/recall and std precision/recall per class + + from sklearn import cross_validation, metrics + + class_list = np.unique(y) + nclasses = len(np.unique(y)) + + # Store performance measures per class + byclass_metrics = { + 'precision': np.zeros((nclasses, cv)), + 'recall': np.zeros((nclasses, cv)), + 'f1': np.zeros((nclasses, cv)) + } + + # generate Kfold indices + k_fold = cross_validation.StratifiedKFold(y, n_folds=cv, shuffle=False, random_state=rstate) + + # dictionary of lists to store metrics + cmstats = { + 'accuracy': [], + 'precision': [], + 'recall': [], + 'f1': [], + 'kappa': [], + 'auc': [] + } + + # loop through each fold + fold=0 + for train_indices, test_indices in k_fold: + + X_train, X_test = X[train_indices], X[test_indices] + y_train, y_test = y[train_indices], y[test_indices] + + # fit the model on the training data and predict the test data + fit = clf.fit(X_train, y_train) + y_pred = fit.predict(X_test) + + # calculate metrics + cmstats['accuracy'] = np.append(cmstats['accuracy'], metrics.accuracy_score(y_test, y_pred)) + cmstats['precision'] = np.append(cmstats['precision'], metrics.precision_score(y_test, y_pred, average='weighted')) + cmstats['recall'] = np.append(cmstats['recall'], metrics.recall_score(y_test, y_pred, average='weighted')) + cmstats['f1'] = np.append(cmstats['f1'], metrics.f1_score(y_test, y_pred, average='weighted')) + cmstats['kappa'] = np.append(cmstats['kappa'], metrics.cohen_kappa_score(y_test, y_pred)) + + # test for if binary and classes equal 0,1 + if len(np.unique(y)) == 2 and all ([0,1] == np.unique(y)): + y_pred_proba = fit.predict_proba(X_test)[:,1] + cmstats['auc'] = np.append(cmstats['auc'], metrics.roc_auc_score(y_test, y_pred_proba)) + + # Get performance measures by class + for cindex in range(nclasses): + byclass_metrics['recall'][cindex, fold] = metrics.recall_score(y_test, y_pred, labels = [class_list[cindex]], pos_label=class_list[cindex]) + byclass_metrics['precision'][cindex, fold] = metrics.precision_score(y_test, y_pred, labels = [class_list[cindex]], pos_label=class_list[cindex]) + byclass_metrics['f1'][cindex, fold] = metrics.f1_score(y_test, y_pred, labels = [class_list[cindex]], pos_label=class_list[cindex]) + fold+=1 + + return(cmstats, byclass_metrics) + def save_training_data(X, y, file): # append X and y and save to csv training_data = np.zeros((y.shape[0], X.shape[1]+1)) @@ -831,30 +894,49 @@ if model == 'RandomForestRegressor': grass.message(_("\r\n")) grass.message(_('Coefficient of determination R^2: \t %0.3f' % - (clf.score(X, y)))) + (clf.score(X=training_data, y=training_labels)))) # If cv > 1 then use cross-validation to generate performance measures if cv > 1: - from sklearn.cross_validation import cross_val_score - from sklearn.metrics import classification_report from sklearn.cross_validation import cross_val_predict grass.message(_('\r\n')) grass.message(_("Cross validation global performance measures......:")) if mode == 'classification': - accuracy = cross_val_score(clf, X, y, scoring='accuracy', cv=cv, n_jobs=-1) - grass.message(_("Accuracy :\t%0.2f\t+/-2SD\t%0.2f" %(accuracy.mean(), accuracy.std() * 2))) - if len(np.unique(y)) == 2: - auc = cross_val_score(clf, X, y, cv=cv, scoring='roc_auc', n_jobs=-1) - grass.message(_("ROC AUC :\t%0.2f\t+/-2SD\t%0.2f" % (auc.mean(), auc.std() * 2))) + # get metrics from kfold cross validation + cmstats, byclass_stats = cross_val_classification(clf, X, y, cv, randst) - # calculate scores by class using classification report - y_pred = cross_val_predict(clf, X, y, cv=cv, n_jobs=-1) - grass.message(_("\n")) - grass.message(_("Classification report:")) - grass.message(_(classification_report(y, y_pred))) + grass.message(_("Accuracy :\t%0.2f\t+/-SD\t%0.2f" \ + %(cmstats['accuracy'].mean(), cmstats['accuracy'].std()))) + grass.message(_("Kappa :\t%0.2f\t+/-SD\t%0.2f" \ + % (cmstats['kappa'].mean(), cmstats['kappa'].std()))) + grass.message(_("Precision weighted average:\t%0.2f\t+/-SD\t%0.2f" \ + % (cmstats['precision'].mean(), cmstats['precision'].std()))) + grass.message(_("Recall weighted average :\t%0.2f\t+/-SD\t%0.2f" \ + % (cmstats['recall'].mean(), cmstats['recall'].std()))) + grass.message(_("f1 weighted average :\t%0.2f\t+/-SD\t%0.2f" \ + % (cmstats['f1'].mean(), cmstats['f1'].std()))) + # test for if binary and classes equal 0,1 + if len(np.unique(y)) == 2 and all ([0,1] == np.unique(y)): + grass.message(_("ROC AUC :\t%0.2f\t+/-SD\t%0.2f"\ + % (cmstats['auc'].mean(), cmstats['auc'].std()))) + + # calculate scores by class + grass.message(_("\r\n")) + grass.message(_("Performance measures by class......:")) + grass.message(_("Cla\tRecall\t2SD \tPrecision\t2SD\tf1 \tSD")) + + byclass_scores = ['recall', 'precision', 'f1'] + + for i in range(nclasses): + row = str(int(class_list[i])) + '\t' + for method in byclass_scores: + row += ('%.2f' % byclass_stats[method][i, :].mean() ) +\ + '\t' + ('%.2f' % byclass_stats[method][i, :].std() ) + '\t' + grass.message(_(row)) + else: r2 = cross_val_score(clf, X, y, cv=cv, scoring='r2', n_jobs=-1) grass.message(_("R2:\t%0.2f\t+/-\t%0.2f" % (r2.mean(), r2.std() * 2))) From svn_grass at osgeo.org Tue Oct 4 00:19:21 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 4 Oct 2016 00:19:21 -0700 Subject: [GRASS-SVN] r69672 - grass/trunk/vector/v.out.postgis Message-ID: <20161004071921.532DE3903C2@trac.osgeo.org> Author: martinl Date: 2016-10-04 00:19:21 -0700 (Tue, 04 Oct 2016) New Revision: 69672 Modified: grass/trunk/vector/v.out.postgis/main.c Log: v.out.postgis doesn't export attribute table (see #2460) Modified: grass/trunk/vector/v.out.postgis/main.c =================================================================== --- grass/trunk/vector/v.out.postgis/main.c 2016-10-04 05:01:52 UTC (rev 69671) +++ grass/trunk/vector/v.out.postgis/main.c 2016-10-04 07:19:21 UTC (rev 69672) @@ -134,18 +134,19 @@ G_fatal_error(_("Unable to create PostGIS layer <%s>"), olayer); G_add_error_handler(output_handler, &Out); - + + /* copy attributes (must be done before checking output type + otherwise attributes are not copied) */ + field = Vect_get_field_number(&In, params.layer->answer); + if (!flags.table->answer) + Vect_copy_map_dblinks(&In, &Out, TRUE); + /* check output type */ if (otype > 0) { /* type is not 'auto' */ if (Vect_write_line(&Out, otype, NULL, NULL) < 0) G_fatal_error(_("Feature type %d is not supported"), otype); } - /* copy attributes */ - field = Vect_get_field_number(&In, params.layer->answer); - if (!flags.table->answer) - Vect_copy_map_dblinks(&In, &Out, TRUE); - /* copy vector features & create PostGIS table */ if (Vect_copy_map_lines_field(&In, field, &Out) != 0) G_fatal_error(_("Copying features failed")); From svn_grass at osgeo.org Tue Oct 4 06:12:15 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 4 Oct 2016 06:12:15 -0700 Subject: [GRASS-SVN] r69673 - in grass/trunk/lib/python/temporal: . testsuite Message-ID: <20161004131215.6CF433903C2@trac.osgeo.org> Author: huhabla Date: 2016-10-04 06:12:14 -0700 (Tue, 04 Oct 2016) New Revision: 69673 Modified: grass/trunk/lib/python/temporal/abstract_dataset.py grass/trunk/lib/python/temporal/abstract_map_dataset.py grass/trunk/lib/python/temporal/abstract_space_time_dataset.py grass/trunk/lib/python/temporal/aggregation.py grass/trunk/lib/python/temporal/base.py grass/trunk/lib/python/temporal/c_libraries_interface.py grass/trunk/lib/python/temporal/core.py grass/trunk/lib/python/temporal/datetime_math.py grass/trunk/lib/python/temporal/extract.py grass/trunk/lib/python/temporal/factory.py grass/trunk/lib/python/temporal/gui_support.py grass/trunk/lib/python/temporal/list_stds.py grass/trunk/lib/python/temporal/mapcalc.py grass/trunk/lib/python/temporal/metadata.py grass/trunk/lib/python/temporal/open_stds.py grass/trunk/lib/python/temporal/register.py grass/trunk/lib/python/temporal/sampling.py grass/trunk/lib/python/temporal/space_time_datasets.py grass/trunk/lib/python/temporal/spatial_extent.py grass/trunk/lib/python/temporal/spatio_temporal_relationships.py grass/trunk/lib/python/temporal/stds_export.py grass/trunk/lib/python/temporal/stds_import.py grass/trunk/lib/python/temporal/temporal_algebra.py grass/trunk/lib/python/temporal/temporal_extent.py grass/trunk/lib/python/temporal/temporal_granularity.py grass/trunk/lib/python/temporal/temporal_raster3d_algebra.py grass/trunk/lib/python/temporal/temporal_raster_algebra.py grass/trunk/lib/python/temporal/temporal_raster_base_algebra.py grass/trunk/lib/python/temporal/temporal_vector_algebra.py grass/trunk/lib/python/temporal/testsuite/test_doctests.py grass/trunk/lib/python/temporal/univar_statistics.py Log: temporal framework: Better Python module import handling Modified: grass/trunk/lib/python/temporal/abstract_dataset.py =================================================================== --- grass/trunk/lib/python/temporal/abstract_dataset.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/abstract_dataset.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -11,11 +11,9 @@ :authors: Soeren Gebbert """ from abc import ABCMeta, abstractmethod -from .temporal_extent import * -from .spatial_extent import * -from .metadata import * -from .temporal_topology_dataset_connector import * -from .spatial_topology_dataset_connector import * +from .core import get_tgis_message_interface, init_dbif, get_enable_mapset_check, get_current_mapset +from .temporal_topology_dataset_connector import TemporalTopologyDatasetConnector +from .spatial_topology_dataset_connector import SpatialTopologyDatasetConnector ############################################################################### Modified: grass/trunk/lib/python/temporal/abstract_map_dataset.py =================================================================== --- grass/trunk/lib/python/temporal/abstract_map_dataset.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/abstract_map_dataset.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -11,8 +11,16 @@ :authors: Soeren Gebbert """ from __future__ import print_function -from .abstract_dataset import * -from .datetime_math import * +import gettext +from grass.exceptions import ImplementationError +from datetime import datetime +from abc import ABCMeta, abstractmethod +from .core import get_tgis_c_library_interface, get_enable_timestamp_write, \ + get_enable_mapset_check, get_current_mapset, init_dbif +from .abstract_dataset import AbstractDataset +from .temporal_extent import RelativeTemporalExtent, AbsoluteTemporalExtent +from .datetime_math import datetime_to_grass_datetime_string, \ + increment_datetime_by_string, decrement_datetime_by_string class AbstractMapDataset(AbstractDataset): @@ -530,7 +538,7 @@ """Convenient method to set the temporal extent from a temporal extent object - :param temporal_extent: The temporal extent that should be set for + :param extent: The temporal extent that should be set for this object .. code-block: : python @@ -722,6 +730,9 @@ spatial directions. :param size: The buffer size, using the unit of the grass region + :param update: If True perform an immediate database update, otherwise only the + internal variables are set + :param dbif: The database interface to be used .. code-block: : python @@ -749,6 +760,9 @@ spatial directions. :param size: The buffer size, using the unit of the grass region + :param update: If True perform an immediate database update, otherwise only the + internal variables are set + :param dbif: The database interface to be used .. code-block: : python @@ -770,7 +784,10 @@ self.spatial_extent.update(dbif) def check_for_correct_time(self): - """Check for correct time""" + """Check for correct time + + :return: True in case of success, False otherwise + """ if self.is_time_absolute(): start, end = self.get_absolute_time() else: Modified: grass/trunk/lib/python/temporal/abstract_space_time_dataset.py =================================================================== --- grass/trunk/lib/python/temporal/abstract_space_time_dataset.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/abstract_space_time_dataset.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -13,9 +13,20 @@ from __future__ import print_function import sys import uuid -from .abstract_dataset import * -from .temporal_granularity import * -from .spatio_temporal_relationships import * +import os +import copy +from datetime import datetime +import gettext +from abc import ABCMeta, abstractmethod +from .core import init_dbif, get_sql_template_path, get_tgis_metadata, get_current_mapset, \ + get_enable_mapset_check +from .abstract_dataset import AbstractDataset, AbstractDatasetComparisonKeyStartTime +from .temporal_granularity import check_granularity_string, compute_absolute_time_granularity,\ + compute_relative_time_granularity +from .spatio_temporal_relationships import count_temporal_topology_relationships, \ + print_spatio_temporal_topology_relationships, SpatioTemporalTopologyBuilder, \ + create_temporal_relation_sql_where_statement +from .datetime_math import increment_datetime_by_string ############################################################################### @@ -1567,7 +1578,6 @@ return None if not check_granularity_string(gran, maps[-1].get_temporal_type()): - self.msgr.error(_("Wrong granularity format: %s" % (gran))) return None for map in maps: Modified: grass/trunk/lib/python/temporal/aggregation.py =================================================================== --- grass/trunk/lib/python/temporal/aggregation.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/aggregation.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -17,13 +17,16 @@ :author: Soeren Gebbert """ -from .space_time_datasets import * +import gettext +import grass.script as gscript +from grass.exceptions import CalledModuleError +from .space_time_datasets import RasterDataset from .datetime_math import create_suffix_from_datetime from .datetime_math import create_time_suffix from .datetime_math import create_numeric_suffic -import grass.script as gscript -from grass.exceptions import CalledModuleError - +from .core import get_current_mapset, get_tgis_message_interface, init_dbif +from .spatio_temporal_relationships import SpatioTemporalTopologyBuilder, \ + create_temporal_relation_sql_where_statement ############################################################################### Modified: grass/trunk/lib/python/temporal/base.py =================================================================== --- grass/trunk/lib/python/temporal/base.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/base.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -26,7 +26,8 @@ """ from __future__ import print_function from datetime import datetime -from .core import * +from .core import get_tgis_message_interface, get_tgis_dbmi_paramstyle, \ + SQLDatabaseInterfaceConnection, init, get_current_mapset ############################################################################### @@ -376,8 +377,7 @@ if len(row) > 0: self.deserialize(row) else: - self.msgr.fatal(_("Object <%s> not found in the temporal database") - % self.get_id()) + self.msgr.fatal(_("Object not found in the temporal database")) return True @@ -610,6 +610,7 @@ """ self.ident = ident self.D["id"] = ident + name = "" if ident is not None: if ident.find("@") >= 0: Modified: grass/trunk/lib/python/temporal/c_libraries_interface.py =================================================================== --- grass/trunk/lib/python/temporal/c_libraries_interface.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/c_libraries_interface.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -12,13 +12,12 @@ """ from grass.exceptions import FatalError -import time -import threading +import gettext import sys from multiprocessing import Process, Lock, Pipe import logging from ctypes import * -from .core import * +from datetime import datetime import grass.lib.gis as libgis import grass.lib.raster as libraster import grass.lib.vector as libvector Modified: grass/trunk/lib/python/temporal/core.py =================================================================== --- grass/trunk/lib/python/temporal/core.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/core.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -30,6 +30,7 @@ """ #import traceback import os +import grass.script as gscript # i18N import gettext gettext.install('grasslibs', os.path.join(os.getenv("GISBASE"), 'locale')) @@ -40,8 +41,6 @@ # python3 long = int -import grass.script as gscript -from datetime import datetime from .c_libraries_interface import * from grass.pygrass import messages # Import all supported database backends Modified: grass/trunk/lib/python/temporal/datetime_math.py =================================================================== --- grass/trunk/lib/python/temporal/datetime_math.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/datetime_math.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -9,7 +9,7 @@ :authors: Soeren Gebbert """ from datetime import datetime, timedelta -from .core import * +from .core import get_tgis_message_interface import copy try: Modified: grass/trunk/lib/python/temporal/extract.py =================================================================== --- grass/trunk/lib/python/temporal/extract.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/extract.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -8,10 +8,11 @@ :authors: Soeren Gebbert """ - -from grass.script.utils import get_num_suffix -from .space_time_datasets import * -from .open_stds import * +# i18N +import gettext +from .core import get_tgis_message_interface, get_current_mapset, SQLDatabaseInterfaceConnection +from .abstract_map_dataset import AbstractMapDataset +from .open_stds import open_old_stds, check_new_stds, open_new_stds from .datetime_math import create_suffix_from_datetime from .datetime_math import create_time_suffix from .datetime_math import create_numeric_suffic Modified: grass/trunk/lib/python/temporal/factory.py =================================================================== --- grass/trunk/lib/python/temporal/factory.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/factory.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -17,8 +17,12 @@ :authors: Soeren Gebbert """ +# i18N +import gettext +from .core import get_tgis_message_interface +from .space_time_datasets import SpaceTimeRaster3DDataset, SpaceTimeRasterDataset, \ + SpaceTimeVectorDataset, Raster3DDataset, RasterDataset, VectorDataset -from .space_time_datasets import * ############################################################################### Modified: grass/trunk/lib/python/temporal/gui_support.py =================================================================== --- grass/trunk/lib/python/temporal/gui_support.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/gui_support.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -9,9 +9,10 @@ :authors: Soeren Gebbert """ - -from .space_time_datasets import * -from .factory import * +# i18N +import gettext +from .core import get_available_temporal_mapsets, init_dbif +from .factory import dataset_factory import grass.script as gscript ############################################################################### @@ -26,6 +27,7 @@ .. code-block:: python + >>> import grass.temporalas tgis >>> tgis.tlist_grouped('strds')['PERMANENT'] ['precipitation', 'temperature'] Modified: grass/trunk/lib/python/temporal/list_stds.py =================================================================== --- grass/trunk/lib/python/temporal/list_stds.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/list_stds.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -18,9 +18,13 @@ :authors: Soeren Gebbert """ from __future__ import print_function -from .space_time_datasets import * -from .factory import * -from .open_stds import * +# i18N +import gettext +from .core import get_tgis_message_interface, get_available_temporal_mapsets, init_dbif +from .datetime_math import time_delta_to_relative_time +from .space_time_datasets import RasterDataset +from .factory import dataset_factory +from .open_stds import open_old_stds ############################################################################### @@ -49,18 +53,19 @@ .. code-block:: python >>> import grass.temporal as tgis - >>> tgis.init() + >>> tgis.core.init() >>> name = "list_stds_test" - >>> sp = tgis.open_new_stds(name=name, type="strds", - ... temporaltype="absolute", title="title", descr="descr", semantic="mean", dbif=None, overwrite=True) + >>> sp = tgis.open_stds.open_new_stds(name=name, type="strds", + ... temporaltype="absolute", title="title", descr="descr", + ... semantic="mean", dbif=None, overwrite=True) >>> mapset = tgis.get_current_mapset() - >>> stds_list = tgis.get_dataset_list("strds", "absolute", columns="name") + >>> stds_list = tgis.list_stds.get_dataset_list("strds", "absolute", columns="name") >>> rows = stds_list[mapset] >>> for row in rows: ... if row["name"] == name: ... print(True) True - >>> stds_list = tgis.get_dataset_list("strds", "absolute", columns="name,mapset", where="mapset = '%s'"%(mapset)) + >>> stds_list = tgis.list_stds.get_dataset_list("strds", "absolute", columns="name,mapset", where="mapset = '%s'"%(mapset)) >>> rows = stds_list[mapset] >>> for row in rows: ... if row["name"] == name and row["mapset"] == mapset: Modified: grass/trunk/lib/python/temporal/mapcalc.py =================================================================== --- grass/trunk/lib/python/temporal/mapcalc.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/mapcalc.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -8,12 +8,16 @@ :authors: Soeren Gebbert """ - -from .space_time_datasets import * -from .open_stds import * +# i18N +import gettext +import copy +from datetime import datetime from multiprocessing import Process import grass.script as gscript from grass.exceptions import CalledModuleError +from .core import SQLDatabaseInterfaceConnection, get_current_mapset, get_tgis_message_interface +from .open_stds import open_new_stds, open_old_stds, check_new_stds +from .datetime_math import time_delta_to_relative_time ############################################################################ Modified: grass/trunk/lib/python/temporal/metadata.py =================================================================== --- grass/trunk/lib/python/temporal/metadata.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/metadata.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -22,7 +22,10 @@ :authors: Soeren Gebbert """ from __future__ import print_function -from .base import * +# i18N +import gettext +from .base import SQLDatabaseInterface +from .core import init ############################################################################### Modified: grass/trunk/lib/python/temporal/open_stds.py =================================================================== --- grass/trunk/lib/python/temporal/open_stds.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/open_stds.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -17,9 +17,12 @@ :authors: Soeren Gebbert """ +# i18N +import gettext +from .core import init_dbif, get_current_mapset, get_tgis_message_interface +from .factory import dataset_factory +from .abstract_map_dataset import AbstractMapDataset -from .factory import * - ############################################################################### Modified: grass/trunk/lib/python/temporal/register.py =================================================================== --- grass/trunk/lib/python/temporal/register.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/register.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -16,9 +16,15 @@ :authors: Soeren Gebbert """ - -from .open_stds import * +# i18N +import gettext +from datetime import datetime import grass.script as gscript +from .core import get_tgis_message_interface, init_dbif, get_current_mapset +from .open_stds import open_old_stds +from .abstract_map_dataset import AbstractMapDataset +from .factory import dataset_factory +from .datetime_math import check_datetime_string, increment_datetime_by_string, string_to_datetime ############################################################################### Modified: grass/trunk/lib/python/temporal/sampling.py =================================================================== --- grass/trunk/lib/python/temporal/sampling.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/sampling.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -17,7 +17,11 @@ :authors: Soeren Gebbert """ from __future__ import print_function -from .factory import * +# i18N +import gettext +from .core import get_current_mapset, get_tgis_message_interface, SQLDatabaseInterfaceConnection +from .datetime_math import time_delta_to_relative_time +from .factory import dataset_factory def sample_stds_by_stds_topology(intype, sampletype, inputs, sampler, header, Modified: grass/trunk/lib/python/temporal/space_time_datasets.py =================================================================== --- grass/trunk/lib/python/temporal/space_time_datasets.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/space_time_datasets.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -8,10 +8,25 @@ :authors: Soeren Gebbert """ +# i18N +import gettext import getpass -from .abstract_map_dataset import * -from .abstract_space_time_dataset import * +from datetime import datetime +from .core import get_current_mapset +from .abstract_map_dataset import AbstractMapDataset +from .abstract_space_time_dataset import AbstractSpaceTimeDataset +from .base import Raster3DBase, RasterBase, VectorBase, STR3DSBase, STVDSBase, STRDSBase,\ + VectorSTDSRegister, Raster3DSTDSRegister, RasterSTDSRegister +from .metadata import Raster3DMetadata, RasterMetadata, VectorMetadata, STRDSMetadata,\ + STR3DSMetadata, STVDSMetadata +from .spatial_extent import RasterSpatialExtent, Raster3DSpatialExtent, VectorSpatialExtent,\ + STRDSSpatialExtent, STR3DSSpatialExtent, STVDSSpatialExtent +from .temporal_extent import RasterAbsoluteTime, RasterRelativeTime, Raster3DAbsoluteTime, \ + Raster3DRelativeTime, VectorAbsoluteTime, VectorRelativeTime, STRDSAbsoluteTime,\ + STRDSRelativeTime, STR3DSAbsoluteTime, STR3DSRelativeTime, STVDSAbsoluteTime, STVDSRelativeTime import grass.script.array as garray +from .core import init +from datetime import datetime ############################################################################### @@ -205,7 +220,7 @@ self.stds_register = RasterSTDSRegister(ident=ident) def has_grass_timestamp(self): - """Check if a grass file bsased time stamp exists for this map. + """Check if a grass file based time stamp exists for this map. :return: True if success, False on error """ Modified: grass/trunk/lib/python/temporal/spatial_extent.py =================================================================== --- grass/trunk/lib/python/temporal/spatial_extent.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/spatial_extent.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -34,7 +34,11 @@ :authors: Soeren Gebbert """ from __future__ import print_function -from .base import * +# i18N +import gettext +from .base import SQLDatabaseInterface +from .core import init +from datetime import datetime class SpatialExtent(SQLDatabaseInterface): Modified: grass/trunk/lib/python/temporal/spatio_temporal_relationships.py =================================================================== --- grass/trunk/lib/python/temporal/spatio_temporal_relationships.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/spatio_temporal_relationships.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -18,13 +18,15 @@ :authors: Soeren Gebbert """ from __future__ import print_function - -from .abstract_dataset import * -from .datetime_math import * +# i18N +import gettext +from datetime import datetime +from .core import init_dbif +from .abstract_dataset import AbstractDatasetComparisonKeyStartTime +from .datetime_math import time_delta_to_relative_time_seconds import grass.lib.vector as vector import grass.lib.rtree as rtree import grass.lib.gis as gis -from ctypes import * ############################################################################### Modified: grass/trunk/lib/python/temporal/stds_export.py =================================================================== --- grass/trunk/lib/python/temporal/stds_export.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/stds_export.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -25,16 +25,16 @@ :authors: Soeren Gebbert """ +# i18N +import gettext import shutil import os import tarfile import tempfile -from .space_time_datasets import * -from .factory import * -from .open_stds import * import grass.script as gscript from grass.exceptions import CalledModuleError +from .open_stds import open_old_stds proj_file_name = "proj.txt" Modified: grass/trunk/lib/python/temporal/stds_import.py =================================================================== --- grass/trunk/lib/python/temporal/stds_import.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/stds_import.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -29,14 +29,15 @@ :authors: Soeren Gebbert """ +# i18N +import gettext import os import os.path import tarfile -from .space_time_datasets import * -from .register import * -from . import factory -from .factory import * +from .core import get_current_mapset, get_tgis_message_interface +from .register import register_maps_in_space_time_dataset +from .factory import dataset_factory import grass.script as gscript from grass.exceptions import CalledModuleError @@ -198,7 +199,6 @@ :param memory: Cache size for raster rows, used in r.in.gdal """ - global raise_on_error old_state = gscript.raise_on_error gscript.set_raise_on_error(True) @@ -308,7 +308,8 @@ try: # Make sure the temporal database exists - factory.init() + from .core import init + init() fs = "|" maplist = [] @@ -498,6 +499,6 @@ location=old_env["LOCATION_NAME"], gisdbase=old_env["GISDBASE"]) except CalledModuleError: - grass.warning(_("Switching to original location failed")) + gscript.warning(_("Switching to original location failed")) gscript.set_raise_on_error(old_state) Modified: grass/trunk/lib/python/temporal/temporal_algebra.py =================================================================== --- grass/trunk/lib/python/temporal/temporal_algebra.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/temporal_algebra.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -446,13 +446,25 @@ except: pass +# i18N +import gettext import os import copy +from datetime import datetime import grass.pygrass.modules as pymod -from .space_time_datasets import * -from .factory import * -from .open_stds import * -from .temporal_operator import * +from .core import init_dbif, get_tgis_message_interface, get_current_mapset,\ + SQLDatabaseInterfaceConnection +from .temporal_granularity import compute_common_absolute_time_granularity, \ + compute_common_relative_time_granularity +from .abstract_dataset import AbstractDatasetComparisonKeyStartTime +from .abstract_map_dataset import AbstractMapDataset +from .space_time_datasets import RasterDataset +from .factory import dataset_factory +from .open_stds import open_new_stds, open_old_stds +from .temporal_operator import TemporalOperatorParser +from spatio_temporal_relationships import SpatioTemporalTopologyBuilder +from .datetime_math import time_delta_to_relative_time +from abstract_space_time_dataset import AbstractSpaceTimeDataset ############################################################################## Modified: grass/trunk/lib/python/temporal/temporal_extent.py =================================================================== --- grass/trunk/lib/python/temporal/temporal_extent.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/temporal_extent.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -20,7 +20,11 @@ :authors: Soeren Gebbert """ from __future__ import print_function -from .base import * +# i18N +import gettext +from .base import SQLDatabaseInterface +from .core import init +from datetime import datetime ############################################################################### Modified: grass/trunk/lib/python/temporal/temporal_granularity.py =================================================================== --- grass/trunk/lib/python/temporal/temporal_granularity.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/temporal_granularity.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -17,7 +17,9 @@ :authors: Soeren Gebbert """ -from .abstract_dataset import * +from __future__ import print_function +# i18N +import gettext from .datetime_math import * from functools import reduce Modified: grass/trunk/lib/python/temporal/temporal_raster3d_algebra.py =================================================================== --- grass/trunk/lib/python/temporal/temporal_raster3d_algebra.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/temporal_raster3d_algebra.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -10,8 +10,22 @@ :authors: Thomas Leppelt and Soeren Gebbert """ -from .temporal_raster_base_algebra import * +from __future__ import print_function +try: + import ply.lex as lex + import ply.yacc as yacc +except: + pass + +# i18N +import gettext +from .temporal_raster_base_algebra import TemporalRasterBaseAlgebraParser,\ + TemporalRasterAlgebraLexer +import grass.pygrass.modules as pymod +from .space_time_datasets import Raster3DDataset + + ############################################################################### class TemporalRaster3DAlgebraParser(TemporalRasterBaseAlgebraParser): Modified: grass/trunk/lib/python/temporal/temporal_raster_algebra.py =================================================================== --- grass/trunk/lib/python/temporal/temporal_raster_algebra.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/temporal_raster_algebra.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -51,9 +51,21 @@ LexToken(FLOAT,2.45,1,42) """ +from __future__ import print_function -from .temporal_raster_base_algebra import * +try: + import ply.lex as lex + import ply.yacc as yacc +except: + pass +# i18N +import gettext +from .temporal_raster_base_algebra import TemporalRasterBaseAlgebraParser,\ + TemporalRasterAlgebraLexer +import grass.pygrass.modules as pymod +from .space_time_datasets import RasterDataset + ############################################################################### class TemporalRasterAlgebraParser(TemporalRasterBaseAlgebraParser): Modified: grass/trunk/lib/python/temporal/temporal_raster_base_algebra.py =================================================================== --- grass/trunk/lib/python/temporal/temporal_raster_base_algebra.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/temporal_raster_base_algebra.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -41,10 +41,25 @@ """ from __future__ import print_function + +try: + import ply.lex as lex + import ply.yacc as yacc +except: + pass + +import copy import grass.pygrass.modules as pymod -from .temporal_operator import * -from .temporal_algebra import * +from grass.exceptions import FatalError +from .temporal_algebra import TemporalAlgebraLexer, TemporalAlgebraParser, GlobalTemporalVar +from .core import init_dbif +from .abstract_dataset import AbstractDatasetComparisonKeyStartTime +from .factory import dataset_factory +from .open_stds import open_new_stds +from spatio_temporal_relationships import SpatioTemporalTopologyBuilder +from .space_time_datasets import Raster3DDataset, RasterDataset + ############################################################################## class TemporalRasterAlgebraLexer(TemporalAlgebraLexer): Modified: grass/trunk/lib/python/temporal/temporal_vector_algebra.py =================================================================== --- grass/trunk/lib/python/temporal/temporal_vector_algebra.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/temporal_vector_algebra.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -42,10 +42,24 @@ """ from __future__ import print_function + +try: + import ply.lex as lex + import ply.yacc as yacc +except: + pass + import grass.pygrass.modules as pygrass -from .temporal_operator import * -from .temporal_algebra import * +import copy +from .temporal_algebra import TemporalAlgebraLexer, TemporalAlgebraParser, GlobalTemporalVar +from .core import init_dbif, get_current_mapset +from .abstract_dataset import AbstractDatasetComparisonKeyStartTime +from .open_stds import open_new_stds +from spatio_temporal_relationships import SpatioTemporalTopologyBuilder +from .space_time_datasets import VectorDataset + + ############################################################################## class TemporalVectorAlgebraLexer(TemporalAlgebraLexer): Modified: grass/trunk/lib/python/temporal/testsuite/test_doctests.py =================================================================== --- grass/trunk/lib/python/temporal/testsuite/test_doctests.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/testsuite/test_doctests.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -25,7 +25,7 @@ tests.addTests(doctest.DocTestSuite(grass.temporal.abstract_space_time_dataset)) tests.addTests(doctest.DocTestSuite(grass.temporal.base)) # Unexpected error here - ##tests.addTests(doctest.DocTestSuite(grass.temporal.core)) + tests.addTests(doctest.DocTestSuite(grass.temporal.core)) tests.addTests(doctest.DocTestSuite(grass.temporal.datetime_math)) # Unexpected error here ##tests.addTests(doctest.DocTestSuite(grass.temporal.list_stds)) Modified: grass/trunk/lib/python/temporal/univar_statistics.py =================================================================== --- grass/trunk/lib/python/temporal/univar_statistics.py 2016-10-04 07:19:21 UTC (rev 69672) +++ grass/trunk/lib/python/temporal/univar_statistics.py 2016-10-04 13:12:14 UTC (rev 69673) @@ -20,7 +20,9 @@ """ from __future__ import print_function -from .open_stds import * +from .core import SQLDatabaseInterfaceConnection, get_current_mapset +from .factory import dataset_factory +from .open_stds import open_old_stds import grass.script as gscript ############################################################################### From svn_grass at osgeo.org Tue Oct 4 06:34:41 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 4 Oct 2016 06:34:41 -0700 Subject: [GRASS-SVN] r69674 - in grass/trunk/temporal: t.connect/testsuite t.rast.neighbors Message-ID: <20161004133442.C31FA39040E@trac.osgeo.org> Author: huhabla Date: 2016-10-04 06:34:38 -0700 (Tue, 04 Oct 2016) New Revision: 69674 Modified: grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster.py grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_vector.py grass/trunk/temporal/t.rast.neighbors/t.rast.neighbors.py Log: temporal modules: Fixed tests Modified: grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster.py =================================================================== --- grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster.py 2016-10-04 13:12:14 UTC (rev 69673) +++ grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_raster.py 2016-10-04 13:34:38 UTC (rev 69674) @@ -104,7 +104,7 @@ a3|test1|2001-03-01 00:00:00|2001-04-01 00:00:00""" trast_list = SimpleModule( - "t.rast.list", quiet=True, flags="s", input="A at test1") + "t.rast.list", quiet=True, flags="u", input="A at test1") self.assertModule(trast_list) out = trast_list.outputs["stdout"].value @@ -117,7 +117,7 @@ a3|test2|2001-05-01 00:00:00|2001-07-01 00:00:00""" trast_list = SimpleModule( - "t.rast.list", quiet=True, flags="s", input="A at test2") + "t.rast.list", quiet=True, flags="u", input="A at test2") self.assertModule(trast_list) out = trast_list.outputs["stdout"].value @@ -130,7 +130,7 @@ a3|test3|2001-07-01 00:00:00|2001-10-01 00:00:00""" trast_list = SimpleModule( - "t.rast.list", quiet=True, flags="s", input="A at test3") + "t.rast.list", quiet=True, flags="u", input="A at test3") self.assertModule(trast_list) out = trast_list.outputs["stdout"].value @@ -143,7 +143,7 @@ a3|test4|2001-09-01 00:00:00|2002-01-01 00:00:00""" trast_list = SimpleModule( - "t.rast.list", quiet=True, flags="s", input="A at test4") + "t.rast.list", quiet=True, flags="u", input="A at test4") self.assertModule(trast_list) out = trast_list.outputs["stdout"].value @@ -156,7 +156,7 @@ a3|test5|2001-11-01 00:00:00|2002-04-01 00:00:00""" trast_list = SimpleModule( - "t.rast.list", quiet=True, flags="s", input="A at test5") + "t.rast.list", quiet=True, flags="u", input="A at test5") self.assertModule(trast_list) out = trast_list.outputs["stdout"].value @@ -164,7 +164,7 @@ for a, b in zip(list_string.split("\n"), out.split("\n")): self.assertEqual(a.strip(), b.strip()) - trast_list = SimpleModule("t.rast.list", quiet=True, flags="s", + trast_list = SimpleModule("t.rast.list", quiet=True, flags="u", input="A at test5", output=self.outfile) self.assertModule(trast_list) self.assertFileExists(self.outfile) Modified: grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_vector.py =================================================================== --- grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_vector.py 2016-10-04 13:12:14 UTC (rev 69673) +++ grass/trunk/temporal/t.connect/testsuite/test_distr_tgis_db_vector.py 2016-10-04 13:34:38 UTC (rev 69674) @@ -102,7 +102,7 @@ a2|testvect1|2001-02-01 00:00:00|2001-03-01 00:00:00 a3|testvect1|2001-03-01 00:00:00|2001-04-01 00:00:00""" - trast_list = SimpleModule("t.vect.list", quiet=True, flags="s", + trast_list = SimpleModule("t.vect.list", quiet=True, flags="u", columns=[ "name", "mapset", "start_time", "end_time"], input="A at testvect1") @@ -118,7 +118,7 @@ a3|testvect2|2001-05-01 00:00:00|2001-07-01 00:00:00""" trast_list = SimpleModule( - "t.vect.list", quiet=True, flags="s", + "t.vect.list", quiet=True, flags="u", columns=["name", "mapset", "start_time", "end_time"], input="A at testvect2") self.assertModule(trast_list) @@ -132,7 +132,7 @@ a2|testvect3|2001-04-01 00:00:00|2001-07-01 00:00:00 a3|testvect3|2001-07-01 00:00:00|2001-10-01 00:00:00""" - trast_list = SimpleModule("t.vect.list", quiet=True, flags="s", + trast_list = SimpleModule("t.vect.list", quiet=True, flags="u", columns=[ "name", "mapset", "start_time", "end_time"], input="A at testvect3") @@ -148,7 +148,7 @@ a3|testvect4|2001-09-01 00:00:00|2002-01-01 00:00:00""" trast_list = SimpleModule( - "t.vect.list", quiet=True, flags="s", + "t.vect.list", quiet=True, flags="u", columns=["name", "mapset", "start_time", "end_time"], input="A at testvect4") self.assertModule(trast_list) @@ -158,7 +158,7 @@ for a, b in zip(list_string.split("\n"), out.split("\n")): self.assertEqual(a.strip(), b.strip()) - trast_list = SimpleModule("t.vect.list", quiet=True, flags="s", + trast_list = SimpleModule("t.vect.list", quiet=True, flags="u", columns=["name", "mapset", "start_time", "end_time"], input="A at testvect4", output=self.outfile) self.assertModule(trast_list) Modified: grass/trunk/temporal/t.rast.neighbors/t.rast.neighbors.py =================================================================== --- grass/trunk/temporal/t.rast.neighbors/t.rast.neighbors.py 2016-10-04 13:12:14 UTC (rev 69673) +++ grass/trunk/temporal/t.rast.neighbors/t.rast.neighbors.py 2016-10-04 13:34:38 UTC (rev 69674) @@ -197,7 +197,7 @@ # Open the new space time raster dataset ttype, stype, title, descr = sp.get_initial_values() new_sp = tgis.open_new_stds(output, "strds", ttype, title, - descr, stype, dbif, overwrite) + descr, stype, dbif, overwrite) num_maps = len(new_maps) # collect empty maps to remove them empty_maps = [] From svn_grass at osgeo.org Tue Oct 4 09:58:17 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 4 Oct 2016 09:58:17 -0700 Subject: [GRASS-SVN] r69675 - grass-addons/grass7/raster/r.randomforest Message-ID: <20161004165818.0A4B339040E@trac.osgeo.org> Author: spawley Date: 2016-10-04 09:58:17 -0700 (Tue, 04 Oct 2016) New Revision: 69675 Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.html Log: fix to manual page in r.randomforest Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.html =================================================================== --- grass-addons/grass7/raster/r.randomforest/r.randomforest.html 2016-10-04 13:34:38 UTC (rev 69674) +++ grass-addons/grass7/raster/r.randomforest/r.randomforest.html 2016-10-04 16:58:17 UTC (rev 69675) @@ -2,40 +2,54 @@ r.randomforest represents a front-end to the scikit learn machine learning python package for the purpose of performing classification and regression on a suite of predictors within a GRASS imagery group. The module also provides access random forest classification, and several other classifiers that are commonly used in remote sensing and spatial modelling. For more information concerning the details of any of the algorithms, consult the scikit-learn documentation directly. The choice of classifier is set using the model parameter. -

        The RandomForestsClassifier and RandomForestsRegressor (Breiman, 2001) options represent ensemble classification and regression tree methods, respectively. These methods construct a forest of uncorrelated decision trees based on a random subset of predictor variables, which occurs independently at every node split in each tree. Each tree produces a prediction probability, and the final classification result is obtained by averaging of the prediction probabilities across all of the trees. Random forests require relatively few user-specified parameter choices, principally consisting of the number of trees in the forest (ntrees_rf), and the number of variables that are allowed to be chosen from at each node split (m_features_rf), which controls the degree of correlation between the trees. Random forests also includes built-in accuracy assessment, termed the 'out-of-bag' (OOB) error. This is computed through bagging, where 33% of the training data are held-out duri ng the construction of each tree, and then OOB data are used to evaluate the prediction accuracy. +

        +The RandomForestsClassifier and RandomForestsRegressor (Breiman, 2001) options represent ensemble classification and regression tree methods, respectively. These methods construct a forest of uncorrelated decision trees based on a random subset of predictor variables, which occurs independently at every node split in each tree. Each tree produces a prediction probability, and the final classification result is obtained by averaging of the prediction probabilities across all of the trees. Random forests require relatively few user-specified parameter choices, principally consisting of the number of trees in the forest (ntrees_rf), and the number of variables that are allowed to be chosen from at each node split (m_features_rf), which controls the degree of correlation between the trees. Random forests also includes built-in accuracy assessment, termed the 'out-of-bag' (OOB) error. This is computed through bagging, where 33% of the training data are held-out during the c onstruction of each tree, and then OOB data are used to evaluate the prediction accuracy. -

        LogisticRegression, despite its name, represents a linear model for classification rather than regression. This module provides access to two parameters, C_lr the inverse of the regularization strength, and i which specifies if a constant (a.k.a. bias or intercept) should be added to the decision function. +

        +LogisticRegression, despite its name, represents a linear model for classification rather than regression. This module provides access to two parameters, C_lr the inverse of the regularization strength, and i which specifies if a constant (a.k.a. bias or intercept) should be added to the decision function. -

        LinearDiscriminantAnalysis and QuadraticDiscriminantAnalysis are two classifiers with a linear and a quadratic decision surface, respectively. These classifiers do not take any parameters. +

        +LinearDiscriminantAnalysis and QuadraticDiscriminantAnalysis are two classifiers with a linear and a quadratic decision surface, respectively. These classifiers do not take any parameters. -

        GaussianNB implements the Gaussian Naive Bayes algorithm for classification. Naive Bayes methods are a set of supervised learning algorithms based on applying Bayes’ theorem with the “naive” assumption of independence between every pair of features. This classifier does not take any parameters. +

        +GaussianNB implements the Gaussian Naive Bayes algorithm for classification. Naive Bayes methods are a set of supervised learning algorithms based on applying Bayes’ theorem with the “naive” assumption of independence between every pair of features. This classifier does not take any parameters. -

        The DecisionTreeClassifier and DecisionTreeRegressor represent non-parametric supervised learning methods used for classification and regression, respectively. Several parameter choices are available, relating to the node splitting method, the number of features to consider at each split, and the minimum number of samples in a split or leaf node. +

        +The DecisionTreeClassifier and DecisionTreeRegressor represent non-parametric supervised learning methods used for classification and regression, respectively. Several parameter choices are available, relating to the node splitting method, the number of features to consider at each split, and the minimum number of samples in a split or leaf node. -

        The GradientBoostingClassifier and GradientBoostingRegressor use an ensemble of boosted decision trees for classification and regression, respectively. Gradient tree boosting produces a prediction model in the form of an ensemble of weak prediction models from decision trees, but the model is built in a stage-wise fashion. Gradient tree boosting includes many parameter choices, although the module provides access to the most common parameters that may require tuning for optimal performance. +

        +The GradientBoostingClassifier and GradientBoostingRegressor use an ensemble of boosted decision trees for classification and regression, respectively. Gradient tree boosting produces a prediction model in the form of an ensemble of weak prediction models from decision trees, but the model is built in a stage-wise fashion. Gradient tree boosting includes many parameter choices, although the module provides access to the most common parameters that may require tuning for optimal performance. -

        The tree-based classifiers include a measure of variable importance based on the Gini impurity criterion, which measures how each variable contributes to the homogeneity of the nodes, with important variables causing a larger decrease in the Gini coefficient in successive node splits. This variable importance allows the contributions of the individual predictors to be determined. The feature importance scores are displayed in the command output. +

        +The tree-based classifiers include a measure of variable importance based on the Gini impurity criterion, which measures how each variable contributes to the homogeneity of the nodes, with important variables causing a larger decrease in the Gini coefficient in successive node splits. This variable importance allows the contributions of the individual predictors to be determined. The feature importance scores are displayed in the command output. -

        Cross validation can be performed by setting the cv parameters to > 1. Cross-validation is performed using stratified kfolds, and multiple global and per-class accuracy measures are produced, consisting of accuracy, kappa, precision, recall, f1 measure, and if the response variable is binary (0,1), area under the receiver operating curve (auc). Note in a multiclass classification, the global precision, recall and f1 measures represent a weighted average of the per-class metrics (weighted by number of samples per class). Also note that this cross-validation is performed on a pixel basis. If there is a strong autocorrelation between pixels (i.e. the pixels represent polygons) then the training/test splits will not represent independent samples and will overestimate the accuracy. In this case you should train/split manually and use i.kappa. +

        +Cross validation can be performed by setting the cv parameters to > 1. Cross-validation is performed using stratified kfolds, and multiple global and per-class accuracy measures are produced, consisting of accuracy, kappa, precision, recall, f1 measure, and if the response variable is binary (0,1), area under the receiver operating curve (auc). Note in a multiclass classification, the global precision, recall and f1 measures represent a weighted average of the per-class metrics (weighted by number of samples per class). Also note that this cross-validation is performed on a pixel basis. If there is a strong autocorrelation between pixels (i.e. the pixels represent polygons) then the training/test splits will not represent independent samples and will overestimate the accuracy. In this case you should train/split manually and use i.kappa. -

        Most machine learning algorithms do not perform well in the case of a large class imbalance. In this case, the classifier will seek to reduce the overall model error, but this will occur by predicting the majority class with a very high accuracy, but at the expense of the minority class. If you have a highly imbalanced dataset, the 'balanced' b flag can be set. The scikit-learn implementation balanced mode then automatically adjust weights inversely proportional to class frequencies. This only applies to the LogisticRegression, DecisionTree, RandomForest, and GradientBoostingClassifiers. +

        +Most machine learning algorithms do not perform well in the case of a large class imbalance. In this case, the classifier will seek to reduce the overall model error, but this will occur by predicting the majority class with a very high accuracy, but at the expense of the minority class. If you have a highly imbalanced dataset, the 'balanced' b flag can be set. The scikit-learn implementation balanced mode then automatically adjust weights inversely proportional to class frequencies. This only applies to the LogisticRegression, DecisionTree, RandomForest, and GradientBoostingClassifiers. -

        The module also offers the ability to save and load a classification or regression model. The model is saved as a list of filenames (starting with the extension .pkl which is added automatically) for each numpy array. This list can involve a large number of files, so it makes sense to save each model in a separate directory. To load the model, you need to select the .pkl file that was saved. Saving and loading a model represents a useful feature because it allows a model to be built on one imagery group (ie. set of predictor variables), and then the prediction can be performed on other imagery groups. This approach is commonly employed in species prediction modelling, or landslide susceptibility modelling, where a classification or regression model is built with one set of predictors (e.g. which include present-day climatic variables) and then predictions can be performed on other imagery groups containing forecasted climatic variables. +

        +The module also offers the ability to save and load a classification or regression model. The model is saved as a list of filenames (starting with the extension .pkl which is added automatically) for each numpy array. This list can involve a large number of files, so it makes sense to save each model in a separate directory. To load the model, you need to select the .pkl file that was saved. Saving and loading a model represents a useful feature because it allows a model to be built on one imagery group (ie. set of predictor variables), and then the prediction can be performed on other imagery groups. This approach is commonly employed in species prediction modelling, or landslide susceptibility modelling, where a classification or regression model is built with one set of predictors (e.g. which include present-day climatic variables) and then predictions can be performed on other imagery groups containing forecasted climatic variables. -

        For convenience when performing repeated classifications using different classifiers or parameters, the training data can be saved to a csv file using the save_training option. This data can then be loaded into subsequent classification runs, saving time by avoiding the need to repeatedly query the predictors. +

        +For convenience when performing repeated classifications using different classifiers or parameters, the training data can be saved to a csv file using the save_training option. This data can then be loaded into subsequent classification runs, saving time by avoiding the need to repeatedly query the predictors.

        NOTES

        r.randomforest uses the "scikit-learn" machine learning python package. This python package needs to be installed within your GRASS GIS Python environment for r.randomforest to work. -
        + +

        For Linux users, this package should be available through the linux package manager in most distributions (named for example "python-scikit-learn"). -
        + +

        For MS-Windows users using a 64 bit GRASS, the easiest way of installing the packages is by using the precompiled binaries from Christoph Gohlke and by using the OSGeo4W installation method of GRASS, where the python setuptools can also be installed. You can then use 'easy_install pip' to install the pip package manager. Then, you can download the NumPy-1.10+MKL and scikit-learn .whl files and install them using 'pip install packagename.whl'. For MS-Windows with a 32 bit GRASS, scikit-learn is available in the OSGeo4W installer.

        -r.randomforest is designed to keep system memory requirements relatively low. For this purpose, the rasters are read from the disk row-by-row, using the RasterRow method in PyGRASS. This however does not represent an efficient volume of data to pass to the classifier, which is multithreaded by default. Therefore, groups of rows specified by the lines parameter are passed to the classifier, and the reclassified image is reconstructed and written row-by-row back to the disk. Lines=25 should be reasonable for most systems with 4-8 GB of ram. However, the sampling of the training data set is slow using a row-by-row basis, and the default approach requires enough memory to load one predictor into memory at a time. If this still exceeds the system memory then the l flag can be set to perform row-by-row sampling. +r.randomforest is designed to keep system memory requirements relatively low. For this purpose, the rasters are read from the disk row-by-row, using the RasterRow method in PyGRASS. This however does not represent an efficient volume of data to pass to the classifiers, which are mostly multithreaded. Therefore, groups of rows specified by the lines parameter are passed to the classifier, and the reclassified image is reconstructed and written row-by-row back to the disk. Lines=25 should be reasonable for most systems with 4-8 GB of ram. The row-by-row access however results in slow performance when sampling the imagery group to build the training data set. Instead, the default behaviour is to read each predictor into memory at a time. If this still exceeds the system memory then the l flag can be set to perform row-by-row sampling, and classification/regression can then be performed on rasters of any size irrespective of the available memory (al though it will be slow). -

        Many of the classifiers involve a random process which can causes a small amount of variation in the classification results, out-of-bag error, and feature importances. To enable reproducible results, a seed is supplied to the classifier. This can be changed using the randst parameter. +

        +Many of the classifiers involve a random process which can causes a small amount of variation in the classification results, out-of-bag error, and feature importances. To enable reproducible results, a seed is supplied to the classifier. This can be changed using the randst parameter.

        TODO

        @@ -46,20 +60,23 @@ Here we are going to use the GRASS GIS sample North Carolina data set as a basis to perform a landsat classification. We are going to classify a Landsat 7 scene from 2000, using training information from an older (1996) land cover dataset. -

        Landsat 7 (2000) bands 7,4,2 color composite example: +

        +Landsat 7 (2000) bands 7,4,2 color composite example:

        Landsat 7 (2000) bands 7,4,2 color composite example
        Note that this example must be run in the "landsat" mapset of the North Carolina sample data set location. -

        First, we are going to generate some training pixels from an older (1996) land cover classification: +

        +First, we are going to generate some training pixels from an older (1996) land cover classification:

         g.region raster=landclass96 -p
         r.random input=landclass96 npoints=1000 raster=landclass96_roi
         
        -

        Then we can use these training pixels to perform a classification on the more recently obtained landsat 7 image: +

        +Then we can use these training pixels to perform a classification on the more recently obtained landsat 7 image:

         r.randomforest igroup=lsat7_2000 roi=landclass96_roi output=rf_classification \
           model=RandomForestClassifier ntrees_rf=500 m_features_rf=-1 minsplit_rf=2 randst=1 lines=25
        @@ -72,7 +89,8 @@
         r.category rf_classification
         
        -

        Random forest classification result: +

        +Random forest classification result:

        Random forest classification result
        From svn_grass at osgeo.org Tue Oct 4 12:59:10 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 4 Oct 2016 12:59:10 -0700 Subject: [GRASS-SVN] r69676 - grass-addons/grass7/vector/v.kriging Message-ID: <20161004195910.493ED39029E@trac.osgeo.org> Author: evas Date: 2016-10-04 12:59:10 -0700 (Tue, 04 Oct 2016) New Revision: 69676 Modified: grass-addons/grass7/vector/v.kriging/ grass-addons/grass7/vector/v.kriging/Makefile grass-addons/grass7/vector/v.kriging/geostat.c grass-addons/grass7/vector/v.kriging/getval.c grass-addons/grass7/vector/v.kriging/main.c grass-addons/grass7/vector/v.kriging/utils.c grass-addons/grass7/vector/v.kriging/utils_kriging.c grass-addons/grass7/vector/v.kriging/utils_write.c Log: v.kriging: fixed ticket #3115 (bug in missing report parameter and messy temporary files) Property changes on: grass-addons/grass7/vector/v.kriging ___________________________________________________________________ Added: svn:ignore + OBJ.* *.tmp.html Modified: grass-addons/grass7/vector/v.kriging/Makefile =================================================================== --- grass-addons/grass7/vector/v.kriging/Makefile 2016-10-04 16:58:17 UTC (rev 69675) +++ grass-addons/grass7/vector/v.kriging/Makefile 2016-10-04 19:59:10 UTC (rev 69676) @@ -7,8 +7,6 @@ EXTRA_INC = $(VECT_INC) $(PROJINC) EXTRA_CFLAGS = $(VECT_CFLAGS) -VPATH=%.png images - include $(MODULE_TOPDIR)/include/Make/Module.make default: cmd Modified: grass-addons/grass7/vector/v.kriging/geostat.c =================================================================== --- grass-addons/grass7/vector/v.kriging/geostat.c 2016-10-04 16:58:17 UTC (rev 69675) +++ grass-addons/grass7/vector/v.kriging/geostat.c 2016-10-04 19:59:10 UTC (rev 69676) @@ -229,7 +229,7 @@ ddir1 = dir - tv; // difference between bearing and azimuth ddir2 = (dir + PI) - tv; - if (fabs(ddir1) <= td || fabs(ddir2) <= td) { // angle test: compare the diff with critical value + if (fabs(ddir1) <= td || fabs(ddir2) <= td) { // angle test: compare the diff with critical value // test squared distance: vertical variogram => 0., ... rv = type == 1 ? 0. : radius_hz_diff(dr); // ... otherwise horizontal distance @@ -238,11 +238,11 @@ } rvh = sqrt(rv) - *h; // the difference between distance and lag - if (rv <= radius && fabs(rvh) <= lag) { // distance test: compare the distance with critical value and find out if the j-point is located within i-lag + if (rv <= radius && fabs(rvh) <= lag) { // distance test: compare the distance with critical value and find out if the j-point is located within i-lag if (type == 2) { // vertical test for bivariate variogram: rvh = *(dr + 2) - *vert; // compare vertical - if (fabs(rvh) <= lag_vert) { // elevation test: vertical lag + if (fabs(rvh) <= lag_vert) { // elevation test: vertical lag goto delta_V; } else { @@ -490,6 +490,7 @@ struct points *pnts, struct var_par *pars, struct output *out) { + G_fatal_error(_("Interpolating values is currently under maintenance (optimization). Theoretical variogram of your data has been computed.")); // Local variables int i3 = xD->i3; double *vals = pnts->invals; // values to be used for interpolation @@ -522,7 +523,7 @@ // Cell/voxel center coords (location of interpolated value) r0 = (double *)G_malloc(3 * sizeof(double)); - if (report->write2file) { // report file available: + if (report->write2file) { // report file available: time(&report->now); fprintf(report->fp, "Interpolating values started on %s\n\n", ctime(&report->now)); @@ -530,6 +531,7 @@ } G_message(_("Interpolating unknown values...")); + G_fatal_error(_("... is currently under maintenance (optimization). Theoretical variogram of your data has been computed.")); if (percents) { G_percent_reset(); } @@ -544,7 +546,7 @@ var_par->GM = G_matrix_copy(GM); // copy matrix because of cross validation // perform cross validation... - if (crossvalid->write2file) { // ... if desired + if (crossvalid->write2file) { // ... if desired crossvalidation(xD, pnts, var_par); } @@ -602,7 +604,7 @@ rslt_OK = vals[list->value[0] - 1]; // Estimated cell/voxel value rslt_OK = w x inputs } else if (list->n_values == 0) { - if (report->write2file) { // report file available: + if (report->write2file) { // report file available: fprintf(report->fp, "Error (see standard output). Process killed..."); fclose(report->fp); @@ -620,7 +622,7 @@ // write output to the (3D) raster layer if (write2layer(xD, reg, out, col, row, dep, rslt_OK) == 0) { - if (report->write2file) { // report file available + if (report->write2file) { // report file available fprintf(report->fp, "Error (see standard output). Process killed..."); fclose(report->fp); // close report file Modified: grass-addons/grass7/vector/v.kriging/getval.c =================================================================== --- grass-addons/grass7/vector/v.kriging/getval.c 2016-10-04 16:58:17 UTC (rev 69675) +++ grass-addons/grass7/vector/v.kriging/getval.c 2016-10-04 19:59:10 UTC (rev 69676) @@ -170,7 +170,7 @@ pnts->trend = T; } - if (xD->phase == 0 && xD->report.name) { + if (xD->report.write2file && xD->phase == 0) { write2file_values(&xD->report, column); test_normality(n, values, &xD->report); } @@ -368,7 +368,7 @@ G_message(_("Unused points: %d (out of region)"), out_reg); } - if (xD->phase == 0) { // initial phase: + if (xD->report.write2file == TRUE && xD->phase == 0) { // initial phase: write2file_vector(xD, point); // describe properties } } @@ -433,7 +433,8 @@ fp = fopen(file_name, "r"); if (fp == NULL) { - G_fatal_error(_("Temporary file is missing, please repeat an initial phase...")); + G_fatal_error(_("Temporary file <%s> is missing, please repeat an initial phase..."), + file_name); } else { // file exists: Modified: grass-addons/grass7/vector/v.kriging/main.c =================================================================== --- grass-addons/grass7/vector/v.kriging/main.c 2016-10-04 16:58:17 UTC (rev 69675) +++ grass-addons/grass7/vector/v.kriging/main.c 2016-10-04 19:59:10 UTC (rev 69676) @@ -319,17 +319,27 @@ if (opt.report->answer) { xD.report.write2file = TRUE; xD.report.name = opt.report->answer; - // Do not truncate existing report files - // Some users might not change report file name after initial run - // thus leading to loss of report content of initial run. + + // initial phase: check if the file exists + if (xD.phase == 0 && access(xD.report.name, F_OK) != -1) { + G_fatal_error(_("Report file exists; please set up different name...")); + } + + // middle / final phase: check if file does not exist + if (xD.phase != 0 && access(xD.report.name, F_OK) != 0) { + G_fatal_error(_("Report file does not exist; please check the name or repeat initial phase...")); + } + xD.report.fp = fopen(xD.report.name, "a"); time(&xD.report.now); fprintf(xD.report.fp, "v.kriging started on %s\n\n", ctime(&xD.report.now)); G_message(_("Report is being written to %s..."), xD.report.name); } - else + else { xD.report.write2file = FALSE; + G_warning(_("The name of report file missing...")); + } if (opt.crossvalid->answer) { xD.crossvalid.write2file = TRUE; @@ -349,7 +359,7 @@ if (opt.nL->answer) { // Test if nL have been set up (optional) var_pars.hz.nLag = atoi(opt.nL->answer); - if (var_pars.hz.nLag < 1) { // Invalid value + if (var_pars.hz.nLag < 1) { // Invalid value G_message(_("Number of horizontal pieces must be at least 1. Default value will be used...")); var_pars.hz.nLag = 20; } @@ -424,7 +434,6 @@ } // end if 3D interpolation else { // 2D interpolation: - G_warning(_("Not recommended to process for sparse or spatially heterogeneous data. The result can be inaccurate - trying to solve asap...")); var_pars.vert.nLag = -1; // abs will be used in next steps if (xD.v3 == TRUE) { if (xD.report.write2file == TRUE) { // close report file @@ -464,12 +473,19 @@ } } E_variogram(0, &xD, &pnts, &var_pars); // horizontal variogram (for both 2D and 3D interpolation) - if (xD.i3 == TRUE) { // 3D interpolation: - E_variogram(1, &xD, &pnts, &var_pars); // vertical variogram - G_message(_("You may continue to computing theoretical variograms (middle phase)...")); + + if (xD.report.write2file == FALSE) { + G_message(_("\nExperimental variogram of your data has been computed. To continue interpolation performance, please repeat initial phase with non-empty parameter...")); } + else { - G_message(_("You may continue to computing theoretical variograms (final phase)...")); + if (xD.i3 == TRUE) { // 3D interpolation: + E_variogram(1, &xD, &pnts, &var_pars); // vertical variogram + G_message(_("\nExperimental variogram of your data has been computed. If you wish to continue with theoretical variograms computation (middle phase), please do not erase temporary files and in your working directory. The files are required in the middle phase and they will be deleted automatically.")); + } + else { + G_message(_("\nExperimental variogram of your data has been computed. If you wish to continue with theoretical variogram computation and interpolation (final phase), please do not erase temporary files and in your working directory. The files are required in the final phase and they will be deleted automatically.")); + } } goto end; @@ -614,8 +630,6 @@ } T_variogram(var_pars.fin.type, xD.i3, opt, &var_pars.fin, &xD.report); // compute theoretical variogram - - G_debug(0, "sill: %f", var_pars.fin.sill); break; } Modified: grass-addons/grass7/vector/v.kriging/utils.c =================================================================== --- grass-addons/grass7/vector/v.kriging/utils.c 2016-10-04 16:58:17 UTC (rev 69675) +++ grass-addons/grass7/vector/v.kriging/utils.c 2016-10-04 19:59:10 UTC (rev 69676) @@ -506,7 +506,7 @@ gamma = &gamma_M->vals[0]; // values of gamma matrix - gp = fopen("dataE.dat", "w"); // open file to write experimental variogram + gp = fopen("dataE.dat", "w"); // open file to write experimental variogram (initial phase) if (access("dataE.dat", W_OK) < 0) { G_fatal_error(_("Something went wrong opening tmp file...")); } @@ -588,6 +588,7 @@ "splot 'dataE.dat' every ::1:1 matrix title \"experimental variogram\"\n"); } + // plot experimental variogram else { // univariate variogram char dim[6]; @@ -618,6 +619,10 @@ "plot 'dataE.dat' using 1:2 title \"experimental variogram\" pointtype 5\n"); } fclose(gp); + + if (xD->report.write2file == FALSE) { + remove("dataE.dat"); + } } // plot experimental and theoretical variogram Modified: grass-addons/grass7/vector/v.kriging/utils_kriging.c =================================================================== --- grass-addons/grass7/vector/v.kriging/utils_kriging.c 2016-10-04 16:58:17 UTC (rev 69675) +++ grass-addons/grass7/vector/v.kriging/utils_kriging.c 2016-10-04 19:59:10 UTC (rev 69676) @@ -175,7 +175,7 @@ double diff_sill_05, diff_sill; diff_sill_05 = sill_hz > sill_vert ? 0.05 * sill_hz : 0.05 * sill_vert; // critical value as 5% from bigger sill - diff_sill = fabs(sill_hz - sill_vert); // difference between the sills + diff_sill = fabs(sill_hz - sill_vert); // difference between the sills if (xD->bivar == TRUE || (!flg->univariate->answer && diff_sill > diff_sill_05)) { // zonal anisotropy var_par->fin.type = 2; // code for bivariate variogram @@ -665,7 +665,7 @@ //Create output *norm = rslt_OK - *vals; // differences between input and interpolated values - *av = fabs(*norm); // absolute values of the differences (quantile computation) + *av = fabs(*norm); // absolute values of the differences (quantile computation) if (xD->i3 == TRUE) { // 3D interpolation: fprintf(fp, "%d %.3f %.3f %.2f %f %f %f\n", i, *r, *(r + 1), Modified: grass-addons/grass7/vector/v.kriging/utils_write.c =================================================================== --- grass-addons/grass7/vector/v.kriging/utils_write.c 2016-10-04 16:58:17 UTC (rev 69675) +++ grass-addons/grass7/vector/v.kriging/utils_write.c 2016-10-04 19:59:10 UTC (rev 69676) @@ -234,7 +234,7 @@ switch (type) { case 0: // horizontal variogram fp = fopen("variogram_hz_tmp.txt", "w"); - if (xD->report.name) { // write name of report file + if (xD->report.write2file) { // write name of report file file_length = strlen(xD->report.name); if (file_length < 4) { // 4 types of variogram G_fatal_error(_("File name must contain more than 2 characters...")); // todo: error From svn_grass at osgeo.org Wed Oct 5 17:47:22 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Wed, 5 Oct 2016 17:47:22 -0700 Subject: [GRASS-SVN] r69677 - grass/trunk/display/d.linegraph Message-ID: <20161006004723.1C40B39029E@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-05 17:47:22 -0700 (Wed, 05 Oct 2016) New Revision: 69677 Modified: grass/trunk/display/d.linegraph/main.c Log: d.linegraph: let user provide Y tics [news] Generated tics disabled when user provided. No unlabeled tics generated. Printed as provided by the user (strings, not numbers). Tics out of range simply ignored. This is also a workaround for tics with decimal places (automatic tics work only with integers). Modified: grass/trunk/display/d.linegraph/main.c =================================================================== --- grass/trunk/display/d.linegraph/main.c 2016-10-04 19:59:10 UTC (rev 69676) +++ grass/trunk/display/d.linegraph/main.c 2016-10-06 00:47:22 UTC (rev 69677) @@ -61,6 +61,22 @@ return ((double)(x - y * d)); } +/* TODO: remove constants */ +/* TODO: include X? (common fun for X and Y) */ +static void set_optimal_text_size(double text_width, double text_height, + const char* text, double *tt, double *tb, + double *tl, double *tr) +{ + D_text_size(text_width, text_height); + D_get_text_box(text, tt, tb, tl, tr); + while ((tt - tb) > YTIC_DIST) { + text_width *= 0.75; + text_height *= 0.75; + D_text_size(text_width, text_height); + D_get_text_box(text, tt, tb, tl, tr); + } +} + int main(int argc, char **argv) { double xoffset; /* offset for x-axis */ @@ -121,6 +137,7 @@ struct Option *title[3]; struct Option *t_color_opt; struct Option *y_range_opt; + struct Option *ytics_opt; /* Initialize the GIS calls */ G_gisinit(argv[0]); @@ -211,6 +228,13 @@ y_range_opt->key_desc = "min,max"; y_range_opt->required = NO; + ytics_opt = G_define_option(); + ytics_opt->key = "y_tics"; + ytics_opt->description = _("Tic values for the Y axis"); + ytics_opt->type = TYPE_DOUBLE; + ytics_opt->required = NO; + ytics_opt->multiple = YES; + if (G_parser(argc, argv)) exit(EXIT_FAILURE); @@ -407,6 +431,7 @@ } } + /* TODO: parse range option function */ /* parse and set y min max */ if (y_range_opt->answer != NULL) { /* all checks should be done by the parser */ @@ -608,60 +633,91 @@ tic_every tells how often to place a tic-number. tic_unit tells the unit to use in expressing tic-numbers. */ - if (yscale < YTIC_DIST) { - max_tics = (y_line[1] - y_line[0]) / YTIC_DIST; - i = 1; - while (((max_y - min_y) / tics[i].every) > max_tics) - i++; - tic_every = tics[i].every; - tic_unit = tics[i].unit; - strcpy(tic_name, tics[i].name); - } - else { - tic_every = 1; - tic_unit = 1; - strcpy(tic_name, ""); - } + /* user versus automatic Y tics */ + if (ytics_opt->answer) { + /* user-provided Y tics, no intermediate tics supported */ + char *text; - /* Y-AXIS LOOP */ + i = 0; + while ((text = ytics_opt->answers[i])) { + i++; - for (i = (int)min_y; i <= (int)max_y; i += tic_unit) { - if (rem(i, tic_every) == 0.0) { - /* draw a tic-mark */ + double val = atof(text); + /* using original user's text for the text later */ - D_begin(); - D_move_abs(x_line[0], yoffset - yscale * (i - min_y)); - D_cont_rel(-(r - l) * BIG_TIC, 0); - D_end(); - D_stroke(); + /* for scripting convenience ignore out of range */ + if (val < min_y || val > max_y) { + G_debug(2, "tic %f out of range %f,%f", val, min_y, max_y); + continue; + } + /* we don't care about order, so just continue, not break */ - /* draw a tic-mark number */ + D_begin(); + D_move_abs(x_line[0], yoffset - yscale * val); + D_cont_rel((-(r - l) * BIG_TIC), 0); + D_end(); + D_stroke(); - sprintf(txt, "%d", (i / tic_unit)); - text_height = (b - t) * TEXT_HEIGHT; - text_width = (r - l) * TEXT_WIDTH; - D_text_size(text_width, text_height); - D_get_text_box(txt, &tt, &tb, &tl, &tr); - while ((tt - tb) > YTIC_DIST) { - text_width *= 0.75; - text_height *= 0.75; - D_text_size(text_width, text_height); - D_get_text_box(txt, &tt, &tb, &tl, &tr); - } - D_pos_abs(l + (r - l) * YNUMS_X - (tr - tl) / 2, - yoffset - (yscale * (i - min_y) + 0.5 * (tt - tb))); - D_text(txt); - } - else if (rem(i, tic_unit) == 0.0) { - /* draw a tic-mark */ - D_begin(); - D_move_abs(x_line[0], (yoffset - yscale * (i - min_y))); - D_cont_rel(-(r - l) * SMALL_TIC, 0); - D_end(); - D_stroke(); - } + /* draw a tic-mark number */ + text_height = (b - t) * TEXT_HEIGHT; + text_width = (r - l) * TEXT_WIDTH; + /* this would be useful, but with some other numbers */ + set_optimal_text_size(text_width, text_height, txt, &tt, &tb, &tl, &tr); + D_pos_abs(l + (r - l) * YNUMS_X - (tr - tl) / 2, + yoffset - (yscale * val + 0.5 * (tt - tb))); + D_text(text); + } + /* no automatic tics comment */ + strcpy(tic_name, ""); } + else { + /* automatic Y tics, decimal places (e.g. range 0-1) not supported */ + if (yscale < YTIC_DIST) { + max_tics = (y_line[1] - y_line[0]) / YTIC_DIST; + i = 1; + while (((max_y - min_y) / tics[i].every) > max_tics) + i++; + tic_every = tics[i].every; + tic_unit = tics[i].unit; + strcpy(tic_name, tics[i].name); + } + else { + tic_every = 1; + tic_unit = 1; + strcpy(tic_name, ""); + } + /* Y-AXIS LOOP */ + for (i = (int)min_y; i <= (int)max_y; i += tic_unit) { + if (rem(i, tic_every) == 0.0) { + /* draw a tic-mark */ + D_begin(); + D_move_abs(x_line[0], yoffset - yscale * (i - min_y)); + D_cont_rel(-(r - l) * BIG_TIC, 0); + D_end(); + D_stroke(); + + /* draw a tic-mark number */ + + sprintf(txt, "%d", (i / tic_unit)); + text_height = (b - t) * TEXT_HEIGHT; + text_width = (r - l) * TEXT_WIDTH; + set_optimal_text_size(text_width, text_height, txt, &tt, &tb, &tl, &tr); + D_pos_abs(l + (r - l) * YNUMS_X - (tr - tl) / 2, + yoffset - (yscale * (i - min_y) + 0.5 * (tt - tb))); + D_text(txt); + } + else if (rem(i, tic_unit) == 0.0) { + /* draw a tic-mark */ + D_begin(); + D_move_abs(x_line[0], (yoffset - yscale * (i - min_y))); + D_cont_rel(-(r - l) * SMALL_TIC, 0); + D_end(); + D_stroke(); + } + } + } + /* draw the y-axis label */ if ((strcmp(title[1]->answer, "") == 0) && (strcmp(tic_name, "") == 0)) *xlabel = '\0'; From svn_grass at osgeo.org Wed Oct 5 19:19:45 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Wed, 5 Oct 2016 19:19:45 -0700 Subject: [GRASS-SVN] r69678 - grass/trunk/lib/python/ctypes Message-ID: <20161006021945.B059839029E@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-05 19:19:45 -0700 (Wed, 05 Oct 2016) New Revision: 69678 Modified: grass/trunk/lib/python/ctypes/Makefile Log: ctypes: colors.h is also part of gis library (lib/gis) Modified: grass/trunk/lib/python/ctypes/Makefile =================================================================== --- grass/trunk/lib/python/ctypes/Makefile 2016-10-06 00:47:22 UTC (rev 69677) +++ grass/trunk/lib/python/ctypes/Makefile 2016-10-06 02:19:45 UTC (rev 69678) @@ -32,7 +32,7 @@ temporal_LIBS = $(TEMPORALLIB) date_HDRS = datetime.h defs/datetime.h -gis_HDRS = gis.h defs/gis.h +gis_HDRS = gis.h defs/gis.h colors.h defs/colors.h raster_HDRS = raster.h defs/raster.h gmath_HDRS = gmath.h defs/gmath.h proj_HDRS = gprojects.h defs/gprojects.h From svn_grass at osgeo.org Thu Oct 6 01:10:52 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Thu, 6 Oct 2016 01:10:52 -0700 Subject: [GRASS-SVN] r69679 - in grass-addons/grass7/vector: . v.in.survey v.in.survey/.git v.in.survey/.git/hooks v.in.survey/.git/info v.in.survey/.git/logs v.in.survey/.git/logs/refs v.in.survey/.git/logs/refs/heads v.in.survey/.git/objects v.in.survey/.git/objects/03 v.in.survey/.git/objects/0a v.in.survey/.git/objects/10 v.in.survey/.git/objects/12 v.in.survey/.git/objects/13 v.in.survey/.git/objects/14 v.in.survey/.git/objects/1c v.in.survey/.git/objects/1d v.in.survey/.git/objects/1e v.in.survey/.git/objects/1f v.in.survey/.git/objects/27 v.in.survey/.git/objects/2b v.in.survey/.git/objects/32 v.in.survey/.git/objects/38 v.in.survey/.git/objects/44 v.in.survey/.git/objects/45 v.in.survey/.git/objects/47 v.in.survey/.git/objects/4b v.in.survey/.git/objects/50 v.in.survey/.git/objects/52 v.in.survey/.git/objects/54 v.in.survey/.git/objects/56 v.in.survey/.git/objects/5e v.in.survey/.git/objects/61 v.in.survey/.git/objects/64 v.in.survey/.git/objects/68 v.in.survey/.git/objects/6a v.in.surve y/.git/objects/6d v.in.survey/.git/objects/76 v.in.survey/.git/objects/81 v.in.survey/.git/objects/89 v.in.survey/.git/objects/8b v.in.survey/.git/objects/90 v.in.survey/.git/objects/94 v.in.survey/.git/objects/95 v.in.survey/.git/objects/98 v.in.survey/.git/objects/9a v.in.survey/.git/objects/9b v.in.survey/.git/objects/9e v.in.survey/.git/objects/a9 v.in.survey/.git/objects/b0 v.in.survey/.git/objects/b2 v.in.survey/.git/objects/b6 v.in.survey/.git/objects/b8 v.in.survey/.git/objects/c0 v.in.survey/.git/objects/c5 v.in.survey/.git/objects/c8 v.in.survey/.git/objects/c9 v.in.survey/.git/objects/ca v.in.survey/.git/objects/cc v.in.survey/.git/objects/d1 v.in.survey/.git/objects/d8 v.in.survey/.git/objects/e3 v.in.survey/.git/objects/e6 v.in.survey/.git/objects/eb v.in.survey/.git/objects/f1 v.in.survey/.git/objects/f2 v.in.survey/.git/objects/f7 v.in.survey/.git/objects/f9 v.in.survey/.git/objects/fd v.in.survey/.git/objects/fe v.in.survey/.git/refs v.in.survey/.git/refs/heads Message-ID: <20161006081052.7029839029E@trac.osgeo.org> Author: evas Date: 2016-10-06 01:10:51 -0700 (Thu, 06 Oct 2016) New Revision: 69679 Added: grass-addons/grass7/vector/v.in.survey/ grass-addons/grass7/vector/v.in.survey/.git/ grass-addons/grass7/vector/v.in.survey/.git/COMMIT_EDITMSG grass-addons/grass7/vector/v.in.survey/.git/HEAD grass-addons/grass7/vector/v.in.survey/.git/branches/ grass-addons/grass7/vector/v.in.survey/.git/config grass-addons/grass7/vector/v.in.survey/.git/description grass-addons/grass7/vector/v.in.survey/.git/hooks/ grass-addons/grass7/vector/v.in.survey/.git/hooks/applypatch-msg.sample grass-addons/grass7/vector/v.in.survey/.git/hooks/commit-msg.sample grass-addons/grass7/vector/v.in.survey/.git/hooks/post-update.sample grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-applypatch.sample grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-commit.sample grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-push.sample grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-rebase.sample grass-addons/grass7/vector/v.in.survey/.git/hooks/prepare-commit-msg.sample grass-addons/grass7/vector/v.in.survey/.git/hooks/update.sample grass-addons/grass7/vector/v.in.survey/.git/index grass-addons/grass7/vector/v.in.survey/.git/info/ grass-addons/grass7/vector/v.in.survey/.git/info/exclude grass-addons/grass7/vector/v.in.survey/.git/logs/ grass-addons/grass7/vector/v.in.survey/.git/logs/HEAD grass-addons/grass7/vector/v.in.survey/.git/logs/refs/ grass-addons/grass7/vector/v.in.survey/.git/logs/refs/heads/ grass-addons/grass7/vector/v.in.survey/.git/logs/refs/heads/master grass-addons/grass7/vector/v.in.survey/.git/objects/ grass-addons/grass7/vector/v.in.survey/.git/objects/03/ grass-addons/grass7/vector/v.in.survey/.git/objects/03/28fae983785eef93612c23f7b9efb4269378c4 grass-addons/grass7/vector/v.in.survey/.git/objects/0a/ grass-addons/grass7/vector/v.in.survey/.git/objects/0a/20261bf39392492e1c0e6be2444ca2702f9228 grass-addons/grass7/vector/v.in.survey/.git/objects/10/ grass-addons/grass7/vector/v.in.survey/.git/objects/10/0b0e0b91fce8b1fd37494573a4208abe359877 grass-addons/grass7/vector/v.in.survey/.git/objects/12/ grass-addons/grass7/vector/v.in.survey/.git/objects/12/987fe9d1f8e1c415b87ad55194c489f651d94f grass-addons/grass7/vector/v.in.survey/.git/objects/13/ grass-addons/grass7/vector/v.in.survey/.git/objects/13/cf1869a8db284e373bc99b86d794cb1ecff6db grass-addons/grass7/vector/v.in.survey/.git/objects/14/ grass-addons/grass7/vector/v.in.survey/.git/objects/14/0d32355a20862ecf5006f758cd97d6dfaa6681 grass-addons/grass7/vector/v.in.survey/.git/objects/1c/ grass-addons/grass7/vector/v.in.survey/.git/objects/1c/f2c35cf7858257f1ba0f33e349f89efc172a4e grass-addons/grass7/vector/v.in.survey/.git/objects/1d/ grass-addons/grass7/vector/v.in.survey/.git/objects/1d/3f5c44bb7c53c45f0b69311cbfc5c872abc411 grass-addons/grass7/vector/v.in.survey/.git/objects/1e/ grass-addons/grass7/vector/v.in.survey/.git/objects/1e/094956288d0b9b35c7682cc34e86f44517f1cc grass-addons/grass7/vector/v.in.survey/.git/objects/1f/ grass-addons/grass7/vector/v.in.survey/.git/objects/1f/c94a337a764cb2c5aba6e9bf404476bf1c38f8 grass-addons/grass7/vector/v.in.survey/.git/objects/27/ grass-addons/grass7/vector/v.in.survey/.git/objects/27/71f37ea094be36070f61196c5694c25b363aeb grass-addons/grass7/vector/v.in.survey/.git/objects/27/abd2678f662aa3cc76c844ddacd750b19ed86a grass-addons/grass7/vector/v.in.survey/.git/objects/2b/ grass-addons/grass7/vector/v.in.survey/.git/objects/2b/cba6a995c70ae8e267f4f2aebcb6babd84e906 grass-addons/grass7/vector/v.in.survey/.git/objects/32/ grass-addons/grass7/vector/v.in.survey/.git/objects/32/fa2414088a109757202c2888a0a7b5380d682b grass-addons/grass7/vector/v.in.survey/.git/objects/38/ grass-addons/grass7/vector/v.in.survey/.git/objects/38/a1aac24671d12daf6b10f59cfcbbb18a05c97b grass-addons/grass7/vector/v.in.survey/.git/objects/44/ grass-addons/grass7/vector/v.in.survey/.git/objects/44/a823d4adb6ec9363ecd8535d703874766ab34d grass-addons/grass7/vector/v.in.survey/.git/objects/45/ grass-addons/grass7/vector/v.in.survey/.git/objects/45/b68b812f9a07b730e8cfdef72ca804e031b601 grass-addons/grass7/vector/v.in.survey/.git/objects/47/ grass-addons/grass7/vector/v.in.survey/.git/objects/47/77b40edeac5a4da02f1ba442f8192ed0733fd0 grass-addons/grass7/vector/v.in.survey/.git/objects/4b/ grass-addons/grass7/vector/v.in.survey/.git/objects/4b/c8ad006bead1c7840940e53da707c48dbda829 grass-addons/grass7/vector/v.in.survey/.git/objects/4b/c90dafb77214b42800624dbd3e94914615518f grass-addons/grass7/vector/v.in.survey/.git/objects/50/ grass-addons/grass7/vector/v.in.survey/.git/objects/50/e24814464b538174b07b2c0b1c14835cc84542 grass-addons/grass7/vector/v.in.survey/.git/objects/52/ grass-addons/grass7/vector/v.in.survey/.git/objects/52/ad200e6377a7af0ec5a97ed83e72dc7a451207 grass-addons/grass7/vector/v.in.survey/.git/objects/54/ grass-addons/grass7/vector/v.in.survey/.git/objects/54/afda083a48e8ac3046af1b9e5b843f265b5b22 grass-addons/grass7/vector/v.in.survey/.git/objects/56/ grass-addons/grass7/vector/v.in.survey/.git/objects/56/cffcf896f336800b771623941a52e12c9d683d grass-addons/grass7/vector/v.in.survey/.git/objects/5e/ grass-addons/grass7/vector/v.in.survey/.git/objects/5e/94212cde10625fed27404117d098b64bd7f312 grass-addons/grass7/vector/v.in.survey/.git/objects/61/ grass-addons/grass7/vector/v.in.survey/.git/objects/61/32e33f678d5f37a25e8535fb946fd4e7912763 grass-addons/grass7/vector/v.in.survey/.git/objects/64/ grass-addons/grass7/vector/v.in.survey/.git/objects/64/5df46b073f13bcfdcc80eb0bd16abcd9e9c071 grass-addons/grass7/vector/v.in.survey/.git/objects/68/ grass-addons/grass7/vector/v.in.survey/.git/objects/68/6f39815237bf23ba2bf93fc87e2c9a272c7e18 grass-addons/grass7/vector/v.in.survey/.git/objects/6a/ grass-addons/grass7/vector/v.in.survey/.git/objects/6a/793b2b7cf9f8c55b211c3f95eccd8d7816eb09 grass-addons/grass7/vector/v.in.survey/.git/objects/6d/ grass-addons/grass7/vector/v.in.survey/.git/objects/6d/09b36e2a98eab26e006bae916c71c290971d29 grass-addons/grass7/vector/v.in.survey/.git/objects/76/ grass-addons/grass7/vector/v.in.survey/.git/objects/76/79e538a9038c95c3af4911e7cd5cbd6c20d766 grass-addons/grass7/vector/v.in.survey/.git/objects/81/ grass-addons/grass7/vector/v.in.survey/.git/objects/81/0a8b4e6765eb13f3aead825c8488aab82033d9 grass-addons/grass7/vector/v.in.survey/.git/objects/81/e7cfa645454bf4af46fc909a4e5b53ddfb9f21 grass-addons/grass7/vector/v.in.survey/.git/objects/89/ grass-addons/grass7/vector/v.in.survey/.git/objects/89/d550f0b780d02a3c9623d907738bf3fecb65b2 grass-addons/grass7/vector/v.in.survey/.git/objects/8b/ grass-addons/grass7/vector/v.in.survey/.git/objects/8b/0f3871ddde717951439240ee70514b2530e1d7 grass-addons/grass7/vector/v.in.survey/.git/objects/8b/9b85886087307927dde24f4db139837580c596 grass-addons/grass7/vector/v.in.survey/.git/objects/90/ grass-addons/grass7/vector/v.in.survey/.git/objects/90/d7c3aea2324a6a16160aa6f79d132225994f29 grass-addons/grass7/vector/v.in.survey/.git/objects/94/ grass-addons/grass7/vector/v.in.survey/.git/objects/94/2d9c5414c63ff83b6139d4985d5e0352e245e6 grass-addons/grass7/vector/v.in.survey/.git/objects/94/6f266a701e10a46e2828273b5c7ea27a2a6bc6 grass-addons/grass7/vector/v.in.survey/.git/objects/94/79d9fc8a6f87e071d6810a30fa22618ee2ef8e grass-addons/grass7/vector/v.in.survey/.git/objects/95/ grass-addons/grass7/vector/v.in.survey/.git/objects/95/0c044a9ab4eab5ae0a4988842b6e8ef42e05af grass-addons/grass7/vector/v.in.survey/.git/objects/98/ grass-addons/grass7/vector/v.in.survey/.git/objects/98/d4874af604cfb48481607d7cc822e7f86d3eb1 grass-addons/grass7/vector/v.in.survey/.git/objects/9a/ grass-addons/grass7/vector/v.in.survey/.git/objects/9a/bbdab7fc3c6c0c7318646a33bfa2b9ed010092 grass-addons/grass7/vector/v.in.survey/.git/objects/9b/ grass-addons/grass7/vector/v.in.survey/.git/objects/9b/d6fb785cf42f4fa9503df685549bcfb62502d3 grass-addons/grass7/vector/v.in.survey/.git/objects/9e/ grass-addons/grass7/vector/v.in.survey/.git/objects/9e/b93615ad4238ddf41e79d948bab8ce6c04c8ec grass-addons/grass7/vector/v.in.survey/.git/objects/9e/c94a321cfffc2e94cf4ca8c1b5ee9661d7add6 grass-addons/grass7/vector/v.in.survey/.git/objects/a9/ grass-addons/grass7/vector/v.in.survey/.git/objects/a9/fef768f80c1340fec52ea6b251b285644805e2 grass-addons/grass7/vector/v.in.survey/.git/objects/b0/ grass-addons/grass7/vector/v.in.survey/.git/objects/b0/f02a774ffefed15ff60439ad3e2064df21d07d grass-addons/grass7/vector/v.in.survey/.git/objects/b2/ grass-addons/grass7/vector/v.in.survey/.git/objects/b2/7f9e6669b4c206c62f67993b98fa40823215d6 grass-addons/grass7/vector/v.in.survey/.git/objects/b6/ grass-addons/grass7/vector/v.in.survey/.git/objects/b6/26a08c65d66e548c2ce42b05c9ab9663b54d3b grass-addons/grass7/vector/v.in.survey/.git/objects/b8/ grass-addons/grass7/vector/v.in.survey/.git/objects/b8/1e3d2c4240b3e6d1b8a7b288cab69966673d98 grass-addons/grass7/vector/v.in.survey/.git/objects/b8/4d653a23d831b724b1b61516da7ff323d9d940 grass-addons/grass7/vector/v.in.survey/.git/objects/c0/ grass-addons/grass7/vector/v.in.survey/.git/objects/c0/a61d094163d7589a536662f685f7cfd849342e grass-addons/grass7/vector/v.in.survey/.git/objects/c5/ grass-addons/grass7/vector/v.in.survey/.git/objects/c5/35d0aedb835e67d376dd225113f892cc878b50 grass-addons/grass7/vector/v.in.survey/.git/objects/c8/ grass-addons/grass7/vector/v.in.survey/.git/objects/c8/88042305ea8569822d9f4290fc8251bbd65153 grass-addons/grass7/vector/v.in.survey/.git/objects/c9/ grass-addons/grass7/vector/v.in.survey/.git/objects/c9/8775a04dd598d4cf71f2c0f27611dd67e3796d grass-addons/grass7/vector/v.in.survey/.git/objects/ca/ grass-addons/grass7/vector/v.in.survey/.git/objects/ca/e391ba56ddf8c453a66ee33a08e9e77a4e3535 grass-addons/grass7/vector/v.in.survey/.git/objects/cc/ grass-addons/grass7/vector/v.in.survey/.git/objects/cc/187a168e12c5f32d95bcd6e728eeeec8ab31e4 grass-addons/grass7/vector/v.in.survey/.git/objects/d1/ grass-addons/grass7/vector/v.in.survey/.git/objects/d1/641c1c9232a196e4c1d7bc59b710177220c0bd grass-addons/grass7/vector/v.in.survey/.git/objects/d1/efbf0b31256b58223225c6d4d269288dcdfec7 grass-addons/grass7/vector/v.in.survey/.git/objects/d8/ grass-addons/grass7/vector/v.in.survey/.git/objects/d8/30fc068890077db2155730c18a2f1b1b6f909c grass-addons/grass7/vector/v.in.survey/.git/objects/e3/ grass-addons/grass7/vector/v.in.survey/.git/objects/e3/bb8c5317aa8c7afaae35f7e67cbc8e5446108f grass-addons/grass7/vector/v.in.survey/.git/objects/e6/ grass-addons/grass7/vector/v.in.survey/.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 grass-addons/grass7/vector/v.in.survey/.git/objects/eb/ grass-addons/grass7/vector/v.in.survey/.git/objects/eb/bad8aae651ceaafb56abbb12604f787fb59b82 grass-addons/grass7/vector/v.in.survey/.git/objects/f1/ grass-addons/grass7/vector/v.in.survey/.git/objects/f1/9898d403ef60db5a15faed5015198b45c48c61 grass-addons/grass7/vector/v.in.survey/.git/objects/f2/ grass-addons/grass7/vector/v.in.survey/.git/objects/f2/87b6df2a101d7b8f8d365550ce6cfa5b2d1253 grass-addons/grass7/vector/v.in.survey/.git/objects/f7/ grass-addons/grass7/vector/v.in.survey/.git/objects/f7/0f28e6d63fb05696616ad6ba48f6b823cac61c grass-addons/grass7/vector/v.in.survey/.git/objects/f9/ grass-addons/grass7/vector/v.in.survey/.git/objects/f9/f9e416403d8e2273aac25a243413d45d6dda6b grass-addons/grass7/vector/v.in.survey/.git/objects/fd/ grass-addons/grass7/vector/v.in.survey/.git/objects/fd/9e641f0fd181d86e38f7168184c2c7b3394ec0 grass-addons/grass7/vector/v.in.survey/.git/objects/fe/ grass-addons/grass7/vector/v.in.survey/.git/objects/fe/b9a2564a54affb7a9ad4201b08c5d37add9efb grass-addons/grass7/vector/v.in.survey/.git/objects/info/ grass-addons/grass7/vector/v.in.survey/.git/objects/pack/ grass-addons/grass7/vector/v.in.survey/.git/refs/ grass-addons/grass7/vector/v.in.survey/.git/refs/heads/ grass-addons/grass7/vector/v.in.survey/.git/refs/heads/master grass-addons/grass7/vector/v.in.survey/.git/refs/tags/ grass-addons/grass7/vector/v.in.survey/.gitignore grass-addons/grass7/vector/v.in.survey/Makefile grass-addons/grass7/vector/v.in.survey/img_NC_dxf.png grass-addons/grass7/vector/v.in.survey/img_lyrs_broken.png grass-addons/grass7/vector/v.in.survey/img_soils_correct.png grass-addons/grass7/vector/v.in.survey/img_sorted_boundaries.png grass-addons/grass7/vector/v.in.survey/v.in.survey.html grass-addons/grass7/vector/v.in.survey/v.in.survey.py Log: v.in.survey: script for automatic import of coded surveying data Added: grass-addons/grass7/vector/v.in.survey/.git/COMMIT_EDITMSG =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/COMMIT_EDITMSG (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/COMMIT_EDITMSG 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1 @@ +dxf done Added: grass-addons/grass7/vector/v.in.survey/.git/HEAD =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/HEAD (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/HEAD 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1 @@ +ref: refs/heads/master Added: grass-addons/grass7/vector/v.in.survey/.git/config =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/config (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/config 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,5 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true Added: grass-addons/grass7/vector/v.in.survey/.git/description =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/description (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/description 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. Added: grass-addons/grass7/vector/v.in.survey/.git/hooks/applypatch-msg.sample =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/hooks/applypatch-msg.sample (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/hooks/applypatch-msg.sample 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +test -x "$GIT_DIR/hooks/commit-msg" && + exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} +: Property changes on: grass-addons/grass7/vector/v.in.survey/.git/hooks/applypatch-msg.sample ___________________________________________________________________ Added: svn:executable + * Added: grass-addons/grass7/vector/v.in.survey/.git/hooks/commit-msg.sample =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/hooks/commit-msg.sample (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/hooks/commit-msg.sample 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} Property changes on: grass-addons/grass7/vector/v.in.survey/.git/hooks/commit-msg.sample ___________________________________________________________________ Added: svn:executable + * Added: grass-addons/grass7/vector/v.in.survey/.git/hooks/post-update.sample =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/hooks/post-update.sample (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/hooks/post-update.sample 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info Property changes on: grass-addons/grass7/vector/v.in.survey/.git/hooks/post-update.sample ___________________________________________________________________ Added: svn:executable + * Added: grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-applypatch.sample =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-applypatch.sample (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-applypatch.sample 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"} +: Property changes on: grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-applypatch.sample ___________________________________________________________________ Added: svn:executable + * Added: grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-commit.sample =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-commit.sample (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-commit.sample 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- Property changes on: grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-commit.sample ___________________________________________________________________ Added: svn:executable + * Added: grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-push.sample =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-push.sample (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-push.sample 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,54 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +IFS=' ' +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 Property changes on: grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-push.sample ___________________________________________________________________ Added: svn:executable + * Added: grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-rebase.sample =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-rebase.sample (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-rebase.sample 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up-to-date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END Property changes on: grass-addons/grass7/vector/v.in.survey/.git/hooks/pre-rebase.sample ___________________________________________________________________ Added: svn:executable + * Added: grass-addons/grass7/vector/v.in.survey/.git/hooks/prepare-commit-msg.sample =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/hooks/prepare-commit-msg.sample (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/hooks/prepare-commit-msg.sample 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,36 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first comments out the +# "Conflicts:" part of a merge commit. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +case "$2,$3" in + merge,) + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; + +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$1" ;; + + *) ;; +esac + +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" Property changes on: grass-addons/grass7/vector/v.in.survey/.git/hooks/prepare-commit-msg.sample ___________________________________________________________________ Added: svn:executable + * Added: grass-addons/grass7/vector/v.in.survey/.git/hooks/update.sample =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/hooks/update.sample (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/hooks/update.sample 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to blocks unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 Property changes on: grass-addons/grass7/vector/v.in.survey/.git/hooks/update.sample ___________________________________________________________________ Added: svn:executable + * Added: grass-addons/grass7/vector/v.in.survey/.git/index =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/index ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/info/exclude =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/info/exclude (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/info/exclude 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ Added: grass-addons/grass7/vector/v.in.survey/.git/logs/HEAD =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/logs/HEAD (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/logs/HEAD 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,5 @@ +0000000000000000000000000000000000000000 9abbdab7fc3c6c0c7318646a33bfa2b9ed010092 Eva 1448300065 +0100 commit (initial): v.in.ascii.multiple: initial commit +9abbdab7fc3c6c0c7318646a33bfa2b9ed010092 946f266a701e10a46e2828273b5c7ea27a2a6bc6 Eva 1448316749 +0100 commit: v.in.ascii.multiple: sorted functions, improved comments +946f266a701e10a46e2828273b5c7ea27a2a6bc6 c535d0aedb835e67d376dd225113f892cc878b50 Eva 1448370564 +0100 commit: v.in.ascii_multiple: fixed line issues +c535d0aedb835e67d376dd225113f892cc878b50 50e24814464b538174b07b2c0b1c14835cc84542 Eva 1448908842 +0100 commit: v.in.surveying: First version to publish +50e24814464b538174b07b2c0b1c14835cc84542 27abd2678f662aa3cc76c844ddacd750b19ed86a Eva 1452302398 +0100 commit: dxf done Added: grass-addons/grass7/vector/v.in.survey/.git/logs/refs/heads/master =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/logs/refs/heads/master (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/logs/refs/heads/master 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,5 @@ +0000000000000000000000000000000000000000 9abbdab7fc3c6c0c7318646a33bfa2b9ed010092 Eva 1448300065 +0100 commit (initial): v.in.ascii.multiple: initial commit +9abbdab7fc3c6c0c7318646a33bfa2b9ed010092 946f266a701e10a46e2828273b5c7ea27a2a6bc6 Eva 1448316749 +0100 commit: v.in.ascii.multiple: sorted functions, improved comments +946f266a701e10a46e2828273b5c7ea27a2a6bc6 c535d0aedb835e67d376dd225113f892cc878b50 Eva 1448370564 +0100 commit: v.in.ascii_multiple: fixed line issues +c535d0aedb835e67d376dd225113f892cc878b50 50e24814464b538174b07b2c0b1c14835cc84542 Eva 1448908842 +0100 commit: v.in.surveying: First version to publish +50e24814464b538174b07b2c0b1c14835cc84542 27abd2678f662aa3cc76c844ddacd750b19ed86a Eva 1452302398 +0100 commit: dxf done Added: grass-addons/grass7/vector/v.in.survey/.git/objects/03/28fae983785eef93612c23f7b9efb4269378c4 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/03/28fae983785eef93612c23f7b9efb4269378c4 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/0a/20261bf39392492e1c0e6be2444ca2702f9228 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/0a/20261bf39392492e1c0e6be2444ca2702f9228 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/10/0b0e0b91fce8b1fd37494573a4208abe359877 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/10/0b0e0b91fce8b1fd37494573a4208abe359877 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/12/987fe9d1f8e1c415b87ad55194c489f651d94f =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/12/987fe9d1f8e1c415b87ad55194c489f651d94f ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/13/cf1869a8db284e373bc99b86d794cb1ecff6db =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/13/cf1869a8db284e373bc99b86d794cb1ecff6db ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/14/0d32355a20862ecf5006f758cd97d6dfaa6681 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/14/0d32355a20862ecf5006f758cd97d6dfaa6681 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/1c/f2c35cf7858257f1ba0f33e349f89efc172a4e =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/1c/f2c35cf7858257f1ba0f33e349f89efc172a4e ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/1d/3f5c44bb7c53c45f0b69311cbfc5c872abc411 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/1d/3f5c44bb7c53c45f0b69311cbfc5c872abc411 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/1e/094956288d0b9b35c7682cc34e86f44517f1cc =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/1e/094956288d0b9b35c7682cc34e86f44517f1cc ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/1f/c94a337a764cb2c5aba6e9bf404476bf1c38f8 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/1f/c94a337a764cb2c5aba6e9bf404476bf1c38f8 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/27/71f37ea094be36070f61196c5694c25b363aeb =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/27/71f37ea094be36070f61196c5694c25b363aeb ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/27/abd2678f662aa3cc76c844ddacd750b19ed86a =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/objects/27/abd2678f662aa3cc76c844ddacd750b19ed86a (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/objects/27/abd2678f662aa3cc76c844ddacd750b19ed86a 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,3 @@ +x��M +�0@a�9�셒I&�D�x���h�Rc��� +n|�Ro�1@�>��H�1� )g�]�T�J�*��9[.���b k�Y9$��v�%�DLHN��R"|ƽ�p������˳o�rk��Rog at 2JK����D)�^��Q�u"+�>��A@ \ No newline at end of file Added: grass-addons/grass7/vector/v.in.survey/.git/objects/2b/cba6a995c70ae8e267f4f2aebcb6babd84e906 =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/objects/2b/cba6a995c70ae8e267f4f2aebcb6babd84e906 (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/objects/2b/cba6a995c70ae8e267f4f2aebcb6babd84e906 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,2 @@ +x]Ͻ +1 �aꛂ,˿�3ljN�HH�_�(���>^��.����A������X E�1l�F�'r�FU�q���2�e�zͫ�2I,[Ζ-Ƨ�2��c�ie��i��Y������}mK+����h�X�0ؾ0�@� \ No newline at end of file Added: grass-addons/grass7/vector/v.in.survey/.git/objects/32/fa2414088a109757202c2888a0a7b5380d682b =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/32/fa2414088a109757202c2888a0a7b5380d682b ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/38/a1aac24671d12daf6b10f59cfcbbb18a05c97b =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/38/a1aac24671d12daf6b10f59cfcbbb18a05c97b ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/44/a823d4adb6ec9363ecd8535d703874766ab34d =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/44/a823d4adb6ec9363ecd8535d703874766ab34d ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/45/b68b812f9a07b730e8cfdef72ca804e031b601 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/45/b68b812f9a07b730e8cfdef72ca804e031b601 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/47/77b40edeac5a4da02f1ba442f8192ed0733fd0 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/47/77b40edeac5a4da02f1ba442f8192ed0733fd0 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/4b/c8ad006bead1c7840940e53da707c48dbda829 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/4b/c8ad006bead1c7840940e53da707c48dbda829 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/4b/c90dafb77214b42800624dbd3e94914615518f =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/4b/c90dafb77214b42800624dbd3e94914615518f ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/50/e24814464b538174b07b2c0b1c14835cc84542 =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/objects/50/e24814464b538174b07b2c0b1c14835cc84542 (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/objects/50/e24814464b538174b07b2c0b1c14835cc84542 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1 @@ +x��Mj�0@�u���F?�\J�&��H'��e$Y��7W���/�m����2���DQ��aB�h���.q�!�$m\\U�;D�m��)xmyvI�9%�,�^��b��+��Y*���Z/�Ot{l�_S,���H�D)Ż��:�׉1�}jg����'|��: �-�z�� �ܞ��=OQ \ No newline at end of file Added: grass-addons/grass7/vector/v.in.survey/.git/objects/52/ad200e6377a7af0ec5a97ed83e72dc7a451207 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/52/ad200e6377a7af0ec5a97ed83e72dc7a451207 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/54/afda083a48e8ac3046af1b9e5b843f265b5b22 =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/objects/54/afda083a48e8ac3046af1b9e5b843f265b5b22 (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/objects/54/afda083a48e8ac3046af1b9e5b843f265b5b22 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,3 @@ +x]�IN1 DY#qYN�x8�_�CB�� ��gH/[z)W�ݷ���s�|xy5�w�}���֜�� emJkh{z�njd̥�ދy0�T�9u:�C�����ɘq1&�L��YM�4����Y,'NV��=�qѱ�A�Gy�H�O/Fv���G�~��v�gJz�'���T?z�G:b�I?uv?r����<<4���dzѩ~|������o�����Y�xB�/:wZH�� +g?q�AX'�}쩣;ݳ���͸�,?�tN�/�,!�ܗ�B��S:�f��#4�gL>�������;t擑�S�$��ez�+�Ѽ�I�� +M�$H"s���|L�l3�%�f��� g�N�K�A�\��g��~w�d2�7���0 \ No newline at end of file Added: grass-addons/grass7/vector/v.in.survey/.git/objects/56/cffcf896f336800b771623941a52e12c9d683d =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/56/cffcf896f336800b771623941a52e12c9d683d ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/5e/94212cde10625fed27404117d098b64bd7f312 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/5e/94212cde10625fed27404117d098b64bd7f312 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/61/32e33f678d5f37a25e8535fb946fd4e7912763 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/61/32e33f678d5f37a25e8535fb946fd4e7912763 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/64/5df46b073f13bcfdcc80eb0bd16abcd9e9c071 =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/objects/64/5df46b073f13bcfdcc80eb0bd16abcd9e9c071 (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/objects/64/5df46b073f13bcfdcc80eb0bd16abcd9e9c071 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,6 @@ +x]�� +1 P�[XV���: +DpCB��q��������ga>]��Ű�nX��IAC�ۿah���a���Hoz����7�� }���bq�����2�'OJ�*e�҆@�\;�6؀Ԣ��:�x�BX ��}��;\����6��)nx���1� \ No newline at end of file Added: grass-addons/grass7/vector/v.in.survey/.git/objects/81/e7cfa645454bf4af46fc909a4e5b53ddfb9f21 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/81/e7cfa645454bf4af46fc909a4e5b53ddfb9f21 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/89/d550f0b780d02a3c9623d907738bf3fecb65b2 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/89/d550f0b780d02a3c9623d907738bf3fecb65b2 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/8b/0f3871ddde717951439240ee70514b2530e1d7 =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/objects/8b/0f3871ddde717951439240ee70514b2530e1d7 (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/objects/8b/0f3871ddde717951439240ee70514b2530e1d7 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,15 @@ +x}X�vG ��_��Eף{��&�crl�`�sl3`&�a|~$]��iBv��z\=JU��vw�똧�4P�����\�����Cw%����i�o�����WW�5�����},Swv���A7���p�^]�O�w>K�������nk���|����{_��y� �ȶ�[P�` @�����y��~��>5��(4�_5��}9�~ެ��m� +=R7�og��=��� �1�xn8���N�u��;"O�м*@� +�ڋn�ƛlҚ�Zo���D�,7(?-�&�~"D���G���ɫ�#^�LDȕ�QC�}���fj�}l�񖡫8R��;��ަ��H�Ml�El�j;�;R�9�Q�&o���2B�(��k�G� h2N�D��e�-<���yT��pSK8�����Ą��6"CPIo� K�EB�|��@@S��5k�S٬k2�M�г�)#�Pp���l RZq A:��oFQ�т� +=LE�Pz4 =L�-#�����#_�����a�������D����Ҟ����� �A�@��@�!�K�!��C�:�_���BذC��ɠ,t Y�(.!'��3ɴ��� ̈́�X�z��za* <z8o&#�*��-��� �G���j�K��"!U�Jۄ�(��LN#o�&�b$F]�_A�jBj5TVi0���J�E� .&�H �Z�����8l�Y96{4k��/�Jbt��<:��Ǯ�}z��o�L�E��lZ@����M�#q@���8@��.�ׇ����������I�� ��������?F,FA�L�ې~۽����~<�"Clڣ��I�K���^`���#Fk�f8L!���{�;���ˡy)}ws�����?K��bV?�g��� Z-�.N�4)z$~��n�ڄ��p��,U� 2��/֩[y \ No newline at end of file Added: grass-addons/grass7/vector/v.in.survey/.git/objects/8b/9b85886087307927dde24f4db139837580c596 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/8b/9b85886087307927dde24f4db139837580c596 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/90/d7c3aea2324a6a16160aa6f79d132225994f29 =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/objects/90/d7c3aea2324a6a16160aa6f79d132225994f29 (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/objects/90/d7c3aea2324a6a16160aa6f79d132225994f29 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,2 @@ +xe�;�0 `朢��؎�����*F$$�?�]Z�O�c~�����~9����� ˊ�����R# �( ��ac$�9�F�Hۚ�eb�ڬ�RvF��a�EΟ�a��� +��c��k�z7Rw]m�z�q ce��ˆ.�Y��J�~0~C \ No newline at end of file Added: grass-addons/grass7/vector/v.in.survey/.git/objects/94/2d9c5414c63ff83b6139d4985d5e0352e245e6 =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/objects/94/2d9c5414c63ff83b6139d4985d5e0352e245e6 (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/objects/94/2d9c5414c63ff83b6139d4985d5e0352e245e6 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,4 @@ +xUQ�n�@�3_���`� �V�FErm�9qbl�o�r,p�qG���L�<�vvnvv6*�����X�0���c��g�v�ʠu�t�f��)ax%ȟYxY)mj���ɴ*ao�2.,��%f��g�5� +�$D�&4�6F�h8C!΀�)�r����k�Ēj��z +��^va<��~����?O�n_�a�]��a�U���YY#��Jڨ��&�g�R��4�*mՀ���>�D�,mƏ`�F�tPB9���Qe��ʄ�����".�*ƃ�8MmԂ�g�N���?�� �:=펊��d#�$Y���;�:~e���k�@�S���=� +�|y�}���0�[-�W�o��[xL�Fހ��Ӧpݩ�x�ݧ \ No newline at end of file Added: grass-addons/grass7/vector/v.in.survey/.git/objects/94/6f266a701e10a46e2828273b5c7ea27a2a6bc6 =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/objects/94/6f266a701e10a46e2828273b5c7ea27a2a6bc6 (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/objects/94/6f266a701e10a46e2828273b5c7ea27a2a6bc6 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,2 @@ +x��An� s�s��a���h/yȀ�� 0���\[���PrN#�z%)�$��1��eܔ�N߭B��=��[�e'V::8�~CocP��������h��- ��S*| +��[/�o��ΘvJ������B��06ӹ��96x:8�����ӹ�Z��6��z*G{���Z��^�y��?�U \ No newline at end of file Added: grass-addons/grass7/vector/v.in.survey/.git/objects/94/79d9fc8a6f87e071d6810a30fa22618ee2ef8e =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/94/79d9fc8a6f87e071d6810a30fa22618ee2ef8e ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/95/0c044a9ab4eab5ae0a4988842b6e8ef42e05af =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/95/0c044a9ab4eab5ae0a4988842b6e8ef42e05af ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/98/d4874af604cfb48481607d7cc822e7f86d3eb1 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/98/d4874af604cfb48481607d7cc822e7f86d3eb1 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/9a/bbdab7fc3c6c0c7318646a33bfa2b9ed010092 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/9a/bbdab7fc3c6c0c7318646a33bfa2b9ed010092 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/9b/d6fb785cf42f4fa9503df685549bcfb62502d3 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/9b/d6fb785cf42f4fa9503df685549bcfb62502d3 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/9e/b93615ad4238ddf41e79d948bab8ce6c04c8ec =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/9e/b93615ad4238ddf41e79d948bab8ce6c04c8ec ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/9e/c94a321cfffc2e94cf4ca8c1b5ee9661d7add6 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/9e/c94a321cfffc2e94cf4ca8c1b5ee9661d7add6 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/a9/fef768f80c1340fec52ea6b251b285644805e2 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/a9/fef768f80c1340fec52ea6b251b285644805e2 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/b0/f02a774ffefed15ff60439ad3e2064df21d07d =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/b0/f02a774ffefed15ff60439ad3e2064df21d07d ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/b2/7f9e6669b4c206c62f67993b98fa40823215d6 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/b2/7f9e6669b4c206c62f67993b98fa40823215d6 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/b6/26a08c65d66e548c2ce42b05c9ab9663b54d3b =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/b6/26a08c65d66e548c2ce42b05c9ab9663b54d3b ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/b8/1e3d2c4240b3e6d1b8a7b288cab69966673d98 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/b8/1e3d2c4240b3e6d1b8a7b288cab69966673d98 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/b8/4d653a23d831b724b1b61516da7ff323d9d940 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/b8/4d653a23d831b724b1b61516da7ff323d9d940 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/c0/a61d094163d7589a536662f685f7cfd849342e =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/c0/a61d094163d7589a536662f685f7cfd849342e ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/c5/35d0aedb835e67d376dd225113f892cc878b50 =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/objects/c5/35d0aedb835e67d376dd225113f892cc878b50 (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/objects/c5/35d0aedb835e67d376dd225113f892cc878b50 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,3 @@ +x��KJ�0@]��J��("n<�LƉ��4i��� +�v<�� ֻ�y����g"Q�H�H\(Q0r�$�{4:��!ۄ'��"R�F�&�b�Mt9p��,afTt��~��E�"-c���_��ը� �� +�����Q��m�)��Ե�m���~�s�u_�J��OX�&P�8e�?(�NU \ No newline at end of file Added: grass-addons/grass7/vector/v.in.survey/.git/objects/c8/88042305ea8569822d9f4290fc8251bbd65153 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/c8/88042305ea8569822d9f4290fc8251bbd65153 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/c9/8775a04dd598d4cf71f2c0f27611dd67e3796d =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/c9/8775a04dd598d4cf71f2c0f27611dd67e3796d ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/ca/e391ba56ddf8c453a66ee33a08e9e77a4e3535 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/ca/e391ba56ddf8c453a66ee33a08e9e77a4e3535 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/cc/187a168e12c5f32d95bcd6e728eeeec8ab31e4 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/cc/187a168e12c5f32d95bcd6e728eeeec8ab31e4 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/d1/641c1c9232a196e4c1d7bc59b710177220c0bd =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/d1/641c1c9232a196e4c1d7bc59b710177220c0bd ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/d1/efbf0b31256b58223225c6d4d269288dcdfec7 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/d1/efbf0b31256b58223225c6d4d269288dcdfec7 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/d8/30fc068890077db2155730c18a2f1b1b6f909c =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/d8/30fc068890077db2155730c18a2f1b1b6f909c ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/e3/bb8c5317aa8c7afaae35f7e67cbc8e5446108f =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/e3/bb8c5317aa8c7afaae35f7e67cbc8e5446108f ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/eb/bad8aae651ceaafb56abbb12604f787fb59b82 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/eb/bad8aae651ceaafb56abbb12604f787fb59b82 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/f1/9898d403ef60db5a15faed5015198b45c48c61 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/f1/9898d403ef60db5a15faed5015198b45c48c61 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/f2/87b6df2a101d7b8f8d365550ce6cfa5b2d1253 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/f2/87b6df2a101d7b8f8d365550ce6cfa5b2d1253 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/f7/0f28e6d63fb05696616ad6ba48f6b823cac61c =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/f7/0f28e6d63fb05696616ad6ba48f6b823cac61c ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/f9/f9e416403d8e2273aac25a243413d45d6dda6b =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/f9/f9e416403d8e2273aac25a243413d45d6dda6b ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/fd/9e641f0fd181d86e38f7168184c2c7b3394ec0 =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/.git/objects/fd/9e641f0fd181d86e38f7168184c2c7b3394ec0 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/.git/objects/fe/b9a2564a54affb7a9ad4201b08c5d37add9efb =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/objects/fe/b9a2564a54affb7a9ad4201b08c5d37add9efb (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/objects/fe/b9a2564a54affb7a9ad4201b08c5d37add9efb 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,23 @@ +x�Y{o���ҧ��P�u���B���:9��G��g���y�H��������ݥH�J���biw��Y��lL{��ÿ���r����8}��{���6K�{�?�� ү��>���q:��$���21q�(�su���y��7l�����d�]v��Z���������*2�<%�W��DkUhGZM鏥6����Z�Y������?Ϗ?�r9�{Aݷ=::8|�dn}<sqA�ԽJ�|�RC�*Z0�V��6֔ټ����B)���� 24�J�Cln�PLc���Dq�,ӟ��n�Xd�%���I��ɚZ����M�~Awj��S=t�aʛ�x�g�����x{|\?�ƩJ�,&e"} O�.�����եCR��K�Z��$Z(�f����&��"+��2~�>/�BM��Vz7���g%7��y|2_�a(F;f1.[D,M]�=7a�3�Ҽ��K�$}6�xZ|���#�V���a�$�d(�I�El�h��AC�f�xX13�at��I�����b ".*�}�q:� ?ߚ�.�YL���Qs+�Ʊ'� �cjH����/�q�\��؈�[$+>%q��D�03B��\= +�n��7�%��S�jr&w8��,Y.R ��6��d���x���w�[aMgqs��Xt��'�f�JTS at 4����ZE �!+�D�F��k[�� +g� +f�Sʩx�Ã^��*��)��>=��o���������ir�Q�Q���M�4L�n��@�qT�#��?��}���nG߯���_QN%�>�b���s��_��ݞ�<�a:��A��T�O������P���J[�V�X���4��TT������ ߛ.n�`�ؖ��������9f�k�L����,�'�>`��"y�@��=)v��2R���:y�����:��ѽi~���%vo�nų +5�.Z�:,!  � +��cu���M�:�&������&`��F��S`�, �CE��XJ`*W� �>ɀ�_Jc�d�6HTڕ�^[�������9=��d��c� +�u|��-8�|��78�BMՑ=s���O~��S9�3Ӓv]� +^p@r���R�_Hw��W$�G��j� +����K�����ue���"�'Y�G�>��_�4�L�ߦj�i�oN,,T`P�n �-� �@�u�Zpoh�� +�f��ç=�U +bt�=���"B�̖��b>�r��6���^��ڳ�7vR�e��p��:�ܴ[�����!C�V����KJ�$/-|�UW��Ȫ�ժz�`w��^���}�ޕ#�\b��H���M��Q�:}#癱��^��g��@�Il�A���Guԟ=-C� +[ց!C���Q���kx���* +�}�UƧ@P= 1A��b�I�D�M���q�wv��jeW����QZn+[�l@�*�a�X|%s����.�J[��t� +3G�F|�9or�&w�N]1�.r^����)�ϐŇLe�)Iz��"Z3T��F� ŁU Ó��J��� ��e�k�]�XF���݄6L�L�n�I��Ǧ/�"�WdgI���0�rtb_�Ē+��A�����{ʁ��jp7���m�,�?(j� +Ѻ.Bq at 3����Πӻ>����e�.� ��a�Is +S]\��L7R9�8��Aȯ}��A�Je�H\�ܜ� K�U/�Zv}~�`�b�\���ps~C�%����L�"B�2;�I����\ku�6�����V������8��a�A.�Q�6�=�/@�Sɿ�� x|ȑ�>K at Ym�����G*�E]oN�ǃE�~�]�2���%�����a+�ۑ�)��8!�!�DQ�(��`���X S�E��Cء����$s�q���E[t�=������7~G2��zC�F�'��a�J}^�p���6z- ���k��t�2�U,�s��o,�+e,��._�������/6�y�ui+͓�}lG����2�ox�7�˼$I�阫�F�M�$�t<:ꉫA9� �r<��������3���C���&S`nD�؄�>�o�Ǣ�b��{)�� pR15��)�|+����}�}l���O��b@ܮ���U�}ï(."�0��Ȱ��C��?$�p���&�`��b���\� +6� +x��F\j�D���8�—�}5#]��uTb}Z�0Ha�]��5^���C K�.�%ބY�Z��Y*V��(,�rd�,��-iK1]'h��Dt>�-���k>|e#T��C�3�4��n�+��;�Io5��_�w�5 +k(����'��e�um�_0I��͓be�eͯ[����O$�gc��=�\ZC5��6�js�� +��@_�*����Ϧ��bQ��n�JT�.�+���L��j�}+�AdO<�?����ցd�/��˵�+U�Z[����ɓq�0�pKeȖ�yD՗�`�py���/8ߐF��U["m{��^8����`<頫�be +�#Ӯj��^�����1��nÃ�T�0�g�0�}8 �9�m���\]��7� +��-�:����$Ss� \ No newline at end of file Added: grass-addons/grass7/vector/v.in.survey/.git/refs/heads/master =================================================================== --- grass-addons/grass7/vector/v.in.survey/.git/refs/heads/master (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.git/refs/heads/master 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1 @@ +27abd2678f662aa3cc76c844ddacd750b19ed86a Added: grass-addons/grass7/vector/v.in.survey/.gitignore =================================================================== --- grass-addons/grass7/vector/v.in.survey/.gitignore (rev 0) +++ grass-addons/grass7/vector/v.in.survey/.gitignore 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,10 @@ +# ignore txt and dat +*.txt +*.dat + +# ignore everything with ~ +*.*~ +*~ + +# ignore directories +test/ Added: grass-addons/grass7/vector/v.in.survey/Makefile =================================================================== --- grass-addons/grass7/vector/v.in.survey/Makefile (rev 0) +++ grass-addons/grass7/vector/v.in.survey/Makefile 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,7 @@ +MODULE_TOPDIR = ../.. + +PGM = v.in.survey + +include $(MODULE_TOPDIR)/include/Make/Script.make + +default: script Added: grass-addons/grass7/vector/v.in.survey/img_NC_dxf.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/img_NC_dxf.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/img_lyrs_broken.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/img_lyrs_broken.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/img_soils_correct.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/img_soils_correct.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/img_sorted_boundaries.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/vector/v.in.survey/img_sorted_boundaries.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: grass-addons/grass7/vector/v.in.survey/v.in.survey.html =================================================================== --- grass-addons/grass7/vector/v.in.survey/v.in.survey.html (rev 0) +++ grass-addons/grass7/vector/v.in.survey/v.in.survey.html 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,288 @@ +

        DESCRIPTION

        + +v.in.survey imports points from ASCII file into specific vector layers by point names. The script +joins several modules to perform following steps: +
          +
        • The data is sorted according to point names to keep points from separated layers together.
        • +
        • The script scans input file and creates separate files for each layer. Layers are distinguished by + point names that provide information on layer name, vector type and point identifier. More detailed information about + how to draft point names in your dataset (during data acquisition or in post-processing) is provided in Notes + section.
           
        • +
        • Line and polygon data are converted to standard format (input data should respect topological rules to get + geometrically correct layers).
           
        • +
        • Then, new vector layer is created using v.in.ascii. Points are stored in point layer; lines and polygons in + line layer at this moment. Lines that store polygon data are converted to new polygon layer using v.centroid.
            +
        • Attribute table is maintained for line and polygon layers (points are imported in point format with the attributes + as well). +
            +
          • in case of line layers, categories are added at first using v.category,
          • +
          • attribute table is created using v.db.addtable,
          • +
          • column that stores layer name is updated using v.db.update.
             
          • +
        • +
        • There is an option to merge the features by v.patch using various patterns to detect desired layers. + For more details, see Notes.
           
        • +
        • Finally, v.clean is performed to clean the topology if any layers have been merged.
        • +
        • If desired, conversion to DXF file is performed as well.
        • +
        + +

        NOTES

        +

        Input data

        +Several recommendations how to format the data: +
          +
        • only input data in point format is accepted. The file should contain just point identifier (see next item) and + coordinates in two- or three-dimensional space. +
          +		Point_name		easting	northing	[elevation]
          +		name.code.number	x	y		[z]
          +		
          + It does not depend on the coordinate order in the input file. The user can set up number of column for each coordinate + (as in v.in.ascii).
           
        • +
        • Point name provides information that is substantial for new layer creation - name and desired type of vector. Required + format of the point name looks like this: +
          +
          +			layer_name.code.number
          +		
          +
          + Items are separated by dots. To get correct results, please remove or replace all redundant dots in the input data. + + + + + + + + + + + + + +
          +
          +					name
          +				
          +
          + any short, descriptive name as you wish your layer to be named. Please do not use spaces or dots. +
          +
          +					code
          +				
          +
          + information about vector type of the new layer (point, line, polygon). You may define your own codes that + refer directly to the geometry (e.g. point, line, poly etc. including various + abbreviations). Or you may specify that e.g. tree, bush etc. are codes for point features, + river, profile etc. refer to line segments and lake and + house represent new polygon layers. +
          +
          +					number
          +				
          +
          + simple identifier of the point in the layer (preferably plain numbering) +
        • +
        • if using a header or columns' names, refer this in skip parameter
           
        • +
        • if necessary to merge any layers, please give them a name with specific prefix, which should be used as + merging rule as well. Merging rule that is based on suffix or another part of the layer name is not recognized.
           
        • +
        • if the module crashes suddenly during large dataset processing, + it might be caused by incomplete data writing to the layer input file. Please divide input data into several smaller + files (probably depends on your computer performance).
        • +
        + +

        Conversion to DXF

        +If you wish to convert the data to DXF, please use -x flag. Then, it is necessary to set up: +
          +
        • the name of DXF file. The file will be written into the output directory.
        • +
        • drawing units. Default value: metric. Another option: imperial.
        • +
        • height of the text. Default value: 0.0 (the height will be derived as a fraction (0.003) of longer side of a rectangular +mapset region)
        • +
        +Output drawing consists of geometry layers (point, line and polygon) supplemented with text. The text layers contain elevation of the vertices +and labels of the points and of the objects as Fig. 4 shows. + +

        EXAMPLES

        +This example is based on the sample dataset of North Carolina +(nc_spm_08_grass7). +Point vector layer hospitals, line vector layer railroads and polygon vector layer soil_general have +been exported to the text files, vertices have been renamed and the files have been merged. This final input was used as +test data for the script. + +
        +v.in.survey input=test_data.dat separator=tab skip=1 easting=2 northing=3 pt_rules=pt ln_rules=ln poly_rules=poly outdir=NC_test
        +
        + +As might be seen in Fig. 1, points and lines fit original dataset well, but areas are broken. +This is caused by input data - it was created exporting lines from areas and then exporting points from lines. Boundary of each +area was split into lines according to topological rule that vertices of the line are given by its intersection with at least +two other lines. Thus, each new area was generated as the space surrounded by a line and connection between its vertices. + +

        + + + + + + + + + + + +
        + Fig. 1: Imported features with broken areas + + Fig. 2: Lines with the directions + + Fig. 3: Imported features with correct areas +
        + Broken areas + + Criteria for the reconstruction of the boundaries + + Correct areas +
        + +

        To fix broken areas, original lines have been merged using v.edit according to their categories. Then points have been +exported again and they were copied to enclose each area - respecting lines and the directions as might be seen in +Fig. 2. In Fig. 3, there is shown that areas fit well too after editing input file. + +

        If it is necessary also to merge some of the layers, then merging rules can be set up: +

        +	v.in.survey input=test_data_small_corrected_soils.dat separator=tab easting=2 northing=3 pt_rules=pt ln_rules=ln poly_rules=poly \ 
        +	outdir=NC_test_small_merge merge_lyrs=road,soil
        +
        + +

        + + + + + + + +
        + Fig. 1: DXF drawing together with the labels
        (north arrow and scale have been added later) +
        + DXF +
        + +

        +The colours in DXF drawing have been set up automatically. In this case, labels of roads and elevation labels of soil types +have been switched of because of too large amount of the data. Examples of more detailed exports can be seen in +(Stopkova, 2016). + +

        WARNINGS

        +WARNING: There are no layers to merge into <item>.
        +Any imported layer does not match given item referring how to merge layers in script settings. + +

        ERROR MESSAGES

        +

        Input data:

        +ERROR: Too many columns. Use input data in format 'name east north [elev]', please.
        +Current version supports only import of 2D or 3D geometry and point name. Edit input file and run script again. + +

        ERROR: Please rename point in line i according to the script request in format +'lyr_name.vect_type_code.number'.
        +Point name is expected to provide information in particular format. Edit point name in ith line of the +input file and run script again. + +

        ERROR: Please do not use SQL forbidden characters in your input data. Remove all 'char' from the file.
        +Any special characters are not allowed in the data. Please use just dots to separate parts of point names. If +necessary, make the names more clear using underscores. + +

        ERROR: Not enough points to make line layer <layer>.
        +ERROR: Not enough points to make polygon layer <layer>.
        +These errors may refer to: +

          +
        • a typographical mistake in particular point's name. Edit point's name in the input file and run script again. +
        • mixed layers. See (Stopkova, 2016) for more details. Edit point's name in the input file and run script again. +
        • broken geometry (just one point referring to a line or less than three points referring to a polygon). Please remove + these points or edit their vector type (middle part of point name) to refer to a point. +
        + +

        Script settings:

        +ERROR: Wrong separator type.
        +The separator does not fit the data file. Please set up another type: pipe, comma, space, tab, +newline. Default: pipe + +

        ERROR: Vector layer layer is not point, neither line, nor boundary. Please check your input data and rules that +you have typed in.
        +Vector type information (middle part of the point name) does not match to any of geometry codes that you have +entered. Please compare input settings with point names in the data file, complete input settings (or edit input data) +and run the script again.

        + +

        ERROR: Please redefine merging option <char>. Different vector types match this rule.
        +Merging different vector types is not allowed. This might be matter of comparing layer names with too free rules: + +

        + + + + + + + + + + + + + + + + + + + + + + +
        Tab. 1: Example of too free rules for merging layers
        riverriver -> river_stream
        river_stream_Danuberiver_area_Danube
        river_stream_Vahriver_stream_Vah
        river_stream_Hronriver_stream_Hron
        + +

        +In the left column, there are summarized line objects that should be merged to one single layers called +river. This merge is possible, as all the features are represented by line. In the right column, there +are summarized rivers as well. But they cannot be merged, because the Danube river is represented by polygon and the rest of the +features are lines. It would be better to use merging criteria river_stream +to separate just line object to be merged. + +

        Files:

        +ERROR: File filename does not exist.
        +Missing input file. + +

        Output layers:

        +ERROR: Vector layer <layer> exists. Please remove the layer or rename the input points.
        +There is a layer with identical name in the mapset. Overwrite it, rename it or rename the layer in the input file +(edit points names). However, this error usually happens if points that belong to several layers are mixed in the file as well. How to prevent this, +examples in (Stopkova, 2016) can demonstrate. + +

        Empty layer (not reported in command output): if the layer exists but is empty, please check the input points. This might happened +because of wrong point order (especially if the point order has been edited). + +

        DXF conversion:

        +ERROR: Please set up the drawing units to 'metric' or to 'imperial'.
        +Anything else cannot be accepted (in accordance to DXF settings). Default value: metric. + +

        SEE ALSO

        + + +v.in.ascii
        +v.centroids
        +g.remove
        +v.db.addtable
        +v.db.update
        +v.patch
        +v.clean
        +v.out.dxf +
        +

        +Stopkova, E. (in print). Open-source tool for automatic import of coded surveying data to multiple vector layers in GIS +environment. In Geoinformatics FCE CTU. Vol. 15, No. 2 (2016). Prague: Czech Technical University, Faculty of Civil +Engineering. ISSN 1802-2669. pp. tba. doi: tba. + +

        AUTHOR

        + +Eva Stopkova
        +functions for DXF conversion are taken from (or based on) the module v.out.dxf (Charles Ehlschlaeger and Radim Blazek) + +

        +Last changed: $Date$ Property changes on: grass-addons/grass7/vector/v.in.survey/v.in.survey.html ___________________________________________________________________ Added: svn:mime-type + text/html Added: svn:keywords + Author Date Id Added: svn:eol-style + native Added: grass-addons/grass7/vector/v.in.survey/v.in.survey.py =================================================================== --- grass-addons/grass7/vector/v.in.survey/v.in.survey.py (rev 0) +++ grass-addons/grass7/vector/v.in.survey/v.in.survey.py 2016-10-06 08:10:51 UTC (rev 69679) @@ -0,0 +1,1688 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +############################################################################## +# +# MODULE: v.in.survey +# +# AUTHOR(S): Eva Stopková +# functions for DXF conversion are taken from (or based on) +# the module v.out.dxf (Charles Ehlschlaeger and Radim Blazek) +# +# PURPOSE: Create multiple vector layers based on one textfile +# COPYRIGHT: (C) 2015 by the GRASS Development Team +# +# This program is free software under the GNU General Public +# License (version 2). Read the file COPYING that comes with +# GRASS for details. +# +############################################################################## + +#%module +#% description: Creates multiple vector layers from just one textfile +#% keywords: vector +#% keywords: import +#% keywords: ASCII +#% keywords: multiple +#%end + +#% option G_OPT_F_INPUT +#% key: input +#% description: Name of input file to be imported +#% required: yes +#%end + +#% option G_OPT_F_SEP +#% key: separator +#% guisection: Input format +#%end + +#% option +#% key: pt_rules +#% guisection: Vector type codes +#% multiple: yes +#% description: Point(s): hosp.pt.01..., forest.tree.01 -> 'pt,tree' +#%end + +#% option +#% key: ln_rules +#% guisection: Vector type codes +#% multiple: yes +#% description: Line(s): road.ln.01..., Danube.river.01 -> 'ln,river' +#%end + +#% option +#% key: poly_rules +#% guisection: Vector type codes +#% multiple: yes +#% description: Polygon(s): hosp.area.01,..., forest.area.01 -> 'area' +#%end + +#% option +#% key: skip +#% type: integer +#% required: NO +#% multiple: NO +#% answer: 0 +#% description: Number of lines to skip at top of input file (points mode) +#% guisection: Points +#%end + +#% option +#% key: columns +#% type: string +#% required: NO +#% multiple: NO +#% guisection: Points +#% label: Column definition in SQL style (points mode)) +#% description: E.g.: 'x double precision, y double precision, cat int, name varchar(10)' +#%end + +#% option +#% key: easting +#% type: integer +#% required: NO +#% multiple: NO +#% answer: 2 +#% guisection: Points +#% label: Number of column used as easting coordinate (points mode) +#% description: First column is 1 +#%end + +#% option +#% key: northing +#% type: integer +#% required: NO +#% multiple: NO +#% answer: 3 +#% guisection: Points +#% label: Number of column used as northing coordinate (points mode) +#% description: First column is 1 +#%end + +#% option +#% key: elevation +#% type: integer +#% required: NO +#% multiple: NO +#% answer: 0 +#% guisection: Points +#% label: Number of column used as elevation (points mode) +#% description: First column is 1. If 0, z coordinate is not used +#%end + +#% option G_OPT_M_DIR +#% key: outdir +#% guisection: Output settings +#% description: Name of directory to store separated files for each layer +#% required: no +#%end + +#% option +#% key: merge_lyrs +#% guisection: Output settings +#% multiple: yes +#% description: Pattern(s) for layers to be merged +#%end + +#% flag +#% key: z +#% description: Create 3D vector map +#%end + +#% flag +#% key: e +#% description: Create a new empty vector map and exit. Nothing is read from input. +#%end + +#% flag +#% key: n +#% description: Do not expect a header when reading in standard format +#% guisection: Input format +#%end + +#% flag +#% key: t +#% description: Do not create table in points mode +#% guisection: Points +#%end + +#% flag +#% key: r +#% description: Only import points falling within current region (points mode) +#% guisection: Points +#% end + +#% flag +#% key: x +#% description: Convert to DXF +#% guisection: DXF conversion +#%end + +#% option +#% key: dxf_file +#% description: Name of the DXF file +#% guisection: DXF conversion +#%end + +#% option +#% key: draw_unit +#% description: Drawing units +#% answer: metric +#% options: metric, imperial +#% guisection: DXF conversion +#%end + +#% option +#% key: textsize +#% description: Text height of the labels in DXF file +#% answer: 0. +#% guisection: DXF conversion +#%end + +import sys +import os +import string +import math +import fileinput + +import grass.script as grass +from grass.pygrass.messages import get_msgr +import grass.script.vector as gvect + + +class test: + def __init__(self, test_file): + self.test_file = test_file + + def files(self): # test if file exists + if not os.path.isfile(self.test_file): + special = self.test_file.split('/') # which file is being checked: + # list of layers that have been done in previous session + if special[len(special) - 1] == "_layers_done.txt": + grass.fatal(_("File <" + self.test_file + + "> should contain list of existing layers." + + " The file does not exist, thus it is not" + + " possible to process script with -x flag.")) + else: # any other file (input file) + grass.fatal("File <" + self.test_file + "> does not exist.") + return 0 + + # test if file is blank + def blank(self, want_blank): + for line in self.test_file: + # the file is blank and it should not be: + if not line.strip() and want_blank is False: + msgr.fatal(_("File <" + self.lyr_name + "." + extension + + "> is empty.")) + return 0 + + def overwrite_file(self): + # the file is not blank and it should be + if os.path.isfile(self.test_file): + if overwrite_all is True: + # remove potentially broken input file + os.remove(self.test_file) + msgr.message(_("Existing file <" + self.test_file + + "> has been removed...")) + else: + msgr.fatal(_("File <" + self.test_file + + "> exists. To overwrite it," + + " please use --o flag...")) + return 0 +# ****** # + + +class glob: # *** Global variables *** # + separator = '' # separator of the rows in the input data + py_separator = '' + outdir = '' + infile = '' + + def __init__(self, infile, outdir, separator): + test(infile).files() # test file existence + + glob.infile = infile # input file (name-east-north-[elev]) + glob.separator = separator + glob.py_separator = self.g2py(separator) # separator of the input data + # directory to store separated files for each layer + glob.outdir = self.test_dir(outdir) + + # separators from GRASS to Python + # e.g. "pipe" -> "|" + def g2py(self, separator): + if separator == "pipe": + py_separator = "|" + elif separator == "comma": + py_separator = "," + elif separator == "space": + py_separator = " " + elif separator == "tab": + py_separator = "\t" + elif separator == "newline": + py_separator = "\n" + else: + msgr.fatal(_("Please setup correct separator...")) + + return py_separator + + # test if output directory exists + def test_dir(self, outdir): + if outdir == '': + outdir = 'output' + msgr.message(_("Output files will be stored " + + "in the directory.")) + + if not os.path.isdir(outdir): # output directory does not exist + os.makedirs(outdir) # create new directory + + else: # output directory exists + msgr.warning(_("Output directory exists. It may contain layers" + + " that might be overwritten.")) + + return outdir +# ****** # + + +class Flag: + signs = '' + + def __init__(self, sign): + self.sign = sign + Flag.signs = self.add_flag() + + def add_flag(self): # test flags + if flags[self.sign]: + if Flag.signs == '': + Flag.signs = self.sign + else: + Flag.signs += self.sign + return Flag.signs +# ****** # + + +class inputs(glob, test): + data = [] # input data + n = 0 + dim = 0 + + def __init__(self, skip_input): + # no. of lines to be skipped in the input file + self.skip_input = int(skip_input) + inputs.data, inputs.n, inputs.dim = self.raw_data() # extract xyz + + # find out data dimension + def dimension(self, row, n_lines, skip_lines, find_dim): + # remove blank elements + filtered = [y for y in row if y != '\n' + and y != '' and y != ' ' and y != '\t'] + n = len(row) # number of non-blank elements + + if find_dim is True: + if n == 3: # name easting northing + inputs.dim = 2 # 2D + elif n == 4: # name easting northing elevation + inputs.dim = 3 # 3D + else: + msgr.fatal(_("Too many columns. Use input data in format" + + " \'name east north [elev]\', please.")) + + find_dim = False + + else: + if n - 1 != inputs.dim: + msgr.fatal(_("Number of columns do not match. Please check" + + " rows " + str(n_lines + skip_lines - 1) + + " and " + str(n_lines + skip_lines) + + " in your data.")) + + return inputs.dim, find_dim + + # test not allowed characters + def characters(self, string, char): + # list of forbidden characters + avoid = ['-', '*', '/', '+', '\\', '|', '<', '>', '=', '~', '°', '!', + '`', ';', ':', '@', '£', '$', '%', '&', '(', ')', '#', '^', + '\'', '\"', '?', '§', '[', ']'] + # number of forbidden characters + n_avoid = len(avoid) + + for i in range(0, n_avoid): + if string.find(avoid[i]) > -1: + if char == '-': # test just '-' in names + msgr.fatal(_("Please do not use SQL forbidden characters" + + " in your input data... remove all \'" + + avoid[i] + "\' from point names.")) + break # everything else has been tested + else: # general test: + if i == 0: # do not test '-' + continue + msgr.fatal(_("Please do not use SQL forbidden characters" + + " in your input data... remove all \'" + + avoid[i] + "\' from the file.")) + return 0 + + # extract raw data + def raw_data(self): + open_input = open(glob.infile, 'r') # open input file for reading + data = [] + find_dim = True # unknown dimension of the data + + skip_lines = self.skip_input + skip.layers + n_lines = 0 # number of non-blank lines + + for line in open_input: # for each line in the file + if n_lines < skip_lines: # skip lines + n_lines += 1 + continue + + if line.strip(): # use strip to check the content + # test the data for SQL non-compliant content: + # everything except '-' <=> allowed in numeric types + self.characters(line, 'general') + n_lines += 1 + + row = line.strip('\n').split(glob.py_separator) + if len(row) == 1: + msgr.fatal(_("Wrong separator type.")) + + # test if the layer name does not start with a digit + if line[0].isdigit(): + msgr.fatal(_("Illegal vector map name <" + row[0] + + ">. Must start with a letter.")) + + # test point names: + # - for '-' as SQL non-compliant content + self.characters(row[0], '-') + + # - for length + if len(row[0].split('.')) != 3: + msgr.fatal(_("Please rename point " + row[0] + + " according to the script request in format" + + " \'lyr_name.vect_type_code.number\'.")) + + # make data array from the first unskipped non-blank line: + # 2D or 3D + inputs.dim, find_dim = self.dimension( + row, n_lines, skip_lines, find_dim) + + # join everthing to data + data.append(row) + open_input.close() # close input file + + if n_lines == skip_lines: + msgr.warning(_("All the data is imported. Just patching" + + " and cleaning will be done if necessary.")) + inputs.skip = True + + return None, None, inputs.skip + if n_lines < 1: + msgr.fatal(_("Empty input file.")) + + # remove empty lines from the data + data = [x for x in data if x != '\n'] + inputs.n = len(data) # number of elements + + # sort data by name + inputs.data = sorted(data, key=lambda data: data[0]) + + return inputs.data, inputs.n, inputs.dim + + +class vect_rules: + pt = '' + ln = '' + poly = '' + east = 2 + north = 3 + elev = 0 + + def __init__(self, pt, ln, poly, east, north, elev): + vect_rules.pt = pt.split(',') # list of codes for point layer + vect_rules.ln = ln.split(',') # list of codes for line layer + vect_rules.poly = poly.split(',') # list of codes for boundary + + if (vect_rules.pt[0] == '' and vect_rules.ln[0] == '' + and vect_rules.poly[0] == ''): + msgr.fatal(_("Any rule for vector geometry missing...")) + + vect_rules.east = east # column with easting + vect_rules.north = north # column with northing + vect_rules.elev = elev # column with elevation + + +class files(glob): + base = '' + + def __init__(self, base): + files.base = base + + # create path to file + def path2(self, extension): + filename = glob.outdir + '/' + files.base + '.' + extension + return filename + + # open output file + def open_output(self, skip_blank_test, dxf): + out_file = glob.outdir + '/' + files.base + if dxf is False: + out_file += '.txt' + + test(out_file).overwrite_file() + open_output = open(out_file, 'a+') + + if skip_blank_test is False: + test(out_file).blank(True) # test if the file is blank + + return open_output +# ****** # + + +class skip(glob, test, files): + layers = 0 + existing = False + lyr_names = '' # names of the layers to be analyzed for merging + vectors = '' # geometry types of the layers for merging + + def __init__(self, existing): + self.existing = existing + + if self.existing is True: + # test if file exists + test.files(glob.outdir + "/_layers_done.txt", "_layers_done.txt") + # open list of existing layers + done_lyrs = files.open_output( + glob.outdir, "_layers_done", True, False) + skip.layers, skip.lyr_names, skip.vectors = self.lines(done_lyrs) + + # count points in existing layers to skip lines + def lines(self): + i = 0 # index + for line in glob.infile: # for each line in the file + if line.strip(): # use strip to check the content + # test layer names for SQL non-compliant content: + # everything except '-' <=> allowed in numeric types) + test.characters(line, 'general') + + # test layer names for '-' as SQL non-compliant content + test.characters(line, '-') + + row = line.strip('\n').split(glob.py_separator) + skip.layers += int(row[0]) + if i == 0: + skip.lyr_names = row[1] + skip.vectors = row[2] + else: + skip.lyr_names += ',' + row[1] + skip.vectors += ',' + row[2] + i += 1 + return skip.layers, skip.lyr_names, skip.vectors +# ****** # + + +class layer_init: + def __init__(self, i): + self.i = i + self.name, self.code = self.define_name() # setup name of the layer + + # setup name of the layer + def define_name(self): + # extract point name + point_name = inputs.data[self.i][0].split(".") # split the data by dot + unit_name = point_name[0] # core name of the layer + self.code = point_name[1] # vector type (point, line, boundary) + self.name = unit_name + "_" + self.code # whole layer name + + return self.name, self.code +# ****** # + + +class layer(glob, Flag, vect_rules, layer_init): + unit = '' # pure name of the layer + code = '' # code for geometry type according to the rules(P - L - B) + name = '' # name of the layer (unit_code) + vector = '' # geometry type of the layer (P - L - B) + n_pts = 0 # number of lines / polygons + close = 0 # index of closing point + + def __init__(self, i): + self.i = i + + layer.name, layer.code = self.define_name() + # open output file (test blank, no dxf) + self.out = files(layer.name).open_output(False, False) + + # initial values for the new layer + layer.n_pts = 0 # number of lines / polygons + layer.close = i # index of the closing point + layer.vector = self.code2vector() # geometry type + layer.unit = self.setup_unit(1) + + self.vformat = self.grass_format() + if self.vformat == 'standard': + # open backup file (test blank, no dxf) + self.out_bckp = files( + layer.name + '_bckp').open_output(False, False) + + self.test_existence(layer.name, False) # test layer existence + self.filename = files(layer.name).path2('txt') + + # compare code with rules to sort the layers + def compare(self, rules, sign): + n_rules = len(rules) # number of rules for each vector type + for i in range(0, n_rules): + if layer.code == rules[i]: # if code is the same as any rule: + layer.vector = sign # define vector type + return layer.vector + + # sort layers according to codes (by user) + # to points, lines and boundaries + def code2vector(self): + layer.vector = '' + layer.vector = self.compare(vect_rules.pt, 'P') # test points + if layer.vector != '': + return layer.vector + + if (layer.vector == ''): # if type undefined: + layer.vector = self.compare(vect_rules.ln, 'L') # test lines + if layer.vector != '': + return layer.vector + + if (layer.vector == ''): # if type still undefined: + # test boundaries + layer.vector = self.compare(vect_rules.poly, 'B') + if layer.vector != '': + return layer.vector + + if (layer.vector == ''): # if type remains undefined: + msgr.fatal(_("Vector layer <" + layer.name + "> is not point," + + " neither line, nor boundary. Please check" # etc + + "your input data and rules that you have" # etc + + "typed in.")) + return 0 + + # format, number of vertices and index of closing point (for polygons) + def grass_format(self): + if layer.vector == 'P': + self.vformat = 'point' + else: + self.vformat = 'standard' + + return self.vformat + + def not_point(self): + if self.vformat != 'P': + layer.n_pts += 1 # number of points in the layer + + return layer.n_pts + + # test existence of the layer + def test_existence(self, layer_name, final): + # final: True - merging / cleaning (skip existing); + # False - any other (fatal error) + + # initial value: do not skip existing layer and make fatal error + skip = False + mapset = grass.gisenv()['MAPSET'] + + # make fatal error if there are any existing layers during data import + if (overwrite_all is False and self.final is False + and grass.find_file(layer_name, element='vector', # etc + mapset=mapset)['file']): + msgr.fatal(_("Vector layer <" + layer_name + "> exists. Please" + + " remove the layer or rename the input points.")) + + # skip existing layers during final steps (merge and clean) + if (final is True and grass.find_file(layer_name, element='vector', mapset=mapset)['file']): + # change value: skip existing layer and do not make fatal error + skip = True + + return skip + + # make new layer from subdataset written to separate file + def make_new(self): + # set up suffix for temporary line layers + # to be transformed into polygon or to be added an attribute table + suffix = '' + separator = glob.separator + if layer.vector != 'P': + suffix = '_' + layer.code + '_tmp' + separator = 'space' + layer_name = layer.unit + suffix + self.test_existence(layer_name, False) # test layer existence + + in_ascii = grass.run_command('v.in.ascii', input=self.filename, + output=layer_name, format=self.vformat, + separator=separator, x=vect_rules.east, + y=vect_rules.north, z=vect_rules.elev, + flags=Flag.signs, overwrite=overwrite_all) + + # make polygon from boundaries + if layer.vector == 'B': + self.test_existence(layer.name, False) # test layer existence + # add centroids and create polygon layer + grass.run_command('v.centroids', + input=layer_name, output=layer.name) + # remove temporary line layer + grass.run_command('g.remove', type='vector', + name=layer_name, flags='f') + + if self.vformat == 'standard': + self.set_attribute_table() + + # make a note that layer has been done""" + # done_lyrs.write(str(self.n_elems) + glob.py_separator + layer.name + + # glob.py_separator + self.vector + '\n') + + return 0 + + # unit name according to temporary layer name (base + vector type code) + def setup_unit(self, remove_suffix): + if layer.vector != 'P': + base = layer.name.split('_') # split point name by '_' + layer.unit = base[0] # unit name: base + + # all parts of the base without vector code + for i in range(1, len(base) - remove_suffix): + layer.unit += "_" + base[i] + else: + layer.unit = layer.name + + return layer.unit + + def check_number_pts(self): + if layer.vector == 'L' and layer.n_pts < 2: + can_be_broken = done_lyrs.readlines()[-1] + msgr.fatal(_("Not enough points to make line layer <" + + layer.name + ">.")) + if layer.vector == 'B' and layer.n_pts < 3: + msgr.fatal(_("Not enough points to make polygon layer <" + + layer.name + ">.")) + return 0 + + # add two specific lines at the beginning of the file in standard format + def standard_poly(self): + if layer.vector == 'B': # for boundaries + layer.n_pts += 1 # no. of vertices (including the closing point) + return layer.n_pts + + def standard_header(self): + # *** function based on answer 3: http://stackoverflow.com/ ... + # questions/5287762/how-to-insert-a-new-line-before-the-first-line- ... + # in-a-file-using-python + for num, line in enumerate(fileinput.FileInput(self.filename, # etc + inplace=2)): + if num == 0: + print "VERTI:" + print layer.vector + ' ' + str(layer.n_pts) + print line.strip('\n') + else: + print line.strip('\n') + # *** + return 0 + + # modify file to respect standard format for lines and boundaries: + def complete_input(self): + # add two specific lines at the beginning of the file + layer.n_pts = self.standard_poly() + self.standard_header() + + # add closing point (the 1st one of the subsample) + if (layer.vector == 'B'): # just for boundaries + with open(self.filename, 'a') as self.out: + self.write2('standard', self.out, layer.close) + return 0 + + def complete(self): + # modify file to respect standard format for lines and boundaries: + self.out.close() # close layer input file + if self.vformat == 'standard': + self.out_bckp.close() # close backup file + self.check_number_pts() + self.complete_input() + + return 0 + + def write(self, i): + # write the point to the layer file + if (self.vformat == 'point'): + self.write2('point', self.out, i) + + if (self.vformat == 'standard'): + self.write2('standard', self.out, i) # nameless points + self.write2('point', self.out_bckp, i) # backup of point names + + layer.n_pts = self.not_point() # setup for non-point layers + return layer.n_pts + + # add atrribute table with the name of the layer + def set_attribute_table(self): + if self.vector == 'L': + line_layer = layer.name + '_tmp' # suffix '_tmp' to the line + self.test_existence(line_layer, False) # test layer existence + # add categories to line layer + grass.run_command('v.category', input=line_layer, + option='add', type='line', output=layer.name) + # remove the layer without cats + grass.run_command('g.remove', + type='vector', name=line_layer, flags='f') + + # add table with the name column + grass.run_command('v.db.addtable', + map=layer.name, columns='lyr_name varchar(15)') + # update the name column with the 1st 15 characters of the layer's name + grass.run_command('v.db.update', map=layer.name, + column='lyr_name', value=layer.name[:15]) + return 0 + + # write coordinates to file + def write2(self, vformat, outfile, index): + if vformat == 'point': + separator = glob.py_separator + else: + separator = ' ' + + if inputs.dim == 2: + endline = '\n' + if inputs.dim == 3: + endline = separator + + # create input file for subsample of the 1st layer + if vformat == 'point': + # point name (standard format is nameless) + outfile.write(inputs.data[index][0] + separator) + + outfile.write(inputs.data[index][1] + separator) # easting + outfile.write(inputs.data[index][2] + endline) # northing + + if inputs.dim == 3: + outfile.write(inputs.data[index][3] + "\n") # elevation + + return 0 +# ****** # + + +class Merge_init(glob, layer): # Functionality for merging layers + item = '' + n_items = 0 + len_item = [] # array of length of layers' names + + def __init__(self, pattern): + self.pattern = pattern # list of merged layers + merge_list = self.count_layers() + Merge_init.item, Merge_init.n_items, Merge_init.len_item = merge_list + + # options -> properties of merged layers (count and names) + def count_layers(self): + # split pattern to the names of merged layers + item = self.pattern.strip(' ').split(',') + n_items = len(item) # count merged layers + + len_item = [0 for i in range(0, n_items)] # initialize + for i in range(0, n_items): + len_item[i] = len(item[i]) # array of length of layers' names + + return item, n_items, len_item +# ****** # + + +class Merge(Merge_init, layer): + name = [] # export to DXF after merging + vector = [] # export to DXF after merging + n_pts = [] + filename = [] + init_add = True + init_done = True + wait4 = False + + def __init__(self, export2dxf): + self.export2dxf = export2dxf + + if sum(Merge_init.len_item) > 0: + if Merge.init_add is True: + # export to DXF after merging + Merge.name = ['' for i in range(0, Merge_init.n_items)] + # export to DXF after merging + Merge.vector = ['' for i in range(0, Merge_init.n_items)] + (Merge.name, Merge.vector, Merge.init_add, + Merge.wait4) = self.add_layers() + + # export to DXF if the layer is not to be merged + # layer containing several objects + if dxf.export2 is True and Merge.wait4 is True: + # create merged file of the layer to be merged... + # and convert it at last + if Merge.init_done is True: + # number of points in merged layers + Merge.n_pts = [[] for i in range(0, Merge_init.n_items)] + for i in range(0, Merge_init.n_items): + # set up path to final merged file + Merge.filename.append(files(Merge_init.item[i] # etc + + '_bckp').path2('txt')) + + test(Merge.filename[i]).overwrite_file() + Merge.n_pts, Merge.init_done = self.outfiles() + + # add layer to the merge list according to pattern + def add_layers(self): + for i in range(0, Merge_init.n_items): + # compare name of each layer with the items of the pattern: + if layer.name[:Merge_init.len_item[i]] == Merge_init.item[i]: + # test: layer to be merged and merged layer not to be identical + if Merge_init.len_item[i] == len(layer.name): + msgr.fatal(_("Please change merging rule or layer <" + + Merge_init.item[i] + ">. Their names" + + " should not be identical.")) + + if Merge.name[i] == '': # initial value: + # name of the first layer according to the pattern + Merge.name[i] = layer.name + # vector type of the first layer according to the pattern + Merge.vector[i] = layer.vector + Merge.init_add = False + else: # next values: + # add all suitable layers delimited by comma + Merge.name[i] += ',' + layer.name + # add vector types of the layers + Merge.vector[i] += ',' + layer.vector + + # test if all layers have the same vector type + control_items = Merge.vector[i].split(',') # create list + n_ctrl = len(control_items) # length of the list + + # compare two last values + if control_items[n_ctrl - 1] != control_items[n_ctrl - 2]: + msgr.fatal(_("Please redefine merging option <" + + Merge.item[i] + ">. Different vector" + + " types match this rule.")) + if dxf.export2 is True: # the layers should be exported 2 CAD: + Merge.wait4 = True # do not export layers before merging + return (Merge.name, Merge.vector, + Merge.init_add, Merge.wait4) + + return Merge.name, Merge.vector, Merge.init_add, Merge.wait4 + + # merge files to convert several objects as one layer + def outfiles(self): + # compare current layer with the list of merged ones & derive settings. + for i in range(0, Merge_init.n_items): # for each merged layer: + n_item = len(Merge_init.item[i]) + # if current layer is to be merged: + if Merge.wait4 is True and layer.name[:n_item] == Merge_init.item[i]: + merge_file = Merge.filename[i] + # set up name of current file to be merged + add_file_name = files(layer.name + '_bckp').path2('txt') + if layer.vector == 'B': + subtract = -1 + else: + subtract = 0 + # add merged items to list of point number in the layer + Merge.n_pts[i].append(layer.n_pts + subtract) + Merge.init_done = False + + # test if file to be added is not blank + with open(add_file_name, 'r') as add_file: + test(add_file).blank(False) + + # test if final file that shall contain coordinates... + # ... of all parts of the layer is blank + with open(merge_file, 'a+') as merged_file: + test(merged_file).blank(False) + + # add content of the current file to the final file + with open(merge_file, 'a') as merged_file: + with open(add_file_name, 'r') as add_file: + for line in add_file: + merged_file.write(line) + + return Merge.n_pts, Merge.init_done + + # merge layers according to pattern items + def layers(self): + if sum(Merge_init.len_item) > 0: + for i in range(0, Merge_init.n_items): + if Merge.name[i] == '': + msgr.warning(_("There are no layers to merge into <" # etc + + Merge_init.item[i] + ">.")) + continue + + # merge layers to temporary layer + grass.run_command('v.patch', + input=Merge.name[i], + output=Merge_init.item[i]+"_tmp", + flags='e', overwrite=True) + # remove original dataset + grass.run_command('g.remove', + type='vector', name=Merge.name[i], flags='f') + return 0 + + # clean topology + def clean_topology(self): + if sum(Merge_init.len_item) > 0: + for i in range(0, Merge.n_items): + if Merge.name[i] != '': # just for merged layers + + # find out code to recognize a type of the vector layer: + # split the name of the 1st layer to be merged... + element = Merge.name[i].split(',')[0] + part = element.split('_') # ... by '_' + n_part = len(part) # count parts + # code: the last part of the layer's name + code = part[n_part - 1] + + # test vector type + if code == 'line': + methods = "snap,break,rmdupl" # topology clean + lyr_name = Merge.item[i] + '_line' # final layer name + elif code != 'pt': # polygons + methods = "break,rmdupl,rmsa" # topology clean + lyr_name = Merge.item[i] # final layer name + # test if these layers have been merged already + current_layer.test_existence(lyr_name, False) + + # each non-point layer that has not been cleaned yet: + if code != 'pt': + temp = Merge.item[i] + "_tmp" # temporary layer + # topology clean according to vector type + grass.run_command('v.clean', input=temp, + output=lyr_name, tool=methods) + # remove temporary layer + grass.run_command('g.remove', + type='vector', name=temp, flags='f') + return 0 +# ****** # + + +class dxf(glob, files): + # based on v.out.dxf by Chuck Ehlschlaeger, Radim Blazek and Martin Landa + export2 = False + File = '' # dxf file + out = '' + units = 'metric' + textsize = '' + + def __init__(self, export2, File, unit, textsize): + dxf.export2 = export2 + dxf.File = File + dxf.unit = unit + dxf.textsize = textsize + + # open dxf file + if dxf.export2 is True: + if dxf.File == '': + msgr.fatal(_("Please set up a name of the DXF file" + + " or remove -x flag.")) + + # open dxf file and test if it is empty (should be) + dxf.out = files(dxf.File).open_output(False, True) + + # setup height of the text if invalid value + if dxf.textsize < 0.: + msgr.fatal(_("Text height must be positive.")) + + if dxf.textsize == 0.: + # find extends and save textsize + dxf.textsize = self.do_limits(True) + else: + # find extends and do not save textsize (given by the user) + self.do_limits(False) + + self.make_tables() # start section of the tables + + # estimate text size according to the map extents + # original: make_layername (v.out.dxf: main) + def do_limits(self, calculate_textsize): + region = grass.region() + self.north = region['n'] + self.south = region['s'] + self.east = region['e'] + self.west = region['w'] + + self.header() + self.draw_units() + self.limits() + self.endsec() + + if calculate_textsize is True: + if ((self.east - self.west) >= (self.north - self.south)): + dxf.textsize = (self.east - self.west) * text_ratio + else: + dxf.textsize = (self.north - self.south) * text_ratio + + return dxf.textsize + else: + return 0 + + # set up drawing units + def draw_units(self): + if dxf.units == 'imperial': + code = 0 + elif dxf.units == 'metric': + code = 1 + else: + msgr.fatal(_("Please set up the drawing units" + + " to 'metric' or to 'imperial'.")) + + dxf.out.write(' 9\n$MEASUREMENT\n 70\n%6d\n' % code) + + return 0 + + # define tables + # functions from v.out.dxf + def make_tables(self): + self.tables() + self.linetype_table(1) + self.solidline() + self.endtable() + self.layer_table(7) + self.layer0() + + return 0 + + # write the header + # original: dxf_header (v.out.dxf: write_dxf) + def header(self): + dxf.out.write(' 0\nSECTION\n 2\nHEADER\n') + + return 0 + + # write tables + # original: dxf_tables (v.out.dxf: write_dxf) + def tables(self): + dxf.out.write(' 0\nSECTION\n 2\nTABLES\n') + + return 0 + + # write entities + # original: dxf_entities (v.out.dxf: write_dxf) + def entities(self): + dxf.out.write(' 0\nSECTION\n 2\nENTITIES\n') + + return 0 + + # end section + # original: dxf_endsec (v.out.dxf: write_dxf) + def endsec(self): + dxf.out.write(' 0\nENDSEC\n') + + return 0 + + # finalize dxf file + # original: dxf_eof (v.out.dxf: write_dxf) + def eof(self): + dxf.out.write(' 0\nEOF\n') + dxf.out.close() + + return 0 + + # header stuff + # original: dxf_limits (v.out.dxf: write_dxf) + def limits(self): + dxf.out.write( + ' 9\n$LIMMIN\n 10\n' + str(self.west) + '\n 20\n' # etc + + str(self.south) + '\n') + dxf.out.write( + ' 9\n$LIMMAX\n 10\n' + str(self.east) + '\n 20\n' # etc + + str(self.north) + '\n') + + return 0 + + # tables stuff + # original: dxf_linetype_table (v.out.dxf: write_dxf) + def linetype_table(self, numlines): + dxf.out.write(' 0\nTABLE\n 2\nLTYPE\n 70\n%6d\n' % numlines) + + return 0 + + # original: dxf_layer_table (v.out.dxf: write_dxf) + def layer_table(self, numlayers): + dxf.out.write(' 0\nTABLE\n 2\nLAYER\n 70\n%6d\n' % numlayers) + + return 0 + + # end table + # original: dxf_endtable (v.out.dxf: write_dxf) + def endtable(self): + dxf.out.write(' 0\nENDTAB\n') + + return 0 + + # write line + # original: dxf_solidline (v.out.dxf: write_dxf) + def solidline(self): + dxf.out.write(' 0\nLTYPE\n 2\nCONTINUOUS\n 70\n') + dxf.out.write(' 64\n 3\nSolid line\n 72\n 65\n') + dxf.out.write(' 73\n 0\n 40\n0.0\n') + + return 0 + + # todo: naco? + # original: dxf_layer0 (v.out.dxf: write_dxf) + def layer0(self): + dxf.out.write(' 0\nLAYER\n 2\n0\n 70\n 0\n') + dxf.out.write(' 62\n 7\n 6\nCONTINUOUS\n') + + return 0 + + # create list of the layers and of their properties... + # ... and write them to dxf file + # functions from v.out.dxf + + # end section of tables + def end_tables(self): + dxfs.endtable() + dxfs.endsec() + + return 0 + + # finalize dxf file + def end_dxf(self): + dxfs.endsec() # end section + dxfs.eof() # puts final stuff in dxf_fp, closes file + + return 0 + + # setup elevation according to 2D/3D geometry + def setup_elev(self, point): + if inputs.dim == 3: # 3D objects: + if point[3] == '': # empty elevation: + elev = str(0.0) # setup 0. + else: + elev = point[3] # setup value + else: # 2D objects: + elev = str(0.0) # setup 0. + + return elev +# ****** # + + +class dxf_layer_merged(Merge): + name = '' + vector = '' + n_pts = '' + + def __init__(self, i): + self.i = i + + dxf_layer_merged.name = Merge_init.item[i] + dxf_layer_merged.vector = Merge.vector[i] + dxf_layer_merged.n_pts = Merge.n_pts[i] + Merge.wait4 = False + + +class dxf_layer(layer, Merge, dxf): # *** make separate dxf layers *** # + color = 1 # layer color (1-255). 0 not recognized by AutoCAD Civil 2015. + n = 0 # number of the layers + name = [] # list of layers for drawing entities + vector = [] # list of geometry types + n_pts = [] # list of point numbers + + def __init__(self, set_layer): + self.set_layer = set_layer + + # export to DXF if the layer is not to be merged + # layer containing single object: + if dxf.export2 is True and Merge.wait4 is False: + self.dxf_properties() + + Merge.wait4 = False + + # DXF properties + def dxf_properties(self): + # add layer name to the list for drawing entities + dxf_layer.name.append(self.set_layer.name) + # add geometry type to the list for drawing entities + dxf_layer.vector.append(self.set_layer.vector) + # add no. of pts to the list + dxf_layer.n_pts.append(self.set_layer.n_pts) + + dxf_layer.n += 1 # increase number of the layers to be drawn + Merge.wait4 = False # merging indicator to the default (no merge) + + self.layername() # add layer name to the layer section + dxf_layer.color = self.setup_color() + + return dxf_layer.color, dxf_layer.n, dxf_layer.name, # etc + dxf_layer.vector, dxf_layer.n_pts, Merge.wait4 + + # define layers and their properties + # original: make_layername (v.out.dxf: main) + def layername(self): + self.layercontent('', 'CONTINUOUS', 0) # geometry object + self.layercontent('_elev_pts', 'CONTINUOUS', 0) # elevation (vertex) + self.layercontent('_label_pts', 'CONTINUOUS', 0) # label (vertex) + if layer.vector != 'P': + self.layercontent('_label', 'CONTINUOUS', 0) # label layer + + return 0 + + # write layer + # original: dxf_layer (v.out.dxf: write_dxf) + def layercontent(self, suffix, linetype, is_frozen): + if is_frozen: + frozen = 1 + else: + frozen = 64 + dxf.out.write( + ' 0\nLAYER\n 2\n' + dxf_layer.name[dxf_layer.n-1] # etc + + suffix + '\n 70\n') + dxf.out.write( + '%6d\n 62\n%6d\n 6\n%s\n' % (frozen, self.color, linetype)) + + return 0 + + # extra color for each group of layers to export2dxf (geometry + labels) + def setup_color(self): + self.color += 1 # calculate new color indicator + if self.color == 256: # if maximum value of 255 has been exceeded: + self.color = 1 # set up minimum again + + return self.color +# ****** # + + +class finalize_dxf( + inputs, layer, Merge_init, Merge, dxf, + dxf_layer_merged, dxf_layer): + + def __init__(self): + dxfs.end_tables() # close the section of the tables + + msgr.message(_("Converting layers to DXF...")) + self.entities2() + dxfs.end_dxf() # finalize and close dxf file + + # add point to the entity in the dxf file + # based on add_plines (v.out.dxf: main) + def point2dxf(self, vector, point, seq_type): + # create layer name according to entity type (geometry or text) + if seq_type == 'geometry': + appendix = '' + else: # elevation or point label, or layer label + appendix = '_' + seq_type + + self.layer2write = self.dxf_layer_name + appendix # layer name + + # write geometry + if seq_type == 'geometry': + if vector == 'P': + self.point2write(point) # write point + else: + self.vertex(point) # write vertex + + # write label to point or to the layer + elif seq_type == 'label': + self.text2write(True, self.dxf_layer_name) # write label + + # write elevation to the point + else: + if seq_type == 'elev_pts': + default_justification = False # change justification mode + text = self.setup_elev(point) # text elevation (2D point: 0.0) + if seq_type == 'label_pts': + default_justification = True # keep default justification mode + text = str(point[0]) # use point name as text + + # write point labels (name and elev) + self.text2write(default_justification, text) + + return 0 + + # label centroid + def label_centroid(self, n): + self.centroid.append(self.dxf_layer_name) # add layer name + self.centroid.append(self.sum_east / n) # easting + self.centroid.append(self.sum_north / n) # northing + self.centroid.append(self.sum_elev / n) # elevation + + self.point2dxf('P', self.centroid, 'label') # label layer + + return 0 + + # initial values for the label of the layer + def init_label(self): + # compute centroid for line/polygon elements + self.sum_east = 0. + self.sum_north = 0. + self.sum_elev = 0. + self.centroid = [] + return self.sum_east, self.sum_north, self.sum_elev, self.centroid + + # write sequence to dxf + def write_sequence(self, parts, seq_type): + self.seq_type = seq_type + + with open(self.filename, 'r+') as coord_file: # open backup file: + test(self.filename).files() # test if the file exists + test(self.filename).blank(False) # test if the file is not blank + + # initial values for the label of the layer + if self.seq_type == 'label' and self.vector != 'P': + (self.sum_east, self.sum_north, self.sum_elev, + self.centroid) = self.init_label() + + closing_pt = True # current point should close the polygon shape + + # converting a layer with more than one object: + if parts is not None: + close_merged = 0 # point index for splitting line detection + index_merged = 0 # index of the object in the layer + # no. of points in labeled objects => closing point detection + done = parts[0] + sum_layer = sum(parts) + + for line in iter(coord_file.readline, ''): + # extract point name and coordinates + self.point = line.strip('\n').split(glob.py_separator) + + if self.seq_type != 'label': + # write point to particular entity + self.point2dxf(self.vector, self.point, self.seq_type) + + # write label of the layer + if self.seq_type == 'label' and self.vector != 'P': + # sum of coordinates + self.sum_east += float(self.point[1]) + self.sum_north += float(self.point[2]) + if inputs.dim == 3: + self.sum_elev += float(self.point[3]) + + # write label extra for each object in the layer + if parts is not None: + if close_merged == done - 1: # closing point reached: + # no. of points in the object + n = parts[index_merged] + # compute and label centroid of the object + self.label_centroid(n) + + # start writing centroid of the next object + # initial values for the label of the layer + if self.seq_type == 'label' and self.vector != 'P': + (self.sum_east, self.sum_north, self.sum_elev, + self.centroid) = self.init_label() + + index_merged += 1 # index of the next object + + # add number of currently labeled object to the sum + # to not exceed array size: + if index_merged < len(parts): + done += parts[index_merged] + + # check the next point (closing or not) + close_merged += 1 + # end: if merged_elements is not None + # end: if seq_type == 'label_pts' and code != 'P' + + # write geometry of the layer + if self.seq_type == 'geometry': + if self.vector == 'B': # for polygon layer: + # if closing point (CP) missing in current session: + if(closing_pt): + # save coordinates of (CP) + point0 = self.point + # => not necessary to save CP in the session now + closing_pt = False + + # separated objects (lines or polygons) + if parts is not None and self.vector != 'P': + if close_merged == done - 1: # closing point reached: + # close the object: + if self.vector == 'B': # copy closing point (B) + # closing point + self.point2dxf( + self.vector, point0, self.seq_type) + self.poly_end() # end line/polygon object + + # start new line/polygon object + # not after the last object: + if close_merged < sum_layer - 1: + self.polyline() + if self.vector == 'B': + closing_pt = True + + index_merged += 1 # index of the next object + # add number of currently labeled object to the sum + if index_merged < len(parts): + # to not exceed array size + done += parts[index_merged] + + # check the next point (closing or not) + close_merged += 1 + # end: if merged_elements is not None ... + # and (code == 'B' or code == 'L') + # end: if seq_type == 'label_pts' and code != 'P' + # end: line in iter(coord_file.readline, '') + + # single object in the layer: + if parts is None: + # close geometry + if self.seq_type == 'geometry': + if self.vector == 'B': + # write closing point + self.point2dxf(self.vector, point0, self.seq_type) + if self.vector != 'P': + self.poly_end() # end polygon + + # label the layer + if self.seq_type == 'label' and self.vector != 'P': + self.label_centroid(self.dxf_layer_n_pts) + + return 0 + + # write geometry entities to dxf file + def entities2(self): + dxfs.entities() # start section of entities + + j = 0 # index of merging pattern item (= merged layer name) + for i in range(0, dxf_layer.n): + self.dxf_layer_name = dxf_layer.name[i] + self.vector = dxf_layer.vector[i] + self.dxf_layer_n_pts = dxf_layer.n_pts[i] + + # set up input file appendix (depends on geometry type) + if self.vector == 'P': + base = self.dxf_layer_name + else: + base = self.dxf_layer_name + "_bckp" + self.filename = files(base).path2('txt') # path to input file + + # write geometry + if self.vector != 'P': + self.polyline() # start polyline entity + + # if current layer has been merged: + if Merge_init.item[j] == self.dxf_layer_name: + parts = Merge.n_pts[j] # find number of points in each object + j += 1 # index of the next merged layer + else: + parts = None # not merged layers: there are no parts + + # write geometry and label of the layer + self.write_sequence(parts, 'geometry') + self.write_sequence(parts, 'label') + + # write labels of the vertices + self.write_sequence(None, 'label_pts') + + # write elevations of the vertices + self.write_sequence(None, 'elev_pts') + + return 0 + + # entities: point + # original: dxf_point (v.out.dxf: write_dxf) + def point2write(self, point): + self.east = point[1] + self.north = point[2] + self.elev = self.setup_elev(point) + + dxf.out.write('0\nPOINT\n') + dxf.out.write('8\n' + self.dxf_layer_name + '\n') + dxf.out.write( + '10\n' + self.east + '\n20\n' + self.north + '\n30\n' # etc + + self.elev + '\n') + + return 0 + + # entities: polyline + # original: dxf_polyline (v.out.dxf: write_dxf) + def polyline(self): + dxf.out.write('0\nPOLYLINE\n') + dxf.out.write('8\n' + self.dxf_layer_name + '\n') + dxf.out.write('66\n1\n') + # fprintf(dxf_fp,"10\n0.0\n 20\n0.0\n 30\n0.0\n"); *//* ? + + if inputs.dim == 3: + dxf.out.write('70\n8\n') + + return 0 + + # entities: vertex + # original: dxf_vertex (v.out.dxf: write_dxf) + def vertex(self, point): + self.east = point[1] + self.north = point[2] + self.elev = self.setup_elev(point) + + dxf.out.write('0\nVERTEX\n') + dxf.out.write('8\n' + self.dxf_layer_name + '\n') + dxf.out.write( + '10\n' + self.east + '\n20\n' + self.north + '\n 30\n' # etc + + self.elev + '\n') + + return 0 + + # entities: text + # original: dxf_text (v.out.dxf: write_dxf) + def text2write(self, default, text): + self.east = self.point[1] + self.north = self.point[2] + self.elev = self.setup_elev(self.point) + + # start text entity + dxf.out.write(' 0\nTEXT\n 8\n' + self.layer2write + '\n') + # reference point + dxf.out.write( + ' 10\n%s\n20\n%s\n30\n%s\n' % (self.east, self.north, self.elev)) + # text properties + dxf.out.write( + ' 40\n' + str(dxf.textsize) + '\n 1\n' + text + '\n') + + # do not use default justification (hz: left, v: baseline): + if default is False: + # justify to hz: rigth, v: top + dxf.out.write(( + ' 72\n 2\n 73\n 3\n 11\n%s\n 21\n' # etc + + '%s\n 31\n%s\n') % (self.east, self.north, self.elev)) + + return 0 + + # entities: end polyline + # original: dxf_poly_end (v.out.dxf: write_dxf) + def poly_end(self): + dxf.out.write(' 0\nSEQEND\n 8\n' + self.dxf_layer_name + '\n') + + return 0 +# ****** # + + +def main(): + global msgr + msgr = get_msgr() # setup messenger as global variable + + global overwrite_all + overwrite_all = grass.overwrite() + + global current_layer + global dxfs + global text_ratio # size of text compared to screen = 1 + global centered + text_ratio = .003 + centered = 4 + + # define options + opt = glob(options['input'], options['outdir'], options['separator']) + # open list of existing layers + done_lyrs = files("_layers_done").open_output(True, False) + + # define rules for vector type + rules = vect_rules(options['pt_rules'], options['ln_rules'], + options['poly_rules'], options['easting'], + options['northing'], options['elevation']) + + # flags for v.in.ascii + Flag('n') + Flag('t') + Flag('r') + Flag('z') + Flag('e') + + # export to dxf + dxfs = dxf(flags['x'], options['dxf_file'], + options['draw_unit'], options['textsize']) + + # *** read input coordinates + inp = inputs(options['skip']) + + # continue importing layers to GIS + current_name = layer_init(0) + current_layer = layer(0) # initial layer settings + +# test options for merging layers + merge_init = Merge_init(options['merge_lyrs']) # manage items to merge + +# continue importing layers to GIS + for i in range(0, inp.n): # step: number of columns (3 or 4) + new_name = layer_init(i) + + # compare current lyr name with i-th name + if current_name.name != new_name.name: # not equal => + current_layer.complete() # finalize current layer's output file + current_layer.make_new() # import current layer + merge = Merge(dxf.export2) # add current layer to the merging list + dxf_lyr = dxf_layer(current_layer) + + # make a note that layer has been done + done_lyrs.write(str(current_layer.n_pts) + glob.py_separator # etc + + current_layer.name + glob.py_separator # etc + + current_layer.vector + '\n') + + current_name = layer_init(i) + current_layer = layer(i) # setup new layer as current + # end initializing a new layer + + current_layer.write(i) # write the point to the file of current layer + # end for i in range(0, n, dim+1) + + # *** process the last layer import + current_layer.complete() # finalize current layer's output file + current_layer.make_new() # import current layer + merge = Merge(dxf.export2) # add current layer to the merging list + dxf_lyr = dxf_layer(current_layer) + + # make a note that layer has been done + done_lyrs.write(str(current_layer.n_pts) + glob.py_separator # etc + + current_layer.name + glob.py_separator # etc + + current_layer.vector + '\n') + done_lyrs.close() + + # finalize merging and clean topology + if merge.n_items > 0: + merge.layers() # merge the layers + merge.clean_topology() # clean topology + + # finalize DXF export + if dxf.export2 is True: + if merge.n_items > 0: + # add merged layers + for i in range(0, merge.n_items): + dxf_pars = dxf_layer_merged(i) + # add merged layers to the table of layers + dxf_lyr = dxf_layer(dxf_pars) + fin_dxf = finalize_dxf() # create entities in DXF file + + return 0 + +if __name__ == "__main__": + options, flags = grass.parser() + main() From svn_grass at osgeo.org Thu Oct 6 01:14:19 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Thu, 6 Oct 2016 01:14:19 -0700 Subject: [GRASS-SVN] r69680 - grass-addons/grass7/vector/v.in.survey Message-ID: <20161006081419.BA21439029E@trac.osgeo.org> Author: evas Date: 2016-10-06 01:14:19 -0700 (Thu, 06 Oct 2016) New Revision: 69680 Removed: grass-addons/grass7/vector/v.in.survey/.git/ grass-addons/grass7/vector/v.in.survey/.gitignore Log: v.in.survey: removed git files Deleted: grass-addons/grass7/vector/v.in.survey/.gitignore =================================================================== --- grass-addons/grass7/vector/v.in.survey/.gitignore 2016-10-06 08:10:51 UTC (rev 69679) +++ grass-addons/grass7/vector/v.in.survey/.gitignore 2016-10-06 08:14:19 UTC (rev 69680) @@ -1,10 +0,0 @@ -# ignore txt and dat -*.txt -*.dat - -# ignore everything with ~ -*.*~ -*~ - -# ignore directories -test/ From svn_grass at osgeo.org Thu Oct 6 02:10:08 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Thu, 6 Oct 2016 02:10:08 -0700 Subject: [GRASS-SVN] r69681 - grass-addons/grass7/vector Message-ID: <20161006091008.354A339047C@trac.osgeo.org> Author: martinl Date: 2016-10-06 02:10:07 -0700 (Thu, 06 Oct 2016) New Revision: 69681 Modified: grass-addons/grass7/vector/Makefile Log: Makefile: add v.in.survey Modified: grass-addons/grass7/vector/Makefile =================================================================== --- grass-addons/grass7/vector/Makefile 2016-10-06 08:14:19 UTC (rev 69680) +++ grass-addons/grass7/vector/Makefile 2016-10-06 09:10:07 UTC (rev 69681) @@ -29,6 +29,7 @@ v.in.osm \ v.in.redlist \ v.in.redwg \ + v.in.survey \ v.in.wfs2 \ v.isochrones \ v.krige \ From svn_grass at osgeo.org Thu Oct 6 14:44:43 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Thu, 6 Oct 2016 14:44:43 -0700 Subject: [GRASS-SVN] r69682 - grass/trunk/lib/gis/testsuite Message-ID: <20161006214443.E4398390125@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-06 14:44:43 -0700 (Thu, 06 Oct 2016) New Revision: 69682 Added: grass/trunk/lib/gis/testsuite/gis_lib_str_color.py Log: libgis: ctypes-based test for G_str_to_color (grass and names syntax) Added: grass/trunk/lib/gis/testsuite/gis_lib_str_color.py =================================================================== --- grass/trunk/lib/gis/testsuite/gis_lib_str_color.py (rev 0) +++ grass/trunk/lib/gis/testsuite/gis_lib_str_color.py 2016-10-06 21:44:43 UTC (rev 69682) @@ -0,0 +1,77 @@ +"""Test of gis library string to color conversions + + at author Vaclav Petras +""" + +from ctypes import byref, c_int + +from grass.gunittest.case import TestCase +from grass.gunittest.main import test + +import grass.lib.gis as libgis + + +class StringToColorTestCase(TestCase): + """Test C function G_str_to_color() from gis library""" + + def convert_color(self, string, red, green, blue): + """General test function to convert string to color + + red, green, blue are expected values. + """ + r = c_int() + g = c_int() + b = c_int() + ret = libgis.G_str_to_color(string, byref(r), byref(g), byref(b)) + colors = ("{string} -> " + "{r.value}, {g.value}, {b.value}".format(**locals())) + self.assertEqual(ret, 1, + msg="Not successful return code (%s)" % colors) + self.assertEqual(r.value, red, + msg="Wrong number for red (%s)" % colors) + self.assertEqual(g.value, green, + msg="Wrong number for green (%s)" % colors) + self.assertEqual(b.value, blue, + msg="Wrong number for blue (%s)" % colors) + + def test_grass_format(self): + """Test GRASS GIS color format (RRR:GGG:BBB)""" + self.convert_color("50:150:250", 50, 150, 250) + + def test_grass_format_black(self): + """Test GRASS GIS color black color""" + self.convert_color("0:0:0", 0, 0, 0) + + def test_grass_format_white(self): + """Test GRASS GIS color white color""" + self.convert_color("255:255:255", 255, 255, 255) + + def test_grass_format_separators(self): + """Test GRASS GIS color format with all allowed separators""" + self.convert_color("50,150,250", 50, 150, 250) + self.convert_color("50:150:250", 50, 150, 250) + self.convert_color("50;150;250", 50, 150, 250) + self.convert_color("50 150 250", 50, 150, 250) + + def test_grass_format_multiple_separators(self): + """Test GRASS GIS color format with duplicated separators""" + self.convert_color("50, 150, 250", 50, 150, 250) + self.convert_color("50::150:250", 50, 150, 250) + self.convert_color("50 ; 150 ; 250", 50, 150, 250) + self.convert_color("50 150 250", 50, 150, 250) + + def test_grass_format_whitespace(self): + """Test with whitespace (spaces) around the string""" + self.convert_color(" 50:150:250 ", 50, 150, 250) + + def test_grass_named_black(self): + """Test GRASS GIS color black color""" + self.convert_color("black", 0, 0, 0) + + def test_grass_named_white(self): + """Test GRASS GIS color white color""" + self.convert_color("white", 255, 255, 255) + + +if __name__ == '__main__': + test() Property changes on: grass/trunk/lib/gis/testsuite/gis_lib_str_color.py ___________________________________________________________________ Added: svn:mime-type + text/x-python Added: svn:eol-style + native From svn_grass at osgeo.org Thu Oct 6 16:45:34 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Thu, 6 Oct 2016 16:45:34 -0700 Subject: [GRASS-SVN] r69683 - in grass/trunk/lib/gis: . testsuite Message-ID: <20161006234534.4F164390125@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-06 16:45:34 -0700 (Thu, 06 Oct 2016) New Revision: 69683 Modified: grass/trunk/lib/gis/color_str.c grass/trunk/lib/gis/testsuite/gis_lib_str_color.py Log: libgis: support also HTML/CSS hash hexadecimal colors in G_str_to_color() (missing docs) [news] Modified: grass/trunk/lib/gis/color_str.c =================================================================== --- grass/trunk/lib/gis/color_str.c 2016-10-06 21:44:43 UTC (rev 69682) +++ grass/trunk/lib/gis/color_str.c 2016-10-06 23:45:34 UTC (rev 69683) @@ -131,6 +131,19 @@ return 1; } + int hex; + + if (sscanf(buf, "#%x", &hex) == 1) { + *red = (hex >> 16) & 0xFF; + *grn = (hex >> 8) & 0xFF; + *blu = hex & 0xFF; + if (*red < 0 || *red > 255 || + *grn < 0 || *grn > 255 || *blu < 0 || *blu > 255) + return 0; + + return 1; + } + /* Look for this color in the standard (preallocated) colors */ for (i = 0; i < num_names; i++) { const struct color_name *name = &standard_color_names[i]; Modified: grass/trunk/lib/gis/testsuite/gis_lib_str_color.py =================================================================== --- grass/trunk/lib/gis/testsuite/gis_lib_str_color.py 2016-10-06 21:44:43 UTC (rev 69682) +++ grass/trunk/lib/gis/testsuite/gis_lib_str_color.py 2016-10-06 23:45:34 UTC (rev 69683) @@ -64,6 +64,39 @@ """Test with whitespace (spaces) around the string""" self.convert_color(" 50:150:250 ", 50, 150, 250) + def test_html_hash_hex(self): + """Test HTML format with hash and hexadecimal (6 letters, #RRGGBB)""" + self.convert_color("#3296FA", 50, 150, 250) + + def test_html_hash_hex_more_colors(self): + """Test HTML format with more colors""" + self.convert_color("#A6CEE3", 166, 206, 227) + self.convert_color("#33A02C", 51, 160, 44) + self.convert_color("#FB9A99", 251, 154, 153) + self.convert_color("#FF7F00", 255, 127, 0) + + def test_html_hash_hex_more_colors_lowercase(self): + """Test HTML format with lowercase letters""" + self.convert_color("#a6cee3", 166, 206, 227) + self.convert_color("#33a02c", 51, 160, 44) + self.convert_color("#fb9a99", 251, 154, 153) + self.convert_color("#ff7f00", 255, 127, 0) + + def test_html_hash_hex_more_colors_mixedcase(self): + """Test HTML format with mixed case letters""" + self.convert_color("#a6CeE3", 166, 206, 227) + self.convert_color("#33a02C", 51, 160, 44) + self.convert_color("#fB9A99", 251, 154, 153) + self.convert_color("#Ff7f00", 255, 127, 0) + + def test_html_hash_hex_black(self): + """Test HTML format black color""" + self.convert_color("#000000", 0, 0, 0) + + def test_html_hash_hex_white(self): + """Test HTML format white color""" + self.convert_color("#FFFFFF", 255, 255, 255) + def test_grass_named_black(self): """Test GRASS GIS color black color""" self.convert_color("black", 0, 0, 0) From svn_grass at osgeo.org Thu Oct 6 21:29:33 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Thu, 6 Oct 2016 21:29:33 -0700 Subject: [GRASS-SVN] r69684 - grass-addons/grass7/raster/r.randomforest Message-ID: <20161007042933.52AE639029E@trac.osgeo.org> Author: spawley Date: 2016-10-06 21:29:32 -0700 (Thu, 06 Oct 2016) New Revision: 69684 Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.py Log: added ncores option and fixed difference in behaviour between scikit learn 0.17 and 0.18 Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.py =================================================================== --- grass-addons/grass7/raster/r.randomforest/r.randomforest.py 2016-10-06 23:45:34 UTC (rev 69683) +++ grass-addons/grass7/raster/r.randomforest/r.randomforest.py 2016-10-07 04:29:32 UTC (rev 69684) @@ -1,7 +1,6 @@ #!/usr/bin/env python ############################################################################ -# -# MODULE: r.scikit.learn +# MODULE: r.randomforest # AUTHOR: Steven Pawley # PURPOSE: Supervised classification and regression of GRASS rasters using the # python scikit-learn package @@ -227,6 +226,14 @@ #% guisection: Optional #%end +#%option +#% key: ncores +#% type: integer +#% description: Number of processing cores. Default -1 is all cores +#% answer: -1 +#% guisection: Optional +#%end + #%flag #% key: p #% label: Output class membership probabilities @@ -303,7 +310,8 @@ def cleanup(): - grass.run_command("g.remove", name='clfmasktmp', flags="f", type="raster", quiet=True) + grass.run_command("g.remove", name='clfmasktmp', flags="f", + type="raster", quiet=True) def sample_predictors_byrow(response, predictors): @@ -320,9 +328,10 @@ if rasstack[i].exist() == True: rasstack[i].open('r') else: - grass.fatal("GRASS raster " + maplist[i] + " does not exist.... exiting") + grass.fatal("GRASS raster " + maplist[i] + + " does not exist.... exiting") - # use grass.pygrass.gis.region to get information about the current region, particularly + # use grass.pygrass.gis.region to get information about the current region current = Region() # determine cell storage type of training roi raster @@ -335,7 +344,7 @@ roi_stats = roi_stats.split(os.linesep)[0] nlabel_pixels = int(str(roi_stats).split('=')[1]) - # Create a zero numpy array with the dimensions of the number of columns in the region + # Create a zero numpy array with the dimensions of the number of columns # and the number of bands plus an additional band to attach the labels tindex = 0 training_labels = [] @@ -348,20 +357,25 @@ roi_row_np = roi_raster[row] # check if any of those pixels are labelled (not equal to nodata) - # can use even if roi is FCELL because nodata will be nan and this is not returned anyway + # can use even if roi is FCELL because nodata will be nan and this is + + # not returned anyway is_train = np.nonzero(roi_row_np > -2147483648) training_labels = np.append(training_labels, roi_row_np[is_train]) nlabels_in_row = np.array(is_train).shape[1] # if there are any labelled pixels - # loop through each imagery band for that row and put the data into the img_row_band_np array + # loop through each imagery band for that row and put the data into + + # the img_row_band_np array if np.isnan(roi_row_np).all() != True: for band in range(n_features): imagerow_np = rasstack[band][row] # attach the label values onto the last column - training_data[tindex : tindex+nlabels_in_row, band] = imagerow_np[is_train] + training_data[tindex : tindex+nlabels_in_row, band] =\ + imagerow_np[is_train] tindex = tindex + nlabels_in_row @@ -402,10 +416,12 @@ for i in range(n_features): if RasterRow(predictors[i]).exist() != True: - grass.fatal("GRASS raster " + predictors[i] + " does not exist.... exiting") + grass.fatal("GRASS raster " + predictors[i] + + " does not exist.... exiting") # check if any of those pixels are labelled (not equal to nodata) - # can use even if roi is FCELL because nodata will be nan and this is not returned anyway + # can use even if roi is FCELL because nodata will be nan and this is not + # returned anyway is_train = np.nonzero(response_np > -2147483648) training_labels = response_np[is_train] n_labels = np.array(is_train).shape[1] @@ -430,13 +446,13 @@ # Remove nan rows from training data training_data = training_data[~np.isnan(training_data).any(axis=1)] - roi_gr.close() # return X and y data return(training_data[:, 0:n_features], training_data[:, n_features]) -def prediction(clf, predictors, class_probabilities, rowincr, output, mode, labels): +def prediction(clf, predictors, class_probabilities, + rowincr, output, mode, labels): class_list = np.unique(labels) nclasses = len(class_list) @@ -449,16 +465,18 @@ if rasstack[i].exist() == True: rasstack[i].open('r') else: - grass.fatal("GRASS raster " + maplist[i] + " does not exist.... exiting") + grass.fatal("GRASS raster " + maplist[i] + + " does not exist.... exiting") - # use grass.pygrass.gis.region to get information about the current region, particularly + # use grass.pygrass.gis.region to get information about the current region current = Region() # create a imagery mask - # the input rasters might have different dimensions in terms of value and non-value pixels. - # r.series used to automatically create a mask by propagating the null values + # the input rasters might have different dimensions and non-value pixels. + # r.series used to automatically create a mask by propagating the nulls clfmask = 'clfmasktmp' - grass.run_command("r.series", output=clfmask, input=predictors, method='count', flags='n') + grass.run_command("r.series", output=clfmask, + input=predictors, method='count', flags='n') mask_raster = RasterRow(clfmask) mask_raster.open('r') @@ -478,7 +496,8 @@ prob_out_raster = [0] * nclasses prob = [0] * nclasses for iclass in range(nclasses): - prob_out_raster[iclass] = output + '_classPr' + str(int(class_list[iclass])) + prob_out_raster[iclass] = output + \ + '_classPr' + str(int(class_list[iclass])) prob[iclass] = RasterRow(prob_out_raster[iclass]) prob[iclass].open('w', 'FCELL', overwrite=True) @@ -493,11 +512,14 @@ img_np_row = np.zeros((rowincr, current.cols, n_features)) mask_np_row = np.zeros((rowincr, current.cols)) - # loop through each row, and each band and add these values to the 2D array img_np_row + # loop through each row, and each band + + # and add these values to the 2D array img_np_row for row in range(rowblock, rowblock+rowincr, 1): mask_np_row[row-rowblock, :] = np.array(mask_raster[row]) for band in range(n_features): - img_np_row[row-rowblock, :, band] = np.array(rasstack[band][row]) + img_np_row[row-rowblock, :, band] = \ + np.array(rasstack[band][row]) mask_np_row[mask_np_row == -2147483648] = np.nan nanmask = np.isnan(mask_np_row) # True in the mask means invalid data @@ -511,10 +533,10 @@ result = clf.predict(flat_pixels) result = result.reshape((rowincr, current.cols)) - # replace NaN values so that the prediction surface does not have a border + # replace NaN values so that the prediction does not have a border result = np.ma.masked_array(result, mask=nanmask, fill_value=np.nan) - # return a copy of result, with masked values filled with a given value + # return a copy of result, with masked values filled with a value result = result.filled([nodata]) # for each row we can perform computation, and write the result into @@ -526,13 +548,20 @@ # same for probabilities if class_probabilities == True and mode == 'classification': result_proba = clf.predict_proba(flat_pixels) + for iclass in range(nclasses): result_proba_class = result_proba[:, iclass] - result_proba_class = result_proba_class.reshape((rowincr, current.cols)) - result_proba_class = np.ma.masked_array(result_proba_class, mask=nanmask, fill_value=np.nan) + result_proba_class = \ + result_proba_class.reshape((rowincr, current.cols)) + + result_proba_class = \ + np.ma.masked_array(result_proba_class, + mask=nanmask, fill_value=np.nan) result_proba_class = result_proba_class.filled([np.nan]) + for row in range(rowincr): - newrow = Buffer((result_proba_class.shape[1],), mtype='FCELL') + newrow = Buffer((result_proba_class.shape[1],), + mtype='FCELL') newrow[:] = result_proba_class[row, :] prob[iclass].put_row(newrow) @@ -561,7 +590,7 @@ def cross_val_classification(clf, X, y, cv, rstate): # custom function to calculate classification metrics - # eliminated need to calculate each metric separately using cross_val_score function + # eliminates need to calculate each metric using cross_val_score # returns: a 1D list of accuracy, kappa and auc scores # returns: mean precision/recall and std precision/recall per class @@ -578,7 +607,9 @@ } # generate Kfold indices - k_fold = cross_validation.StratifiedKFold(y, n_folds=cv, shuffle=False, random_state=rstate) + k_fold = cross_validation.StratifiedKFold(y, n_folds=cv, + shuffle=False, + random_state=rstate) # dictionary of lists to store metrics cmstats = { @@ -602,22 +633,54 @@ y_pred = fit.predict(X_test) # calculate metrics - cmstats['accuracy'] = np.append(cmstats['accuracy'], metrics.accuracy_score(y_test, y_pred)) - cmstats['precision'] = np.append(cmstats['precision'], metrics.precision_score(y_test, y_pred, average='weighted')) - cmstats['recall'] = np.append(cmstats['recall'], metrics.recall_score(y_test, y_pred, average='weighted')) - cmstats['f1'] = np.append(cmstats['f1'], metrics.f1_score(y_test, y_pred, average='weighted')) - cmstats['kappa'] = np.append(cmstats['kappa'], metrics.cohen_kappa_score(y_test, y_pred)) + cmstats['accuracy'] = np.append(cmstats['accuracy'], + metrics.accuracy_score(y_test, y_pred)) + cmstats['precision'] = np.append(cmstats['precision'], + metrics.precision_score(y_test, + y_pred, + average='weighted')) + + + cmstats['recall'] = np.append(cmstats['recall'], + metrics.recall_score(y_test, y_pred, + average='weighted')) + + cmstats['f1'] = np.append(cmstats['f1'], + metrics.f1_score(y_test, y_pred, + average='weighted')) + + cmstats['kappa'] = np.append(cmstats['kappa'], + metrics.cohen_kappa_score(y_test, y_pred)) + # test for if binary and classes equal 0,1 if len(np.unique(y)) == 2 and all ([0,1] == np.unique(y)): + + stat_method = "binary" + y_pred_proba = fit.predict_proba(X_test)[:,1] - cmstats['auc'] = np.append(cmstats['auc'], metrics.roc_auc_score(y_test, y_pred_proba)) + cmstats['auc'] = np.append(cmstats['auc'], + metrics.roc_auc_score(y_test, + y_pred_proba)) + else: + stat_method = "micro" # Get performance measures by class for cindex in range(nclasses): - byclass_metrics['recall'][cindex, fold] = metrics.recall_score(y_test, y_pred, labels = [class_list[cindex]], pos_label=class_list[cindex]) - byclass_metrics['precision'][cindex, fold] = metrics.precision_score(y_test, y_pred, labels = [class_list[cindex]], pos_label=class_list[cindex]) - byclass_metrics['f1'][cindex, fold] = metrics.f1_score(y_test, y_pred, labels = [class_list[cindex]], pos_label=class_list[cindex]) + byclass_metrics['recall'][cindex, fold] = \ + metrics.recall_score(y_test, y_pred, labels = + [class_list[cindex]], + pos_label=class_list[cindex], average = stat_method) + + byclass_metrics['precision'][cindex, fold] = \ + metrics.precision_score(y_test, y_pred, labels = + [class_list[cindex]], + pos_label=class_list[cindex], average = stat_method) + + byclass_metrics['f1'][cindex, fold] = \ + metrics.f1_score(y_test, y_pred, labels = + [class_list[cindex]], + pos_label=class_list[cindex], average = stat_method) fold+=1 return(cmstats, byclass_metrics) @@ -657,6 +720,7 @@ importances = flags['f'] weighting = flags['b'] lowmem = flags['l'] + ncores = int(options['ncores']) # logistic regression c_lr = float(options['c_lr']) @@ -692,7 +756,6 @@ or model == 'GaussianNB' \ or model == 'LinearDiscriminantAnalysis' \ or model == 'QuadraticDiscriminantAnalysis': - mode = 'classification' else: mode = 'regression' @@ -755,7 +818,9 @@ """ # fetch individual raster names from group - groupmaps = im.group(group=igroup, flags="g", quiet = True, stdout_=PIPE).outputs.stdout + groupmaps = im.group(group=igroup, flags="g", + quiet = True, stdout_=PIPE).outputs.stdout + maplist = groupmaps.split(os.linesep) maplist = maplist[0:len(maplist)-1] n_features = len(maplist) @@ -825,7 +890,7 @@ from sklearn.ensemble import GradientBoostingRegressor classifiers = { - 'LogisticRegression': LogisticRegression(C=c_lr, fit_intercept=fi, n_jobs=-1, class_weight=weighting), + 'LogisticRegression': LogisticRegression(C=c_lr, fit_intercept=fi, n_jobs=ncores, class_weight=weighting), 'DecisionTreeClassifier': DecisionTreeClassifier(splitter=splitter_dt, max_features=m_features_dt, min_samples_split=min_samples_split_dt, @@ -844,9 +909,9 @@ max_features=m_features_rf, min_samples_split=minsplit_rf, random_state=randst, - n_jobs=-1, + n_jobs=ncores, class_weight=weighting), - 'RandomForestRegressor': RandomForestRegressor(n_jobs=-1, + 'RandomForestRegressor': RandomForestRegressor(n_jobs=ncores, n_estimators=ntrees_rf, oob_score=False, max_features=m_features_rf, @@ -898,7 +963,8 @@ # If cv > 1 then use cross-validation to generate performance measures if cv > 1: - from sklearn.cross_validation import cross_val_predict + from sklearn.cross_validation import cross_val_predict, cross_val_score + from sklearn.metrics import classification_report grass.message(_('\r\n')) grass.message(_("Cross validation global performance measures......:")) @@ -938,10 +1004,9 @@ grass.message(_(row)) else: - r2 = cross_val_score(clf, X, y, cv=cv, scoring='r2', n_jobs=-1) + r2 = cross_val_score(clf, X, y, cv=cv, scoring='r2', n_jobs=ncores) grass.message(_("R2:\t%0.2f\t+/-\t%0.2f" % (r2.mean(), r2.std() * 2))) - # diagnostics if importances == True: if (model == 'RandomForestClassifier' or @@ -957,7 +1022,8 @@ grass.message(_("id" + "\t" + "Raster" + "\t" + "Importance")) for i in range(len(clfimp)): - grass.message(_(str(i) + "\t" + maplist[i] + "\t" + str(round(clfimp[i], 4)))) + grass.message(_(str(i) + "\t" + maplist[i] + + "\t" + str(round(clfimp[i], 4)))) # save the model if model_save != '': From svn_grass at osgeo.org Sat Oct 8 18:51:29 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 8 Oct 2016 18:51:29 -0700 Subject: [GRASS-SVN] r69685 - grass/trunk/gui/wxpython/tplot Message-ID: <20161009015129.E61AF390240@trac.osgeo.org> Author: annakrat Date: 2016-10-08 18:51:29 -0700 (Sat, 08 Oct 2016) New Revision: 69685 Modified: grass/trunk/gui/wxpython/tplot/frame.py Log: g.gui.tplot: do not use EVT_COMBOBOX_CLOSEUP, not available on all platforms, see #3175 Modified: grass/trunk/gui/wxpython/tplot/frame.py =================================================================== --- grass/trunk/gui/wxpython/tplot/frame.py 2016-10-07 04:29:32 UTC (rev 69684) +++ grass/trunk/gui/wxpython/tplot/frame.py 2016-10-09 01:51:29 UTC (rev 69685) @@ -228,7 +228,7 @@ self.datasetSelectV = gselect.Select( parent=self.controlPanelVector, id=wx.ID_ANY, size=globalvar.DIALOG_GSELECT_SIZE, type='stvds', multiple=True) - self.datasetSelectV.Bind(wx.EVT_COMBOBOX_CLOSEUP, + self.datasetSelectV.Bind(wx.EVT_TEXT, self.OnVectorSelected) self.attribute = gselect.ColumnSelect(parent=self.controlPanelVector) @@ -886,7 +886,18 @@ def OnVectorSelected(self, event): """Update the controlbox related to stvds""" dataset = self.datasetSelectV.GetValue().strip() - if dataset: + name = dataset.split('@')[0] + mapset = dataset.split('@')[1] if len(dataset.split('@')) > 1 else '' + found = False + for each in tgis.tlist(type='stvds', dbif=self.dbif): + each_name, each_mapset = each.split('@') + if name == each_name: + if mapset and mapset != each_mapset: + continue + dataset = name + '@' + each_mapset + found = True + break + if found: try: vect_list = grass.read_command('t.vect.list', flags='s', input=dataset, column='name') @@ -901,7 +912,7 @@ for vec in vect_list: self.attribute.InsertColumns(vec, 1) else: - return + self.attribute.Clear() class LookUp: From svn_grass at osgeo.org Sat Oct 8 18:52:10 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 8 Oct 2016 18:52:10 -0700 Subject: [GRASS-SVN] r69686 - grass/trunk/gui/wxpython/tplot Message-ID: <20161009015210.2E27D390240@trac.osgeo.org> Author: annakrat Date: 2016-10-08 18:52:10 -0700 (Sat, 08 Oct 2016) New Revision: 69686 Modified: grass/trunk/gui/wxpython/tplot/frame.py Log: g.gui.tplot: t.vect.list changed flags Modified: grass/trunk/gui/wxpython/tplot/frame.py =================================================================== --- grass/trunk/gui/wxpython/tplot/frame.py 2016-10-09 01:51:29 UTC (rev 69685) +++ grass/trunk/gui/wxpython/tplot/frame.py 2016-10-09 01:52:10 UTC (rev 69686) @@ -899,7 +899,7 @@ break if found: try: - vect_list = grass.read_command('t.vect.list', flags='s', + vect_list = grass.read_command('t.vect.list', flags='u', input=dataset, column='name') except Exception: self.attribute.Clear() From svn_grass at osgeo.org Sat Oct 8 19:16:15 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 8 Oct 2016 19:16:15 -0700 Subject: [GRASS-SVN] r69687 - grass/trunk/vector/v.what/testsuite Message-ID: <20161009021615.C47B73901D3@trac.osgeo.org> Author: annakrat Date: 2016-10-08 19:16:15 -0700 (Sat, 08 Oct 2016) New Revision: 69687 Modified: grass/trunk/vector/v.what/testsuite/test_vwhat_layers.py Log: v.what: add tests for #3172 Modified: grass/trunk/vector/v.what/testsuite/test_vwhat_layers.py =================================================================== --- grass/trunk/vector/v.what/testsuite/test_vwhat_layers.py 2016-10-09 01:52:10 UTC (rev 69686) +++ grass/trunk/vector/v.what/testsuite/test_vwhat_layers.py 2016-10-09 02:16:15 UTC (rev 69687) @@ -112,7 +112,50 @@ number=8.09 """ +out4 = """East=634243 +North=226193 +Map=test_vector +Mapset=... +Type=Area +Sq_Meters=633834.281 +Hectares=63.383 +Acres=156.624 +Sq_Miles=0.2447 +Layer=1 +Category=2 +Driver=... +Database=... +Table=t1 +Key_column=cat_ +Layer=1 +Category=1 +Driver=... +Database=... +Table=t1 +Key_column=cat_ +cat_=1 +text=Petrášová +number=6 +""" + +out5 = """East=634243 +North=226193 + +Map=test_vector +Mapset=... +Type=Area +Sq_Meters=633834.281 +Hectares=63.383 +Acres=156.624 +Sq_Miles=0.2447 +Layer=2 +Category=3 +Layer=2 +Category=4 +""" + + class TestMultiLayerMap(TestCase): @classmethod @@ -156,6 +199,21 @@ except ValueError: self.fail(msg="No JSON object could be decoded:\n" + self.vwhat.outputs.stdout) + def test_selected_layers(self): + self.vwhat.inputs.layer = -1 + self.vwhat.flags['g'].value = True + self.vwhat.flags['a'].value = True + self.assertModule(self.vwhat) + self.assertLooksLike(reference=out3, actual=self.vwhat.outputs.stdout) + self.vwhat.inputs.layer = 1 + self.assertModule(self.vwhat) + self.assertLooksLike(reference=out4, actual=self.vwhat.outputs.stdout) + + self.vwhat.inputs.layer = 2 + self.vwhat.flags['a'].value = False + self.assertModule(self.vwhat) + self.assertLooksLike(reference=out5, actual=self.vwhat.outputs.stdout) + if __name__ == '__main__': test() From svn_grass at osgeo.org Sat Oct 8 19:17:30 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 8 Oct 2016 19:17:30 -0700 Subject: [GRASS-SVN] r69688 - grass/branches/releasebranch_7_2/vector/v.what/testsuite Message-ID: <20161009021730.1F6F33901D3@trac.osgeo.org> Author: annakrat Date: 2016-10-08 19:17:30 -0700 (Sat, 08 Oct 2016) New Revision: 69688 Modified: grass/branches/releasebranch_7_2/vector/v.what/testsuite/test_vwhat_layers.py Log: v.what: add tests for #3172 (merge from trunk, r69687) Modified: grass/branches/releasebranch_7_2/vector/v.what/testsuite/test_vwhat_layers.py =================================================================== --- grass/branches/releasebranch_7_2/vector/v.what/testsuite/test_vwhat_layers.py 2016-10-09 02:16:15 UTC (rev 69687) +++ grass/branches/releasebranch_7_2/vector/v.what/testsuite/test_vwhat_layers.py 2016-10-09 02:17:30 UTC (rev 69688) @@ -112,7 +112,50 @@ number=8.09 """ +out4 = """East=634243 +North=226193 +Map=test_vector +Mapset=... +Type=Area +Sq_Meters=633834.281 +Hectares=63.383 +Acres=156.624 +Sq_Miles=0.2447 +Layer=1 +Category=2 +Driver=... +Database=... +Table=t1 +Key_column=cat_ +Layer=1 +Category=1 +Driver=... +Database=... +Table=t1 +Key_column=cat_ +cat_=1 +text=Petrášová +number=6 +""" + +out5 = """East=634243 +North=226193 + +Map=test_vector +Mapset=... +Type=Area +Sq_Meters=633834.281 +Hectares=63.383 +Acres=156.624 +Sq_Miles=0.2447 +Layer=2 +Category=3 +Layer=2 +Category=4 +""" + + class TestMultiLayerMap(TestCase): @classmethod @@ -156,6 +199,21 @@ except ValueError: self.fail(msg="No JSON object could be decoded:\n" + self.vwhat.outputs.stdout) + def test_selected_layers(self): + self.vwhat.inputs.layer = -1 + self.vwhat.flags['g'].value = True + self.vwhat.flags['a'].value = True + self.assertModule(self.vwhat) + self.assertLooksLike(reference=out3, actual=self.vwhat.outputs.stdout) + self.vwhat.inputs.layer = 1 + self.assertModule(self.vwhat) + self.assertLooksLike(reference=out4, actual=self.vwhat.outputs.stdout) + + self.vwhat.inputs.layer = 2 + self.vwhat.flags['a'].value = False + self.assertModule(self.vwhat) + self.assertLooksLike(reference=out5, actual=self.vwhat.outputs.stdout) + if __name__ == '__main__': test() From svn_grass at osgeo.org Sat Oct 8 19:51:14 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 8 Oct 2016 19:51:14 -0700 Subject: [GRASS-SVN] r69689 - grass/trunk/lib/python/script Message-ID: <20161009025114.1557B3901D3@trac.osgeo.org> Author: annakrat Date: 2016-10-08 19:51:13 -0700 (Sat, 08 Oct 2016) New Revision: 69689 Modified: grass/trunk/lib/python/script/vector.py Log: pythonlib: add layers to vector_what function Modified: grass/trunk/lib/python/script/vector.py =================================================================== --- grass/trunk/lib/python/script/vector.py 2016-10-09 02:17:30 UTC (rev 69688) +++ grass/trunk/lib/python/script/vector.py 2016-10-09 02:51:13 UTC (rev 69689) @@ -269,7 +269,7 @@ orderedDict = None -def vector_what(map, coord, distance=0.0, ttype=None, encoding=None, skip_attributes=False): +def vector_what(map, coord, distance=0.0, ttype=None, encoding=None, skip_attributes=False, layer=None): """Query vector map at given locations To query one vector map at one location @@ -327,6 +327,8 @@ area, face) :param encoding: attributes encoding :param skip_attributes: True to skip quering attributes + :param layer: layer number or list of layers (one for each vector), + if None, all layers (-1) are used :return: parsed list """ @@ -339,7 +341,17 @@ else: map_list = map - layer_list = ['-1'] * len(map_list) + if layer: + if isinstance(layer, (tuple, list)): + layer_list = [str(l) for l in layer] + else: + layer_list = [str(layer)] + if len(layer_list) != len(map_list): + raise ScriptError(_("Number of given vector maps ({m}) " + "differs from number of layers ({l})").format(m=len(map_list), + l=len(layer_list))) + else: + layer_list = ['-1'] * len(map_list) coord_list = list() if isinstance(coord, tuple): From svn_grass at osgeo.org Sun Oct 9 03:59:56 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 9 Oct 2016 03:59:56 -0700 Subject: [GRASS-SVN] r69690 - grass/branches/releasebranch_7_2/raster/r.patch Message-ID: <20161009105956.DF3F0390240@trac.osgeo.org> Author: mlennert Date: 2016-10-09 03:59:56 -0700 (Sun, 09 Oct 2016) New Revision: 69690 Modified: grass/branches/releasebranch_7_2/raster/r.patch/main.c grass/branches/releasebranch_7_2/raster/r.patch/r.patch.html Log: r.patch: add flag to avoid creation of color and category files (merge from trunk r68681 - fix for #3056) Modified: grass/branches/releasebranch_7_2/raster/r.patch/main.c =================================================================== --- grass/branches/releasebranch_7_2/raster/r.patch/main.c 2016-10-09 02:51:13 UTC (rev 69689) +++ grass/branches/releasebranch_7_2/raster/r.patch/main.c 2016-10-09 10:59:56 UTC (rev 69690) @@ -41,7 +41,7 @@ char *rname; int i; int row, nrows, ncols; - int use_zero; + int use_zero, no_support; char *new_name; char **names; char **ptr; @@ -49,7 +49,7 @@ struct Cell_head *cellhd; struct GModule *module; - struct Flag *zeroflag; + struct Flag *zeroflag, *nosupportflag; struct Option *opt1, *opt2; G_gisinit(argv[0]); @@ -80,10 +80,16 @@ zeroflag->description = _("Use zero (0) for transparency instead of NULL"); + nosupportflag = G_define_flag(); + nosupportflag->key = 's'; + nosupportflag->description = + _("Do not create color and category files"); + if (G_parser(argc, argv)) exit(EXIT_FAILURE); use_zero = (zeroflag->answer); + no_support = (nosupportflag->answer); names = opt1->answers; @@ -163,19 +169,24 @@ G_free(presult); for (i = 0; i < nfiles; i++) Rast_close(infd[i]); - /* - * build the new cats and colors. do this before closing the new - * file, in case the new file is one of the patching files as well. - */ - G_verbose_message(_("Creating support files for raster map <%s>..."), new_name); - support(names, statf, nfiles, &cats, &cats_ok, &colr, &colr_ok, out_type); + if(!no_support) { + /* + * build the new cats and colors. do this before closing the new + * file, in case the new file is one of the patching files as well. + */ + G_verbose_message(_("Creating support files for raster map <%s>..."), new_name); + support(names, statf, nfiles, &cats, &cats_ok, &colr, &colr_ok, out_type); + } + /* now close (and create) the result */ Rast_close(outfd); - if (cats_ok) - Rast_write_cats(new_name, &cats); - if (colr_ok) - Rast_write_colors(new_name, G_mapset(), &colr); + if(!no_support) { + if (cats_ok) + Rast_write_cats(new_name, &cats); + if (colr_ok) + Rast_write_colors(new_name, G_mapset(), &colr); + } Rast_short_history(new_name, "raster", &history); Rast_command_history(&history); Modified: grass/branches/releasebranch_7_2/raster/r.patch/r.patch.html =================================================================== --- grass/branches/releasebranch_7_2/raster/r.patch/r.patch.html 2016-10-09 02:51:13 UTC (rev 69689) +++ grass/branches/releasebranch_7_2/raster/r.patch/r.patch.html 2016-10-09 10:59:56 UTC (rev 69690) @@ -80,7 +80,13 @@ layer.

        -r.patch creates support files for the patched, composite output map. +r.patch reads the existing category label files and color tables +from the input maps and creates these files for the patched, +composite output map. This can be quite time consuming for +certain maps, especially if there are many different category values +across the patched maps. The -s flag allows to disable the reading +and creation of these support files, meaning that the output +map will have no category labels and no explicit color table.

        Number of raster maps to be processed is given by the limit of the From svn_grass at osgeo.org Mon Oct 10 09:44:53 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 10 Oct 2016 09:44:53 -0700 Subject: [GRASS-SVN] r69691 - grass-addons/grass7/vector/v.fixed.segmentpoints Message-ID: <20161010164453.B91C23901D3@trac.osgeo.org> Author: hellik Date: 2016-10-10 09:44:53 -0700 (Mon, 10 Oct 2016) New Revision: 69691 Modified: grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.html grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.py Log: v.fixed.segmentpoints: add category of the input line to the segment point attribute table. patch by Paulo van Breugel Modified: grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.html =================================================================== --- grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.html 2016-10-09 10:59:56 UTC (rev 69690) +++ grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.html 2016-10-10 16:44:53 UTC (rev 69691) @@ -1,5 +1,6 @@

        DESCRIPTION

        +

        v.fixed.segmentpoints creates segment points along a vector line with fixed distances by using the v.segment module. A category of one line has to be given. Start and end point of the line @@ -7,11 +8,18 @@ As a prefix (starting with a letter) has to be given, resulting vectors are prefix_singleline and prefix_segmentpoints, resulting external files are -prefix_segmentpoints and prefix_segmentpoints.csv. The -next to last point may be closer to the last point as the given +prefix_segmentpoints and prefix_segmentpoints.csv. +

        + +

        +The next to last point may be closer to the last point as the given distance. Distance information for every point is added to the vector -attribute table. The attribute is then exported as CSV file. +attribute table. The attribute is then exported as CSV file. +

        +The category (cat) of the input line is stored in the column +cat_line of the prefix_segmentpoints attribute table. +

        EXAMPLE

        Modified: grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.py =================================================================== --- grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.py 2016-10-09 10:59:56 UTC (rev 69690) +++ grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.py 2016-10-10 16:44:53 UTC (rev 69691) @@ -196,10 +196,11 @@ grass.run_command("v.db.addcolumn", map = voutpoint, layer = 1, - columns = "cat_2 integer,distance double") + columns = "cat_2 integer,distance double,cat_line integer") grass.run_command("db.execute", sql = "UPDATE %s SET cat_2 = field_2" % (voutpoint)) - grass.run_command("db.execute", sql = "UPDATE %s SET distance = field_4" % (voutpoint)) + grass.run_command("db.execute", sql = "UPDATE %s SET distance = field_4" % (voutpoint)) + grass.run_command("db.execute", sql = "UPDATE %s SET cat_line = %d" % (voutpoint, int(vcat))) grass.run_command("db.execute", sql = "UPDATE %s SET distance = %s WHERE cat = %s" %(voutpoint, vector_line_length, number_segmentpoints_with_end)) grass.run_command("db.dropcolumn", table = voutpoint, From svn_grass at osgeo.org Tue Oct 11 03:51:04 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 11 Oct 2016 03:51:04 -0700 Subject: [GRASS-SVN] r69692 - grass/trunk/imagery/i.segment Message-ID: <20161011105104.E9D873901D3@trac.osgeo.org> Author: martinl Date: 2016-10-11 03:51:04 -0700 (Tue, 11 Oct 2016) New Revision: 69692 Modified: grass/trunk/imagery/i.segment/parse_args.c Log: i.segment: watershed method disabled, see #3181 Modified: grass/trunk/imagery/i.segment/parse_args.c =================================================================== --- grass/trunk/imagery/i.segment/parse_args.c 2016-10-10 16:44:53 UTC (rev 69691) +++ grass/trunk/imagery/i.segment/parse_args.c 2016-10-11 10:51:04 UTC (rev 69692) @@ -58,7 +58,12 @@ method->type = TYPE_STRING; method->required = NO; method->answer = "region_growing"; + method->options = "region_growing,mean_shift"; + /* + Watershed method disabled, it's not implemented yet, see + https://trac.osgeo.org/grass/ticket/3181 method->options = "region_growing,mean_shift,watershed"; + */ method->description = _("Segmentation method"); method->guisection = _("Settings"); From svn_grass at osgeo.org Tue Oct 11 03:56:05 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 11 Oct 2016 03:56:05 -0700 Subject: [GRASS-SVN] r69693 - grass/branches/releasebranch_7_2/imagery/i.segment Message-ID: <20161011105605.25F543901D3@trac.osgeo.org> Author: martinl Date: 2016-10-11 03:56:04 -0700 (Tue, 11 Oct 2016) New Revision: 69693 Modified: grass/branches/releasebranch_7_2/imagery/i.segment/parse_args.c Log: i.segment: watershed and mean shift methods disabled, see #3181 Modified: grass/branches/releasebranch_7_2/imagery/i.segment/parse_args.c =================================================================== --- grass/branches/releasebranch_7_2/imagery/i.segment/parse_args.c 2016-10-11 10:51:04 UTC (rev 69692) +++ grass/branches/releasebranch_7_2/imagery/i.segment/parse_args.c 2016-10-11 10:56:04 UTC (rev 69693) @@ -37,7 +37,12 @@ method->type = TYPE_STRING; method->required = NO; method->answer = "region_growing"; + method->options = "region_growing"; + /* + Watershed and Mean Shift methods disabled, it's not implemented yet, see + https://trac.osgeo.org/grass/ticket/3181 method->options = "region_growing,mean_shift,watershed"; + */ method->description = _("Segmentation method"); method->guisection = _("Settings"); From svn_grass at osgeo.org Tue Oct 11 18:13:18 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 11 Oct 2016 18:13:18 -0700 Subject: [GRASS-SVN] r69694 - grass/trunk/display/d.linegraph Message-ID: <20161012011318.662463903C2@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-11 18:13:18 -0700 (Tue, 11 Oct 2016) New Revision: 69694 Modified: grass/trunk/display/d.linegraph/Makefile grass/trunk/display/d.linegraph/main.c Log: d.linegraph: draw points Draw lines and points, points only, or workaround for thick line ends. Color inherited from the line, secondary color from settings. Modified: grass/trunk/display/d.linegraph/Makefile =================================================================== --- grass/trunk/display/d.linegraph/Makefile 2016-10-11 10:56:04 UTC (rev 69693) +++ grass/trunk/display/d.linegraph/Makefile 2016-10-12 01:13:18 UTC (rev 69694) @@ -2,8 +2,8 @@ PGM = d.linegraph -LIBES = $(DISPLAYLIB) $(GISLIB) $(RASTERLIB) -DEPENDENCIES = $(DISPLAYDEP) $(GISDEP) $(RASTERDEP) +LIBES = $(DISPLAYLIB) $(SYMBLIB) $(GISLIB) $(RASTERLIB) +DEPENDENCIES = $(DISPLAYDEP) $(SYMBDEP) $(GISDEP) $(RASTERDEP) include $(MODULE_TOPDIR)/include/Make/Module.make Modified: grass/trunk/display/d.linegraph/main.c =================================================================== --- grass/trunk/display/d.linegraph/main.c 2016-10-11 10:56:04 UTC (rev 69693) +++ grass/trunk/display/d.linegraph/main.c 2016-10-12 01:13:18 UTC (rev 69694) @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -77,6 +78,82 @@ } } +/* copied from d.vect */ +static int cmp(const void *a, const void *b) +{ + return (strcmp(*(char **)a, *(char **)b)); +} + +/* TODO: this should go to the library with new gisprompt and std opt */ +/* copied from d.vect, requires dirent.h */ +static char *icon_files(void) +{ + char **list, *ret; + char buf[GNAME_MAX], path[GPATH_MAX], path_i[GPATH_MAX]; + int i, count; + size_t len; + DIR *dir, *dir_i; + struct dirent *d, *d_i; + + list = NULL; + len = 0; + sprintf(path, "%s/etc/symbol", G_gisbase()); + + dir = opendir(path); + if (!dir) + return NULL; + + count = 0; + + /* loop over etc/symbol */ + while ((d = readdir(dir))) { + if (d->d_name[0] == '.') + continue; + + sprintf(path_i, "%s/etc/symbol/%s", G_gisbase(), d->d_name); + dir_i = opendir(path_i); + + if (!dir_i) + continue; + + /* loop over each directory in etc/symbols */ + while ((d_i = readdir(dir_i))) { + if (d_i->d_name[0] == '.') + continue; + + list = G_realloc(list, (count + 1) * sizeof(char *)); + + sprintf(buf, "%s/%s", d->d_name, d_i->d_name); + list[count++] = G_store(buf); + + len += strlen(d->d_name) + strlen(d_i->d_name) + 2; /* '/' + ',' */ + } + + closedir(dir_i); + } + + closedir(dir); + + qsort(list, count, sizeof(char *), cmp); + + if (len > 0) { + ret = G_malloc((len + 1) * sizeof(char)); /* \0 */ + *ret = '\0'; + for (i = 0; i < count; i++) { + if (i > 0) + strcat(ret, ","); + strcat(ret, list[i]); + G_free(list[i]); + } + G_free(list); + } + else { + ret = G_store(""); + } + + return ret; +} + int main(int argc, char **argv) { double xoffset; /* offset for x-axis */ @@ -138,6 +215,11 @@ struct Option *t_color_opt; struct Option *y_range_opt; struct Option *ytics_opt; + struct Option *point_symbol_opt; + struct Option *point_size_opt; + struct Option *point_color2_opt; + struct Option *secondary_width_opt; + struct Flag *do_points_flg, *no_lines_flg; /* Initialize the GIS calls */ G_gisinit(argv[0]); @@ -235,6 +317,55 @@ ytics_opt->required = NO; ytics_opt->multiple = YES; + point_symbol_opt = G_define_option(); + /* TODO: name must be icon to get GUI dialog */ + point_symbol_opt->key = "icon"; + point_symbol_opt->type = TYPE_STRING; + point_symbol_opt->required = NO; + point_symbol_opt->multiple = NO; + point_symbol_opt->answer = "basic/circle"; + /* This could also use ->gisprompt = "old,symbol,symbol" instead of ->options */ + point_symbol_opt->options = icon_files(); + point_symbol_opt->description = _("Symbol for point"); + point_symbol_opt->guisection = _("Points"); + + point_size_opt = G_define_option(); + point_size_opt->key = "point_size"; + point_size_opt->type = TYPE_DOUBLE; + point_size_opt->required = NO; + point_size_opt->multiple = NO; + point_size_opt->answer = "5"; + point_size_opt->label = _("Point size"); + point_size_opt->guisection = _("Points"); + + /* theoretically for other things than points */ + point_color2_opt = G_define_standard_option(G_OPT_CN); + point_color2_opt->key = "secondary_color"; + point_color2_opt->type = TYPE_STRING; + point_color2_opt->required = NO; + point_color2_opt->multiple = NO; + point_color2_opt->description = _("Color for point symbol edge color"); + point_color2_opt->guisection = _("Points"); + + /* theoretically for other things than points */ + secondary_width_opt = G_define_option(); + secondary_width_opt->key = "secondary_width"; + secondary_width_opt->description = _("Width of point symbol lines"); + secondary_width_opt->type = TYPE_INTEGER; + secondary_width_opt->required = NO; + secondary_width_opt->multiple = YES; + secondary_width_opt->answer = "0.1"; + + /* TODO: change this to option, use filled/empty symbol option for this */ + do_points_flg = G_define_flag(); + do_points_flg->key = 's'; + do_points_flg->description = "Draw points"; + do_points_flg->guisection = _("Points"); + + no_lines_flg = G_define_flag(); + no_lines_flg->key = 'l'; + no_lines_flg->description = "Do not draw lines"; + if (G_parser(argc, argv)) exit(EXIT_FAILURE); @@ -285,6 +416,58 @@ title_color = D_translate_color(t_color_opt->answer); + int draw_lines = TRUE; + int draw_points = FALSE; + + if (do_points_flg->answer) + draw_points = TRUE; + if (no_lines_flg->answer) + draw_lines = FALSE; + + SYMBOL *point_symbol = NULL; + double symbol_size; + double symbol_rotation = 0; /* not supported here */ + int symbol_tolerance = 0; /* not supported by S_stroke */ + double symbol_line_width; + + if (point_size_opt->answer) + symbol_size = atof(point_size_opt->answer); + + if (secondary_width_opt->answer) + symbol_line_width = atof(secondary_width_opt->answer); + + /* TODO: symbol vs point in iface and vars */ + /* there seems there is no free for symbol */ + if (draw_points && point_symbol_opt->answer) { + point_symbol = S_read(point_symbol_opt->answer); + /* S_read gives warning only */ + if (!point_symbol) + G_fatal_error(_("Cannot find/open symbol: '%s'"), point_symbol_opt->answer); + } + RGBA_Color primary_color; + RGBA_Color secondary_color; + + if (draw_points) { + S_stroke(point_symbol, symbol_size, symbol_rotation, symbol_tolerance); + primary_color.a = RGBA_COLOR_OPAQUE; + + if (point_color2_opt->answer) { + int rgb_r, rgb_g, rgb_b; + int ret = G_str_to_color(point_color2_opt->answer, &rgb_r, &rgb_g, &rgb_b); + if (ret == 0) + G_fatal_error(_("Color <%s> cannot for option %s be parsed"), + point_color2_opt->answer, point_color2_opt->key); + else if (ret == 2) + secondary_color.a = RGBA_COLOR_TRANSPARENT; + else + secondary_color.a = RGBA_COLOR_OPAQUE; + secondary_color.r = rgb_r; + secondary_color.g = rgb_g; + secondary_color.b = rgb_b; + + } + } + /* TODO: use parser for the following and avoid -Wsign-compare */ /* I had an argument with the parser, and couldn't get a neat list of the input colors as I thought I should. I did a quick hack to get @@ -521,13 +704,6 @@ /* draw increment of each Y file's data */ - if (color_table_opt->answer) - D_RGB_color(in[i].r, in[i].g, in[i].b); - else - D_use_color(in[i].color); - if (line_width_opt->answer) - D_line_width(in[i].width); - /* find out position of where Y should be drawn. */ /* if our minimum value of y is not negative, this is easy */ @@ -549,9 +725,40 @@ } new_x = xoffset + (line * xscale); + /* draw only when we the previous point to start from */ - if (line > 0) + if (draw_lines && line > 0) { + if (color_table_opt->answer) + D_RGB_color(in[i].r, in[i].g, in[i].b); + else + D_use_color(in[i].color); + if (line_width_opt->answer) + D_line_width(in[i].width); D_line_abs(prev_x, prev_y[i], new_x, new_y[i]); + } + /* draw points after lines, last point after last line */ + if (draw_points && line > 0) { + if (color_table_opt->answer) { + primary_color.r = in[i].r; + primary_color.g = in[i].g; + primary_color.b = in[i].b; + } + else { + /* TODO: do this ahead. store in .r .g .b in .rgb */ + int rgb_r, rgb_g, rgb_b; + D_color_number_to_RGB(in[i].color, &rgb_r, &rgb_g, &rgb_b); + primary_color.r = rgb_r; + primary_color.g = rgb_g; + primary_color.b = rgb_b; + } + D_line_width(symbol_line_width); + D_symbol2(point_symbol, prev_x, prev_y[i], &primary_color, + &secondary_color); + /* last point */ + if (line == in[i].num_pnts - 1) + D_symbol2(point_symbol, new_x, new_y[i], &primary_color, + &secondary_color); + } prev_y[i] = new_y[i]; } } From svn_grass at osgeo.org Fri Oct 14 03:18:18 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Fri, 14 Oct 2016 03:18:18 -0700 Subject: [GRASS-SVN] r69695 - grass-addons/grass7/imagery/i.landsat8.qc Message-ID: <20161014101818.E22B93901D3@trac.osgeo.org> Author: sbl Date: 2016-10-14 03:18:18 -0700 (Fri, 14 Oct 2016) New Revision: 69695 Modified: grass-addons/grass7/imagery/i.landsat8.qc/i.landsat8.qc.py Log: fixed typo in option cloud_shadow Modified: grass-addons/grass7/imagery/i.landsat8.qc/i.landsat8.qc.py =================================================================== --- grass-addons/grass7/imagery/i.landsat8.qc/i.landsat8.qc.py 2016-10-12 01:13:18 UTC (rev 69694) +++ grass-addons/grass7/imagery/i.landsat8.qc/i.landsat8.qc.py 2016-10-14 10:18:18 UTC (rev 69695) @@ -71,7 +71,7 @@ #%end #%option -#% key: cloud_shaddow +#% key: cloud_shadow #% multiple: yes #% description: Unacceptable conditions for Cloud Shaddow Confidence (bit 6-7) #% options: Not Determined, No, Maybe, Yes @@ -111,7 +111,7 @@ #%end #%rules -#% required: designated_fill,dropped_frame,terrain_occlusion,water,cloud_shaddow,vegetation,snow_ice,cirrus,cloud +#% required: designated_fill,dropped_frame,terrain_occlusion,water,cloud_shadow,vegetation,snow_ice,cirrus,cloud #%end import os @@ -172,7 +172,7 @@ 'terrain_occlusion': 1, # 'reserved': 1, 'water': 2, - 'cloud_shaddow': 2, + 'cloud_shadow': 2, 'vegetation': 2, 'snow_ice': 2, 'cirrus': 2, @@ -185,7 +185,7 @@ 'terrain_occlusion': 2, # 'reserved': 3, 'water': 4, - 'cloud_shaddow': 6, + 'cloud_shadow': 6, 'vegetation': 8, 'snow_ice': 10, 'cirrus': 12, From svn_grass at osgeo.org Fri Oct 14 21:28:42 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Fri, 14 Oct 2016 21:28:42 -0700 Subject: [GRASS-SVN] r69696 - grass-addons/grass7/raster/r.randomforest Message-ID: <20161015042842.686043901D3@trac.osgeo.org> Author: spawley Date: 2016-10-14 21:28:42 -0700 (Fri, 14 Oct 2016) New Revision: 69696 Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.py Log: fixed bug in loading model in r.randomforest Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.py =================================================================== --- grass-addons/grass7/raster/r.randomforest/r.randomforest.py 2016-10-14 10:18:18 UTC (rev 69695) +++ grass-addons/grass7/raster/r.randomforest/r.randomforest.py 2016-10-15 04:28:42 UTC (rev 69696) @@ -294,9 +294,12 @@ #%rules #% exclusive: roi,loadfile +#% exclusive: roi,load_training #% exclusive: save_training,load_training #%end + + # import standard modules import atexit, random, string, re, os import numpy as np @@ -307,14 +310,35 @@ from grass.pygrass.gis.region import Region from grass.pygrass.raster.buffer import Buffer from grass.pygrass.modules.shortcuts import imagery as im - + + + def cleanup(): grass.run_command("g.remove", name='clfmasktmp', flags="f", type="raster", quiet=True) + + def sample_predictors_byrow(response, predictors): + """ + Samples a list of GRASS rasters using a labelled raster + Row-by-row sampling + + Parameters + ---------- + response: String; GRASS raster with labelled pixels + predictors: List of GRASS rasters containing explanatory variables + + Returns + ------- + + training_data: Numpy array of extracted raster values + training_labels: Numpy array of labels + + """ + # create response rasterrow and open roi_raster = RasterRow(response) roi_raster.open('r') @@ -401,8 +425,27 @@ return(training_data, training_labels) + + def sample_predictors(response, predictors): + """ + Samples a list of GRASS rasters using a labelled raster + Per raster sampling + + Parameters + ---------- + response: String; GRASS raster with labelled pixels + predictors: List of GRASS rasters containing explanatory variables + + Returns + ------- + + training_data: Numpy array of extracted raster values + training_labels: Numpy array of labels + + """ + # open response raster as rasterrow and read as np array if RasterRow(response).exist() == True: roi_gr = RasterRow(response) @@ -451,12 +494,26 @@ # return X and y data return(training_data[:, 0:n_features], training_data[:, n_features]) + + def prediction(clf, predictors, class_probabilities, - rowincr, output, mode, labels): + rowincr, output, mode): - class_list = np.unique(labels) - nclasses = len(class_list) + """ + Prediction on list of GRASS rasters using a fitted scikit learn model + Parameters + ---------- + clf: Scikit learn estimator object + predictors: List of paths to GDAL rasters that represent the predictor variables + output: Name of GRASS raster to output classification results + rowincr: Integer of raster rows to process at one time + class_probabilties: Boolean of whether probabilities of each class should also be predicted + mode: String, classification or regression mode + labels: Numpy array of the labels used for the classification + + """ + # create a list of rasterrow objects for predictors n_features = len(predictors) rasstack = [0] * n_features @@ -549,7 +606,7 @@ if class_probabilities == True and mode == 'classification': result_proba = clf.predict_proba(flat_pixels) - for iclass in range(nclasses): + for iclass in range(result_proba.shape[1]): result_proba_class = result_proba[:, iclass] result_proba_class = \ result_proba_class.reshape((rowincr, current.cols)) @@ -571,8 +628,26 @@ if class_probabilities == True and mode == 'classification': for iclass in range(nclasses): prob[iclass].close() + + def shuffle_data(X, y, rstate): + """ + Uses scikit learn to shuffle data + + Parameters + ---------- + X: Numpy array containing predictor values + y: Numpy array containing labels + rstate: Seed for random generator + + Returns + ------- + X: Numpy array containing predictor values + y: Numpy array containing labels + + """ + from sklearn.utils import shuffle # combine XY data into a single numpy array @@ -588,12 +663,30 @@ return(X, y) + + def cross_val_classification(clf, X, y, cv, rstate): - # custom function to calculate classification metrics - # eliminates need to calculate each metric using cross_val_score - # returns: a 1D list of accuracy, kappa and auc scores - # returns: mean precision/recall and std precision/recall per class + + """ + Stratified Kfold cross-validation + Generates several scoring_metrics without the need to repeatedly use cross_val_score + Also produces by-class scores + + Parameters + ---------- + clf: Scikit learn estimator object + X: Numpy array containing predictor values + y: Numpy array containing labels + cv: Integer of cross-validation folds + rstate: Seed to pass to the random number generator + + Returns + ------- + cmstats: Dictionary of global accuracy measures per fold + byclass_metrics: Dictionary of by-class accuracy measures per fold + """ + from sklearn import cross_validation, metrics class_list = np.unique(y) @@ -686,23 +779,55 @@ return(cmstats, byclass_metrics) def save_training_data(X, y, file): - # append X and y and save to csv + + """ + Saves any extracted training data to a csv file + + Parameters + ---------- + X: Numpy array containing predictor values + y: Numpy array containing labels + file: Path to a csv file to save data to + + """ + training_data = np.zeros((y.shape[0], X.shape[1]+1)) training_data[:, 0:X.shape[1]] = X training_data[:, X.shape[1]] = y np.savetxt(file, training_data, delimiter = ',') + + def load_training_data(file): + + """ + Loads training data and labels from a csv file + + Parameters + ---------- + file: Path to a csv file to save data to + + Returns + ------- + X: Numpy array containing predictor values + y: Numpy array containing labels + + """ + training_data = np.loadtxt(file, delimiter = ',') n_features = training_data.shape[1] X = training_data[:, 0:n_features-1] y = training_data[:, n_features-1] + return(X, y) def main(): + """ GRASS options and flags + ----------------------- """ + # General options and flags igroup = options['igroup'] roi = options['roi'] @@ -760,8 +885,10 @@ else: mode = 'regression' + """ Error checking for valid input parameters + ----------------------------------------- """ # decision trees @@ -813,8 +940,10 @@ else: weighting = None + """ Obtain information about GRASS rasters to be classified + ------------------------------------------------------- """ # fetch individual raster names from group @@ -835,9 +964,11 @@ warnings.filterwarnings("ignore") except: grass.fatal("Scikit-learn python module is not installed...exiting") - + + """ Sample training data using training ROI + --------------------------------------- """ # load the model or training data @@ -867,9 +998,11 @@ if m_features_dt > n_features: m_features_dt = n_features if m_features_rf > n_features: m_features_rf = n_features if max_features_gtb > n_features: max_features_gtb = n_features - + + """ Train the classifier + -------------------- """ # define classifier unless model is to be loaded from file @@ -947,8 +1080,10 @@ clf.fit(X, y) grass.message(_("Model built with: " + model)) + """ Cross Validation + ---------------- """ # output internal performance measures for random forests @@ -1032,11 +1167,13 @@ if modelonly == True: grass.fatal("Model built and now exiting") + """ Prediction on the rest of the GRASS rasters in the imagery group + ---------------------------------------------------------------- """ - prediction(clf, maplist, class_probabilities, rowincr, output, mode, y) + prediction(clf, maplist, class_probabilities, rowincr, output, mode) if __name__ == "__main__": From svn_grass at osgeo.org Sat Oct 15 20:11:40 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 15 Oct 2016 20:11:40 -0700 Subject: [GRASS-SVN] r69697 - in grass/trunk/display: d.legend.vect d.vect d.vect.thematic Message-ID: <20161016031140.4F8EB3902B3@trac.osgeo.org> Author: annakrat Date: 2016-10-15 20:11:40 -0700 (Sat, 15 Oct 2016) New Revision: 69697 Modified: grass/trunk/display/d.legend.vect/d.legend.vect.html grass/trunk/display/d.legend.vect/draw.c grass/trunk/display/d.vect.thematic/legend.c grass/trunk/display/d.vect/legend.c Log: d.legend.vect: add new column to legend file to be able to distinguish line/fill color by d.vect and primary/secondary color by d.vect.thematic Modified: grass/trunk/display/d.legend.vect/d.legend.vect.html =================================================================== --- grass/trunk/display/d.legend.vect/d.legend.vect.html 2016-10-15 04:28:42 UTC (rev 69696) +++ grass/trunk/display/d.legend.vect/d.legend.vect.html 2016-10-16 03:11:40 UTC (rev 69697) @@ -53,16 +53,19 @@

        Legend file has this format:

        -label|symbol_name|feature_color|fill_color|size|line_width|geometry_type|feature_count
        +label|symbol_name|size|color_type|feature_color|fill_color|line_width|geometry_type|feature_count
         
        +Color type can be 'lf' or 'ps'. Based on color type color columns are interpreted +as line color and fill colors (lf), or primary and secondary colors (ps). +Module d.vect always uses 'lf' and d.vect.thematic 'ps'. Here is an example of legend file with subtitles:
        -Infrastructure|||||||
        -major roads|legend/line|5|black|200:200:200|2|line|355
        -bridges|extra/bridge|15|black|black|1|point|10938
        -Hydrology|||||||
        -streams|legend/line_crooked|5|30:144:255|200:200:200|3|line|8554
        -water bodies|legend/area_curved|5|none|30:144:255|1|area|27764
        +Infrastructure||||||||
        +major roads|legend/line|5|lf|black|200:200:200|2|line|355
        +bridges|extra/bridge|15|lf|black|black|1|point|10938
        +Hydrology||||||||
        +streams|legend/line_crooked|5|lf|30:144:255|200:200:200|3|line|8554
        +water bodies|legend/area_curved|5|lf|none|30:144:255|1|area|27764
         
        Example of subheadings used in vector legend Modified: grass/trunk/display/d.legend.vect/draw.c =================================================================== --- grass/trunk/display/d.legend.vect/draw.c 2016-10-15 04:28:42 UTC (rev 69696) +++ grass/trunk/display/d.legend.vect/draw.c 2016-10-16 03:11:40 UTC (rev 69697) @@ -29,7 +29,7 @@ char buf[BUFFSIZE]; int got_new; SYMBOL *Symb; - char *symb_name, *line_color_str, *fill_color_str, *label, *type_str; + char *symb_name, *line_color_str, *fill_color_str, *label, *type_str, *color_type; double size, line_width; double row_w, text_h, title_h, title_w; RGBA_Color *line_color, *fill_color; @@ -67,7 +67,7 @@ file_in = fopen(file_name, "r"); sub_delim = G_malloc(GNAME_MAX); - snprintf(sub_delim, sizeof(GNAME_MAX), "%s%s%s%s%s", sep, sep, sep, sep, sep); + snprintf(sub_delim, sizeof(GNAME_MAX), "%s%s%s%s%s%s", sep, sep, sep, sep, sep, sep); if (!file_in) G_fatal_error(_("Unable to open input file <%s>"), file_name); @@ -83,7 +83,7 @@ tokens = G_tokenize(buf, sep); symb_name = G_store(tokens[1]); size = atof(tokens[2]); - type_str = G_store(tokens[6]); + type_str = G_store(tokens[7]); G_free_tokens(tokens); /* Symbol */ @@ -167,10 +167,11 @@ label = G_store(tokens[0]); symb_name = G_store(tokens[1]); size = atof(tokens[2]); - line_color_str = G_store(tokens[3]); - fill_color_str = G_store(tokens[4]); - line_width = atof(tokens[5]); - type_str = G_store(tokens[6]); + color_type = G_store(tokens[3]); + line_color_str = G_store(tokens[4]); + fill_color_str = G_store(tokens[5]); + line_width = atof(tokens[6]); + type_str = G_store(tokens[7]); G_free_tokens(tokens); /* Symbol */ @@ -233,8 +234,17 @@ x = x0 + offs_x + def_symb_w/2.; y = y0 + offs_y - symb_h/2; D_line_width(line_width); - D_symbol(Symb, x, y, line_color, fill_color); - + /* lf - line, fill (as in d.vect)*/ + if (strcmp(color_type, "lf") == 0) + D_symbol(Symb, x, y, line_color, fill_color); + /* ps - primary, secondary (as in d.vect.thematic) */ + else if (strcmp(color_type, "ps") == 0) + D_symbol2(Symb, x, y, line_color, fill_color); + else { + G_warning(_("Invalid value for color type in legend file. " + "Use one of 'lf' or 'ps'.")); + D_symbol(Symb, x, y, line_color, fill_color); + } x = x0 + offs_x + def_symb_w + sym_lbl_space; y = y0 + offs_y - symb_h/2. + text_h/2.; D_pos_abs(x, y); Modified: grass/trunk/display/d.vect/legend.c =================================================================== --- grass/trunk/display/d.vect/legend.c 2016-10-15 04:28:42 UTC (rev 69696) +++ grass/trunk/display/d.vect/legend.c 2016-10-16 03:11:40 UTC (rev 69697) @@ -30,7 +30,7 @@ fprintf(fd, "%s|", leglab); else fprintf(fd, "%s|", map); - fprintf(fd, "%s|%s|%s|%s|%s", icon, size, color, fcolor, width); + fprintf(fd, "%s|%s|lf|%s|%s|%s", icon, size, color, fcolor, width); fprintf(fd, "|%s|%d\n", "point", nfeatures); } } @@ -43,7 +43,7 @@ fprintf(fd, "%s|", leglab); else fprintf(fd, "%s|", map); - fprintf(fd, "%s|%s|%s|%s|%s", icon_line, size, color, fcolor, width); + fprintf(fd, "%s|%s|lf|%s|%s|%s", icon_line, size, color, fcolor, width); fprintf(fd, "|%s|%d\n", "line", nfeatures); } } @@ -56,7 +56,7 @@ fprintf(fd, "%s|", leglab); else fprintf(fd, "%s|", map); - fprintf(fd, "%s|%s|%s|%s|%s", icon_area, size, color, fcolor, width); + fprintf(fd, "%s|%s|lf|%s|%s|%s", icon_area, size, color, fcolor, width); fprintf(fd, "|%s|%d\n", "area", nfeatures); } } @@ -68,7 +68,7 @@ fprintf(fd, "%s|", leglab); else fprintf(fd, "%s|", map); - fprintf(fd, "%s|%s|%s|%s|%s", icon, size, color, fcolor, width); + fprintf(fd, "%s|%s|lf|%s|%s|%s", icon, size, color, fcolor, width); fprintf(fd, "|%s|%d\n", "centroid", nfeatures); } } Modified: grass/trunk/display/d.vect.thematic/legend.c =================================================================== --- grass/trunk/display/d.vect.thematic/legend.c 2016-10-15 04:28:42 UTC (rev 69696) +++ grass/trunk/display/d.vect.thematic/legend.c 2016-10-16 03:11:40 UTC (rev 69697) @@ -28,7 +28,7 @@ fd = fopen(legfile, "a"); /* Title */ - fprintf(fd, "|||||%s\n", title); + fprintf(fd, "||||||%s\n", title); /* First line */ if (stats_min > breakpoints[0]){ @@ -37,16 +37,16 @@ else{ fprintf(fd, "%.2f - %.2f|",stats_min, breakpoints[0]); } - fprintf(fd, "%s|%d|%d:%d:%d|%d:%d:%d|%d|%s|%d\n", - icon, size, bcolor.r, bcolor.g, bcolor.b, - colors[0].r, colors[0].g, colors[0].b, default_width, + fprintf(fd, "%s|%d|ps|%d:%d:%d|%d:%d:%d|%d|%s|%d\n", + icon, size, colors[0].r, colors[0].g, colors[0].b, + bcolor.r, bcolor.g, bcolor.b, default_width, topo, frequencies[0]); /* Middle lines */ for (i = 1; i < nbreaks; i++){ - fprintf(fd, "%.2f - %.2f|%s|%d|%d:%d:%d|%d:%d:%d|%d|%s|%d\n", + fprintf(fd, "%.2f - %.2f|%s|%d|ps|%d:%d:%d|%d:%d:%d|%d|%s|%d\n", breakpoints[i-1],breakpoints[i], - icon, size, bcolor.r, bcolor.g, bcolor.b, - colors[i].r, colors[i].g, colors[i].b, default_width, + icon, size, colors[i].r, colors[i].g, colors[i].b, + bcolor.r, bcolor.g, bcolor.b, default_width, topo, frequencies[i]); } /* Last one */ @@ -56,9 +56,9 @@ else { fprintf(fd, "%.2f - %.2f|", breakpoints[nbreaks - 1], stats_max); } - fprintf(fd, "%s|%d|%d:%d:%d|%d:%d:%d|%d|%s|%d\n", - icon, size, bcolor.r, bcolor.g, bcolor.b, - colors[nbreaks].r, colors[nbreaks].g, colors[nbreaks].b, default_width, + fprintf(fd, "%s|%d|ps|%d:%d:%d|%d:%d:%d|%d|%s|%d\n", + icon, size, colors[nbreaks].r, colors[nbreaks].g, colors[nbreaks].b, + bcolor.r, bcolor.g, bcolor.b, default_width, topo, frequencies[nbreaks]); fclose(fd); From svn_grass at osgeo.org Sat Oct 15 20:22:49 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 15 Oct 2016 20:22:49 -0700 Subject: [GRASS-SVN] r69698 - in grass/branches/releasebranch_7_2/display: d.legend.vect d.vect d.vect.thematic Message-ID: <20161016032249.65C3E3902B3@trac.osgeo.org> Author: annakrat Date: 2016-10-15 20:22:49 -0700 (Sat, 15 Oct 2016) New Revision: 69698 Modified: grass/branches/releasebranch_7_2/display/d.legend.vect/d.legend.vect.html grass/branches/releasebranch_7_2/display/d.legend.vect/draw.c grass/branches/releasebranch_7_2/display/d.vect.thematic/legend.c grass/branches/releasebranch_7_2/display/d.vect/legend.c Log: d.legend.vect: add new column to legend file to be able to distinguish line/fill color by d.vect and primary/secondary color by d.vect.thematic (merge from trunk, r69697) Modified: grass/branches/releasebranch_7_2/display/d.legend.vect/d.legend.vect.html =================================================================== --- grass/branches/releasebranch_7_2/display/d.legend.vect/d.legend.vect.html 2016-10-16 03:11:40 UTC (rev 69697) +++ grass/branches/releasebranch_7_2/display/d.legend.vect/d.legend.vect.html 2016-10-16 03:22:49 UTC (rev 69698) @@ -53,16 +53,19 @@

        Legend file has this format:

        -label|symbol_name|feature_color|fill_color|size|line_width|geometry_type|feature_count
        +label|symbol_name|size|color_type|feature_color|fill_color|line_width|geometry_type|feature_count
         
        +Color type can be 'lf' or 'ps'. Based on color type color columns are interpreted +as line color and fill colors (lf), or primary and secondary colors (ps). +Module d.vect always uses 'lf' and d.vect.thematic 'ps'. Here is an example of legend file with subtitles:
        -Infrastructure|||||||
        -major roads|legend/line|5|black|200:200:200|2|line|355
        -bridges|extra/bridge|15|black|black|1|point|10938
        -Hydrology|||||||
        -streams|legend/line_crooked|5|30:144:255|200:200:200|3|line|8554
        -water bodies|legend/area_curved|5|none|30:144:255|1|area|27764
        +Infrastructure||||||||
        +major roads|legend/line|5|lf|black|200:200:200|2|line|355
        +bridges|extra/bridge|15|lf|black|black|1|point|10938
        +Hydrology||||||||
        +streams|legend/line_crooked|5|lf|30:144:255|200:200:200|3|line|8554
        +water bodies|legend/area_curved|5|lf|none|30:144:255|1|area|27764
         
        Example of subheadings used in vector legend Modified: grass/branches/releasebranch_7_2/display/d.legend.vect/draw.c =================================================================== --- grass/branches/releasebranch_7_2/display/d.legend.vect/draw.c 2016-10-16 03:11:40 UTC (rev 69697) +++ grass/branches/releasebranch_7_2/display/d.legend.vect/draw.c 2016-10-16 03:22:49 UTC (rev 69698) @@ -29,7 +29,7 @@ char buf[BUFFSIZE]; int got_new; SYMBOL *Symb; - char *symb_name, *line_color_str, *fill_color_str, *label, *type_str; + char *symb_name, *line_color_str, *fill_color_str, *label, *type_str, *color_type; double size, line_width; double row_w, text_h, title_h, title_w; RGBA_Color *line_color, *fill_color; @@ -67,7 +67,7 @@ file_in = fopen(file_name, "r"); sub_delim = G_malloc(GNAME_MAX); - snprintf(sub_delim, sizeof(GNAME_MAX), "%s%s%s%s%s", sep, sep, sep, sep, sep); + snprintf(sub_delim, sizeof(GNAME_MAX), "%s%s%s%s%s%s", sep, sep, sep, sep, sep, sep); if (!file_in) G_fatal_error(_("Unable to open input file <%s>"), file_name); @@ -83,7 +83,7 @@ tokens = G_tokenize(buf, sep); symb_name = G_store(tokens[1]); size = atof(tokens[2]); - type_str = G_store(tokens[6]); + type_str = G_store(tokens[7]); G_free_tokens(tokens); /* Symbol */ @@ -167,10 +167,11 @@ label = G_store(tokens[0]); symb_name = G_store(tokens[1]); size = atof(tokens[2]); - line_color_str = G_store(tokens[3]); - fill_color_str = G_store(tokens[4]); - line_width = atof(tokens[5]); - type_str = G_store(tokens[6]); + color_type = G_store(tokens[3]); + line_color_str = G_store(tokens[4]); + fill_color_str = G_store(tokens[5]); + line_width = atof(tokens[6]); + type_str = G_store(tokens[7]); G_free_tokens(tokens); /* Symbol */ @@ -233,8 +234,17 @@ x = x0 + offs_x + def_symb_w/2.; y = y0 + offs_y - symb_h/2; D_line_width(line_width); - D_symbol(Symb, x, y, line_color, fill_color); - + /* lf - line, fill (as in d.vect)*/ + if (strcmp(color_type, "lf") == 0) + D_symbol(Symb, x, y, line_color, fill_color); + /* ps - primary, secondary (as in d.vect.thematic) */ + else if (strcmp(color_type, "ps") == 0) + D_symbol2(Symb, x, y, line_color, fill_color); + else { + G_warning(_("Invalid value for color type in legend file. " + "Use one of 'lf' or 'ps'.")); + D_symbol(Symb, x, y, line_color, fill_color); + } x = x0 + offs_x + def_symb_w + sym_lbl_space; y = y0 + offs_y - symb_h/2. + text_h/2.; D_pos_abs(x, y); Modified: grass/branches/releasebranch_7_2/display/d.vect/legend.c =================================================================== --- grass/branches/releasebranch_7_2/display/d.vect/legend.c 2016-10-16 03:11:40 UTC (rev 69697) +++ grass/branches/releasebranch_7_2/display/d.vect/legend.c 2016-10-16 03:22:49 UTC (rev 69698) @@ -30,7 +30,7 @@ fprintf(fd, "%s|", leglab); else fprintf(fd, "%s|", map); - fprintf(fd, "%s|%s|%s|%s|%s", icon, size, color, fcolor, width); + fprintf(fd, "%s|%s|lf|%s|%s|%s", icon, size, color, fcolor, width); fprintf(fd, "|%s|%d\n", "point", nfeatures); } } @@ -43,7 +43,7 @@ fprintf(fd, "%s|", leglab); else fprintf(fd, "%s|", map); - fprintf(fd, "%s|%s|%s|%s|%s", icon_line, size, color, fcolor, width); + fprintf(fd, "%s|%s|lf|%s|%s|%s", icon_line, size, color, fcolor, width); fprintf(fd, "|%s|%d\n", "line", nfeatures); } } @@ -56,7 +56,7 @@ fprintf(fd, "%s|", leglab); else fprintf(fd, "%s|", map); - fprintf(fd, "%s|%s|%s|%s|%s", icon_area, size, color, fcolor, width); + fprintf(fd, "%s|%s|lf|%s|%s|%s", icon_area, size, color, fcolor, width); fprintf(fd, "|%s|%d\n", "area", nfeatures); } } @@ -68,7 +68,7 @@ fprintf(fd, "%s|", leglab); else fprintf(fd, "%s|", map); - fprintf(fd, "%s|%s|%s|%s|%s", icon, size, color, fcolor, width); + fprintf(fd, "%s|%s|lf|%s|%s|%s", icon, size, color, fcolor, width); fprintf(fd, "|%s|%d\n", "centroid", nfeatures); } } Modified: grass/branches/releasebranch_7_2/display/d.vect.thematic/legend.c =================================================================== --- grass/branches/releasebranch_7_2/display/d.vect.thematic/legend.c 2016-10-16 03:11:40 UTC (rev 69697) +++ grass/branches/releasebranch_7_2/display/d.vect.thematic/legend.c 2016-10-16 03:22:49 UTC (rev 69698) @@ -28,7 +28,7 @@ fd = fopen(legfile, "a"); /* Title */ - fprintf(fd, "|||||%s\n", title); + fprintf(fd, "||||||%s\n", title); /* First line */ if (stats_min > breakpoints[0]){ @@ -37,16 +37,16 @@ else{ fprintf(fd, "%.2f - %.2f|",stats_min, breakpoints[0]); } - fprintf(fd, "%s|%d|%d:%d:%d|%d:%d:%d|%d|%s|%d\n", - icon, size, bcolor.r, bcolor.g, bcolor.b, - colors[0].r, colors[0].g, colors[0].b, default_width, + fprintf(fd, "%s|%d|ps|%d:%d:%d|%d:%d:%d|%d|%s|%d\n", + icon, size, colors[0].r, colors[0].g, colors[0].b, + bcolor.r, bcolor.g, bcolor.b, default_width, topo, frequencies[0]); /* Middle lines */ for (i = 1; i < nbreaks; i++){ - fprintf(fd, "%.2f - %.2f|%s|%d|%d:%d:%d|%d:%d:%d|%d|%s|%d\n", + fprintf(fd, "%.2f - %.2f|%s|%d|ps|%d:%d:%d|%d:%d:%d|%d|%s|%d\n", breakpoints[i-1],breakpoints[i], - icon, size, bcolor.r, bcolor.g, bcolor.b, - colors[i].r, colors[i].g, colors[i].b, default_width, + icon, size, colors[i].r, colors[i].g, colors[i].b, + bcolor.r, bcolor.g, bcolor.b, default_width, topo, frequencies[i]); } /* Last one */ @@ -56,9 +56,9 @@ else { fprintf(fd, "%.2f - %.2f|", breakpoints[nbreaks - 1], stats_max); } - fprintf(fd, "%s|%d|%d:%d:%d|%d:%d:%d|%d|%s|%d\n", - icon, size, bcolor.r, bcolor.g, bcolor.b, - colors[nbreaks].r, colors[nbreaks].g, colors[nbreaks].b, default_width, + fprintf(fd, "%s|%d|ps|%d:%d:%d|%d:%d:%d|%d|%s|%d\n", + icon, size, colors[nbreaks].r, colors[nbreaks].g, colors[nbreaks].b, + bcolor.r, bcolor.g, bcolor.b, default_width, topo, frequencies[nbreaks]); fclose(fd); From svn_grass at osgeo.org Sun Oct 16 14:19:59 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 16 Oct 2016 14:19:59 -0700 Subject: [GRASS-SVN] r69699 - in grass/trunk/lib/python/temporal: . testsuite Message-ID: <20161016211959.1FCAC39008E@trac.osgeo.org> Author: huhabla Date: 2016-10-16 14:19:58 -0700 (Sun, 16 Oct 2016) New Revision: 69699 Modified: grass/trunk/lib/python/temporal/abstract_space_time_dataset.py grass/trunk/lib/python/temporal/space_time_datasets.py grass/trunk/lib/python/temporal/testsuite/unittests_temporal_algebra.py grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py grass/trunk/lib/python/temporal/testsuite/unittests_temporal_vector_algebra.py Log: temporal framework: Added new doctests for space time dataset, fixed bug in AbstractSpaceTimeDataset Modified: grass/trunk/lib/python/temporal/abstract_space_time_dataset.py =================================================================== --- grass/trunk/lib/python/temporal/abstract_space_time_dataset.py 2016-10-16 03:22:49 UTC (rev 69698) +++ grass/trunk/lib/python/temporal/abstract_space_time_dataset.py 2016-10-16 21:19:58 UTC (rev 69699) @@ -408,7 +408,7 @@ """ if maps is None: - maps = get_registered_maps_as_objects( + maps = self.get_registered_maps_as_objects( where=None, order="start_time", dbif=dbif) time_invalid = 0 Modified: grass/trunk/lib/python/temporal/space_time_datasets.py =================================================================== --- grass/trunk/lib/python/temporal/space_time_datasets.py 2016-10-16 03:22:49 UTC (rev 69698) +++ grass/trunk/lib/python/temporal/space_time_datasets.py 2016-10-16 21:19:58 UTC (rev 69699) @@ -97,6 +97,10 @@ (2, None) >>> rmap.get_relative_time_unit() 'years' + >>> rmap.is_in_db() + False + >>> rmap.is_stds() + False >>> newmap = rmap.get_new_instance("new at PERMANENT") >>> isinstance(newmap, RasterDataset) @@ -426,6 +430,10 @@ (2, None) >>> r3map.get_relative_time_unit() 'years' + >>> r3map.is_in_db() + False + >>> r3map.is_stds() + False >>> newmap = r3map.get_new_instance("new at PERMANENT") >>> isinstance(newmap, Raster3DDataset) @@ -767,6 +775,10 @@ (2, None) >>> vmap.get_relative_time_unit() 'years' + >>> vmap.is_in_db() + False + >>> vmap.is_stds() + False >>> newmap = vmap.get_new_instance("new at PERMANENT") >>> isinstance(newmap, VectorDataset) @@ -1005,6 +1017,35 @@ class SpaceTimeRasterDataset(AbstractSpaceTimeDataset): """Space time raster dataset class + + .. code-block:: python + + >>> import grass.temporal as tgis + >>> tgis.init() + >>> strds = tgis.SpaceTimeRasterDataset("old at PERMANENT") + >>> strds.is_in_db() + False + >>> strds.is_stds() + True + >>> strds.get_type() + 'strds' + >>> newstrds = strds.get_new_instance("newstrds at PERMANENT") + >>> isinstance(newstrds, SpaceTimeRasterDataset) + True + >>> newmap = strds.get_new_map_instance("newmap at PERMANENT") + >>> isinstance(newmap, RasterDataset) + True + >>> strds.reset("new at PERMANENT") + >>> strds.is_in_db() + False + >>> strds.get_id() + 'new at PERMANENT' + >>> strds.reset(None) + >>> strds.is_in_db() + False + >>> strds.get_id() + + ... """ def __init__(self, ident): AbstractSpaceTimeDataset.__init__(self, ident) @@ -1085,6 +1126,35 @@ class SpaceTimeRaster3DDataset(AbstractSpaceTimeDataset): """Space time raster3d dataset class + + .. code-block:: python + + >>> import grass.temporal as tgis + >>> tgis.init() + >>> str3ds = tgis.SpaceTimeRaster3DDataset("old at PERMANENT") + >>> str3ds.is_in_db() + False + >>> str3ds.is_stds() + True + >>> str3ds.get_type() + 'str3ds' + >>> newstrds = str3ds.get_new_instance("newstrds at PERMANENT") + >>> isinstance(newstrds, SpaceTimeRaster3DDataset) + True + >>> newmap = str3ds.get_new_map_instance("newmap at PERMANENT") + >>> isinstance(newmap, Raster3DDataset) + True + >>> str3ds.reset("new at PERMANENT") + >>> str3ds.is_in_db() + False + >>> str3ds.get_id() + 'new at PERMANENT' + >>> str3ds.reset(None) + >>> str3ds.is_in_db() + False + >>> str3ds.get_id() + + ... """ def __init__(self, ident): @@ -1184,6 +1254,35 @@ class SpaceTimeVectorDataset(AbstractSpaceTimeDataset): """Space time vector dataset class + + .. code-block:: python + + >>> import grass.temporal as tgis + >>> tgis.init() + >>> stvds = tgis.SpaceTimeVectorDataset("old at PERMANENT") + >>> stvds.is_in_db() + False + >>> stvds.is_stds() + True + >>> stvds.get_type() + 'stvds' + >>> newstvds = stvds.get_new_instance("newstvds at PERMANENT") + >>> isinstance(newstvds, SpaceTimeVectorDataset) + True + >>> newmap = stvds.get_new_map_instance("newmap at PERMANENT") + >>> isinstance(newmap, VectorDataset) + True + >>> stvds.reset("new at PERMANENT") + >>> stvds.is_in_db() + False + >>> stvds.get_id() + 'new at PERMANENT' + >>> stvds.reset(None) + >>> stvds.is_in_db() + False + >>> stvds.get_id() + + ... """ def __init__(self, ident): Modified: grass/trunk/lib/python/temporal/testsuite/unittests_temporal_algebra.py =================================================================== --- grass/trunk/lib/python/temporal/testsuite/unittests_temporal_algebra.py 2016-10-16 03:22:49 UTC (rev 69698) +++ grass/trunk/lib/python/temporal/testsuite/unittests_temporal_algebra.py 2016-10-16 21:19:58 UTC (rev 69699) @@ -74,6 +74,7 @@ ta.parse(expression="R = A : A", stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 4) self.assertEqual(D.metadata.get_min_min(), 1) @@ -90,6 +91,7 @@ ta.parse(expression="R = A : D", stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 2) self.assertEqual(D.metadata.get_min_min(), 3) @@ -106,6 +108,7 @@ ta.parse(expression="R = A !: D", stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 2) self.assertEqual(D.metadata.get_min_min(), 1) @@ -122,6 +125,7 @@ ta.parse(expression="R = A {:,during} C", stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 2) self.assertEqual(D.metadata.get_min_min(), 2) @@ -138,6 +142,7 @@ ta.parse(expression="R = A {:,equal|during} C", stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 2) self.assertEqual(D.metadata.get_min_min(), 2) @@ -155,6 +160,7 @@ ta.parse(expression="R = A {!:,during} C", stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 2) self.assertEqual(D.metadata.get_min_min(), 1) @@ -172,6 +178,7 @@ ta.parse(expression="R = A {:,during,d} C", stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() maplist = D.get_registered_maps_as_objects() for map_i in maplist: @@ -194,6 +201,7 @@ ta.parse(expression="R = C {:,contains} A", stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() maplist = D.get_registered_maps_as_objects() for map_i in maplist: @@ -215,6 +223,7 @@ ta.parse(expression="R = A {:,during,r} C", stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() maplist = D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 2) @@ -232,6 +241,7 @@ ta.parse(expression="R = A {:,during,d} C", stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() maplist = D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 2) @@ -249,6 +259,7 @@ ta.parse(expression="R = A {:,during,u} C", stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() maplist = D.get_registered_maps_as_objects() for map_i in maplist: @@ -270,6 +281,7 @@ ta.parse(expression="R = if(A # D == 1, A)", stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() maplist = D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 2) @@ -288,6 +300,7 @@ basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() maplist = D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 2) @@ -306,6 +319,7 @@ stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() maplist = D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 2) @@ -323,6 +337,7 @@ ta.parse(expression='R = tmap(singletmap)', stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() maplist = D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 1) @@ -340,6 +355,7 @@ ta.parse(expression='R = A : tmap(singletmap)', stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() maplist = D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 1) @@ -357,6 +373,7 @@ ta.parse(expression='R = merge(A,D)', stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() maplist = D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 7) @@ -374,6 +391,7 @@ ta.parse(expression='R = merge(A, B {!:,contains} A)', stdstype = 'strds', basename="r", overwrite=True) D = tgis.open_old_stds("R", type="strds") + self.assertTrue(D.is_in_db()) D.select() maplist = D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 4) Modified: grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py =================================================================== --- grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py 2016-10-16 03:22:49 UTC (rev 69698) +++ grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py 2016-10-16 21:19:58 UTC (rev 69699) @@ -54,6 +54,7 @@ basename="d", overwrite=True) D = tgis.open_old_stds("D", type="str3ds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 2) self.assertEqual(D.metadata.get_min_min(), 4) # 1 + 3 @@ -69,6 +70,7 @@ basename="d", overwrite=True) D = tgis.open_old_stds("D", type="str3ds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 2) self.assertEqual(D.metadata.get_min_min(), 4) # 1 + 3 Modified: grass/trunk/lib/python/temporal/testsuite/unittests_temporal_vector_algebra.py =================================================================== --- grass/trunk/lib/python/temporal/testsuite/unittests_temporal_vector_algebra.py 2016-10-16 03:22:49 UTC (rev 69698) +++ grass/trunk/lib/python/temporal/testsuite/unittests_temporal_vector_algebra.py 2016-10-16 21:19:58 UTC (rev 69699) @@ -73,6 +73,7 @@ tva.parse(expression="R = A : A", basename="r", overwrite=True) D = tgis.open_old_stds("R", type="stvds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 4) self.assertEqual(D.metadata.get_number_of_points(), 80) @@ -90,6 +91,7 @@ ta.parse(expression="R = A {:,during,r} C", basename="r", overwrite=True) D = tgis.open_old_stds("R", type="stvds") + self.assertTrue(D.is_in_db()) D.select() D.print_info() maplist = D.get_registered_maps_as_objects() @@ -106,6 +108,7 @@ tva.parse(expression="R = A {:,during} C", basename="r", overwrite=True) D = tgis.open_old_stds("R", type="stvds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 2) self.assertEqual(D.metadata.get_number_of_points(), 40) @@ -123,6 +126,7 @@ tva.parse(expression="R = buff_p(A,0.5)", basename="r", overwrite=True) D = tgis.open_old_stds("R", type="stvds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 4) self.assertEqual(D.metadata.get_number_of_points(), 0) @@ -140,6 +144,7 @@ tva.parse(expression="R = buff_a(buff_p(A,1),10)", basename="r", overwrite=True) D = tgis.open_old_stds("R", type="stvds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 4) self.assertEqual(D.metadata.get_number_of_points(), 0) @@ -157,6 +162,7 @@ tva.parse(expression="R = buff_p(A,2) & buff_p(D,2)", basename="r", overwrite=True) D = tgis.open_old_stds("R", type="stvds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 2) self.assertEqual(D.metadata.get_number_of_points(), 0) @@ -174,6 +180,7 @@ tva.parse(expression="R = buff_p(A,1.5) {&,during,r} buff_p(B,1.5)", basename="r", overwrite=True) D = tgis.open_old_stds("R", type="stvds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 4) self.assertEqual(D.metadata.get_number_of_points(), 0) @@ -191,6 +198,7 @@ tva.parse(expression="R = buff_p(A,2.5) {&,during,l} buff_p(C,2.5)", basename="r", overwrite=True) D = tgis.open_old_stds("R", type="stvds") + self.assertTrue(D.is_in_db()) D.select() self.assertEqual(D.metadata.get_number_of_maps(), 2) self.assertEqual(D.metadata.get_number_of_points(), 0) From svn_grass at osgeo.org Tue Oct 18 08:15:11 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 18 Oct 2016 08:15:11 -0700 Subject: [GRASS-SVN] r69700 - grass-addons/grass7/imagery/i.segment.stats Message-ID: <20161018151512.074D43903C2@trac.osgeo.org> Author: mlennert Date: 2016-10-18 08:15:11 -0700 (Tue, 18 Oct 2016) New Revision: 69700 Modified: grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py Log: i.segment.stats: find_file expects 'cell' not 'raster' Modified: grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py =================================================================== --- grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py 2016-10-16 21:19:58 UTC (rev 69699) +++ grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py 2016-10-18 15:15:11 UTC (rev 69700) @@ -160,7 +160,7 @@ for raster in rasters: gscript.message(_("Calculating statistics for raster %s" % raster)) - if not gscript.find_file(raster, element='raster')['name']: + if not gscript.find_file(raster, element='cell')['name']: gscript.message(_("Cannot find raster %s" % raster)) continue rastername=raster.split('@')[0] From svn_grass at osgeo.org Tue Oct 18 09:44:53 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 18 Oct 2016 09:44:53 -0700 Subject: [GRASS-SVN] r69701 - grass-addons/grass7/raster/r.basin Message-ID: <20161018164453.1F209390125@trac.osgeo.org> Author: madi Date: 2016-10-18 09:44:52 -0700 (Tue, 18 Oct 2016) New Revision: 69701 Modified: grass-addons/grass7/raster/r.basin/r.basin.html Log: known issues added Modified: grass-addons/grass7/raster/r.basin/r.basin.html =================================================================== --- grass-addons/grass7/raster/r.basin/r.basin.html 2016-10-18 15:15:11 UTC (rev 69700) +++ grass-addons/grass7/raster/r.basin/r.basin.html 2016-10-18 16:44:52 UTC (rev 69701) @@ -157,6 +157,16 @@
      • r.width.funct
      +

      Known issues

      +
        +
      • r.basin hasn't been designed for working in lat/long coordinates. +This means that if you are working in lat/long coordinates, you need to reproject +your map first in order to apply the tool. +
      • r.basin is designed to work in meters unit. The values that you get using +feet are nonsense. +
      • r.basin does not handle overwrite. You need to delete the output products +already created (maps, text file, figures) by hand before running it again. +

        SEE ALSO

        From svn_grass at osgeo.org Tue Oct 18 15:10:48 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 18 Oct 2016 15:10:48 -0700 Subject: [GRASS-SVN] r69702 - grass/trunk/gui/wxpython/gui_core Message-ID: <20161018221048.DAECA390125@trac.osgeo.org> Author: annakrat Date: 2016-10-18 15:10:48 -0700 (Tue, 18 Oct 2016) New Revision: 69702 Modified: grass/trunk/gui/wxpython/gui_core/widgets.py Log: wxGUI: fix v.in.dxf wrapper Modified: grass/trunk/gui/wxpython/gui_core/widgets.py =================================================================== --- grass/trunk/gui/wxpython/gui_core/widgets.py 2016-10-18 16:44:52 UTC (rev 69701) +++ grass/trunk/gui/wxpython/gui_core/widgets.py 2016-10-18 22:10:48 UTC (rev 69702) @@ -1611,9 +1611,12 @@ for i in range(len(columns)): self.InsertColumn(i, columns[i]) - if len(columns) == 4: + width = [] + if len(columns) == 3: + width = (65, 200) + elif len(columns) == 4: width = (65, 200, 90) - else: + elif len(columns) == 5: width = (65, 180, 90, 70) for i in range(len(width)): From svn_grass at osgeo.org Tue Oct 18 15:12:20 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 18 Oct 2016 15:12:20 -0700 Subject: [GRASS-SVN] r69703 - grass/branches/releasebranch_7_2/gui/wxpython/gui_core Message-ID: <20161018221220.61676390125@trac.osgeo.org> Author: annakrat Date: 2016-10-18 15:12:20 -0700 (Tue, 18 Oct 2016) New Revision: 69703 Modified: grass/branches/releasebranch_7_2/gui/wxpython/gui_core/widgets.py Log: wxGUI: fix v.in.dxf wrapper (merge from trunk, r69702) Modified: grass/branches/releasebranch_7_2/gui/wxpython/gui_core/widgets.py =================================================================== --- grass/branches/releasebranch_7_2/gui/wxpython/gui_core/widgets.py 2016-10-18 22:10:48 UTC (rev 69702) +++ grass/branches/releasebranch_7_2/gui/wxpython/gui_core/widgets.py 2016-10-18 22:12:20 UTC (rev 69703) @@ -1611,9 +1611,12 @@ for i in range(len(columns)): self.InsertColumn(i, columns[i]) - if len(columns) == 4: + width = [] + if len(columns) == 3: + width = (65, 200) + elif len(columns) == 4: width = (65, 200, 90) - else: + elif len(columns) == 5: width = (65, 180, 90, 70) for i in range(len(width)): From svn_grass at osgeo.org Tue Oct 18 15:41:44 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 18 Oct 2016 15:41:44 -0700 Subject: [GRASS-SVN] r69704 - grass/trunk/gui/wxpython/lmgr Message-ID: <20161018224145.1BE13390125@trac.osgeo.org> Author: annakrat Date: 2016-10-18 15:41:44 -0700 (Tue, 18 Oct 2016) New Revision: 69704 Modified: grass/trunk/gui/wxpython/lmgr/frame.py Log: wxGUI: fix rendering behavior in GUI when only d.* is entered in command console without any map Modified: grass/trunk/gui/wxpython/lmgr/frame.py =================================================================== --- grass/trunk/gui/wxpython/lmgr/frame.py 2016-10-18 22:12:20 UTC (rev 69703) +++ grass/trunk/gui/wxpython/lmgr/frame.py 2016-10-18 22:41:44 UTC (rev 69704) @@ -793,9 +793,8 @@ # add layer into layer tree lname, found = GetLayerNameFromCmd(command, fullyQualified=True, layerType=layertype) - self.GetLayerTree().AddLayer(ltype=layertype, lchecked=True, - lname=lname, - lcmd=command) + self.GetLayerTree().AddLayer(ltype=layertype, lchecked=True if lname else None, + lname=lname, lcmd=command) def GetLayerNotebook(self): """Get Layers Notebook""" From svn_grass at osgeo.org Tue Oct 18 15:42:57 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 18 Oct 2016 15:42:57 -0700 Subject: [GRASS-SVN] r69705 - grass/branches/releasebranch_7_2/gui/wxpython/lmgr Message-ID: <20161018224257.B7D9A390125@trac.osgeo.org> Author: annakrat Date: 2016-10-18 15:42:57 -0700 (Tue, 18 Oct 2016) New Revision: 69705 Modified: grass/branches/releasebranch_7_2/gui/wxpython/lmgr/frame.py Log: wxGUI: fix rendering behavior in GUI when only d.* is entered in command console without any map (merge from trunk, r69704) Modified: grass/branches/releasebranch_7_2/gui/wxpython/lmgr/frame.py =================================================================== --- grass/branches/releasebranch_7_2/gui/wxpython/lmgr/frame.py 2016-10-18 22:41:44 UTC (rev 69704) +++ grass/branches/releasebranch_7_2/gui/wxpython/lmgr/frame.py 2016-10-18 22:42:57 UTC (rev 69705) @@ -793,9 +793,8 @@ # add layer into layer tree lname, found = GetLayerNameFromCmd(command, fullyQualified=True, layerType=layertype) - self.GetLayerTree().AddLayer(ltype=layertype, lchecked=True, - lname=lname, - lcmd=command) + self.GetLayerTree().AddLayer(ltype=layertype, lchecked=True if lname else None, + lname=lname, lcmd=command) def GetLayerNotebook(self): """Get Layers Notebook""" From svn_grass at osgeo.org Wed Oct 19 04:18:20 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Wed, 19 Oct 2016 04:18:20 -0700 Subject: [GRASS-SVN] r69706 - grass-addons/grass7/raster/r.basin Message-ID: <20161019111821.17FE53903C2@trac.osgeo.org> Author: madi Date: 2016-10-19 04:18:20 -0700 (Wed, 19 Oct 2016) New Revision: 69706 Modified: grass-addons/grass7/raster/r.basin/r.basin.html Log: closing tags Modified: grass-addons/grass7/raster/r.basin/r.basin.html =================================================================== --- grass-addons/grass7/raster/r.basin/r.basin.html 2016-10-18 22:42:57 UTC (rev 69705) +++ grass-addons/grass7/raster/r.basin/r.basin.html 2016-10-19 11:18:20 UTC (rev 69706) @@ -161,11 +161,12 @@
        • r.basin hasn't been designed for working in lat/long coordinates. This means that if you are working in lat/long coordinates, you need to reproject -your map first in order to apply the tool. +your map first in order to apply the tool.
        • r.basin is designed to work in meters unit. The values that you get using -feet are nonsense. +feet are nonsense.
        • r.basin does not handle overwrite. You need to delete the output products -already created (maps, text file, figures) by hand before running it again. +already created (maps, text file, figures) by hand before running it again.
        • +

        SEE ALSO

        From svn_grass at osgeo.org Wed Oct 19 08:05:57 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Wed, 19 Oct 2016 08:05:57 -0700 Subject: [GRASS-SVN] r69707 - grass-addons/grass7/imagery/i.segment.stats Message-ID: <20161019150557.57BF939040E@trac.osgeo.org> Author: mlennert Date: 2016-10-19 08:05:57 -0700 (Wed, 19 Oct 2016) New Revision: 69707 Modified: grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py Log: i.segment.stats: replace points by underscores in raster names used as basenames for column names Modified: grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py =================================================================== --- grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py 2016-10-19 11:18:20 UTC (rev 69706) +++ grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py 2016-10-19 15:05:57 UTC (rev 69707) @@ -163,7 +163,8 @@ if not gscript.find_file(raster, element='cell')['name']: gscript.message(_("Cannot find raster %s" % raster)) continue - rastername=raster.split('@')[0] + rastername = raster.split('@')[0] + rastername = rastername.replace('.', '_') output_header += [rastername + "_" + x for x in raster_statistics] stat_indices = [raster_stat_dict[x] for x in raster_statistics] gscript.run_command('r.univar', From svn_grass at osgeo.org Wed Oct 19 15:17:34 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Wed, 19 Oct 2016 15:17:34 -0700 Subject: [GRASS-SVN] r69708 - in grass/trunk/lib/raster: . testsuite Message-ID: <20161019221734.D56FB390125@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-19 15:17:34 -0700 (Wed, 19 Oct 2016) New Revision: 69708 Added: grass/trunk/lib/raster/testsuite/ grass/trunk/lib/raster/testsuite/rast_parse_color_rule.py Modified: grass/trunk/lib/raster/color_rules.c Log: rasterlib: use G_str_to_color() for parsing color table rules This introduces whatever syntax from G_str_to_color() to Rast_parse_color_rule(), i.e. not only 'v r g b', 'v r:g:b', and 'v name' is supported, but also any other separator from G_str_to_color() which now adds comma and semicolon. Also hexadecimal colors from r69683 are now supported which makes the fact that comments in color rules (indicated by hash) must start at the first column (character) more important than before. (Comments starting in the middle of the line are not currently supported, but from now on they cannot be supported because it would interfere with color identification because hexadecimal colors are (usually and in G_str_to_color()) indicated by hash.) Now also NONE/none color is parsed but considered as an syntax error and not reported separately to the user. Number of errors (error strings) reported to user was reduced because G_str_to_color() has limited diagnostics. Specifically, out-of-range RGB values and broken syntax (which includes and was not distinguished from wrong color names) is reported and syntax error in color (if the paring of the whole rule was successful). The commit removes last/only usage of the G_color_values() function. Named colors for Rast_parse_color_rule() now go from the lib/gis/color_str.c file and not from the lib/gis/named_colr.c file. Modified: grass/trunk/lib/raster/color_rules.c =================================================================== --- grass/trunk/lib/raster/color_rules.c 2016-10-19 15:05:57 UTC (rev 69707) +++ grass/trunk/lib/raster/color_rules.c 2016-10-19 22:17:34 UTC (rev 69708) @@ -1,9 +1,9 @@ /*! - \file lib/raster/color_read.c + \file lib/raster/color_rules.c \brief Raster Library - Read and parse color rules file - (C) 2007 by the GRASS Development Team + (C) 2007-2016 by the GRASS Development Team This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -28,9 +29,8 @@ enum rule_error { CR_OK = 0, - CR_ERROR_SYNTAX, - CR_ERROR_RGB, - CR_ERROR_COLOR, + CR_ERROR_RULE_SYNTAX, + CR_ERROR_COLOR_SYNTAX, CR_ERROR_PERCENT, CR_ERROR_VALUE, }; @@ -38,16 +38,24 @@ /*! \brief Read color rule + The val output parameter is always an absolute value and is derived + from the rule and the min and max values in case the rule is in percents. + + Always only one of the norm, nval, and dflt output parameters is set + to non-zero value, the others are set to zero. + + The return code can be translated to an error message using + the Rast_parse_color_rule_error() function. + \param min, max min & max values (used only when color rules are in percentage) - \param buf - \param val value + \param buf string with the color rule + \param[out] val value which the color is assigned to \param[out] r,g,b color values - \param norm - \param nval - \param dflt + \param[out] norm set to non-zero value if the value and color are set + \param[out] nval set to non-zero value if rule is for null value + \param[out] dflt set to non-zero value if rule specifies the default color - \return 0 on failure - \return 1 on success + \returns enum rule_error values (non-zero on failure) */ int Rast_parse_color_rule(DCELL min, DCELL max, const char *buf, DCELL * val, int *r, int *g, int *b, @@ -60,26 +68,13 @@ *norm = *nval = *dflt = 0; if (sscanf(buf, "%s %[^\n]", value, color) != 2) - return CR_ERROR_SYNTAX; + return CR_ERROR_RULE_SYNTAX; - G_chop(color); + /* we don't allow 'none' color here (ret == 2) */ + /* G_str_to_color chops and has only 1 error state */ + if (G_str_to_color(color, r, g, b) != 1) + return CR_ERROR_COLOR_SYNTAX; - if (sscanf(color, "%d:%d:%d", r, g, b) == 3 || - sscanf(color, "%d %d %d", r, g, b) == 3) { - if (*r < 0 || *r > 255 || *g < 0 || *g > 255 || *b < 0 || *b > 255) - return CR_ERROR_RGB; - } - else { - float fr, fg, fb; - - if (G_color_values(color, &fr, &fg, &fb) < 0) - return CR_ERROR_COLOR; - - *r = (int)(fr * 255.99); - *g = (int)(fg * 255.99); - *b = (int)(fb * 255.99); - } - G_chop(value); if (G_strcasecmp(value, "default") == 0) { @@ -121,12 +116,16 @@ switch (code) { case CR_OK: return ""; - case CR_ERROR_SYNTAX: - return _("syntax error"); + case CR_ERROR_RULE_SYNTAX: + return _("syntax error in the color rule"); + case CR_ERROR_COLOR_SYNTAX: + return _("syntax error in the color format"); +/* we no longer distinguish between these two errors case CR_ERROR_RGB: return _("R/G/B not in range 0-255"); case CR_ERROR_COLOR: return _("invalid color name"); +*/ case CR_ERROR_PERCENT: return _("percentage not in range 0-100"); case CR_ERROR_VALUE: Added: grass/trunk/lib/raster/testsuite/rast_parse_color_rule.py =================================================================== --- grass/trunk/lib/raster/testsuite/rast_parse_color_rule.py (rev 0) +++ grass/trunk/lib/raster/testsuite/rast_parse_color_rule.py 2016-10-19 22:17:34 UTC (rev 69708) @@ -0,0 +1,98 @@ +"""Test of raster library string color rule to value and color conversions + + at author Vaclav Petras + + at copyright 2016 by Vaclav Petras and the GRASS Development Team + + at license This program is free software under the +GNU General Public License (>=v2). +Read the file COPYING that comes with GRASS +for details +""" + +from ctypes import byref, c_int, c_double + +from grass.gunittest.case import TestCase +from grass.gunittest.main import test + +from grass.lib.raster import Rast_parse_color_rule, Rast_parse_color_rule_error + + +# TODO: add also a test class for values +class ParseSingleColorRuleColorsTestCase(TestCase): + """Color-focused test of C function Rast_parse_color_rule()""" + + def convert_rule(self, string, value, red, green, blue): + """General test function to convert string to value and color + + value, red, green, blue are expected values. + """ + # we are not testing value, but color, so using these values + # so that value and percentage can be used interchangeably + min_val = 0. + max_val = 100. + r = c_int() + g = c_int() + b = c_int() + v = c_double() # DCELL + # not testing any of these three + norm = c_int() + nv = c_int() + default = c_int() + ret = Rast_parse_color_rule(min_val, max_val, string, + byref(v), byref(r), byref(g), byref(b), + byref(norm), byref(nv), byref(default)) + colors = ("{string} -> " + "{v.value}: {r.value}, {g.value}, {b.value}".format(**locals())) + error_text = Rast_parse_color_rule_error(ret) + self.assertEqual(error_text, "", + msg=("Conversion not successful (%s): %s (%s)" + % (colors, error_text, ret))) + self.assertEqual(v.value, value, + msg="Wrong number for value (%s)" % colors) + self.assertEqual(r.value, red, + msg="Wrong number for red (%s)" % colors) + self.assertEqual(g.value, green, + msg="Wrong number for green (%s)" % colors) + self.assertEqual(b.value, blue, + msg="Wrong number for blue (%s)" % colors) + + def test_grass_format_separators(self): + """Test GRASS GIS color format with all allowed separators""" + self.convert_rule("15% 50,150,250", 15, 50, 150, 250) + self.convert_rule("15% 50:150:250", 15, 50, 150, 250) + self.convert_rule("15 50;150;250", 15, 50, 150, 250) + self.convert_rule("15 50 150 250", 15, 50, 150, 250) + + def test_grass_format_multiple_separators(self): + """Test GRASS GIS color format with duplicated separators""" + self.convert_rule("15% 50, 150, 250", 15, 50, 150, 250) + self.convert_rule("15% 50::150:250", 15, 50, 150, 250) + self.convert_rule("15 50 ; 150 ; 250", 15, 50, 150, 250) + self.convert_rule("15 50 150 250", 15, 50, 150, 250) + + def test_grass_format_whitespace(self): + """Test with whitespace (spaces) around and in the string""" + self.convert_rule(" 15% 50:150:250 ", 15, 50, 150, 250) + self.convert_rule(" 15 50 150 250 ", 15, 50, 150, 250) + + def test_html_hash_hex(self): + """Test HTML format with hash and hexadecimal (6 letters, #RRGGBB) + + comments (with #) and empty lines are handled in + Rast_read_color_rule() by simple first-character test + so we have not much here to test + """ + self.convert_rule("15% #A6CEE3", 15, 166, 206, 227) + self.convert_rule("15 #33a02c", 15, 51, 160, 44) + self.convert_rule("15 #fB9A99", 15, 251, 154, 153) + + def test_grass_named(self): + """Test GRASS GIS named colors""" + self.convert_rule("15% black ", 15, 0, 0, 0) + self.convert_rule("15 white", 15, 255, 255, 255) + self.convert_rule(" 15 white", 15, 255, 255, 255) + + +if __name__ == '__main__': + test() From svn_grass at osgeo.org Wed Oct 19 17:00:38 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Wed, 19 Oct 2016 17:00:38 -0700 Subject: [GRASS-SVN] r69709 - grass/trunk/include/Make Message-ID: <20161020000038.416D7390125@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-19 17:00:38 -0700 (Wed, 19 Oct 2016) New Revision: 69709 Modified: grass/trunk/include/Make/Docs.make Log: doc: add general things missing from r69588 for misc to miscellaneous change Modified: grass/trunk/include/Make/Docs.make =================================================================== --- grass/trunk/include/Make/Docs.make 2016-10-19 22:17:34 UTC (rev 69708) +++ grass/trunk/include/Make/Docs.make 2016-10-20 00:00:38 UTC (rev 69709) @@ -58,7 +58,7 @@ display.html \ general.html \ imagery.html \ - misc.html \ + miscellaneous.html \ photo.html \ postscript.html \ raster.html \ @@ -83,7 +83,7 @@ $(call html_pdf display,d.*.html) $(call html_pdf general,g.*.html) $(call html_pdf imagery,i.*.html) - $(call html_pdf misc,m.*.html) + $(call html_pdf miscellaneous,m.*.html) $(call html_pdf photo,i.ortho*.html photo*.html) $(call html_pdf postscript,ps.*.html) $(call html_pdf raster,r.*.html) From svn_grass at osgeo.org Wed Oct 19 17:13:13 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Wed, 19 Oct 2016 17:13:13 -0700 Subject: [GRASS-SVN] r69710 - in grass/trunk: raster/r.in.lidar raster3d/r3.in.lidar vector/v.in.lidar Message-ID: <20161020001313.C9101390125@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-19 17:13:13 -0700 (Wed, 19 Oct 2016) New Revision: 69710 Modified: grass/trunk/raster/r.in.lidar/main.c grass/trunk/raster3d/r3.in.lidar/main.c grass/trunk/vector/v.in.lidar/main.c Log: v.in.lidar, r.in.lidar, r3.in.lidar: make the file open error messages more precise Modified: grass/trunk/raster/r.in.lidar/main.c =================================================================== --- grass/trunk/raster/r.in.lidar/main.c 2016-10-20 00:00:38 UTC (rev 69709) +++ grass/trunk/raster/r.in.lidar/main.c 2016-10-20 00:13:13 UTC (rev 69710) @@ -398,11 +398,11 @@ /* Open LAS file*/ LAS_reader = LASReader_Create(infile); if (LAS_reader == NULL) - G_fatal_error(_("Unable to open file <%s>"), infile); + G_fatal_error(_("Unable to open file <%s> as a LiDAR point cloud"), + infile); LAS_header = LASReader_GetHeader(LAS_reader); if (LAS_header == NULL) { - G_fatal_error(_("Input file <%s> is not a LAS LiDAR point cloud"), - infile); + G_fatal_error(_("Unable to read LAS header of <%s>"), infile); } LAS_srs = LASHeader_GetSRS(LAS_header); Modified: grass/trunk/raster3d/r3.in.lidar/main.c =================================================================== --- grass/trunk/raster3d/r3.in.lidar/main.c 2016-10-20 00:00:38 UTC (rev 69709) +++ grass/trunk/raster3d/r3.in.lidar/main.c 2016-10-20 00:13:13 UTC (rev 69710) @@ -375,11 +375,11 @@ /* Open LAS file*/ LAS_reader = LASReader_Create(infile); if (LAS_reader == NULL) - G_fatal_error(_("Unable to open file <%s>"), infile); + G_fatal_error(_("Unable to open file <%s> as a LiDAR point cloud"), + infile); LAS_header = LASReader_GetHeader(LAS_reader); if (LAS_header == NULL) { - G_fatal_error(_("Input file <%s> is not a LAS LiDAR point cloud"), - infile); + G_fatal_error(_("Unable to read LAS header of <%s>"), infile); } LAS_srs = LASHeader_GetSRS(LAS_header); Modified: grass/trunk/vector/v.in.lidar/main.c =================================================================== --- grass/trunk/vector/v.in.lidar/main.c 2016-10-20 00:00:38 UTC (rev 69709) +++ grass/trunk/vector/v.in.lidar/main.c 2016-10-20 00:13:13 UTC (rev 69710) @@ -349,11 +349,11 @@ /* Open LAS file*/ LAS_reader = LASReader_Create(in_opt->answer); if (LAS_reader == NULL) - G_fatal_error(_("Unable to open file <%s>"), in_opt->answer); + G_fatal_error(_("Unable to open file <%s> as a LiDAR point cloud"), + in_opt->answer); LAS_header = LASReader_GetHeader(LAS_reader); if (LAS_header == NULL) { - G_fatal_error(_("Input file <%s> is not a LAS LiDAR point cloud"), - in_opt->answer); + G_fatal_error(_("Unable to read LAS header of <%s>"), in_opt->answer); } LAS_srs = LASHeader_GetSRS(LAS_header); From svn_grass at osgeo.org Wed Oct 19 17:40:52 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Wed, 19 Oct 2016 17:40:52 -0700 Subject: [GRASS-SVN] r69711 - grass/trunk/lib/init Message-ID: <20161020004052.28483390125@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-19 17:40:52 -0700 (Wed, 19 Oct 2016) New Revision: 69711 Modified: grass/trunk/lib/init/grass.py Log: init: more explanations for invalid location or mapset Also added comments from https://lists.osgeo.org/pipermail/grass-dev/2016-September/082317.html Modified: grass/trunk/lib/init/grass.py =================================================================== --- grass/trunk/lib/init/grass.py 2016-10-20 00:13:13 UTC (rev 69710) +++ grass/trunk/lib/init/grass.py 2016-10-20 00:40:52 UTC (rev 69711) @@ -800,9 +800,15 @@ fatal(err.value.strip('"').strip("'").replace('\\n', os.linesep)) +# TODO: distinguish between valid for getting maps and usable as current +# https://lists.osgeo.org/pipermail/grass-dev/2016-September/082317.html # interface created according to the current usage def is_mapset_valid(full_mapset): """Return True if GRASS Mapset is valid""" + # WIND is created from DEFAULT_WIND by `g.region -d` and functions + # or modules which create a new mapset. Most modules will fail if + # WIND doesn't exist (assuming that neither GRASS_REGION nor + # WIND_OVERRIDE environmental variables are set). return os.access(os.path.join(full_mapset, "WIND"), os.R_OK) @@ -812,6 +818,10 @@ :param gisdbase: Path to GRASS GIS database directory :param location: name of a Location """ + # DEFAULT_WIND file should not be required until you do something + # that actually uses them. The check is just a heuristic; a directory + # containing a PERMANENT/DEFAULT_WIND file is probably a GRASS + # location, while a directory lacking it probably isn't. return os.access(os.path.join(gisdbase, location, "PERMANENT", "DEFAULT_WIND"), os.F_OK) @@ -840,10 +850,16 @@ return _("<%s> is not a valid GRASS Location" " because PERMANENT Mapset does not have a DEFAULT_WIND file" " (default computational region)") % full_location - else: + elif mapset not in os.listdir(full_location): return _("Mapset <{mapset}> doesn't exist in GRASS Location <{loc}>. " "A new mapset can be created by '-c' switch.").format( mapset=mapset, loc=location) + elif not os.path.isdir(os.path.join(full_location, mapset)): + return _("<%s> is not a GRASS Mapset" + " because it is not a directory") % mapset + else: + return _("Mapset <{mapset}> is invalid for an unknown reason").format( + mapset=mapset, loc=location) def set_mapset(gisrc, arg, geofile=None, create_new=False): From svn_grass at osgeo.org Wed Oct 19 18:33:27 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Wed, 19 Oct 2016 18:33:27 -0700 Subject: [GRASS-SVN] r69712 - grass-addons/grass7/raster/r.colors.matplotlib Message-ID: <20161020013327.297C439040E@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-19 18:33:27 -0700 (Wed, 19 Oct 2016) New Revision: 69712 Modified: grass-addons/grass7/raster/r.colors.matplotlib/r.colors.matplotlib.html Log: r.colors.matplotlib: fix wrong file name (leaving this one as the primary picture) Modified: grass-addons/grass7/raster/r.colors.matplotlib/r.colors.matplotlib.html =================================================================== --- grass-addons/grass7/raster/r.colors.matplotlib/r.colors.matplotlib.html 2016-10-20 00:40:52 UTC (rev 69711) +++ grass-addons/grass7/raster/r.colors.matplotlib/r.colors.matplotlib.html 2016-10-20 01:33:27 UTC (rev 69712) @@ -107,7 +107,7 @@
    -Matplotlib summer +Matplotlib summer Matplotlib winter discrete Matplotlib autumn Matplotlib cubehelix discrete From svn_grass at osgeo.org Thu Oct 20 03:13:00 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Thu, 20 Oct 2016 03:13:00 -0700 Subject: [GRASS-SVN] r69713 - grass/trunk/temporal Message-ID: <20161020101300.585F7390125@trac.osgeo.org> Author: huhabla Date: 2016-10-20 03:12:59 -0700 (Thu, 20 Oct 2016) New Revision: 69713 Modified: grass/trunk/temporal/temporalintro.html Log: temporal modules: Better introduction to mapset specific space-time datasets Modified: grass/trunk/temporal/temporalintro.html =================================================================== --- grass/trunk/temporal/temporalintro.html 2016-10-20 01:33:27 UTC (rev 69712) +++ grass/trunk/temporal/temporalintro.html 2016-10-20 10:12:59 UTC (rev 69713) @@ -20,37 +20,69 @@

    Temporal data management in general

    -Space time datasets are stored in a temporal database. SQLite3 or -PostgreSQL are supported as SQL database back end. Temporal databases -stored in other mapsets can be used as long as they are in the +

    Space time datasets are stored in a temporal database. +A core principle of the temporal framework is that temporal databases are mapset specific. +A new temporal databases is created, when a temporal command is invoked in a mapset +that does not contain a temporal database. For example if a mapset was recently created. +As a result, space-time datasets are mapset specific and can only register raster, 3D raster or +vector maps from the same mapset. By default space-time datasets can not register +maps from other mapsets. This is a security measure, since the registration of maps in +a space-time dataset will always modify the metadata of the registered map. This is critical if: +

    +
      +
    • + The user has no write access to the maps from other mapsets he wants to register +
    • +
    • + If registered maps are removed from other mapsets, the temporal database will not be updated + and will contain ghost maps +
    • +
    + +SQLite3 or PostgreSQL are supported as temporal database back end. +Temporal databases stored in other mapsets can be accessed as long as they are in the user's current mapset search path (managed with g.mapsets). +Access to space-time datasets from other mapsets is read only. +They can not be modified or removed.

    Connection settings are performed with t.connect. As default a sqlite3 database will be created in the current mapset that stores all space time datasets and registered time series maps. -

    +

    New space time datasets are created in the temporal database with t.create. The name of the new dataset, the type (strds, str3ds, stvds), the title and the description must be provided for creation. Optional the temporal type (absolute, relative) and semantic information can be provided.

    -The module t.remove will remove the space time datasets -from the temporal database. Use t.support -to modify the metadata of space time datasets or to update the metadata -that is derived from registered maps. This module also checks for removed -and modified maps and updates the space time datasets accordingly. -Rename a space time dataset with t.rename. -

    -The module t.register is designed to +The module t.register is designed to register raster, 3D raster and vector maps in the temporal database and -optionally in a space time dataset. It supports different input options. Maps +in space time datasets. It supports different input options. Maps to register can be provided as a comma separated string at the command line, or -in an input file. The module supports the definition of time stamps +in an input file. The module supports the definition of time stamps (time instances or intervals) for each map in the input file. With t.unregister maps can be unregistered from space time datasets and the temporal database. +

    + +Important
    +Use only temporal commands like t.register to attach a time stamp to +raster, 3D raster and vector maps. The commands r.timestamp, r3.timestamp and +v.timestamp should not be used, since they do not register maps in +the temporal database and modify only the metadata of the map in the +spatial database. However maps with timestamps attached with *.timestamp modules +and be registered in space-time datasets using the existing timestamp. +

    +The module t.remove will remove the space time datasets +from the temporal database and optionally all registered maps. It will take care of multiple map registration, +hence if maps are registered in several space-time datasets in the current mapset. +Use t.support +to modify the metadata of space time datasets or to update the metadata +that is derived from registered maps. This module also checks for removed +and modified maps and updates the space time datasets accordingly. +Rename a space time dataset with t.rename. +

    To print information about space time datasets or registered maps, the module t.info can be used. t.list will list all space time datasets and @@ -61,8 +93,10 @@ t.sample samples input space time dataset(s) with a sample space time dataset and print the result to standard output. Several different sample methods are supported that can be combined. +

    -List of general management modules: +List of general management modules: +

    • t.connect
    • t.create
    • From svn_grass at osgeo.org Thu Oct 20 13:26:20 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Thu, 20 Oct 2016 13:26:20 -0700 Subject: [GRASS-SVN] r69714 - grass/trunk/raster/r.water.outlet Message-ID: <20161020202621.1EAC6390125@trac.osgeo.org> Author: neteler Date: 2016-10-20 13:26:20 -0700 (Thu, 20 Oct 2016) New Revision: 69714 Modified: grass/trunk/raster/r.water.outlet/r.water.outlet.html Log: r.water.outlet manual: example expanded Modified: grass/trunk/raster/r.water.outlet/r.water.outlet.html =================================================================== --- grass/trunk/raster/r.water.outlet/r.water.outlet.html 2016-10-20 10:12:59 UTC (rev 69713) +++ grass/trunk/raster/r.water.outlet/r.water.outlet.html 2016-10-20 20:26:20 UTC (rev 69714) @@ -45,6 +45,9 @@ # overlay with transparency r.colors map=basin_A30 color=grey d.his h=accum_5K i=basin_A30 + +# report outlet size in ha +r.report map=basin_A30 units=h

      From svn_grass at osgeo.org Thu Oct 20 13:26:55 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Thu, 20 Oct 2016 13:26:55 -0700 Subject: [GRASS-SVN] r69715 - grass/branches/releasebranch_7_2/raster/r.water.outlet Message-ID: <20161020202655.AEB48390125@trac.osgeo.org> Author: neteler Date: 2016-10-20 13:26:55 -0700 (Thu, 20 Oct 2016) New Revision: 69715 Modified: grass/branches/releasebranch_7_2/raster/r.water.outlet/r.water.outlet.html Log: r.water.outlet manual: example expanded Modified: grass/branches/releasebranch_7_2/raster/r.water.outlet/r.water.outlet.html =================================================================== --- grass/branches/releasebranch_7_2/raster/r.water.outlet/r.water.outlet.html 2016-10-20 20:26:20 UTC (rev 69714) +++ grass/branches/releasebranch_7_2/raster/r.water.outlet/r.water.outlet.html 2016-10-20 20:26:55 UTC (rev 69715) @@ -45,6 +45,9 @@ # overlay with transparency r.colors map=basin_A30 color=grey d.his h=accum_5K i=basin_A30 + +# report outlet size in ha +r.report map=basin_A30 units=h

      From svn_grass at osgeo.org Sat Oct 22 10:10:13 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 22 Oct 2016 10:10:13 -0700 Subject: [GRASS-SVN] r69716 - in grass-addons/grass7/raster: . r.scatterplot Message-ID: <20161022171013.DE99439037E@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-22 10:10:13 -0700 (Sat, 22 Oct 2016) New Revision: 69716 Added: grass-addons/grass7/raster/r.scatterplot/ grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html grass-addons/grass7/raster/r.scatterplot/r_scatterplot.png Removed: grass-addons/grass7/raster/r.scatterplot/r3.scatterplot.html grass-addons/grass7/raster/r.scatterplot/r3_scatterplot.png grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables.png grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_color.png grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_z.png grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_z_4th_color.png grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_z_4th_color2.png grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2d.png grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_3_variables.png grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_3_variables_3_colors.png grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_3_variables_3_colors_overlap.png Modified: grass-addons/grass7/raster/Makefile grass-addons/grass7/raster/r.scatterplot/Makefile grass-addons/grass7/raster/r.scatterplot/main.c Log: r.scatterplot: scatter plot as vector points, 2D raster verion of r3.scatterplot (r69572) Modified: grass-addons/grass7/raster/Makefile =================================================================== --- grass-addons/grass7/raster/Makefile 2016-10-20 20:26:55 UTC (rev 69715) +++ grass-addons/grass7/raster/Makefile 2016-10-22 17:10:13 UTC (rev 69716) @@ -84,6 +84,7 @@ r.rock.stability \ r.roughness.vector \ r.sample.category \ + r.scatterplot \ r.series.decompose \ r.series.diversity \ r.shaded.pca \ Property changes on: grass-addons/grass7/raster/r.scatterplot ___________________________________________________________________ Added: svn:ignore + OBJ.* *.tmp.html Modified: grass-addons/grass7/raster/r.scatterplot/Makefile =================================================================== --- grass-addons/grass7/raster3d/r3.scatterplot/Makefile 2016-09-28 23:55:37 UTC (rev 69601) +++ grass-addons/grass7/raster/r.scatterplot/Makefile 2016-10-22 17:10:13 UTC (rev 69716) @@ -1,9 +1,9 @@ MODULE_TOPDIR = ../.. -PGM = r3.scatterplot +PGM = r.scatterplot -LIBES = $(RASTER3DLIB) $(VECTORLIB) $(GISLIB) $(MATHLIB) -DEPENDENCIES = $(RASTER3DDEP) $(VECTORDEP) $(GISDEP) +LIBES = $(RASTERLIB) $(VECTORLIB) $(GISLIB) $(MATHLIB) +DEPENDENCIES = $(RASTERDEP) $(VECTORDEP) $(GISDEP) EXTRA_INC = $(VECT_INC) EXTRA_CFLAGS = $(VECT_CFLAGS) Modified: grass-addons/grass7/raster/r.scatterplot/main.c =================================================================== --- grass-addons/grass7/raster3d/r3.scatterplot/main.c 2016-09-28 23:55:37 UTC (rev 69601) +++ grass-addons/grass7/raster/r.scatterplot/main.c 2016-10-22 17:10:13 UTC (rev 69716) @@ -1,10 +1,11 @@ /**************************************************************************** * - * MODULE: r3.scatterplot + * MODULE: r.scatterplot + * (based on and a lot of common code with r3.scatterplot) * * AUTHOR(S): Vaclav Petras * - * PURPOSE: Creates a scatter plot of two or more 3D maps + * PURPOSE: Creates a scatter plot of two or more raster maps * * COPYRIGHT: (C) 2016 by the GRASS Development Team * @@ -32,7 +33,7 @@ #include #include -#include +#include #include #include "vector_mask.h" @@ -60,31 +61,30 @@ struct GModule *module; module = G_define_module(); - G_add_keyword(_("raster3d")); + G_add_keyword(_("raster")); G_add_keyword(_("statistics")); G_add_keyword(_("diagram")); G_add_keyword(_("correlation")); G_add_keyword(_("scatter plot")); G_add_keyword(_("vector")); - G_add_keyword(_("voxel")); - module->label = _("Creates a scatter plot of 3D raster maps"); + module->label = _("Creates a scatter plot of raster maps"); module->description = - _("Creates a scatter plot of two or more 3D raster maps as a vector map"); + _("Creates a scatter plot of two or more raster maps as a vector map"); - opt->input = G_define_standard_option(G_OPT_R3_INPUTS); + opt->input = G_define_standard_option(G_OPT_R_INPUTS); opt->output = G_define_standard_option(G_OPT_V_OUTPUT); - opt->z_raster = G_define_standard_option(G_OPT_R3_INPUT); + opt->z_raster = G_define_standard_option(G_OPT_R_INPUT); opt->z_raster->key = "z_raster"; opt->z_raster->description = - _("Name of input 3D raster map to define Z coordinates"); + _("Name of input raster map to define Z coordinates"); opt->z_raster->required = NO; - opt->color_raster = G_define_standard_option(G_OPT_R3_INPUT); + opt->color_raster = G_define_standard_option(G_OPT_R_INPUT); opt->color_raster->key = "color_raster"; opt->color_raster->description = - _("Name of input 3D raster map to define category and color"); + _("Name of input raster map to define category and color"); opt->color_raster->required = NO; opt->xscale = G_define_option(); @@ -196,14 +196,11 @@ G_fatal_error(_("Invalid northing: %s"), option->answers[1]); } -static RASTER3D_Map *open_raster3d(char *name, RASTER3D_Region *region) +int open_raster(char *name) { - RASTER3D_Map * map; + int map; - map = Rast3d_open_cell_old(name, G_find_raster3d(name, ""), region, - RASTER3D_TILE_SAME_AS_FILE, RASTER3D_USE_CACHE_DEFAULT); - if (map == NULL) - Rast3d_fatal_error(_("Unable to open 3D raster map <%s>"), name); + map = Rast_open_old(name, ""); return map; } @@ -237,23 +234,18 @@ double start_x = 0; double start_y = 0; - struct Cell_head region_2d; + struct Cell_head region; - G_get_window(®ion_2d); + G_get_window(®ion); if (flg.region_position->answer) { - start_x = region_2d.west; - start_y = region_2d.south; + start_x = region.west; + start_y = region.south; } if (opt.position->answer) - option_to_en(opt.position, &start_x, &start_y, ®ion_2d); + option_to_en(opt.position, &start_x, &start_y, ®ion); - RASTER3D_Region region; - - Rast3d_init_defaults(); - Rast3d_get_window(®ion); - struct Map_info output; struct line_pnts *points; struct line_cats *cats; @@ -271,15 +263,14 @@ points = Vect_new_line_struct(); cats = Vect_new_cats_struct(); - int rows, cols, depths; - int col, row, depth; + int rows, cols; + int col, row; char **name1, **name2; DCELL x, y, z; - FCELL fcat; int cat; int layer; /* actual geographical coordinates */ - double xcoor, ycoor, unused; + double xcoor, ycoor; double current_max_x = -HUGE_VAL; double layer_x_offset = start_x; @@ -290,25 +281,26 @@ layer = 1; rows = region.rows; cols = region.cols; - depths = region.depths; - G_debug(1, "limits: r=%d c=%d d=%d", rows, cols, depths); + G_debug(1, "limits: r=%d c=%d", rows, cols); - RASTER3D_Map *z_raster = NULL; - RASTER3D_Map *color_raster = NULL; + int z_raster = -1; + int color_raster = -1; int n_inputs = 0; for (name1 = opt.input->answers; *name1 != NULL; name1++) { n_inputs++; - if (!G_find_raster3d(*name1, "")) - Rast3d_fatal_error(_("3D raster map <%s> not found"), *name1); + if (!G_find_raster(*name1, "")) + G_fatal_error(_("Raster map <%s> not found"), *name1); } if (opt.color_raster->answer) - color_raster = open_raster3d(opt.color_raster->answer, ®ion); + color_raster = open_raster(opt.color_raster->answer); if (opt.z_raster->answer) - z_raster = open_raster3d(opt.z_raster->answer, ®ion); + z_raster = open_raster(opt.z_raster->answer); + G_message("clr: %s %d", opt.color_raster->answer, color_raster); + struct VectorMask vector_mask; int use_vector_mask = FALSE; if (opt.vector_mask->answer) { @@ -319,6 +311,13 @@ use_vector_mask = TRUE; } + DCELL *buffer1 = Rast_allocate_d_buf(); + DCELL *buffer2 = Rast_allocate_d_buf(); + DCELL *z_buffer = Rast_allocate_d_buf(); + /* TODO: this could go directly after color + * skip cat if attr table or cats encode color */ + CELL *color_buffer = Rast_allocate_c_buf(); + for (name1 = opt.input->answers; *name1 != NULL; name1++) { for (name2 = opt.input->answers; *name2 != NULL; name2++) { /* same name or used combination */ @@ -329,60 +328,63 @@ G_message(_("Putting values from <%s> and <%s> into layer %d of <%s>"), *name1, *name2, layer, opt.output->answer); G_debug(3, "save %s + %s to %d (%s)", *name1, *name2, layer, opt.output->answer); - RASTER3D_Map *map1 = open_raster3d(*name1, ®ion); - RASTER3D_Map *map2 = open_raster3d(*name2, ®ion); + int map1 = open_raster(*name1); + int map2 = open_raster(*name2); for (row = 0; row < rows; row++) { G_percent(row, rows, 1); + Rast_get_d_row(map1, buffer1, row); + Rast_get_d_row(map2, buffer2, row); + if (z_raster >= 0) + Rast_get_d_row(z_raster, z_buffer, row); + if (color_raster >= 0) + Rast_get_c_row(color_raster, color_buffer, row); for (col = 0; col < cols; col++) { /* vector mask is expensive, so we first do 2D loops */ if (use_vector_mask) { - Rast3d_coord2location(®ion, row + 0.5, col + 0.5, 0, &ycoor, &xcoor, &unused); + ycoor = Rast_row_to_northing(row + 0.5, ®ion); + xcoor = Rast_col_to_easting(col + 0.5, ®ion); if (!VectorMask_point_in(&vector_mask, xcoor, ycoor)) continue; } - for (depth = 0; depth < depths; depth++) { - x = Rast3d_get_double(map1, col, row, depth); - if (Rast_is_d_null_value(&x)) + x = buffer1[col]; + if (Rast_is_d_null_value(&x)) + continue; + y = buffer2[col]; + if (Rast_is_d_null_value(&y)) + continue; + /* TODO: better check if the raster is alive */ + if (z_raster >= 0) { + z = z_buffer[col]; + if (Rast_is_d_null_value(&z)) continue; - y = Rast3d_get_double(map2, col, row, depth); - if (Rast_is_d_null_value(&y)) + } + if (color_raster >= 0) { + cat = color_buffer[col]; + if (Rast_is_c_null_value(&cat)) continue; - if (z_raster) { - z = Rast3d_get_double(z_raster, col, row, depth); - if (Rast_is_d_null_value(&z)) - continue; - } - if (color_raster) { - fcat = Rast3d_get_float(color_raster, col, row, depth); - if (Rast_is_d_null_value(&fcat)) - continue; - cat = (int) fcat; - /* TODO: what to do when value cannot be cat */ - } - x *= xscale; - y *= yscale; - z *= zscale; - x += layer_x_offset; - y += layer_y_offset; - if (current_max_x < x) - current_max_x = x; - Vect_cat_set(cats, layer, cat); - Vect_append_point(points, x, y, z); - //Vect_append_point(points, xcoor, ycoor, z); - Vect_write_line(&output, GV_POINT, points, cats); - Vect_reset_line(points); - Vect_reset_cats(cats); - /* TODO: we can determine cat == GV_CAT_MAX ahead and tell user what to do */ - cat++; + /* TODO: what to do when value cannot be cat */ } + x *= xscale; + y *= yscale; + z *= zscale; + x += layer_x_offset; + y += layer_y_offset; + if (current_max_x < x) + current_max_x = x; + Vect_cat_set(cats, layer, cat); + Vect_append_point(points, x, y, z); + //Vect_append_point(points, xcoor, ycoor, z); + Vect_write_line(&output, GV_POINT, points, cats); + Vect_reset_line(points); + Vect_reset_cats(cats); + /* TODO: we can determine cat == GV_CAT_MAX ahead and tell user what to do */ + cat++; } } G_percent(1, 1, 1); - if (!Rast3d_close(map1)) - Rast3d_fatal_error(_("Unable to close 3D raster map")); - if (!Rast3d_close(map2)) - Rast3d_fatal_error(_("Unable to close 3D raster map")); + Rast_close(map1); + Rast_close(map2); if (!flg.one_layer->answer) layer++; if (flg.auto_offset->answer) @@ -393,17 +395,17 @@ Vect_destroy_line_struct(points); Vect_destroy_cats_struct(cats); - if (color_raster) { + if (color_raster >= 0) { struct Colors colors; - Rast3d_read_colors(opt.color_raster->answer, G_find_raster3d(opt.color_raster->answer, ""), &colors); + Rast_read_colors(opt.color_raster->answer, G_find_raster(opt.color_raster->answer, ""), &colors); Vect_write_colors(opt.output->answer, G_mapset(), &colors); } - if (z_raster && !Rast3d_close(z_raster)) - Rast3d_fatal_error(_("Unable to close 3D raster map")); - if (color_raster && !Rast3d_close(color_raster)) - Rast3d_fatal_error(_("Unable to close 3D raster map")); + if (z_raster >= 0) + Rast_close(z_raster); + if (color_raster >= 0) + Rast_close(color_raster); if (opt.vector_mask->answer) { VectorMask_destroy(&vector_mask); Copied: grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html (from rev 69601, grass-addons/grass7/raster3d/r3.scatterplot/r3.scatterplot.html) =================================================================== --- grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html (rev 0) +++ grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html 2016-10-22 17:10:13 UTC (rev 69716) @@ -0,0 +1,192 @@ +

      DESCRIPTION

      + +The r.scatterplot module takes raster maps and creates +a scatter plot which is a vector map and where individual points in +the scatter plot are vector points. As with any scatter plot the X +coordinates of the points represent values from the first raster map +and the Y coordinates represent values from the second raster map. +Consequently, the vector map is placed in the combined value space of +the original raster maps and its geographic position should be ignored. +Typically, it is necessary to zoom or to change computational in order +to view the scatter plot or to perform further computations on the result. + +

      +With the default settings, the r.scatterplot output allows +measuring and querying of the values in the scatter plot. Settings +such as xscale or position option change the coordinates +and make some of the measurements wrong. + + +

      Multiple variables

      + +If more than two raster maps are provided to the input option, +r.scatterplot creates a scatter plot for each unique pair +of input maps. For example, if A, B, C, and D are the inputs, +r.scatterplot creates scatter plots for A and B, A and C, +A and D, B and C, B and D, and finally C and D. Each pair is part of +different vector map layer. r.scatterplot provides textual +output which specifies the pairs and associated layers. + +

      +A 3D scatter plot can be generated when the z_raster option is +provided. A third variable is added to each scatter plot and each point +has Z coordinate which represents this third variable. + +

      +Each point can also have a color based on an additional variable +based on the values from color_raster. Values from a raster are +stored as categories, i.e. floating point values are truncated to +integers, and a color table based on the input raster color table is +assigned to the vector map. + +

      +The z_raster and color_raster can be the same. This can help +with understanding the 3D scatter plot and makes the third variable +visible in 2D as well. +When z_raster and color_raster are the same, total of four +variables are associated with one point. + +

      + + + +

      + Figure: One scatter plot of two variables (left), + the same scatter plot but with color showing third variable (middle), + again the same scatter plot in 3D where Z represents a third variable (right). +

      +
      + +
      + + +

      + Figure: One scatter plot in with one variable as Z coordinate and + another variable as color (two rotated views). +

      +
      + + +

      Layout

      + +When working only with variable, X axis represents the first one +and Y axis the second one. With more than one variable, the individual +scatter plots for individual pairs of variables are at the same +place. In this case, the coordinates show the actual values of the +variables. Each scatter plot is placed into a separate layer of +the output vector map. + +
      + +

      + Figure: Three overlapping scatter plots of three variables A, B, and C. + Individual scatter plots are distinguished by color. + The colors can be obtained using d.vect layer=-1 -c. +

      +
      + +

      +If visualization is more important than preserving the actual values, +the -s flag can be used. This will place the scatter plots next +to each other separated by values provided using spacing option. + +

      +The layout options can be still combined with additional variables +represented as Z coordinate or color. In that case, Z coordinate +or color is same for all the scatter plots. + +

      + +

      + Figure: Three scatter plots of three variables A, B, and C. + First one is A and B, second A and C, and third B and C. +

      +
      + +
      + +

      + Figure: Three scatter plots of three variables A, B, and C + with color showing a fourth variable D in all scatter plots. +

      +
      + +The options xscale, yscale and zscale will cause +the values to be rescaled before they are stored as point coordinates. +This is useful for visualization when one of the variables has +significantly different range than the other or when the scatter plot +is shown with other data and must fit a certain area. + +The position option is used to place the scatter plot to any +given coordinates. Similarly, -w flag can be used to place it +to the south-west corner of the computation region. + + +

      NOTES

      + +

      +The resulting vector will have as many points as there is 3D raster +cells in the current computational region. It might be appropriate to +use coarser resolution for the scatter plot than for the other +computations. However, note that the some values will be skipped +which may lead, e.g. to missing some outliers. + +

      +The color_raster input is expected to be categorical raster +or have values which won't loose anything when converted from floating +point to integer. This is because vector categories are used to store +the color_raster values and carry association with the color. + +

      +The visualization of the output vector map has potentially the same +issue as visualization of any vector with many points. The points +cover each other and above certain density of points, it is not possible +to compare relative density in the scatter plot. Furthermore, if colors +are associated with the points, the colors of points rendered last are +those which are visible, not actually showing the prevailing color +(value). The modules v.mkgrid and +v.vect.stats can be used to +overcome this issue. + +

      EXAMPLES

      + +

      Landsat bands

      + +Set the computation region to one of the raster maps: + +
      +g.region raster=lsat7_2002_30
      +
      + +Create the scatter plot: + +
      +r.scatterplot input=lsat7_2002_30,lsat7_2002_40 output=scatterplot color_raster=landclass96
      +
      + + + +
      + +

      + Figure: Scatter plot showing third variable as color +

      +
      + + +

      SEE ALSO

      + + +r.stats, +d.correlate, +v.mkgrid, +v.vect.stats, +g.region + + +

      AUTHOR

      + +Vaclav Petras, NCSU GeoForAll Lab Deleted: grass-addons/grass7/raster/r.scatterplot/r3.scatterplot.html =================================================================== --- grass-addons/grass7/raster3d/r3.scatterplot/r3.scatterplot.html 2016-09-28 23:55:37 UTC (rev 69601) +++ grass-addons/grass7/raster/r.scatterplot/r3.scatterplot.html 2016-10-22 17:10:13 UTC (rev 69716) @@ -1,201 +0,0 @@ -

      DESCRIPTION

      - -The r3.scatterplot module takes 3D raster maps and creates -a scatter plot which is a vector map and where individual points in -the scatter plot are vector points. As with any scatter plot the X -coordinates of the points represent values from the first raster map -and the Y coordinates represent values from the second raster map. -Consequently, the vector map is placed in the combined value space of -the original raster maps and its geographic position should be ignored. -Typically, it is necessary to zoom or to change computational in order -to view the scatter plot or to perform further computations on the result. - -

      -With the default settings, the r3.scatterplot output allows -measuring and querying of the values in the scatter plot. Settings -such as xscale or position option change the coordinates -and make some of the measurements wrong. - - -

      Multiple variables

      - -If more than two raster maps are provided to the input option, -r3.scatterplot creates a scatter plot for each unique pair -of input maps. For example, if A, B, C, and D are the inputs, -r3.scatterplot creates scatter plots for A and B, A and C, -A and D, B and C, B and D, and finally C and D. Each pair is part of -different vector map layer. r3.scatterplot provides textual -output which specifies the pairs and associated layers. - -

      -A 3D scatter plot can be generated when the z_raster option is -provided. A third variable is added to each scatter plot and each point -has Z coordinate which represents this third variable. - -

      -Each point can also have a color based on an additional variable -based on the values from color_raster. Values from a raster are -stored as categories, i.e. floating point values are truncated to -integers, and a color table based on the input raster color table is -assigned to the vector map. - -

      -The z_raster and color_raster can be the same. This can help -with understanding the 3D scatter plot and makes the third variable -visible in 2D as well. -When z_raster and color_raster are the same, total of four -variables are associated with one point. - -

      - - - -

      - Figure: One scatter plot of two variables (left), - the same scatter plot but with color showing third variable (middle), - again the same scatter plot in 3D where Z represents a third variable (right). -

      -
      - -
      - - -

      - Figure: One scatter plot in with one variable as Z coordinate and - another variable as color (two rotated views). -

      -
      - - -

      Layout

      - -When working only with variable, X axis represents the first one -and Y axis the second one. With more than one variable, the individual -scatter plots for individual pairs of variables are at the same -place. In this case, the coordinates show the actual values of the -variables. Each scatter plot is placed into a separate layer of -the output vector map. - -
      - -

      - Figure: Three overlapping scatter plots of three variables A, B, and C. - Individual scatter plots are distinguished by color. - The colors can be obtained using d.vect layer=-1 -c. -

      -
      - -

      -If visualization is more important than preserving the actual values, -the -s flag can be used. This will place the scatter plots next -to each other separated by values provided using spacing option. - -

      -The layout options can be still combined with additional variables -represented as Z coordinate or color. In that case, Z coordinate -or color is same for all the scatter plots. - -

      - -

      - Figure: Three scatter plots of three variables A, B, and C. - First one is A and B, second A and C, and third B and C. -

      -
      - -
      - -

      - Figure: Three scatter plots of three variables A, B, and C - with color showing a fourth variable D in all scatter plots. -

      -
      - -The options xscale, yscale and zscale will cause -the values to be rescaled before they are stored as point coordinates. -This is useful for visualization when one of the variables has -significantly different range than the other or when the scatter plot -is shown with other data and must fit a certain area. - -The position option is used to place the scatter plot to any -given coordinates. Similarly, -w flag can be used to place it -to the south-west corner of the computation region. - - -

      NOTES

      - -

      -The resulting vector will have as many points as there is 3D raster -cells in the current computational region. It might be appropriate to -use coarser resolution for the scatter plot than for the other -computations. However, note that the some values will be skipped -which may lead, e.g. to missing some outliers. - -

      -The color_raster input is expected to be categorical raster -or have values which won't loose anything when converted from floating -point to integer. This is because vector categories are used to store -the color_raster values and carry association with the color. - -

      -The visualization of the output vector map has potentially the same -issue as visualization of any vector with many points. The points -cover each other and above certain density of points, it is not possible -to compare relative density in the scatter plot. Furthermore, if colors -are associated with the points, the colors of points rendered last are -those which are visible, not actually showing the prevailing color -(value). The modules v.mkgrid and -v.vect.stats can be used to -overcome this issue. - -

      EXAMPLES

      - -

      Example with generated data

      - -Set the computational region for generating data and subsequent -analysis: - -
      -g.region s=0 n=100 w=0 e=100 b=0 t=50 res=10 res3=10 tbres=1 -p3
      -
      - -Generate data using raster algebra: - -
      -r3.mapcalc "A = if(depth() < ndepths()/ 2,  row()+col()+depth(), col())" -s
      -r3.mapcalc "B = if(row() < nrows()/2, rand(0, nrows()) + col() + depth(), depth() + rand(0, nrows()))" -s
      -r3.mapcalc "C = if(col() < ncols()/3, row() + depth(), rand(0, ncols()))" -s
      -r3.mapcalc "D = depth()"
      -
      - -Create a scatter plot of correlations between A and B. -Use C for the Z axes (height) and D for the color. - -
      -r3.scatterplot input=A,B output=scatterplot z_raster=C color_raster=D
      -
      - -
      - - -

      - Figure: 2D scatter plot showing third variable as color - and 3D scatter plot showing third variable as color and fourth variable on Z axis - which uncovers another group of values not visible from the 2D scatter plot -

      -
      - - -

      SEE ALSO

      - - -r3.stats, -d.correlate, -v.mkgrid, -v.vect.stats, -g.region - - -

      AUTHOR

      - -Vaclav Petras, NCSU GeoForAll Lab Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot.png =================================================================== (Binary files differ) Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables.png =================================================================== (Binary files differ) Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_color.png =================================================================== (Binary files differ) Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_z.png =================================================================== (Binary files differ) Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_z_4th_color.png =================================================================== (Binary files differ) Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_z_4th_color2.png =================================================================== (Binary files differ) Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2d.png =================================================================== (Binary files differ) Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_3_variables.png =================================================================== (Binary files differ) Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_3_variables_3_colors.png =================================================================== (Binary files differ) Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_3_variables_3_colors_overlap.png =================================================================== (Binary files differ) Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream From svn_grass at osgeo.org Sat Oct 22 15:42:34 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 22 Oct 2016 15:42:34 -0700 Subject: [GRASS-SVN] r69717 - grass-addons/grass7/raster/r.scatterplot Message-ID: <20161022224234.822BE390125@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-22 15:42:34 -0700 (Sat, 22 Oct 2016) New Revision: 69717 Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_color.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z_4th_color.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z_4th_color2.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables_3_colors.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables_3_colors_overlap.png Modified: grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html grass-addons/grass7/raster/r.scatterplot/r_scatterplot.png Log: r.scatterplot: unique images for description based on landsat (not using r3.scatterplot's) Modified: grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html =================================================================== --- grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html 2016-10-22 17:10:13 UTC (rev 69716) +++ grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html 2016-10-22 22:42:34 UTC (rev 69717) @@ -47,9 +47,9 @@ variables are associated with one point.
      - - - + + +

      Figure: One scatter plot of two variables (left), the same scatter plot but with color showing third variable (middle), @@ -57,9 +57,13 @@

      +
      - - + +

      Figure: One scatter plot in with one variable as Z coordinate and another variable as color (two rotated views). @@ -76,8 +80,12 @@ variables. Each scatter plot is placed into a separate layer of the output vector map. +

      - +

      Figure: Three overlapping scatter plots of three variables A, B, and C. Individual scatter plots are distinguished by color. @@ -95,16 +103,22 @@ represented as Z coordinate or color. In that case, Z coordinate or color is same for all the scatter plots. +

      - +

      Figure: Three scatter plots of three variables A, B, and C. First one is A and B, second A and C, and third B and C.

      +
      - +

      Figure: Three scatter plots of three variables A, B, and C with color showing a fourth variable D in all scatter plots. @@ -152,7 +166,8 @@

      Landsat bands

      -Set the computation region to one of the raster maps: +In the full North Carolina sample location, +set the computation region to one of the raster maps:
       g.region raster=lsat7_2002_30
      @@ -172,7 +187,8 @@
       

      - Figure: Scatter plot showing third variable as color + Figure: Scatter plot showing red and near infrared Landsat bands + colored using land cover classes

      @@ -182,6 +198,7 @@ r.stats, d.correlate, +r3.scatterplot, v.mkgrid, v.vect.stats, g.region Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot.png ___________________________________________________________________ Modified: svn:mime-type - application/octet-stream + image/png Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_color.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_color.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z_4th_color.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z_4th_color.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z_4th_color2.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z_4th_color2.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables_3_colors.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables_3_colors.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables_3_colors_overlap.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables_3_colors_overlap.png ___________________________________________________________________ Added: svn:mime-type + image/png From svn_grass at osgeo.org Sat Oct 22 20:20:57 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 22 Oct 2016 20:20:57 -0700 Subject: [GRASS-SVN] r69718 - grass-addons/grass7/raster/r.scatterplot Message-ID: <20161023032057.905AB39037E@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-22 20:20:57 -0700 (Sat, 22 Oct 2016) New Revision: 69718 Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_full.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_grid_hexagons.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_grid_rectangles.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_grid_rectangles_res_1.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_res_120.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_res_240.png Modified: grass-addons/grass7/raster/r.scatterplot/main.c grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html grass-addons/grass7/raster/r.scatterplot/r_scatterplot.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_color.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z_4th_color.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z_4th_color2.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables_3_colors.png grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables_3_colors_overlap.png Log: r.scatterplot: dealing with hight density scatter plot example, missing optipng Modified: grass-addons/grass7/raster/r.scatterplot/main.c =================================================================== --- grass-addons/grass7/raster/r.scatterplot/main.c 2016-10-22 22:42:34 UTC (rev 69717) +++ grass-addons/grass7/raster/r.scatterplot/main.c 2016-10-23 03:20:57 UTC (rev 69718) @@ -299,8 +299,6 @@ if (opt.z_raster->answer) z_raster = open_raster(opt.z_raster->answer); - G_message("clr: %s %d", opt.color_raster->answer, color_raster); - struct VectorMask vector_mask; int use_vector_mask = FALSE; if (opt.vector_mask->answer) { Modified: grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html =================================================================== --- grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html 2016-10-22 22:42:34 UTC (rev 69717) +++ grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html 2016-10-23 03:20:57 UTC (rev 69718) @@ -193,6 +193,112 @@
      +

      High density scatter plots

      + +In an ideal case, the scatter plot is computed with the computation region +resolution set to the resolutions of one of the rasters (which ideally +matches the other raster as well): + +
      +g.region raster=lsat7_2002_30 -p
      +r.scatterplot input=lsat7_2002_30,lsat7_2002_40 output=scatterplot_full_res
      +
      + +This best describes the actual state of the data, but unfortunately +this creates a lot of points which must be processed and rendered. +Therefore, it is also possible to compute the scatter plot in a lower +resolution by changing the computational region resolution: + +
      +g.region raster=lsat7_2002_30 res=120 -p
      +r.scatterplot input=lsat7_2002_30,lsat7_2002_40 output=scatterplot_res_120
      +
      + +Reducing the resolution creates a possibility of missing some outliers +or even smaller groups as some of the cells are just ignored, but +typically the general shape of the scatter plot is preserved. +In any case, with less points, every operation will by much faster. + +
      + + + +

      + Figure: Scatter plots computed with different computational region + resolutions; first one is with full raster resolution (~30 m) + second with resolution 120 m, and third with 240 m +

      +
      + +Another way of dealing with hight density scatter plots +is to bin the points into cells of a rectangular grid. +Number of points per cells with influence color of the cell, +so the density will be expressed clearly. +The scatter plot can be computed in full resolution: + +
      +g.region raster=lsat7_2002_30 -p
      +r.scatterplot input=lsat7_2002_30,lsat7_2002_40 output=scatterplot
      +
      + +To create the grid the computation region extent should match +the scatter plot extent. The resolution determines the size of the grid +cells. 5 is a good size for data from 0 to 255. + +
      +g.region vector=scatterplot res=5 -p
      +
      + +The grid can be created using v.mkgrid +module, the binning done using +v.vect.stats, and finally the +color is set using v.colors. + +
      +v.mkgrid map=scatterplot_grid
      +v.vect.stats points=scatterplot areas=scatterplot_grid count_column=count
      +v.colors map=scatterplot_grid use=attr column=count color=viridis
      +
      + +The d.vect module picks up the color table +automatically, but it is advantageous to also specify that only +the grid cells with non-zero count of points should be displayed +using where="count > 0": + +
      +d.vect map=scatterplot_grid where="count > 0" icon=basic/point
      +
      + +To get more interesting and sometimes smoother look, hexagonal +grid can be used: + +
      +v.mkgrid -h map=scatterplot_grid
      +
      + +Alternatively, a smaller cell size can be used. When the cell size +is the same as the distance between the points, like for example +using cells size 1 with integer rasters, the grid needs to be shifted +so that the points fall into the middle of the cells rather than +on the edges or corners. For these purposes the +g.region accepts modifications of +the current extent values: + +
      +g.region vector=scatterplot res=1 w=w-0.5 e=e+0.5 s=s-0.5 n=n+0.5
      +
      + +
      + + + +

      + Figure: High density scatter plot visualized using binning into + rectangular grid, hexagonal grid, and dense rectangular grid +

      +
      + +

      SEE ALSO

      Modified: grass-addons/grass7/raster/r.scatterplot/r_scatterplot.png =================================================================== (Binary files differ) Modified: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables.png =================================================================== (Binary files differ) Modified: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_color.png =================================================================== (Binary files differ) Modified: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z.png =================================================================== (Binary files differ) Modified: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z_4th_color.png =================================================================== (Binary files differ) Modified: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_2_variables_3rd_z_4th_color2.png =================================================================== (Binary files differ) Modified: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables.png =================================================================== (Binary files differ) Modified: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables_3_colors.png =================================================================== (Binary files differ) Modified: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_3_variables_3_colors_overlap.png =================================================================== (Binary files differ) Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_full.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_full.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_grid_hexagons.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_grid_hexagons.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_grid_rectangles.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_grid_rectangles.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_grid_rectangles_res_1.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_grid_rectangles_res_1.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_res_120.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_res_120.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_res_240.png =================================================================== (Binary files differ) Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot_density_res_240.png ___________________________________________________________________ Added: svn:mime-type + image/png From svn_grass at osgeo.org Tue Oct 25 05:50:32 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 25 Oct 2016 05:50:32 -0700 Subject: [GRASS-SVN] r69719 - grass-promo/grassflyer/flyer_2016/en Message-ID: <20161025125032.849523903A0@trac.osgeo.org> Author: lucadelu Date: 2016-10-25 05:50:32 -0700 (Tue, 25 Oct 2016) New Revision: 69719 Modified: grass-promo/grassflyer/flyer_2016/en/grass_flyer.svg Log: update grass flyer Modified: grass-promo/grassflyer/flyer_2016/en/grass_flyer.svg =================================================================== (Binary files differ) From svn_grass at osgeo.org Tue Oct 25 05:50:55 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 25 Oct 2016 05:50:55 -0700 Subject: [GRASS-SVN] r69720 - grass-promo/grassflyer/flyer_2016/it Message-ID: <20161025125055.4D6B53903A0@trac.osgeo.org> Author: lucadelu Date: 2016-10-25 05:50:55 -0700 (Tue, 25 Oct 2016) New Revision: 69720 Modified: grass-promo/grassflyer/flyer_2016/it/grass_flyer.svg Log: update italian translation grass flyer Modified: grass-promo/grassflyer/flyer_2016/it/grass_flyer.svg =================================================================== (Binary files differ) From svn_grass at osgeo.org Tue Oct 25 05:51:39 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 25 Oct 2016 05:51:39 -0700 Subject: [GRASS-SVN] r69721 - grass-promo/grassflyer/flyer_2016 Message-ID: <20161025125139.8DCF73903A0@trac.osgeo.org> Author: lucadelu Date: 2016-10-25 05:51:39 -0700 (Tue, 25 Oct 2016) New Revision: 69721 Modified: grass-promo/grassflyer/flyer_2016/README Log: Added more dependencies in README file Modified: grass-promo/grassflyer/flyer_2016/README =================================================================== --- grass-promo/grassflyer/flyer_2016/README 2016-10-25 12:50:55 UTC (rev 69720) +++ grass-promo/grassflyer/flyer_2016/README 2016-10-25 12:51:39 UTC (rev 69721) @@ -1,5 +1,6 @@ -Font: Fira Sans ----> mozilla-fira-sans-fonts +Fonts: +* Fira Sans https://github.com/mozilla/Fira +* EBGaramond https://github.com/georgd/EB-Garamond Font installation - Fedora: @@ -28,7 +29,7 @@ In order to preserve the original document settings, I think it would be better to avoid editing the file from within e.g. Inkscape, but rather add translated chains through a text editor, or better via a dedicated solution like OmegaT[1]. -It provides a rather convenient/intuitive GUI to access strings to translate. +It provides a rather convenient/intuitive GUI to access strings to translate. The two-sided document is given a certain page layout. Text blocks are not much expandable : please when translating keep in mind this constraint and try to be as concise as English (I know it's a bit challenging). From svn_grass at osgeo.org Tue Oct 25 12:10:24 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 25 Oct 2016 12:10:24 -0700 Subject: [GRASS-SVN] r69722 - grass/trunk/vector/v.vect.stats Message-ID: <20161025191024.A78053904DE@trac.osgeo.org> Author: mmetz Date: 2016-10-25 12:10:24 -0700 (Tue, 25 Oct 2016) New Revision: 69722 Modified: grass/trunk/vector/v.vect.stats/main.c Log: v.vect.stats: fix #3184, also remove the erroneous 'half' parameter Modified: grass/trunk/vector/v.vect.stats/main.c =================================================================== --- grass/trunk/vector/v.vect.stats/main.c 2016-10-25 12:51:39 UTC (rev 69721) +++ grass/trunk/vector/v.vect.stats/main.c 2016-10-25 19:10:24 UTC (rev 69722) @@ -29,7 +29,7 @@ struct menu { stat_func *method; /* routine to compute new value */ - int half; /* whether to add 0.5 to result */ + int is_int; /* whether the result is an integer (unused) */ char *name; /* method name */ char *text; /* menu display - full description */ }; @@ -37,18 +37,18 @@ /* modify this table to add new methods */ static struct menu menu[] = { {c_sum, 0, "sum", "sum of values"}, - {c_ave, 1, "average", "average value"}, + {c_ave, 0, "average", "average value"}, {c_median, 0, "median", "median value"}, {c_mode, 0, "mode", "most frequently occurring value"}, {c_min, 0, "minimum", "lowest value"}, - {c_minx, 0, "min_cat", "category number of lowest value"}, + {c_minx, 1, "min_cat", "category number of lowest value"}, {c_max, 0, "maximum", "highest value"}, - {c_maxx, 0, "max_cat", "category number of highest value"}, + {c_maxx, 1, "max_cat", "category number of highest value"}, {c_range, 0, "range", "range of values"}, - {c_stddev, 1, "stddev", "standard deviation"}, - {c_var, 1, "variance", "statistical variance"}, - {c_divr, 0, "diversity", "number of different values"}, - {0, 0, 0, 0} + {c_stddev, 0, "stddev", "standard deviation"}, + {c_var, 0, "variance", "statistical variance"}, + {c_divr, 1, "diversity", "number of different values"}, + {NULL, 0, NULL, NULL} }; /* Structure to store info for each area category */ @@ -68,18 +68,14 @@ AREA_CAT *p1 = (AREA_CAT *) pa; AREA_CAT *p2 = (AREA_CAT *) pb; - if (p1->area_cat < p2->area_cat) - return -1; - if (p1->area_cat > p2->area_cat) - return 1; - return 0; + return (p1->area_cat - p2->area_cat); } int main(int argc, char *argv[]) { char *p; int i, j, k; - int method, half, use_catno; + int method, use_catno; const char *mapset; struct GModule *module; struct Option *point_opt, /* point vector */ @@ -258,7 +254,6 @@ method = -1; use_catno = 0; - half = 0; if (method_opt->answer) { /* get the method */ for (method = 0; (p = menu[method].name); method++) @@ -287,6 +282,7 @@ /* Open database driver */ db_init_string(&stmt); Adriver = NULL; + AFi = NULL; if (!print_flag->answer) { @@ -358,8 +354,6 @@ } } } - else - AFi = NULL; Pdriver = NULL; if (method_opt->answer) { @@ -400,11 +394,7 @@ ctype = db_column_Ctype(Pdriver, PFi->table, point_column_opt->answer); - if (ctype == DB_C_TYPE_INT) - half = menu[method].half; - else if (ctype == DB_C_TYPE_DOUBLE) - half = 0; - else + if (ctype != DB_C_TYPE_INT && ctype != DB_C_TYPE_DOUBLE) G_fatal_error(_("column for points vector must be numeric")); db_CatValArray_init(&cvarr); @@ -443,6 +433,8 @@ Area_cat[nacats].count = 0; Area_cat[nacats].nvalues = 0; Area_cat[nacats].nalloc = 0; + Area_cat[nacats].values = NULL; + Area_cat[nacats].cats = NULL; nacats++; if (nacats >= nacatsalloc) { nacatsalloc += 100; @@ -458,18 +450,22 @@ G_debug(1, "%d cats loaded from vector (including duplicates)", nacats); + if (nacats == 0) + G_fatal_error(_("No area categories in vector <%s>, layer <%s>"), + area_opt->answer, area_field_opt->answer); + /* Sort by category */ qsort((void *)Area_cat, nacats, sizeof(AREA_CAT), cmp_area); /* remove duplicate categories */ + j = 1; for (i = 1; i < nacats; i++) { - if (Area_cat[i].area_cat == Area_cat[i - 1].area_cat) { - for (j = i; j < nacats - 1; j++) { - Area_cat[j].area_cat = Area_cat[j + 1].area_cat; - } - nacats--; + if (Area_cat[i].area_cat != Area_cat[i - 1].area_cat) { + Area_cat[j].area_cat = Area_cat[i].area_cat; + j++; } } + nacats = j; G_debug(1, "%d cats loaded from vector (unique)", nacats); @@ -658,9 +654,7 @@ statsvalue(&result, Area_cat[i].values, Area_cat[i].nvalues, NULL); - if (half) - result += 0.5; - else if (use_catno) + if (use_catno) result = Area_cat[i].cats[(int)result]; } if (print_flag->answer) { From svn_grass at osgeo.org Tue Oct 25 12:11:01 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 25 Oct 2016 12:11:01 -0700 Subject: [GRASS-SVN] r69723 - grass/branches/releasebranch_7_2/vector/v.vect.stats Message-ID: <20161025191101.A21ED3904DE@trac.osgeo.org> Author: mmetz Date: 2016-10-25 12:11:01 -0700 (Tue, 25 Oct 2016) New Revision: 69723 Modified: grass/branches/releasebranch_7_2/vector/v.vect.stats/main.c Log: v.vect.stats: fix #3184, also remove the erroneous 'half' parameter (backport from trunk r69722) Modified: grass/branches/releasebranch_7_2/vector/v.vect.stats/main.c =================================================================== --- grass/branches/releasebranch_7_2/vector/v.vect.stats/main.c 2016-10-25 19:10:24 UTC (rev 69722) +++ grass/branches/releasebranch_7_2/vector/v.vect.stats/main.c 2016-10-25 19:11:01 UTC (rev 69723) @@ -29,7 +29,7 @@ struct menu { stat_func *method; /* routine to compute new value */ - int half; /* whether to add 0.5 to result */ + int is_int; /* whether the result is an integer (unused) */ char *name; /* method name */ char *text; /* menu display - full description */ }; @@ -37,18 +37,18 @@ /* modify this table to add new methods */ static struct menu menu[] = { {c_sum, 0, "sum", "sum of values"}, - {c_ave, 1, "average", "average value"}, + {c_ave, 0, "average", "average value"}, {c_median, 0, "median", "median value"}, {c_mode, 0, "mode", "most frequently occurring value"}, {c_min, 0, "minimum", "lowest value"}, - {c_minx, 0, "min_cat", "category number of lowest value"}, + {c_minx, 1, "min_cat", "category number of lowest value"}, {c_max, 0, "maximum", "highest value"}, - {c_maxx, 0, "max_cat", "category number of highest value"}, + {c_maxx, 1, "max_cat", "category number of highest value"}, {c_range, 0, "range", "range of values"}, - {c_stddev, 1, "stddev", "standard deviation"}, - {c_var, 1, "variance", "statistical variance"}, - {c_divr, 0, "diversity", "number of different values"}, - {0, 0, 0, 0} + {c_stddev, 0, "stddev", "standard deviation"}, + {c_var, 0, "variance", "statistical variance"}, + {c_divr, 1, "diversity", "number of different values"}, + {NULL, 0, NULL, NULL} }; /* Structure to store info for each area category */ @@ -68,18 +68,14 @@ AREA_CAT *p1 = (AREA_CAT *) pa; AREA_CAT *p2 = (AREA_CAT *) pb; - if (p1->area_cat < p2->area_cat) - return -1; - if (p1->area_cat > p2->area_cat) - return 1; - return 0; + return (p1->area_cat - p2->area_cat); } int main(int argc, char *argv[]) { char *p; int i, j, k; - int method, half, use_catno; + int method, use_catno; const char *mapset; struct GModule *module; struct Option *point_opt, /* point vector */ @@ -258,7 +254,6 @@ method = -1; use_catno = 0; - half = 0; if (method_opt->answer) { /* get the method */ for (method = 0; (p = menu[method].name); method++) @@ -287,6 +282,7 @@ /* Open database driver */ db_init_string(&stmt); Adriver = NULL; + AFi = NULL; if (!print_flag->answer) { @@ -358,8 +354,6 @@ } } } - else - AFi = NULL; Pdriver = NULL; if (method_opt->answer) { @@ -400,11 +394,7 @@ ctype = db_column_Ctype(Pdriver, PFi->table, point_column_opt->answer); - if (ctype == DB_C_TYPE_INT) - half = menu[method].half; - else if (ctype == DB_C_TYPE_DOUBLE) - half = 0; - else + if (ctype != DB_C_TYPE_INT && ctype != DB_C_TYPE_DOUBLE) G_fatal_error(_("column for points vector must be numeric")); db_CatValArray_init(&cvarr); @@ -443,6 +433,8 @@ Area_cat[nacats].count = 0; Area_cat[nacats].nvalues = 0; Area_cat[nacats].nalloc = 0; + Area_cat[nacats].values = NULL; + Area_cat[nacats].cats = NULL; nacats++; if (nacats >= nacatsalloc) { nacatsalloc += 100; @@ -458,18 +450,22 @@ G_debug(1, "%d cats loaded from vector (including duplicates)", nacats); + if (nacats == 0) + G_fatal_error(_("No area categories in vector <%s>, layer <%s>"), + area_opt->answer, area_field_opt->answer); + /* Sort by category */ qsort((void *)Area_cat, nacats, sizeof(AREA_CAT), cmp_area); /* remove duplicate categories */ + j = 1; for (i = 1; i < nacats; i++) { - if (Area_cat[i].area_cat == Area_cat[i - 1].area_cat) { - for (j = i; j < nacats - 1; j++) { - Area_cat[j].area_cat = Area_cat[j + 1].area_cat; - } - nacats--; + if (Area_cat[i].area_cat != Area_cat[i - 1].area_cat) { + Area_cat[j].area_cat = Area_cat[i].area_cat; + j++; } } + nacats = j; G_debug(1, "%d cats loaded from vector (unique)", nacats); @@ -658,9 +654,7 @@ statsvalue(&result, Area_cat[i].values, Area_cat[i].nvalues, NULL); - if (half) - result += 0.5; - else if (use_catno) + if (use_catno) result = Area_cat[i].cats[(int)result]; } if (print_flag->answer) { From svn_grass at osgeo.org Tue Oct 25 12:11:13 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 25 Oct 2016 12:11:13 -0700 Subject: [GRASS-SVN] r69724 - grass/branches/releasebranch_7_0/vector/v.vect.stats Message-ID: <20161025191113.435483904DE@trac.osgeo.org> Author: mmetz Date: 2016-10-25 12:11:13 -0700 (Tue, 25 Oct 2016) New Revision: 69724 Modified: grass/branches/releasebranch_7_0/vector/v.vect.stats/main.c Log: v.vect.stats: fix #3184, also remove the erroneous 'half' parameter (backport from trunk r69722) Modified: grass/branches/releasebranch_7_0/vector/v.vect.stats/main.c =================================================================== --- grass/branches/releasebranch_7_0/vector/v.vect.stats/main.c 2016-10-25 19:11:01 UTC (rev 69723) +++ grass/branches/releasebranch_7_0/vector/v.vect.stats/main.c 2016-10-25 19:11:13 UTC (rev 69724) @@ -29,7 +29,7 @@ struct menu { stat_func *method; /* routine to compute new value */ - int half; /* whether to add 0.5 to result */ + int is_int; /* whether the result is an integer (unused) */ char *name; /* method name */ char *text; /* menu display - full description */ }; @@ -37,18 +37,18 @@ /* modify this table to add new methods */ static struct menu menu[] = { {c_sum, 0, "sum", "sum of values"}, - {c_ave, 1, "average", "average value"}, + {c_ave, 0, "average", "average value"}, {c_median, 0, "median", "median value"}, {c_mode, 0, "mode", "most frequently occurring value"}, {c_min, 0, "minimum", "lowest value"}, - {c_minx, 0, "min_cat", "category number of lowest value"}, + {c_minx, 1, "min_cat", "category number of lowest value"}, {c_max, 0, "maximum", "highest value"}, - {c_maxx, 0, "max_cat", "category number of highest value"}, + {c_maxx, 1, "max_cat", "category number of highest value"}, {c_range, 0, "range", "range of values"}, - {c_stddev, 1, "stddev", "standard deviation"}, - {c_var, 1, "variance", "statistical variance"}, - {c_divr, 0, "diversity", "number of different values"}, - {0, 0, 0, 0} + {c_stddev, 0, "stddev", "standard deviation"}, + {c_var, 0, "variance", "statistical variance"}, + {c_divr, 1, "diversity", "number of different values"}, + {NULL, 0, NULL, NULL} }; /* Structure to store info for each area category */ @@ -68,18 +68,14 @@ AREA_CAT *p1 = (AREA_CAT *) pa; AREA_CAT *p2 = (AREA_CAT *) pb; - if (p1->area_cat < p2->area_cat) - return -1; - if (p1->area_cat > p2->area_cat) - return 1; - return 0; + return (p1->area_cat - p2->area_cat); } int main(int argc, char *argv[]) { char *p; int i, j, k; - int method, half, use_catno; + int method, use_catno; const char *mapset; struct GModule *module; struct Option *point_opt, /* point vector */ @@ -258,7 +254,6 @@ method = -1; use_catno = 0; - half = 0; if (method_opt->answer) { /* get the method */ for (method = 0; (p = menu[method].name); method++) @@ -287,6 +282,7 @@ /* Open database driver */ db_init_string(&stmt); Adriver = NULL; + AFi = NULL; if (!print_flag->answer) { @@ -358,8 +354,6 @@ } } } - else - AFi = NULL; Pdriver = NULL; if (method_opt->answer) { @@ -400,11 +394,7 @@ ctype = db_column_Ctype(Pdriver, PFi->table, point_column_opt->answer); - if (ctype == DB_C_TYPE_INT) - half = menu[method].half; - else if (ctype == DB_C_TYPE_DOUBLE) - half = 0; - else + if (ctype != DB_C_TYPE_INT && ctype != DB_C_TYPE_DOUBLE) G_fatal_error(_("column for points vector must be numeric")); db_CatValArray_init(&cvarr); @@ -443,6 +433,8 @@ Area_cat[nacats].count = 0; Area_cat[nacats].nvalues = 0; Area_cat[nacats].nalloc = 0; + Area_cat[nacats].values = NULL; + Area_cat[nacats].cats = NULL; nacats++; if (nacats >= nacatsalloc) { nacatsalloc += 100; @@ -458,18 +450,22 @@ G_debug(1, "%d cats loaded from vector (including duplicates)", nacats); + if (nacats == 0) + G_fatal_error(_("No area categories in vector <%s>, layer <%s>"), + area_opt->answer, area_field_opt->answer); + /* Sort by category */ qsort((void *)Area_cat, nacats, sizeof(AREA_CAT), cmp_area); /* remove duplicate categories */ + j = 1; for (i = 1; i < nacats; i++) { - if (Area_cat[i].area_cat == Area_cat[i - 1].area_cat) { - for (j = i; j < nacats - 1; j++) { - Area_cat[j].area_cat = Area_cat[j + 1].area_cat; - } - nacats--; + if (Area_cat[i].area_cat != Area_cat[i - 1].area_cat) { + Area_cat[j].area_cat = Area_cat[i].area_cat; + j++; } } + nacats = j; G_debug(1, "%d cats loaded from vector (unique)", nacats); @@ -658,9 +654,7 @@ statsvalue(&result, Area_cat[i].values, Area_cat[i].nvalues, NULL); - if (half) - result += 0.5; - else if (use_catno) + if (use_catno) result = Area_cat[i].cats[(int)result]; } if (print_flag->answer) { From svn_grass at osgeo.org Tue Oct 25 12:26:08 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 25 Oct 2016 12:26:08 -0700 Subject: [GRASS-SVN] r69725 - grass-addons/grass7/vector/v.surf.tps Message-ID: <20161025192608.1E4663904DE@trac.osgeo.org> Author: mmetz Date: 2016-10-25 12:26:08 -0700 (Tue, 25 Oct 2016) New Revision: 69725 Modified: grass-addons/grass7/vector/v.surf.tps/tps.c Log: v.surf.tps: optimize Modified: grass-addons/grass7/vector/v.surf.tps/tps.c =================================================================== --- grass-addons/grass7/vector/v.surf.tps/tps.c 2016-10-25 19:11:13 UTC (rev 69724) +++ grass-addons/grass7/vector/v.surf.tps/tps.c 2016-10-25 19:26:08 UTC (rev 69725) @@ -109,7 +109,7 @@ } /* TPS */ - for (k = 0; k < n_points; k++) { + for (k = 0; k <= i; k++) { dx = (pnts[i].c -pnts[k].c) * 2.0; dy = (pnts[i].r -pnts[k].r) * 2.0; @@ -118,9 +118,17 @@ if (dist2 > 0) dist = dist2 * log(dist2) * 0.5; - m[i + 1 + n_vars][k + 1 + n_vars] = m[k + 1 + n_vars][i + 1 + n_vars] = dist; - if (regularization > 0 && dist2 > 0) - distsum += sqrt(dist2); + m[i + 1 + n_vars][k + 1 + n_vars] = dist; + + if (regularization > 0 && dist2 > 0) { + dist = sqrt(dist2); + distsum += dist; + } + if (k != i) { + m[k + 1 + n_vars][i + 1 + n_vars] = m[i + 1 + n_vars][k + 1 + n_vars]; + if (regularization > 0 && dist2 > 0) + distsum += dist; + } } } @@ -338,14 +346,14 @@ int local_tps(int out_fd, int *var_fd, int n_vars, int mask_fd, struct tps_pnt *pnts, int n_points, int min_points, double regularization, double overlap, double pthin, - int do_bfs, double segs_mb) + int clustered, double segs_mb) { int ridx, cidx, row, col, nrows, ncols; double **m, *a, *B; int i, j; int kdalloc, palloc, n_cur_points; struct tps_pnt *cur_pnts; - double dx, dy, dist, dist2, ovlfactor; + double dx, dy, dist, dist2, mfactor; DCELL **dbuf, result, *outbuf, *varbuf; CELL *maskbuf; int solved; @@ -405,11 +413,9 @@ maskbuf = NULL; } - do_bfs = (do_bfs > 0); - /* create and init SEG structs */ varsize = n_vars * sizeof(DCELL); - segsize = (double)64 * 64 * (sizeof(struct tps_out) + varsize + do_bfs * sizeof(int)); + segsize = (double)64 * 64 * (sizeof(struct tps_out) + varsize + clustered * sizeof(int)); nsegs = 1024. * 1024. * segs_mb / segsize; if (Segment_open(&out_seg, G_tempfile(), nrows, ncols, 64, 64, @@ -432,7 +438,7 @@ } } - if (do_bfs) { + if (clustered) { G_message("Creating temporary point map..."); if (Segment_open(&p_seg, G_tempfile(), nrows, ncols, 64, 64, @@ -623,7 +629,7 @@ } pfound = kdfound; - if (do_bfs) { + if (clustered) { /* collect points with breadth-first search * min dist must be > max dist of nearest neighbors */ @@ -735,32 +741,37 @@ cmax = cur_pnts[i].c; } - /* must be < 0.5 */ - ovlfactor = 0.3; - - irow1 = rmin + (int)((rmax - rmin) * overlap * ovlfactor); - irow2 = rmax - (int)((rmax - rmin) * overlap * ovlfactor); - icol1 = cmin + (int)((cmax - cmin) * overlap * ovlfactor); - icol2 = cmax - (int)((cmax - cmin) * overlap * ovlfactor); + /* must be <= 0.5 */ + mfactor = 0.0; + /* min: 0 + * max: 0.5 + * 1 - 1 / d: -> 0 for dense spacing + * 1 for sparse points + */ - if (rmin == rminp) - irow1 = 0; - if (rmax == rmaxp) - irow2 = nrows - 1; - if (cmin == cminp) - icol1 = 0; - if (cmax == cmaxp) - icol2 = ncols - 1; + if (clustered) { + double mfactoradj; + double dmin; + double dmax; - if (irow1 < 0) - irow1 = 0; - if (irow2 > nrows - 1) - irow2 = nrows - 1; - if (icol1 < 0) - icol1 = 0; - if (icol2 > ncols - 1) - icol2 = ncols - 1; + dmin = 2.0 * sqrt(2.0 * kdfound / M_PI); + dmax = rmax - rmin; + if (dmax < cmax - cmin) + dmax = cmax - cmin; + mfactoradj = 0.0; + if (dmax > dmin) { + mfactoradj = pow((1 - dmin / dmax), 2.0) * 0.5; + G_debug(1, "adjusted mfactor: %g", mfactoradj); + } + mfactor = mfactoradj; + } + + irow1 = rmin + (int)((rmax - rmin) * mfactor); + irow2 = rmax - (int)((rmax - rmin) * mfactor); + icol1 = cmin + (int)((cmax - cmin) * mfactor); + icol2 = cmax - (int)((cmax - cmin) * mfactor); + if (irow1 > row) { irow2 -= irow1 - row; irow1 = row; @@ -778,6 +789,15 @@ icol2 = col; } + if (rmin == rminp) + irow1 = 0; + if (rmax == rmaxp) + irow2 = nrows - 1; + if (cmin == cminp) + icol1 = 0; + if (cmax == cmaxp) + icol2 = ncols - 1; + if (irow1 < 0) irow1 = 0; if (irow2 > nrows - 1) @@ -787,9 +807,6 @@ if (icol2 > ncols - 1) icol2 = ncols - 1; - dx = icol2 - icol1; - dy = irow2 - irow1; - dxi = icol2 - icol1 + 1; dyi = irow2 - irow1 + 1; @@ -867,7 +884,7 @@ if (n_vars) Segment_close(&var_seg); - if (do_bfs) + if (clustered) Segment_close(&p_seg); outbuf = Rast_allocate_d_buf(); From svn_grass at osgeo.org Tue Oct 25 12:27:03 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 25 Oct 2016 12:27:03 -0700 Subject: [GRASS-SVN] r69726 - grass-addons/grass7/raster/r.hants Message-ID: <20161025192703.0EB5B3904DE@trac.osgeo.org> Author: mmetz Date: 2016-10-25 12:27:02 -0700 (Tue, 25 Oct 2016) New Revision: 69726 Modified: grass-addons/grass7/raster/r.hants/main.c Log: r.hants: optimize Modified: grass-addons/grass7/raster/r.hants/main.c =================================================================== --- grass-addons/grass7/raster/r.hants/main.c 2016-10-25 19:26:08 UTC (rev 69725) +++ grass-addons/grass7/raster/r.hants/main.c 2016-10-25 19:27:02 UTC (rev 69726) @@ -45,7 +45,7 @@ static int solvemat(double **m, double a[], double B[], int n) { int i, j, i2, j2, imark; - double factor, temp; + double factor, temp, *tempp; double pivot; /* ACTUAL VALUE OF THE LARGEST PIVOT CANDIDATE */ for (i = 0; i < n; i++) { @@ -75,12 +75,18 @@ /* if row with highest pivot is not the current row, switch them */ if (imark != i) { + /* for (j2 = 0; j2 < n; j2++) { temp = m[imark][j2]; m[imark][j2] = m[i][j2]; m[i][j2] = temp; } + */ + tempp = m[imark]; + m[imark] = m[i]; + m[i] = tempp; + temp = a[imark]; a[imark] = a[i]; a[i] = temp; @@ -144,7 +150,7 @@ int row, col; double lo, hi, fet, *cs, *sn, *ts, delta; int bl; - double **mat, **mat_t, **A, *Azero, *za, *zr, maxerrlo, maxerrhi; + double **mat, **mat_t, **A, *Av, *Azero, *za, *zr, maxerrlo, maxerrhi; int asize; int dod, nf, nr, nout, noutmax; int rejlo, rejhi, *useval; @@ -467,6 +473,7 @@ mat = G_alloc_matrix(nr, num_inputs); mat_t = G_alloc_matrix(num_inputs, nr); A = G_alloc_matrix(nr, nr); + Av = *A; Azero = G_alloc_vector(nr * nr); asize = nr * nr * sizeof(double); za = G_alloc_vector(nr); @@ -566,7 +573,7 @@ * A temp: nr, num_inputs * A: nr, nr */ - memcpy(*A, Azero, asize); + memcpy(Av, Azero, asize); for (i = 0; i < nr; i++) { za[i] = 0; for (j = 0; j < num_inputs; j++) { @@ -604,7 +611,6 @@ maxerrlo = rc[i] - values[i]; if (maxerrhi < values[i] - rc[i]) maxerrhi = values[i] - rc[i]; - } } if (rejlo || rejhi) { @@ -613,21 +619,21 @@ done = 0; if (rejhi && maxerrhi > fet) done = 0; - } - if (!done && (rejlo || rejhi)) { - /* filter outliers */ - for (i = 0; i < num_inputs; i++) { + if (!done) { + /* filter outliers */ + for (i = 0; i < num_inputs; i++) { - if (useval[i]) { - if (rejlo && rc[i] - values[i] > maxerrlo * 0.5) { - useval[i] = 0; - nout++; + if (useval[i]) { + if (rejlo && rc[i] - values[i] > maxerrlo * 0.5) { + useval[i] = 0; + nout++; + } + if (rejhi && values[i] - rc[i] > maxerrhi * 0.5) { + useval[i] = 0; + nout++; + } } - if (rejhi && values[i] - rc[i] > maxerrhi * 0.5) { - useval[i] = 0; - nout++; - } } } } @@ -641,8 +647,12 @@ for (i = 0; i < num_outputs; i++) { struct output *out = &outputs[i]; - + out->buf[col] = rc[i]; + if (rc[i] < lo) + out->buf[col] = lo; + else if (rc[i] > hi) + out->buf[col] = hi; } if (do_amp || do_phase) { From svn_grass at osgeo.org Tue Oct 25 14:16:04 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 25 Oct 2016 14:16:04 -0700 Subject: [GRASS-SVN] r69727 - in grass-promo/grassflyer/flyer_2016: . en fr it Message-ID: <20161025211604.C05CB3904DE@trac.osgeo.org> Author: vincent Date: 2016-10-25 14:16:04 -0700 (Tue, 25 Oct 2016) New Revision: 69727 Modified: grass-promo/grassflyer/flyer_2016/README grass-promo/grassflyer/flyer_2016/en/grass_flyer.pdf grass-promo/grassflyer/flyer_2016/en/grass_flyer.svg grass-promo/grassflyer/flyer_2016/fr/grass_flyer.pdf grass-promo/grassflyer/flyer_2016/fr/grass_flyer.svg grass-promo/grassflyer/flyer_2016/it/grass_flyer.svg Log: unified fr/en/it .svg files and added instructions for pdf creation Modified: grass-promo/grassflyer/flyer_2016/README =================================================================== --- grass-promo/grassflyer/flyer_2016/README 2016-10-25 19:27:02 UTC (rev 69726) +++ grass-promo/grassflyer/flyer_2016/README 2016-10-25 21:16:04 UTC (rev 69727) @@ -36,3 +36,18 @@ [1] http://www.omegat.org/ + +##################### +How to turn the .svg source file to a .pdf output document [*N?X users] +[- if you did not follow the previous recommendations, and edited the source file from within Inkscape, please make sure /both/ "recto" and "verso" layers are visible ] + +- open a terminal in the right directory then convert each layer to pdf [you need to have inkscape package installed] + inkscape grass_flyer.svg -A grassflyerr.pdf -i layer6 -j + inkscape grass_flyer.svg -A grassflyerv.pdf -i layer7 -j + +- gather these files in a single one [you need to have texlive-extra-utils package installed, perhaps some other tools do the job, don't know] + pdfjam grassflyerr.pdf grassflyerv.pdf --papersize '{29.7cm,21cm}' + +- rename the latter, and you're done + rm grassflyerr.pdf grassflyerv.pdf + mv grassflyerv-pdfjam.pdf grass_flyer.pdf Modified: grass-promo/grassflyer/flyer_2016/en/grass_flyer.pdf =================================================================== (Binary files differ) Modified: grass-promo/grassflyer/flyer_2016/en/grass_flyer.svg =================================================================== (Binary files differ) Modified: grass-promo/grassflyer/flyer_2016/fr/grass_flyer.pdf =================================================================== (Binary files differ) Modified: grass-promo/grassflyer/flyer_2016/fr/grass_flyer.svg =================================================================== --- grass-promo/grassflyer/flyer_2016/fr/grass_flyer.svg 2016-10-25 19:27:02 UTC (rev 69726) +++ grass-promo/grassflyer/flyer_2016/fr/grass_flyer.svg 2016-10-25 21:16:04 UTC (rev 69727) @@ -38,11 +38,11 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="1" - inkscape:cx="502.53968" - inkscape:cy="382.28571" + inkscape:zoom="1.1073862" + inkscape:cx="526.1811" + inkscape:cy="372.04724" inkscape:document-units="mm" - inkscape:current-layer="g5424" + inkscape:current-layer="svg4222" showgrid="true" inkscape:window-width="1680" inkscape:window-height="1011" @@ -111,7 +111,8 @@ inkscape:groupmode="layer" id="layer7" inkscape:label="verso" - style="display:none"> + style="display:inline" + sodipodi:insensitive="true"> - Commandes modulaires- Rassemble plus de 400 modules- Rassemble plus de 450 modules- Dépôt Add-ons dédié aux modules utilisateurs - Documentation illustrée d'exemples pour chaque module Formats vectorielsASCII, ARC/INFO ungenerate, ARC/INFO E00, ArcView SHAPE, BIL, DLG (U.S.), DXF, DXF3D, GMT, GPS-ASCII USGS-DEM, IDRISI, MOSS, MapInfo, MIF, PostGIS, TIGER, VRML, etc. ASCII, ARC/INFO ungenerate, ARC/INFO E00, ArcView SHAPE, BIL, DLG (U.S.), DXF, DXF3D, GMT, GPS-ASCII USGS-DEM, IDRISI, MOSS, MapInfo, MIF, PostGIS, TIGER, VRML, etc. Formats matricielsASCII, ARC/GRID, E00, GIF, GMT, TIF, PNG, Vis5D, SURFER (.grd), etc. ASCII, ARC/GRID, E00, GIF, GMT, TIF, PNG, Vis5D, SURFER (.grd), etc. Formats imageCEOS (SAR, SRTM, LANDSAT7 etc.), ERDAS LAN / IMG, HDF, LANDSAT TM/MSS, imagerie NHAP,SAR, SPOT, MODIS, etc. SAR, SPOT, MODIS, etc. Support de bases de donnéesSQLite, PostgreSQL / PostGIS, MySQL, ODBC, DBF SQLite, PostgreSQL / PostGIS, MySQL, ODBC, DBF - NVIZ pour la visualisation 2,5D et 3D (animations, survols)- VTK, POVray- Services web - Services web - Langage R (statistiques)- Gstat (géostatistiques)- Gstat (geostatistiques)- UMN MapServer (webmapping) - ZOO-Project, PyWPS (WPS) Plateformes supportéesGRASS GIS fonctionne sur presque toutes les architectures : GNU/Linux, systèmes Unix conformes Posix, MS Windows et MacOS X. GRASS GIS fonctionne sur presque toutes les architectures : GNU/Linux, systèmes Unix conformes Posix, MS Windows et MacOS X. - Manipulation d’images- Topologie vectorielle, analyse de réseaux- Topologie vectorielle- Géostatistique (interface avec R)- Network analysis- jeux de données temporelles- Geostatistique (Interface avec R)- interface WPS- Jeux de données temporelles - interface web services OGC - ANSI C- interface GRASS-SWIG- API Python, bibliothèque de script et IGU + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans'">- API Python, bibliothèque de script et IGU + id="image4378" + preserveAspectRatio="none" + height="177.03552" + width="397.52524" /> Visualisez et gérez facilement vos jeux de données les plus complexes : les géométries volumineuses liées aux SGBD les plus avancés sont prises en charge. + id="flowPara3588-7">Visualisez et gérez facilement vos jeux de données les plus complexes : les géométries volumineuses liées aux SGBD les plus avancés sont prises en charge. @@ -875,58 +524,24 @@ width="255.41425" id="rect3552-7-7-7" style="fill:#4c4c4c;fill-opacity:1" />wxGUI offre de multiples outils graphiques puissants. Map Swipe permet de comparer facilement des cartes raster deux à deux. wxGUI offre de multiples outils graphiques puissants. Map Swipe permet de comparer facilement des cartes raster deux à deux. + id="image4527" + preserveAspectRatio="none" + height="180" + width="240" /> @@ -943,50 +558,18 @@ x="168.55138" y="12.585855" ry="0" />Combinez, visualisez et animez vos données vectorielles et raster 3D avec l'outil nviz. Combinez, visualisez et animez vos données vectorielles et raster 3D avec l'outil nviz. + preserveAspectRatio="none" + id="image4651" + x="2007.079" + y="328.19818" /> + preserveAspectRatio="none" + id="image5112" + x="1511.1951" + y="566.94891" /> + style="display:inline" + sodipodi:insensitive="true"> + preserveAspectRatio="none" + id="image5199" + x="0" + y="556.29919" /> GRASS GIS Offrir à tous les technologies géospatiales les plus avancées @@ -1156,99 +739,112 @@ inkscape:label="GRASS_GIS_white" style="display:inline"> - - - - - - - - GRASS GIS Offrir à tous les technologies géospatiales les plus avancées + id="g3504" + transform="translate(4.6362205e-5,-2.0905512e-5)" + style="fill:#ffffff;fill-opacity:1"> + + + + + + + + + + + GRASS GIS Offrir à tous les technologies géospatiales les plus avancées + + + @@ -1354,42 +950,14 @@ style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:16.39572716px;line-height:125%;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Medium';text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#008f00">Où utilise-t-on GRASS GIS ? GRASS GIS est à l’œuvre dans le monde entier : applications scientifiques, dispositifs commerciaux, secteur public, etc. Le logiciel fait la preuve de sa robustesse et de sa capacité à résoudre des problèmes géospatiaux complexes dans de très nombreux cas. GRASS GIS est à l’œuvre dans le monde entier : applications scientifiques, dispositifs commerciaux, secteur public, etc. Le logiciel fait la preuve de sa robustesse et de sa capacité à résoudre des problèmes géospatiaux complexes dans de très nombreux cas. Un effort de longue haleineGRASS GIS est né il y a plus de 30 ans... et la dernière mise à jour n’a sans doute que quelques heures ! Beaucoup de personnes contribuent à perfectionner le logiciel ; sa force et son succès s’appuient sur une équipe active de développeurs et les retours d’une large communauté. Ensemble ils combinent leurs efforts pour rendre GRASS GIS est né il y a plus de 30 ans... et la dernière mise à jour n’a sans doute que quelques heures ! Beaucoup de personnes contribuent à perfectionner le logiciel ; sa force et son succès s’appuient sur une équipe active de développeurs et les retours d’une large communauté. Ensemble ils combinent leurs efforts pour rendre GRASS GIS toujours plus pratique, simple, et puissant.  GIS toujours plus pratique, simple, et puissant. Un projet libre et Open SourceLa philosophie Open Source garantit la transparence du code source et de la structure de l’application ; les utilisateurs peuvent aisément adapter ses fonctionnalités à leurs besoins. Le contrôle permanent du code par les pairs garantit un haut niveau de qualité et de sécurité. Le gestionnaire d’extensions permet de développer de nouveaux modules indépendamment du code source de La philosophie Open Source garantit la transparence du code source et de la structure de l’application ; les utilisateurs peuvent aisément adapter ses fonctionnalités à leurs besoins. Le contrôle permanent du code par les pairs garantit un haut niveau de qualité et de sécurité. Le gestionnaire d’extensions permet de développer de nouveaux modules indépendamment du code source de GRASS GIS GIS. https://grass.osgeo.org/support- Page du projet : - Page du projet : GRASS GIS est un projet fondateur de la Fondation Géospatiale Open Source (OSGeo) qui œuvre à l’émergence d’une offre de logiciels Open Source en géomatique de la plus grande qualité. Visitez la page de l'OSGeo : For further information visit the OSGeo homepage: LicenceGNU General Public License (Free Software Foundation) GNU General Public License (Free Software Foundation) Une solution cartographique matureGRASS GIS est un logiciel libre et Open Source dédié à l’analyse spatiale. Il est composé de plus de 400 modules de calcul vecteur (2D/3D), raster, voxel et données temporelles (4D). Il offre plusieurs interfaces avec d’autres programmes de domaines voisins comme la géostatistique, les bases de données, les services de webmapping, ainsi que d’autres SIG. C’est la plus ancienne et la plus complète des offres SIG Open Source, couvrant les besoins d’une simple application client SIG jusqu’à ceux d’un gestionnaire d’infrastructure SIG complexe. + id="flowSpan6984"> est un logiciel libre et Open Source dédié à l’analyse spatiale. Il est composé de plus de 450 modules de calcul vecteur (2D/3D), raster, voxel et données temporelles (4D). Il offre plusieurs interfaces avec d’autres programmes de domaines voisins comme la géostatistique, les bases de données, les services de webmapping, ainsi que d’autres SIG. C’est la plus ancienne et la plus complète des offres SIG Open Source, couvrant les besoins d’une simple application client SIG jusqu’à ceux d’un gestionnaire d’infrastructure SIG complexe. + style="display:inline"> @@ -1716,54 +1135,8 @@ x="48.401169" y="56.338501" ry="0" />http://grass.osgeo.org http://grass.osgeo.org http://www.osgeo.org http://www.osgeo.org Author: vincent Date: 2016-10-25 14:18:02 -0700 (Tue, 25 Oct 2016) New Revision: 69728 Added: grass-promo/grassflyer/flyer_2016/it/grass_flyer.pdf Log: unified fr/en/it .svg files and added instructions for pdf creation Added: grass-promo/grassflyer/flyer_2016/it/grass_flyer.pdf =================================================================== (Binary files differ) Property changes on: grass-promo/grassflyer/flyer_2016/it/grass_flyer.pdf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream From svn_grass at osgeo.org Tue Oct 25 18:18:02 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 25 Oct 2016 18:18:02 -0700 Subject: [GRASS-SVN] r69729 - grass/trunk/scripts/d.frame Message-ID: <20161026011802.1B6CE3903A0@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-25 18:18:01 -0700 (Tue, 25 Oct 2016) New Revision: 69729 Modified: grass/trunk/scripts/d.frame/d.frame.py Log: d.frame: round, not truncate, when calculating pixels from percents Four frames for image size 500x367 were not the same size with different combinations of 0,49.8,50.2,100 used for at option to achieve regular 2x2 layout with margins in the middle. Modified: grass/trunk/scripts/d.frame/d.frame.py =================================================================== --- grass/trunk/scripts/d.frame/d.frame.py 2016-10-25 21:18:02 UTC (rev 69728) +++ grass/trunk/scripts/d.frame/d.frame.py 2016-10-26 01:18:01 UTC (rev 69729) @@ -165,20 +165,42 @@ def get_frame_name(line): return line.rstrip('\n').rsplit('#', 1)[1].strip(' ') -# calculate position of the frame in percent +def calculate_frame(frame, at, width, height): + """Calculate absolute position of the frame from percentages -def calculate_frame(frame, at, width, height): + at is from bottom left in percents (bottom,top,left,right) + output is in pixels from top left (top,bottom,left,right) + + This function does also the necessary formating. + + >>> calculate_frame('apple', "0,49.8,0,50.2", 500, 500) + 'GRASS_RENDER_FRAME=251,500,0,251 # apple\\n' + >>> calculate_frame('orange', "50.2,0,49.8,100", 500, 500) + 'GRASS_RENDER_FRAME=500,249,249,500 # orange\\n' + >>> calculate_frame('odd_number', "0,49.8,0,50.2", 367, 367) + 'GRASS_RENDER_FRAME=184,367,0,184 # odd_number\\n' + + The following would give 182,367,0,184 if we would be truncating + to integers instead of rounding, but that would be wrong because + height of the frame would be 367 minus 182 which is 185 while + 0.502 times 367 is 184.234 which fits with the (correct) width of + the frame which is 184. + + >>> calculate_frame('test_truncating_bug', "0,50.2,0,50.2", 367, 367) + 'GRASS_RENDER_FRAME=183,367,0,184 # test_truncating_bug\\n' + """ try: b, t, l, r = list(map(float, at.split(','))) except: fatal(_("Invalid frame position: %s") % at) - top = height - (t / 100. * height) - bottom = height - (b / 100. * height) - left = l / 100. * width - right = r / 100. * width + top = round(height - (t / 100. * height)) + bottom = round(height - (b / 100. * height)) + left = round(l / 100. * width) + right = round(r / 100. * width) + # %d for floats works like int() - truncates return 'GRASS_RENDER_FRAME=%d,%d,%d,%d # %s%s' % \ (top, bottom, left, right, frame, '\n') @@ -276,5 +298,9 @@ select_frame(monitor, options['frame']) if __name__ == "__main__": + if len(sys.argv) == 2 and sys.argv[1] == '--doctest': + import doctest + _ = str # doctest gettext workaround + sys.exit(doctest.testmod().failed) options, flags = parser() sys.exit(main()) From svn_grass at osgeo.org Tue Oct 25 19:04:33 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Tue, 25 Oct 2016 19:04:33 -0700 Subject: [GRASS-SVN] r69730 - grass/trunk/raster/r.mapcalc Message-ID: <20161026020433.AA0C83904DE@trac.osgeo.org> Author: wenzeslaus Date: 2016-10-25 19:04:33 -0700 (Tue, 25 Oct 2016) New Revision: 69730 Modified: grass/trunk/raster/r.mapcalc/r.mapcalc.html Log: r.mapcalc: mention the LHS/RHS limits also in Notes and provide workaround (see #2986, r66548, r68268) Modified: grass/trunk/raster/r.mapcalc/r.mapcalc.html =================================================================== --- grass/trunk/raster/r.mapcalc/r.mapcalc.html 2016-10-26 01:18:01 UTC (rev 69729) +++ grass/trunk/raster/r.mapcalc/r.mapcalc.html 2016-10-26 02:04:33 UTC (rev 69730) @@ -608,6 +608,17 @@ If a user want to use the existing map, the name of the temporary variable (map) must be changed. +

      Using the same map for input and output results

      +A map cannot be used both as an input and as an output as in +this invalid expression oldmap = oldmap + 1, instead +a subsequent rename using g.rename is +needed when the same name is desired: + +
      +r.mapcalc "newmap = oldmap + 1"
      +g.rename raster=newmap,oldmap
      +
      +

      Random number generator initialization

      The pseudo-random number generator used by the rand() function can be initialised to a specific value using the seed option. @@ -624,6 +635,7 @@

      Note that the rand() function will generate a fatal error if neither the seed option nor the -s flag are given. +

      EXAMPLES

      To compute the average of two raster map layers @@ -721,6 +733,7 @@ (i.e. there is an implicit "for row in rows {...}" around the entire expression). Thus the #, @, and [ ] operators cannot be used on a map generated within same r.mapcalc command run. +Consequently, the following (strikethrough code) does not work:
       newmap = oldmap * 3.14
      
      
      From svn_grass at osgeo.org  Tue Oct 25 19:11:49 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Tue, 25 Oct 2016 19:11:49 -0700
      Subject: [GRASS-SVN] r69731 - grass/trunk/man
      Message-ID: <20161026021149.9E7513904DE@trac.osgeo.org>
      
      Author: wenzeslaus
      Date: 2016-10-25 19:11:49 -0700 (Tue, 25 Oct 2016)
      New Revision: 69731
      
      Modified:
         grass/trunk/man/grassdocs.css
      Log:
      doc: make strike line transparent to make text in pre more readable
      
      W3C Candidate Recommendation 1 August 2013
      https://www.w3.org/TR/css-text-decor-3/#text-decoration-color-property
      Works at least in Mozilla Firefox.
      
      
      Modified: grass/trunk/man/grassdocs.css
      ===================================================================
      --- grass/trunk/man/grassdocs.css	2016-10-26 02:04:33 UTC (rev 69730)
      +++ grass/trunk/man/grassdocs.css	2016-10-26 02:11:49 UTC (rev 69731)
      @@ -229,3 +229,8 @@
       table.compact tr:nth-child(even) {
           background: #FFF;
       }
      +
      +/* soft strike through so that we can still see the text */
      +s {
      +    text-decoration-color: rgba(0, 0, 0, 0.53);
      +}
      
      
      From svn_grass at osgeo.org  Tue Oct 25 19:41:19 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Tue, 25 Oct 2016 19:41:19 -0700
      Subject: [GRASS-SVN] r69732 - in grass/trunk/gui/wxpython: core nviz
      Message-ID: <20161026024119.EEF243904DE@trac.osgeo.org>
      
      Author: annakrat
      Date: 2016-10-25 19:41:17 -0700 (Tue, 25 Oct 2016)
      New Revision: 69732
      
      Modified:
         grass/trunk/gui/wxpython/core/settings.py
         grass/trunk/gui/wxpython/nviz/mapwindow.py
         grass/trunk/gui/wxpython/nviz/preferences.py
         grass/trunk/gui/wxpython/nviz/workspace.py
      Log:
      wxGUI/3D view: set point size relatively to region
      
      Modified: grass/trunk/gui/wxpython/core/settings.py
      ===================================================================
      --- grass/trunk/gui/wxpython/core/settings.py	2016-10-26 02:11:49 UTC (rev 69731)
      +++ grass/trunk/gui/wxpython/core/settings.py	2016-10-26 02:41:17 UTC (rev 69732)
      @@ -672,6 +672,7 @@
                           'points': {
                               'show': False,
                               'size': 100,
      +                        'autosize': True,
                               'width': 2,
                               'marker': 2,
                               'color': (0, 0, 0, 255),
      
      Modified: grass/trunk/gui/wxpython/nviz/mapwindow.py
      ===================================================================
      --- grass/trunk/gui/wxpython/nviz/mapwindow.py	2016-10-26 02:11:49 UTC (rev 69731)
      +++ grass/trunk/gui/wxpython/nviz/mapwindow.py	2016-10-26 02:41:17 UTC (rev 69732)
      @@ -1452,7 +1452,7 @@
       
                   elif mapType == 'vector':
                       # reset to default properties (lines/points)
      -                data['vector'] = self.nvizDefault.SetVectorDefaultProp()
      +                data['vector'] = self.nvizDefault.SetVectorDefaultProp(longDim=self._display.GetLongDim())
                       self.SetVectorFromCmd(item, data['vector'])
                       self.SetVectorSurface(data['vector']['points'])
                       self.SetVectorSurface(data['vector']['lines'])
      @@ -1477,9 +1477,7 @@
                               ['lines'])
                       if not data['vector']['points']:
                           self.nvizDefault.SetVectorPointsDefaultProp(
      -                        data
      -                        ['vector']
      -                        ['points'])
      +                        data['vector']['points'], self._display.GetLongDim())
                   # set updates
                   for sec in data.keys():
                       for sec1 in data[sec].keys():
      @@ -2310,9 +2308,7 @@
                       vInfo = grass.vector_info_topo(layer.GetName())
                       if (vInfo['points'] + vInfo['centroids']) > 0:
                           self.nvizDefault.SetVectorPointsDefaultProp(
      -                        data
      -                        ['vector']
      -                        ['points'])
      +                        data['vector']['points'], self._display.GetLongDim())
                       if (vInfo['lines'] + vInfo['boundaries']) > 0:
                           self.nvizDefault.SetVectorLinesDefaultProp(
                               data
      
      Modified: grass/trunk/gui/wxpython/nviz/preferences.py
      ===================================================================
      --- grass/trunk/gui/wxpython/nviz/preferences.py	2016-10-26 02:11:49 UTC (rev 69731)
      +++ grass/trunk/gui/wxpython/nviz/preferences.py	2016-10-26 02:41:17 UTC (rev 69732)
      @@ -594,6 +594,14 @@
       
               row = 0
               # icon size
      +        autosize = wx.CheckBox(parent=panel, label=_("Automatic size"))
      +        autosize.SetToolTipString(_("Icon size is set automatically based on landscape dimensions."))
      +        gridSizer.Add(autosize, pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
      +        self.winId['nviz:vector:points:autosize'] = autosize.GetId()
      +        autosize.SetValue(UserSettings.Get(group='nviz', key='vector',
      +                                           subkey=['points', 'autosize']))
      +
      +        row += 1
               gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
                                                label=_("Size:")),
                             pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
      @@ -609,9 +617,10 @@
                             flag=wx.ALIGN_CENTER_VERTICAL)
       
               # icon symbol
      +        row += 1
               gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
                                                label=_("Marker:")),
      -                      pos=(row, 2), flag=wx.ALIGN_CENTER_VERTICAL)
      +                      pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
               isym = wx.Choice(
                   parent=panel, id=wx.ID_ANY, size=(100, -1),
                   choices=UserSettings.Get(
      @@ -622,12 +631,13 @@
               isym.SetSelection(UserSettings.Get(group='nviz', key='vector',
                                                  subkey=['points', 'marker']))
               gridSizer.Add(item=isym, flag=wx.ALIGN_CENTER_VERTICAL,
      -                      pos=(row, 3))
      +                      pos=(row, 1))
       
               # icon color
      +        row += 1
               gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
                                                label=_("Color:")),
      -                      pos=(row, 4), flag=wx.ALIGN_CENTER_VERTICAL)
      +                      pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
               icolor = csel.ColourSelect(panel, id=wx.ID_ANY,
                                          size=globalvar.DIALOG_COLOR_SIZE)
               icolor.SetName('GetColour')
      @@ -635,7 +645,7 @@
               icolor.SetColour(UserSettings.Get(group='nviz', key='vector',
                                                 subkey=['points', 'color']))
               gridSizer.Add(item=icolor, flag=wx.ALIGN_CENTER_VERTICAL,
      -                      pos=(row, 5))
      +                      pos=(row, 1))
       
               boxSizer.Add(item=gridSizer, proportion=1,
                            flag=wx.ALL | wx.EXPAND, border=5)
      
      Modified: grass/trunk/gui/wxpython/nviz/workspace.py
      ===================================================================
      --- grass/trunk/gui/wxpython/nviz/workspace.py	2016-10-26 02:11:49 UTC (rev 69731)
      +++ grass/trunk/gui/wxpython/nviz/workspace.py	2016-10-26 02:41:17 UTC (rev 69732)
      @@ -194,7 +194,7 @@
                       subkey='transp'))
               return data
       
      -    def SetVectorDefaultProp(self, data=None):
      +    def SetVectorDefaultProp(self, longDim, data=None):
               """Set default vector data properties"""
               if not data:
                   data = dict()
      @@ -202,7 +202,7 @@
                   data[sec] = {}
       
               self.SetVectorLinesDefaultProp(data['lines'])
      -        self.SetVectorPointsDefaultProp(data['points'])
      +        self.SetVectorPointsDefaultProp(data['points'], longDim)
       
               return data
       
      @@ -250,11 +250,17 @@
                   for attrb in ('color', 'width', 'mode', 'height', 'thematic'):
                       data[attrb]['update'] = None
       
      -    def SetVectorPointsDefaultProp(self, data):
      +    def SetVectorPointsDefaultProp(self, data, longDim):
               """Set default vector properties -- points"""
      +        size_fraction = 0.005
               # size
      -        data['size'] = {'value': UserSettings.Get(group='nviz', key='vector',
      -                                                  subkey=['points', 'size'])}
      +        autosize = UserSettings.Get(group='nviz', key='vector',
      +                                    subkey=['points', 'autosize'])
      +        if autosize:
      +            data['size'] = {'value': longDim * size_fraction}
      +        else:
      +            data['size'] = {'value': UserSettings.Get(group='nviz', key='vector',
      +                                                      subkey=['points', 'size'])}
       
               # width
               data['width'] = {'value': UserSettings.Get(group='nviz', key='vector',
      
      
      From svn_grass at osgeo.org  Wed Oct 26 10:45:22 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Wed, 26 Oct 2016 10:45:22 -0700
      Subject: [GRASS-SVN] r69733 - in grass-promo/grassflyer/flyer_2016: . en fr
      	it
      Message-ID: <20161026174522.13D2D39040E@trac.osgeo.org>
      
      Author: vincent
      Date: 2016-10-26 10:45:21 -0700 (Wed, 26 Oct 2016)
      New Revision: 69733
      
      Modified:
         grass-promo/grassflyer/flyer_2016/README
         grass-promo/grassflyer/flyer_2016/en/grass_flyer.pdf
         grass-promo/grassflyer/flyer_2016/en/grass_flyer.svg
         grass-promo/grassflyer/flyer_2016/fr/grass_flyer.pdf
         grass-promo/grassflyer/flyer_2016/fr/grass_flyer.svg
         grass-promo/grassflyer/flyer_2016/it/grass_flyer.pdf
         grass-promo/grassflyer/flyer_2016/it/grass_flyer.svg
      Log:
      optimized svg structure, some translation modifications
      
      Modified: grass-promo/grassflyer/flyer_2016/README
      ===================================================================
      --- grass-promo/grassflyer/flyer_2016/README	2016-10-26 02:41:17 UTC (rev 69732)
      +++ grass-promo/grassflyer/flyer_2016/README	2016-10-26 17:45:21 UTC (rev 69733)
      @@ -42,8 +42,8 @@
       [- if you did not follow the previous recommendations, and edited the source file from within Inkscape, please make sure /both/ "recto" and "verso" layers are visible ]
       
       - open a terminal in the right directory then convert each layer to pdf [you need to have inkscape package installed]
      -	inkscape grass_flyer.svg -A grassflyerr.pdf -i layer6 -j
      -	inkscape grass_flyer.svg -A grassflyerv.pdf -i layer7 -j
      +	inkscape grass_flyer.svg -A grassflyerr.pdf -i recto -j
      +	inkscape grass_flyer.svg -A grassflyerv.pdf -i verso -j
       
       - gather these files in a single one [you need to have texlive-extra-utils package installed, perhaps some other tools do the job, don't know]
       	pdfjam grassflyerr.pdf grassflyerv.pdf --papersize '{29.7cm,21cm}'
      
      Modified: grass-promo/grassflyer/flyer_2016/en/grass_flyer.pdf
      ===================================================================
      (Binary files differ)
      
      Modified: grass-promo/grassflyer/flyer_2016/en/grass_flyer.svg
      ===================================================================
      (Binary files differ)
      
      Modified: grass-promo/grassflyer/flyer_2016/fr/grass_flyer.pdf
      ===================================================================
      (Binary files differ)
      
      Modified: grass-promo/grassflyer/flyer_2016/fr/grass_flyer.svg
      ===================================================================
      --- grass-promo/grassflyer/flyer_2016/fr/grass_flyer.svg	2016-10-26 02:41:17 UTC (rev 69732)
      +++ grass-promo/grassflyer/flyer_2016/fr/grass_flyer.svg	2016-10-26 17:45:21 UTC (rev 69733)
      @@ -13,23 +13,38 @@
          width="297mm"
          height="210mm"
          viewBox="0 0 1052.3622 744.09448"
      -   id="svg4222"
      +   id="svg1"
          version="1.1"
          inkscape:version="0.91 r13725"
          sodipodi:docname="grass_flyer.svg"
          enable-background="new">
         GRASS GIS flyer
      +     id="title1">GRASS GIS flyer
         
      +     id="def1">
           
             
      +         id="feGaussianBlur1" />
           
      +    
      +      GRASS
      +       GIS
      +    
      +    
         
         
         
         
      +     id="metadata1">
           
             
      @@ -90,8 +105,8 @@
                  rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
               GRASS GIS flyer
               
      -        20160908
      +           rdf:resource="http://www.gnu.org/licenses/gpl.html" />
      +        20161025
               
                 
                   Vincent BAIN
      @@ -109,73 +124,149 @@
         
         
           
      +       id="illustr"
      +       inkscape:label="illustr"
      +       style="display:inline"
      +       sodipodi:insensitive="true">
             
      -        
      +         style="display:inline;enable-background:new"
      +         id="map_swipe"
      +         transform="translate(-1134.133,-310.48166)"
      +         inkscape:export-filename="verso.png">
      +        
      +          wxGUI offre de multiples outils graphiques puissants. Map Swipe permet de comparer facilement des cartes raster deux à deux.          
      +        
      +      
      +      
               Formats de fichiers supportés      
      +           id="flowRoot3548-3-3"
      +           style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10px;line-height:125%;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans, Italic';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#4d4d4d;fill-opacity:1;stroke:none"
      +           transform="translate(1838.5282,503.81612)">Combinez, visualisez et animez vos données vectorielles et raster 3D avec l'outil nviz.        
      +      
             
      -        
      +         transform="translate(-1174.5809,-301.20089)"
      +         style="display:inline;enable-background:new"
      +         id="illustr_gmod">
               Grâce au Modeleur graphique, une chaîne de processus peut être combinée en une seule action, à travers une interface intuitive.        
      +      
      +      
      +        
      +        Fiche technique      
      +           id="flowRoot3548-3"
      +           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22px;line-height:125%;font-family:Fontin;-inkscape-font-specification:Fontin;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#4c4c4c;fill-opacity:1;stroke:none"
      +           transform="translate(2039.4582,503.85667)">Visualisez et gérez facilement vos jeux de données les plus complexes : les géométries volumineuses liées aux SGBD les plus avancés sont prises en charge.      
           
           
      +       style="display:inline"
      +       sodipodi:insensitive="true">
             - Documentation illustrée d'exemples pour chaque module      GRASS GIS accepte presque tous les formats de fichier SIG courants via le recours à la bibliothèque GDAL/OGR.
      + accepte presque tous les formats de fichier SIG courants via le recours à la bibliothèque GDAL/OGR.Accepte également les Simple Features du consortium OpenGeospatial.            ASCII, ARC/INFO ungenerate, ARC/INFO E00, ArcView SHAPE, BIL, DLG (U.S.), DXF, DXF3D, GMT, GPS-ASCII USGS-DEM, IDRISI, MOSS, MapInfo, MIF, PostGIS, TIGER, VRML, etc.      ASCII, ARC/GRID, E00, GIF, GMT, TIF, PNG, Vis5D, SURFER (.grd), etc.      SAR, SPOT, MODIS, etc.      SQLite, PostgreSQL / PostGIS, MySQL, ODBC, DBF      - Services web      Interopérabilité - QGIS (SIG libre)- QGIS (SIG généraliste)- Langage R (statistiques)- R (langage et environnement statistique)- Gstat (geostatistiques)- ZOO-Project, PyWPS (WPS)      Plateformes supportéesGRASS GIS fonctionne sur presque toutes les architectures : GNU/Linux, systèmes Unix conformes Posix, MS Windows et MacOS X.      - Topologie vectorielle- Network analysis- Analyse de réseau- Geostatistique (Interface avec R)- interface web services OGC      - ANSI C- interface GRASS-SWIG- interface -SWIG- API Python, bibliothèque de script et IGU    
           
      +       id="v_sections"
      +       inkscape:label="v_sections"
      +       style="display:inline"
      +       sodipodi:insensitive="true">
             
      -        
      +         id="v_1">
      +        
               Visualisez et gérez facilement vos jeux de données les plus complexes : les géométries volumineuses liées aux SGBD les plus avancés sont prises en charge.      
      +           id="flowRoot4976-7"
      +           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.55879784px;line-height:125%;font-family:Fontin;-inkscape-font-specification:Fontin;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#000000;fill-opacity:1;stroke:none"
      +           transform="translate(0,0)">Fiche technique      
             
      -        
      -          wxGUI offre de multiples outils graphiques puissants. Map Swipe permet de comparer facilement des cartes raster deux à deux.          
      -        
      -      
      -      
      +         id="v_2">
      +        
               Combinez, visualisez et animez vos données vectorielles et raster 3D avec l'outil nviz.        
      -      
      -      
      -        
      -        Grâce au Modeleur graphique, une chaîne de processus peut être combinée en une seule action, à travers une interface intuitive.      
      +           id="flowRoot140"
      +           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.55879784px;line-height:125%;font-family:Fontin;-inkscape-font-specification:Fontin;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#000000;fill-opacity:1;stroke:none"
      +           transform="translate(0,0)">Formats de fichiers      
           
         
         
           
             
               
               
      +           style="filter:url(#filter1)">
                 
                 
                 
                 
             
               
                       
                       
                       
           
             
      -        
      -          
      -            
      -            Qu’est-ce que GRASS GIS ?          
      -        
      -      
      -      
      -        
      -          
      -            
      -            À propos          
      -        
      -      
      -    
      -    
      -      Où utilise-t-on GRASS GIS ? GRASS GIS est à l’œuvre dans le monde entier : applications scientifiques, dispositifs commerciaux, secteur public, etc. Le logiciel fait la preuve de sa robustesse et de sa capacité à résoudre des problèmes géospatiaux complexes dans de très nombreux cas.      Un effort de longue haleineGRASS GIS est né il y a plus de 30 ans... et la dernière mise à jour n’a sans doute que quelques heures ! Beaucoup de personnes contribuent à perfectionner le logiciel ; sa force et son succès s’appuient sur une équipe active de développeurs et les retours d’une large communauté. Ensemble ils combinent leurs efforts pour rendre GRASS GIS toujours plus pratique, simple, et puissant.      Un projet libre et Open SourceLa philosophie Open Source garantit la transparence du code source et de la structure de l’application ; les utilisateurs peuvent aisément adapter ses fonctionnalités à leurs besoins. Le contrôle permanent du code par les pairs garantit un haut niveau de qualité et de sécurité. Le gestionnaire d’extensions permet de développer de nouveaux modules indépendamment du code source de  GRASS GIS.      Où trouver plus d’informations ?- Wiki GRASS GIS :https://grasswiki.osgeo.org/wiki- Support communautaire GRASS GIS :  https://grass.osgeo.org/support- Page du projet :      Un projet OSGeoGRASS GIS est un projet fondateur de la Fondation Géospatiale Open Source (OSGeo) qui œuvre à l’émergence d’une offre de logiciels Open Source en géomatique de la plus grande qualité. Visitez la page de l'OSGeo :For further information visit the OSGeo homepage:      LicenceGNU General Public License (Free Software Foundation)      Une solution cartographique matureGRASS GIS  est un logiciel libre et Open Source dédié à l’analyse spatiale. Il est composé de plus de 450 modules de calcul vecteur (2D/3D), raster, voxel et données temporelles (4D). Il offre plusieurs interfaces avec d’autres programmes de domaines voisins comme la géostatistique, les bases de données, les services de webmapping, ainsi que d’autres SIG. C’est la plus ancienne et la plus complète des offres SIG Open Source, couvrant les besoins d’une simple application client SIG jusqu’à ceux d’un gestionnaire d’infrastructure SIG complexe.    
      -    
      -      
      +         id="logo_grass"
      +         transform="translate((-6.6462877,0)">
               
                 
                   
             
             
               
                 
             
           
      +    
      +      Où trouver plus d’informations ?- Wiki  :https://grasswiki.osgeo.org/wiki- Support communautaire  :  https://grass.osgeo.org/support- Page du projet :      Un projet libre et Open SourceLa philosophie Open Source garantit la transparence du code source et de la structure de l’application ; les utilisateurs peuvent aisément adapter ses fonctionnalités à leurs besoins. Le contrôle permanent du code par les pairs garantit un haut niveau de qualité et de sécurité. Le gestionnaire d’extensions permet de développer de nouveaux modules indépendamment du code source de  .      LicenceGNU General Public License (Free Software Foundation)      Un projet OSGeo est un projet fondateur de la Fondation Géospatiale Open Source (OSGeo) qui œuvre à l’émergence d’une offre de logiciels Open Source en géomatique de la plus grande qualité. Visitez la page de l'OSGeo :For further information visit the OSGeo homepage:      Une solution cartographique mature est un logiciel libre et Open Source dédié à l’analyse spatiale. Il est composé de plus de 450 modules de calcul vecteur (2D/3D), raster, voxel et données temporelles (4D). Il offre plusieurs interfaces avec d’autres programmes de domaines voisins comme la géostatistique, les bases de données, les services de webmapping, ainsi que d’autres SIG. C’est la plus ancienne et la plus complète des offres SIG Open Source, couvrant les besoins d’une simple application client SIG jusqu’à ceux d’un gestionnaire d’infrastructure SIG complexe.      Un effort de longue haleine  est né il y a plus de 30 ans... et la dernière mise à jour n’a sans doute que quelques heures ! Beaucoup de personnes contribuent à perfectionner le logiciel ; sa force et son succès s’appuient sur une équipe active de développeurs et les retours d’une large communauté. Ensemble ils combinent leurs efforts pour rendre  toujours plus pratique, simple, et puissant.      Où utilise-t-on  ?  est à l’œuvre dans le monde entier : applications scientifiques, dispositifs commerciaux, secteur public, etc. Le logiciel fait la preuve de sa robustesse et de sa capacité à résoudre des problèmes géospatiaux complexes dans de très nombreux cas.    
      +    
      +      
      +        
      +        À propos      
      +      
      +        
      +        Qu’est-ce que  ?      
      +    
         
       
      
      Modified: grass-promo/grassflyer/flyer_2016/it/grass_flyer.pdf
      ===================================================================
      (Binary files differ)
      
      Modified: grass-promo/grassflyer/flyer_2016/it/grass_flyer.svg
      ===================================================================
      (Binary files differ)
      
      
      From svn_grass at osgeo.org  Wed Oct 26 15:37:33 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Wed, 26 Oct 2016 15:37:33 -0700
      Subject: [GRASS-SVN] r69734 -
      	grass/branches/releasebranch_7_2/gui/wxpython/xml
      Message-ID: <20161026223733.60DA73904DE@trac.osgeo.org>
      
      Author: neteler
      Date: 2016-10-26 15:37:33 -0700 (Wed, 26 Oct 2016)
      New Revision: 69734
      
      Modified:
         grass/branches/releasebranch_7_2/gui/wxpython/xml/toolboxes.xml
      Log:
      wxGUI toolboxes: new modules added to menu (contributed by Stefan Blumentrath)
      
      Modified: grass/branches/releasebranch_7_2/gui/wxpython/xml/toolboxes.xml
      ===================================================================
      --- grass/branches/releasebranch_7_2/gui/wxpython/xml/toolboxes.xml	2016-10-26 17:45:21 UTC (rev 69733)
      +++ grass/branches/releasebranch_7_2/gui/wxpython/xml/toolboxes.xml	2016-10-26 22:37:33 UTC (rev 69734)
      @@ -174,9 +174,15 @@
             
               
             
      +      
      +        
      +      
             
               
             
      +      
      +        
      +      
             
               
             
      @@ -348,6 +354,9 @@
             
               
             
      +      
      +        
      +      
             
               
             
      @@ -429,6 +438,9 @@
             
               
             
      +      
      +        
      +      
             
               
             
      @@ -1223,6 +1235,9 @@
         
           
           
      +      
      +        
      +      
             
               
             
      @@ -1750,6 +1765,9 @@
             
               
             
      +      
      +        
      +      
             
             
             
      @@ -1770,8 +1788,12 @@
             
               
             
      +      
      +        
      +      
             
             
      +      
             
             
           
      @@ -1911,6 +1933,20 @@
             
           
         
      +  
      +    
      +    
      +      
      +        
      +      
      +      
      +        
      +      
      +      
      +        
      +      
      +    
      +  
         
           
           
      
      
      From svn_grass at osgeo.org  Wed Oct 26 19:05:38 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Wed, 26 Oct 2016 19:05:38 -0700
      Subject: [GRASS-SVN] r69735 -
      	grass/branches/releasebranch_7_2/gui/wxpython/xml
      Message-ID: <20161027020538.179083904DE@trac.osgeo.org>
      
      Author: annakrat
      Date: 2016-10-26 19:05:37 -0700 (Wed, 26 Oct 2016)
      New Revision: 69735
      
      Modified:
         grass/branches/releasebranch_7_2/gui/wxpython/xml/toolboxes.xml
      Log:
      wxGUI: fix menu label
      
      Modified: grass/branches/releasebranch_7_2/gui/wxpython/xml/toolboxes.xml
      ===================================================================
      --- grass/branches/releasebranch_7_2/gui/wxpython/xml/toolboxes.xml	2016-10-26 22:37:33 UTC (rev 69734)
      +++ grass/branches/releasebranch_7_2/gui/wxpython/xml/toolboxes.xml	2016-10-27 02:05:37 UTC (rev 69735)
      @@ -1934,7 +1934,7 @@
           
         
         
      -    
      +    
           
             
               
      
      
      From svn_grass at osgeo.org  Wed Oct 26 19:12:42 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Wed, 26 Oct 2016 19:12:42 -0700
      Subject: [GRASS-SVN] r69736 -
      	grass/branches/releasebranch_7_2/gui/wxpython/xml
      Message-ID: <20161027021242.CF4673904DE@trac.osgeo.org>
      
      Author: annakrat
      Date: 2016-10-26 19:12:42 -0700 (Wed, 26 Oct 2016)
      New Revision: 69736
      
      Modified:
         grass/branches/releasebranch_7_2/gui/wxpython/xml/toolboxes.xml
      Log:
      wxGUI: better menu labels for newly added modules
      
      Modified: grass/branches/releasebranch_7_2/gui/wxpython/xml/toolboxes.xml
      ===================================================================
      --- grass/branches/releasebranch_7_2/gui/wxpython/xml/toolboxes.xml	2016-10-27 02:05:37 UTC (rev 69735)
      +++ grass/branches/releasebranch_7_2/gui/wxpython/xml/toolboxes.xml	2016-10-27 02:12:42 UTC (rev 69736)
      @@ -175,7 +175,7 @@
               
             
             
      -        
      +        
             
             
               
      @@ -1940,7 +1940,7 @@
               
             
             
      -        
      +        
             
             
               
      
      
      From svn_grass at osgeo.org  Thu Oct 27 06:33:46 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Thu, 27 Oct 2016 06:33:46 -0700
      Subject: [GRASS-SVN] r69737 - grass/branches/releasebranch_7_2
      Message-ID: <20161027133347.0581A3901E5@trac.osgeo.org>
      
      Author: neteler
      Date: 2016-10-27 06:33:46 -0700 (Thu, 27 Oct 2016)
      New Revision: 69737
      
      Modified:
         grass/branches/releasebranch_7_2/config.guess
         grass/branches/releasebranch_7_2/config.sub
      Log:
      config.guess + config.sub: updated from http://git.savannah.gnu.org/cgit/config.git/plain/
      
      Modified: grass/branches/releasebranch_7_2/config.guess
      ===================================================================
      --- grass/branches/releasebranch_7_2/config.guess	2016-10-27 02:12:42 UTC (rev 69736)
      +++ grass/branches/releasebranch_7_2/config.guess	2016-10-27 13:33:46 UTC (rev 69737)
      @@ -1,8 +1,8 @@
       #! /bin/sh
       # Attempt to guess a canonical system name.
      -#   Copyright 1992-2015 Free Software Foundation, Inc.
      +#   Copyright 1992-2016 Free Software Foundation, Inc.
       
      -timestamp='2015-12-14'
      +timestamp='2016-10-02'
       
       # This file is free software; you can redistribute it and/or modify it
       # under the terms of the GNU General Public License as published by
      @@ -27,7 +27,7 @@
       # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
       #
       # You can get the latest version of this script from:
      -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
      +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
       #
       # Please send patches to .
       
      @@ -50,7 +50,7 @@
       GNU config.guess ($timestamp)
       
       Originally written by Per Bothner.
      -Copyright 1992-2015 Free Software Foundation, Inc.
      +Copyright 1992-2016 Free Software Foundation, Inc.
       
       This is free software; see the source for copying conditions.  There is NO
       warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
      @@ -186,9 +186,12 @@
       	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
       	esac
       	# The Operating System including object format, if it has switched
      -	# to ELF recently, or will in the future.
      +	# to ELF recently (or will in the future) and ABI.
       	case "${UNAME_MACHINE_ARCH}" in
      -	    arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
      +	    earm*)
      +		os=netbsdelf
      +		;;
      +	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
       		eval $set_cc_for_build
       		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
       			| grep -q __ELF__
      @@ -237,6 +240,10 @@
       	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
       	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
       	exit ;;
      +    *:LibertyBSD:*:*)
      +	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
      +	echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
      +	exit ;;
           *:ekkoBSD:*:*)
       	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
       	exit ;;
      @@ -268,42 +275,42 @@
       	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
       	case "$ALPHA_CPU_TYPE" in
       	    "EV4 (21064)")
      -		UNAME_MACHINE="alpha" ;;
      +		UNAME_MACHINE=alpha ;;
       	    "EV4.5 (21064)")
      -		UNAME_MACHINE="alpha" ;;
      +		UNAME_MACHINE=alpha ;;
       	    "LCA4 (21066/21068)")
      -		UNAME_MACHINE="alpha" ;;
      +		UNAME_MACHINE=alpha ;;
       	    "EV5 (21164)")
      -		UNAME_MACHINE="alphaev5" ;;
      +		UNAME_MACHINE=alphaev5 ;;
       	    "EV5.6 (21164A)")
      -		UNAME_MACHINE="alphaev56" ;;
      +		UNAME_MACHINE=alphaev56 ;;
       	    "EV5.6 (21164PC)")
      -		UNAME_MACHINE="alphapca56" ;;
      +		UNAME_MACHINE=alphapca56 ;;
       	    "EV5.7 (21164PC)")
      -		UNAME_MACHINE="alphapca57" ;;
      +		UNAME_MACHINE=alphapca57 ;;
       	    "EV6 (21264)")
      -		UNAME_MACHINE="alphaev6" ;;
      +		UNAME_MACHINE=alphaev6 ;;
       	    "EV6.7 (21264A)")
      -		UNAME_MACHINE="alphaev67" ;;
      +		UNAME_MACHINE=alphaev67 ;;
       	    "EV6.8CB (21264C)")
      -		UNAME_MACHINE="alphaev68" ;;
      +		UNAME_MACHINE=alphaev68 ;;
       	    "EV6.8AL (21264B)")
      -		UNAME_MACHINE="alphaev68" ;;
      +		UNAME_MACHINE=alphaev68 ;;
       	    "EV6.8CX (21264D)")
      -		UNAME_MACHINE="alphaev68" ;;
      +		UNAME_MACHINE=alphaev68 ;;
       	    "EV6.9A (21264/EV69A)")
      -		UNAME_MACHINE="alphaev69" ;;
      +		UNAME_MACHINE=alphaev69 ;;
       	    "EV7 (21364)")
      -		UNAME_MACHINE="alphaev7" ;;
      +		UNAME_MACHINE=alphaev7 ;;
       	    "EV7.9 (21364A)")
      -		UNAME_MACHINE="alphaev79" ;;
      +		UNAME_MACHINE=alphaev79 ;;
       	esac
       	# A Pn.n version is a patched version.
       	# A Vn.n version is a released version.
       	# A Tn.n version is a released field test version.
       	# A Xn.n version is an unreleased experimental baselevel.
       	# 1.2 uses "1.2" for uname -r.
      -	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
      +	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
       	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
       	exitcode=$?
       	trap '' 0
      @@ -376,16 +383,16 @@
       	exit ;;
           i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
       	eval $set_cc_for_build
      -	SUN_ARCH="i386"
      +	SUN_ARCH=i386
       	# If there is a compiler, see if it is configured for 64-bit objects.
       	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
       	# This test works for both compilers.
      -	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
      +	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
       	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
      -		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
      +		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
       		grep IS_64BIT_ARCH >/dev/null
       	    then
      -		SUN_ARCH="x86_64"
      +		SUN_ARCH=x86_64
       	    fi
       	fi
       	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
      @@ -410,7 +417,7 @@
       	exit ;;
           sun*:*:4.2BSD:*)
       	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
      -	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
      +	test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
       	case "`/bin/arch`" in
       	    sun3)
       		echo m68k-sun-sunos${UNAME_RELEASE}
      @@ -635,13 +642,13 @@
       		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
       		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
       		    case "${sc_cpu_version}" in
      -		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
      -		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
      +		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
      +		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
       		      532)                      # CPU_PA_RISC2_0
       			case "${sc_kernel_bits}" in
      -			  32) HP_ARCH="hppa2.0n" ;;
      -			  64) HP_ARCH="hppa2.0w" ;;
      -			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
      +			  32) HP_ARCH=hppa2.0n ;;
      +			  64) HP_ARCH=hppa2.0w ;;
      +			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
       			esac ;;
       		    esac
       		fi
      @@ -680,11 +687,11 @@
       		    exit (0);
       		}
       EOF
      -		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
      +		    (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
       		    test -z "$HP_ARCH" && HP_ARCH=hppa
       		fi ;;
       	esac
      -	if [ ${HP_ARCH} = "hppa2.0w" ]
      +	if [ ${HP_ARCH} = hppa2.0w ]
       	then
       	    eval $set_cc_for_build
       
      @@ -697,12 +704,12 @@
       	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
       	    # => hppa64-hp-hpux11.23
       
      -	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
      +	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
       		grep -q __LP64__
       	    then
      -		HP_ARCH="hppa2.0w"
      +		HP_ARCH=hppa2.0w
       	    else
      -		HP_ARCH="hppa64"
      +		HP_ARCH=hppa64
       	    fi
       	fi
       	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
      @@ -807,14 +814,14 @@
       	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
       	exit ;;
           F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
      -	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
      -	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
      +	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
      +	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
       	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
       	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
       	exit ;;
           5000:UNIX_System_V:4.*:*)
      -	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
      -	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
      +	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
      +	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
       	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
       	exit ;;
           i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
      @@ -896,7 +903,7 @@
       	exit ;;
           *:GNU/*:*:*)
       	# other systems with GNU libc and userland
      -	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
      +	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
       	exit ;;
           i*86:Minix:*:*)
       	echo ${UNAME_MACHINE}-pc-minix
      @@ -919,7 +926,7 @@
       	  EV68*) UNAME_MACHINE=alphaev68 ;;
       	esac
       	objdump --private-headers /bin/sh | grep -q ld.so.1
      -	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
      +	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
       	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
       	exit ;;
           arc:Linux:*:* | arceb:Linux:*:*)
      @@ -993,6 +1000,9 @@
       	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
       	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
       	;;
      +    mips64el:Linux:*:*)
      +	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
      +	exit ;;
           openrisc*:Linux:*:*)
       	echo or1k-unknown-linux-${LIBC}
       	exit ;;
      @@ -1025,6 +1035,9 @@
           ppcle:Linux:*:*)
       	echo powerpcle-unknown-linux-${LIBC}
       	exit ;;
      +    riscv32:Linux:*:* | riscv64:Linux:*:*)
      +	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
      +	exit ;;
           s390:Linux:*:* | s390x:Linux:*:*)
       	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
       	exit ;;
      @@ -1272,6 +1285,9 @@
           SX-8R:SUPER-UX:*:*)
       	echo sx8r-nec-superux${UNAME_RELEASE}
       	exit ;;
      +    SX-ACE:SUPER-UX:*:*)
      +	echo sxace-nec-superux${UNAME_RELEASE}
      +	exit ;;
           Power*:Rhapsody:*:*)
       	echo powerpc-apple-rhapsody${UNAME_RELEASE}
       	exit ;;
      @@ -1285,9 +1301,9 @@
       	    UNAME_PROCESSOR=powerpc
       	fi
       	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
      -	    if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
      +	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
       		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
      -		    (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
      +		    (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
       		    grep IS_64BIT_ARCH >/dev/null
       		then
       		    case $UNAME_PROCESSOR in
      @@ -1309,7 +1325,7 @@
       	exit ;;
           *:procnto*:*:* | *:QNX:[0123456789]*:*)
       	UNAME_PROCESSOR=`uname -p`
      -	if test "$UNAME_PROCESSOR" = "x86"; then
      +	if test "$UNAME_PROCESSOR" = x86; then
       		UNAME_PROCESSOR=i386
       		UNAME_MACHINE=pc
       	fi
      @@ -1340,7 +1356,7 @@
       	# "uname -m" is not consistent, so use $cputype instead. 386
       	# is converted to i386 for consistency with other x86
       	# operating systems.
      -	if test "$cputype" = "386"; then
      +	if test "$cputype" = 386; then
       	    UNAME_MACHINE=i386
       	else
       	    UNAME_MACHINE="$cputype"
      @@ -1382,7 +1398,7 @@
       	echo i386-pc-xenix
       	exit ;;
           i*86:skyos:*:*)
      -	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
      +	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
       	exit ;;
           i*86:rdos:*:*)
       	echo ${UNAME_MACHINE}-pc-rdos
      @@ -1401,18 +1417,17 @@
       cat >&2 < in order to provide the needed
      -information to handle your system.
      +If $0 has already been updated, send the following data and any
      +information you think might be pertinent to config-patches at gnu.org to
      +provide the necessary information to handle your system.
       
       config.guess timestamp = $timestamp
       
      
      Modified: grass/branches/releasebranch_7_2/config.sub
      ===================================================================
      --- grass/branches/releasebranch_7_2/config.sub	2016-10-27 02:12:42 UTC (rev 69736)
      +++ grass/branches/releasebranch_7_2/config.sub	2016-10-27 13:33:46 UTC (rev 69737)
      @@ -1,8 +1,8 @@
       #! /bin/sh
       # Configuration validation subroutine script.
      -#   Copyright 1992-2015 Free Software Foundation, Inc.
      +#   Copyright 1992-2016 Free Software Foundation, Inc.
       
      -timestamp='2015-12-14'
      +timestamp='2016-09-05'
       
       # This file is free software; you can redistribute it and/or modify it
       # under the terms of the GNU General Public License as published by
      @@ -33,7 +33,7 @@
       # Otherwise, we print the canonical config type on stdout and succeed.
       
       # You can get the latest version of this script from:
      -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
      +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
       
       # This file is supposed to be the same for all GNU packages
       # and recognize all the CPU types, system types and aliases
      @@ -67,7 +67,7 @@
       version="\
       GNU config.sub ($timestamp)
       
      -Copyright 1992-2015 Free Software Foundation, Inc.
      +Copyright 1992-2016 Free Software Foundation, Inc.
       
       This is free software; see the source for copying conditions.  There is NO
       warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
      @@ -117,7 +117,7 @@
         nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
         linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
         knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
      -  kopensolaris*-gnu* | \
      +  kopensolaris*-gnu* | cloudabi*-eabi* | \
         storm-chaos* | os2-emx* | rtmk-nova*)
           os=-$maybe_os
           basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
      @@ -643,6 +643,14 @@
       		basic_machine=m68k-bull
       		os=-sysv3
       		;;
      +	e500v[12])
      +		basic_machine=powerpc-unknown
      +		os=$os"spe"
      +		;;
      +	e500v[12]-*)
      +		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
      +		os=$os"spe"
      +		;;
       	ebmon29k)
       		basic_machine=a29k-amd
       		os=-ebmon
      @@ -1022,7 +1030,7 @@
       	ppc-* | ppcbe-*)
       		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
       		;;
      -	ppcle | powerpclittle | ppc-le | powerpc-little)
      +	ppcle | powerpclittle)
       		basic_machine=powerpcle-unknown
       		;;
       	ppcle-* | powerpclittle-*)
      @@ -1032,7 +1040,7 @@
       		;;
       	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
       		;;
      -	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
      +	ppc64le | powerpc64little)
       		basic_machine=powerpc64le-unknown
       		;;
       	ppc64le-* | powerpc64little-*)
      @@ -1382,14 +1390,14 @@
       	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
       	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
       	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
      -	      | -bitrig* | -openbsd* | -solidbsd* \
      +	      | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
       	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
       	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
       	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
       	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
       	      | -chorusos* | -chorusrdb* | -cegcc* \
       	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
      -	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
      +	      | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
       	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
       	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
       	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
      @@ -1399,7 +1407,7 @@
       	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
       	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
       	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
      -	      | -onefs* | -tirtos*)
      +	      | -onefs* | -tirtos* | -phoenix*)
       	# Remember, each alternative MUST END IN *, to match a version number.
       		;;
       	-qnx*)
      @@ -1531,6 +1539,8 @@
       		;;
       	-nacl*)
       		;;
      +	-ios)
      +		;;
       	-none)
       		;;
       	*)
      
      
      From svn_grass at osgeo.org  Thu Oct 27 07:31:32 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Thu, 27 Oct 2016 07:31:32 -0700
      Subject: [GRASS-SVN] r69738 - grass/trunk
      Message-ID: <20161027143132.B908E39040E@trac.osgeo.org>
      
      Author: neteler
      Date: 2016-10-27 07:31:32 -0700 (Thu, 27 Oct 2016)
      New Revision: 69738
      
      Modified:
         grass/trunk/config.guess
         grass/trunk/config.sub
      Log:
      config.guess + config.sub: updated from http://git.savannah.gnu.org/cgit/config.git/plain/
      
      Modified: grass/trunk/config.guess
      ===================================================================
      --- grass/trunk/config.guess	2016-10-27 13:33:46 UTC (rev 69737)
      +++ grass/trunk/config.guess	2016-10-27 14:31:32 UTC (rev 69738)
      @@ -1,8 +1,8 @@
       #! /bin/sh
       # Attempt to guess a canonical system name.
      -#   Copyright 1992-2015 Free Software Foundation, Inc.
      +#   Copyright 1992-2016 Free Software Foundation, Inc.
       
      -timestamp='2015-12-14'
      +timestamp='2016-10-02'
       
       # This file is free software; you can redistribute it and/or modify it
       # under the terms of the GNU General Public License as published by
      @@ -27,7 +27,7 @@
       # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
       #
       # You can get the latest version of this script from:
      -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
      +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
       #
       # Please send patches to .
       
      @@ -50,7 +50,7 @@
       GNU config.guess ($timestamp)
       
       Originally written by Per Bothner.
      -Copyright 1992-2015 Free Software Foundation, Inc.
      +Copyright 1992-2016 Free Software Foundation, Inc.
       
       This is free software; see the source for copying conditions.  There is NO
       warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
      @@ -186,9 +186,12 @@
       	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
       	esac
       	# The Operating System including object format, if it has switched
      -	# to ELF recently, or will in the future.
      +	# to ELF recently (or will in the future) and ABI.
       	case "${UNAME_MACHINE_ARCH}" in
      -	    arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
      +	    earm*)
      +		os=netbsdelf
      +		;;
      +	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
       		eval $set_cc_for_build
       		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
       			| grep -q __ELF__
      @@ -237,6 +240,10 @@
       	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
       	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
       	exit ;;
      +    *:LibertyBSD:*:*)
      +	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
      +	echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
      +	exit ;;
           *:ekkoBSD:*:*)
       	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
       	exit ;;
      @@ -268,42 +275,42 @@
       	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
       	case "$ALPHA_CPU_TYPE" in
       	    "EV4 (21064)")
      -		UNAME_MACHINE="alpha" ;;
      +		UNAME_MACHINE=alpha ;;
       	    "EV4.5 (21064)")
      -		UNAME_MACHINE="alpha" ;;
      +		UNAME_MACHINE=alpha ;;
       	    "LCA4 (21066/21068)")
      -		UNAME_MACHINE="alpha" ;;
      +		UNAME_MACHINE=alpha ;;
       	    "EV5 (21164)")
      -		UNAME_MACHINE="alphaev5" ;;
      +		UNAME_MACHINE=alphaev5 ;;
       	    "EV5.6 (21164A)")
      -		UNAME_MACHINE="alphaev56" ;;
      +		UNAME_MACHINE=alphaev56 ;;
       	    "EV5.6 (21164PC)")
      -		UNAME_MACHINE="alphapca56" ;;
      +		UNAME_MACHINE=alphapca56 ;;
       	    "EV5.7 (21164PC)")
      -		UNAME_MACHINE="alphapca57" ;;
      +		UNAME_MACHINE=alphapca57 ;;
       	    "EV6 (21264)")
      -		UNAME_MACHINE="alphaev6" ;;
      +		UNAME_MACHINE=alphaev6 ;;
       	    "EV6.7 (21264A)")
      -		UNAME_MACHINE="alphaev67" ;;
      +		UNAME_MACHINE=alphaev67 ;;
       	    "EV6.8CB (21264C)")
      -		UNAME_MACHINE="alphaev68" ;;
      +		UNAME_MACHINE=alphaev68 ;;
       	    "EV6.8AL (21264B)")
      -		UNAME_MACHINE="alphaev68" ;;
      +		UNAME_MACHINE=alphaev68 ;;
       	    "EV6.8CX (21264D)")
      -		UNAME_MACHINE="alphaev68" ;;
      +		UNAME_MACHINE=alphaev68 ;;
       	    "EV6.9A (21264/EV69A)")
      -		UNAME_MACHINE="alphaev69" ;;
      +		UNAME_MACHINE=alphaev69 ;;
       	    "EV7 (21364)")
      -		UNAME_MACHINE="alphaev7" ;;
      +		UNAME_MACHINE=alphaev7 ;;
       	    "EV7.9 (21364A)")
      -		UNAME_MACHINE="alphaev79" ;;
      +		UNAME_MACHINE=alphaev79 ;;
       	esac
       	# A Pn.n version is a patched version.
       	# A Vn.n version is a released version.
       	# A Tn.n version is a released field test version.
       	# A Xn.n version is an unreleased experimental baselevel.
       	# 1.2 uses "1.2" for uname -r.
      -	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
      +	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
       	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
       	exitcode=$?
       	trap '' 0
      @@ -376,16 +383,16 @@
       	exit ;;
           i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
       	eval $set_cc_for_build
      -	SUN_ARCH="i386"
      +	SUN_ARCH=i386
       	# If there is a compiler, see if it is configured for 64-bit objects.
       	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
       	# This test works for both compilers.
      -	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
      +	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
       	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
      -		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
      +		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
       		grep IS_64BIT_ARCH >/dev/null
       	    then
      -		SUN_ARCH="x86_64"
      +		SUN_ARCH=x86_64
       	    fi
       	fi
       	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
      @@ -410,7 +417,7 @@
       	exit ;;
           sun*:*:4.2BSD:*)
       	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
      -	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
      +	test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
       	case "`/bin/arch`" in
       	    sun3)
       		echo m68k-sun-sunos${UNAME_RELEASE}
      @@ -635,13 +642,13 @@
       		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
       		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
       		    case "${sc_cpu_version}" in
      -		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
      -		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
      +		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
      +		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
       		      532)                      # CPU_PA_RISC2_0
       			case "${sc_kernel_bits}" in
      -			  32) HP_ARCH="hppa2.0n" ;;
      -			  64) HP_ARCH="hppa2.0w" ;;
      -			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
      +			  32) HP_ARCH=hppa2.0n ;;
      +			  64) HP_ARCH=hppa2.0w ;;
      +			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
       			esac ;;
       		    esac
       		fi
      @@ -680,11 +687,11 @@
       		    exit (0);
       		}
       EOF
      -		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
      +		    (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
       		    test -z "$HP_ARCH" && HP_ARCH=hppa
       		fi ;;
       	esac
      -	if [ ${HP_ARCH} = "hppa2.0w" ]
      +	if [ ${HP_ARCH} = hppa2.0w ]
       	then
       	    eval $set_cc_for_build
       
      @@ -697,12 +704,12 @@
       	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
       	    # => hppa64-hp-hpux11.23
       
      -	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
      +	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
       		grep -q __LP64__
       	    then
      -		HP_ARCH="hppa2.0w"
      +		HP_ARCH=hppa2.0w
       	    else
      -		HP_ARCH="hppa64"
      +		HP_ARCH=hppa64
       	    fi
       	fi
       	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
      @@ -807,14 +814,14 @@
       	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
       	exit ;;
           F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
      -	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
      -	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
      +	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
      +	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
       	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
       	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
       	exit ;;
           5000:UNIX_System_V:4.*:*)
      -	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
      -	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
      +	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
      +	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
       	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
       	exit ;;
           i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
      @@ -896,7 +903,7 @@
       	exit ;;
           *:GNU/*:*:*)
       	# other systems with GNU libc and userland
      -	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
      +	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
       	exit ;;
           i*86:Minix:*:*)
       	echo ${UNAME_MACHINE}-pc-minix
      @@ -919,7 +926,7 @@
       	  EV68*) UNAME_MACHINE=alphaev68 ;;
       	esac
       	objdump --private-headers /bin/sh | grep -q ld.so.1
      -	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
      +	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
       	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
       	exit ;;
           arc:Linux:*:* | arceb:Linux:*:*)
      @@ -993,6 +1000,9 @@
       	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
       	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
       	;;
      +    mips64el:Linux:*:*)
      +	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
      +	exit ;;
           openrisc*:Linux:*:*)
       	echo or1k-unknown-linux-${LIBC}
       	exit ;;
      @@ -1025,6 +1035,9 @@
           ppcle:Linux:*:*)
       	echo powerpcle-unknown-linux-${LIBC}
       	exit ;;
      +    riscv32:Linux:*:* | riscv64:Linux:*:*)
      +	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
      +	exit ;;
           s390:Linux:*:* | s390x:Linux:*:*)
       	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
       	exit ;;
      @@ -1272,6 +1285,9 @@
           SX-8R:SUPER-UX:*:*)
       	echo sx8r-nec-superux${UNAME_RELEASE}
       	exit ;;
      +    SX-ACE:SUPER-UX:*:*)
      +	echo sxace-nec-superux${UNAME_RELEASE}
      +	exit ;;
           Power*:Rhapsody:*:*)
       	echo powerpc-apple-rhapsody${UNAME_RELEASE}
       	exit ;;
      @@ -1285,9 +1301,9 @@
       	    UNAME_PROCESSOR=powerpc
       	fi
       	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
      -	    if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
      +	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
       		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
      -		    (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
      +		    (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
       		    grep IS_64BIT_ARCH >/dev/null
       		then
       		    case $UNAME_PROCESSOR in
      @@ -1309,7 +1325,7 @@
       	exit ;;
           *:procnto*:*:* | *:QNX:[0123456789]*:*)
       	UNAME_PROCESSOR=`uname -p`
      -	if test "$UNAME_PROCESSOR" = "x86"; then
      +	if test "$UNAME_PROCESSOR" = x86; then
       		UNAME_PROCESSOR=i386
       		UNAME_MACHINE=pc
       	fi
      @@ -1340,7 +1356,7 @@
       	# "uname -m" is not consistent, so use $cputype instead. 386
       	# is converted to i386 for consistency with other x86
       	# operating systems.
      -	if test "$cputype" = "386"; then
      +	if test "$cputype" = 386; then
       	    UNAME_MACHINE=i386
       	else
       	    UNAME_MACHINE="$cputype"
      @@ -1382,7 +1398,7 @@
       	echo i386-pc-xenix
       	exit ;;
           i*86:skyos:*:*)
      -	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
      +	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
       	exit ;;
           i*86:rdos:*:*)
       	echo ${UNAME_MACHINE}-pc-rdos
      @@ -1401,18 +1417,17 @@
       cat >&2 < in order to provide the needed
      -information to handle your system.
      +If $0 has already been updated, send the following data and any
      +information you think might be pertinent to config-patches at gnu.org to
      +provide the necessary information to handle your system.
       
       config.guess timestamp = $timestamp
       
      
      Modified: grass/trunk/config.sub
      ===================================================================
      --- grass/trunk/config.sub	2016-10-27 13:33:46 UTC (rev 69737)
      +++ grass/trunk/config.sub	2016-10-27 14:31:32 UTC (rev 69738)
      @@ -1,8 +1,8 @@
       #! /bin/sh
       # Configuration validation subroutine script.
      -#   Copyright 1992-2015 Free Software Foundation, Inc.
      +#   Copyright 1992-2016 Free Software Foundation, Inc.
       
      -timestamp='2015-12-14'
      +timestamp='2016-09-05'
       
       # This file is free software; you can redistribute it and/or modify it
       # under the terms of the GNU General Public License as published by
      @@ -33,7 +33,7 @@
       # Otherwise, we print the canonical config type on stdout and succeed.
       
       # You can get the latest version of this script from:
      -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
      +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
       
       # This file is supposed to be the same for all GNU packages
       # and recognize all the CPU types, system types and aliases
      @@ -67,7 +67,7 @@
       version="\
       GNU config.sub ($timestamp)
       
      -Copyright 1992-2015 Free Software Foundation, Inc.
      +Copyright 1992-2016 Free Software Foundation, Inc.
       
       This is free software; see the source for copying conditions.  There is NO
       warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
      @@ -117,7 +117,7 @@
         nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
         linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
         knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
      -  kopensolaris*-gnu* | \
      +  kopensolaris*-gnu* | cloudabi*-eabi* | \
         storm-chaos* | os2-emx* | rtmk-nova*)
           os=-$maybe_os
           basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
      @@ -643,6 +643,14 @@
       		basic_machine=m68k-bull
       		os=-sysv3
       		;;
      +	e500v[12])
      +		basic_machine=powerpc-unknown
      +		os=$os"spe"
      +		;;
      +	e500v[12]-*)
      +		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
      +		os=$os"spe"
      +		;;
       	ebmon29k)
       		basic_machine=a29k-amd
       		os=-ebmon
      @@ -1022,7 +1030,7 @@
       	ppc-* | ppcbe-*)
       		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
       		;;
      -	ppcle | powerpclittle | ppc-le | powerpc-little)
      +	ppcle | powerpclittle)
       		basic_machine=powerpcle-unknown
       		;;
       	ppcle-* | powerpclittle-*)
      @@ -1032,7 +1040,7 @@
       		;;
       	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
       		;;
      -	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
      +	ppc64le | powerpc64little)
       		basic_machine=powerpc64le-unknown
       		;;
       	ppc64le-* | powerpc64little-*)
      @@ -1382,14 +1390,14 @@
       	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
       	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
       	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
      -	      | -bitrig* | -openbsd* | -solidbsd* \
      +	      | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
       	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
       	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
       	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
       	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
       	      | -chorusos* | -chorusrdb* | -cegcc* \
       	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
      -	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
      +	      | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
       	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
       	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
       	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
      @@ -1399,7 +1407,7 @@
       	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
       	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
       	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
      -	      | -onefs* | -tirtos*)
      +	      | -onefs* | -tirtos* | -phoenix*)
       	# Remember, each alternative MUST END IN *, to match a version number.
       		;;
       	-qnx*)
      @@ -1531,6 +1539,8 @@
       		;;
       	-nacl*)
       		;;
      +	-ios)
      +		;;
       	-none)
       		;;
       	*)
      
      
      From svn_grass at osgeo.org  Thu Oct 27 07:49:38 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Thu, 27 Oct 2016 07:49:38 -0700
      Subject: [GRASS-SVN] r69739 - grass/trunk
      Message-ID: <20161027144938.A15C539040E@trac.osgeo.org>
      
      Author: neteler
      Date: 2016-10-27 07:49:38 -0700 (Thu, 27 Oct 2016)
      New Revision: 69739
      
      Modified:
         grass/trunk/CHANGES
      Log:
      CHANGES: links to release pages added
      
      Modified: grass/trunk/CHANGES
      ===================================================================
      --- grass/trunk/CHANGES	2016-10-27 14:31:32 UTC (rev 69738)
      +++ grass/trunk/CHANGES	2016-10-27 14:49:38 UTC (rev 69739)
      @@ -1,5 +1,11 @@
      -CHANGES IN GRASS GIS 7 compared to GRASS GIS 6
      +CHANGES current GRASS GIS 7.x compared to previous GRASS GIS 7.x
       
      +See list of releases with changelog at
      +https://trac.osgeo.org/grass/wiki/Release
      +
      +
      +CHANGES in GRASS GIS 7.0 compared to GRASS GIS 6.x
      +
       The graphical user interface based on wxPython (introduced in GRASS GIS 
       6.4) has been enriched with many new features in order to make complex 
       GIS operations available as simple as possible. The old Tcl/Tk based 
      @@ -14,8 +20,8 @@
       raster and vector data; some of the already existing modules were 
       improved and made faster (some even 1000 x faster). 
       
      -In total, more than 10,000 changes have been implemented so far with 
      -respect to GRASS GIS 6.4.
      +In total, more than 10,000 changes have been implemented in GRASS GIS 7.0.0
      +with respect to GRASS GIS 6.4.x
       
       For details, please refer to this Web page:
       http://trac.osgeo.org/grass/wiki/Grass7/NewFeatures
      
      
      From svn_grass at osgeo.org  Thu Oct 27 07:49:45 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Thu, 27 Oct 2016 07:49:45 -0700
      Subject: [GRASS-SVN] r69740 - grass/branches/releasebranch_7_2
      Message-ID: <20161027144945.608CD39040E@trac.osgeo.org>
      
      Author: neteler
      Date: 2016-10-27 07:49:45 -0700 (Thu, 27 Oct 2016)
      New Revision: 69740
      
      Modified:
         grass/branches/releasebranch_7_2/CHANGES
      Log:
      CHANGES: links to release pages added
      
      Modified: grass/branches/releasebranch_7_2/CHANGES
      ===================================================================
      --- grass/branches/releasebranch_7_2/CHANGES	2016-10-27 14:49:38 UTC (rev 69739)
      +++ grass/branches/releasebranch_7_2/CHANGES	2016-10-27 14:49:45 UTC (rev 69740)
      @@ -1,5 +1,11 @@
      -CHANGES IN GRASS GIS 7 compared to GRASS GIS 6
      +CHANGES current GRASS GIS 7.x compared to previous GRASS GIS 7.x
       
      +See list of releases with changelog at
      +https://trac.osgeo.org/grass/wiki/Release
      +
      +
      +CHANGES in GRASS GIS 7.0 compared to GRASS GIS 6.x
      +
       The graphical user interface based on wxPython (introduced in GRASS GIS 
       6.4) has been enriched with many new features in order to make complex 
       GIS operations available as simple as possible. The old Tcl/Tk based 
      @@ -14,8 +20,8 @@
       raster and vector data; some of the already existing modules were 
       improved and made faster (some even 1000 x faster). 
       
      -In total, more than 10,000 changes have been implemented so far with 
      -respect to GRASS GIS 6.4.
      +In total, more than 10,000 changes have been implemented in GRASS GIS 7.0.0
      +with respect to GRASS GIS 6.4.x
       
       For details, please refer to this Web page:
       http://trac.osgeo.org/grass/wiki/Grass7/NewFeatures
      
      
      From svn_grass at osgeo.org  Thu Oct 27 07:50:30 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Thu, 27 Oct 2016 07:50:30 -0700
      Subject: [GRASS-SVN] r69741 - grass/branches/releasebranch_7_0
      Message-ID: <20161027145031.01C7739040E@trac.osgeo.org>
      
      Author: neteler
      Date: 2016-10-27 07:50:30 -0700 (Thu, 27 Oct 2016)
      New Revision: 69741
      
      Modified:
         grass/branches/releasebranch_7_0/CHANGES
      Log:
      CHANGES: links to release pages added
      
      Modified: grass/branches/releasebranch_7_0/CHANGES
      ===================================================================
      --- grass/branches/releasebranch_7_0/CHANGES	2016-10-27 14:49:45 UTC (rev 69740)
      +++ grass/branches/releasebranch_7_0/CHANGES	2016-10-27 14:50:30 UTC (rev 69741)
      @@ -1,5 +1,11 @@
      -CHANGES IN GRASS GIS 7 compared to GRASS GIS 6
      +CHANGES current GRASS GIS 7.x compared to previous GRASS GIS 7.x
       
      +See list of releases with changelog at
      +https://trac.osgeo.org/grass/wiki/Release
      +
      +
      +CHANGES in GRASS GIS 7.0 compared to GRASS GIS 6.x
      +
       The graphical user interface based on wxPython (introduced in GRASS GIS 
       6.4) has been enriched with many new features in order to make complex 
       GIS operations available as simple as possible. The old Tcl/Tk based 
      @@ -14,8 +20,8 @@
       raster and vector data; some of the already existing modules were 
       improved and made faster (some even 1000 x faster). 
       
      -In total, more than 10,000 changes have been implemented so far with 
      -respect to GRASS GIS 6.4.
      +In total, more than 10,000 changes have been implemented in GRASS GIS 7.0.0
      +with respect to GRASS GIS 6.4.x
       
       For details, please refer to this Web page:
       http://trac.osgeo.org/grass/wiki/Grass7/NewFeatures
      
      
      From svn_grass at osgeo.org  Thu Oct 27 11:30:54 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Thu, 27 Oct 2016 11:30:54 -0700
      Subject: [GRASS-SVN] r69742 - in grass/branches/releasebranch_7_2: include
      	mswindows/osgeo4w
      Message-ID: <20161027183054.94A0A39040E@trac.osgeo.org>
      
      Author: neteler
      Date: 2016-10-27 11:30:54 -0700 (Thu, 27 Oct 2016)
      New Revision: 69742
      
      Modified:
         grass/branches/releasebranch_7_2/include/VERSION
         grass/branches/releasebranch_7_2/mswindows/osgeo4w/setup.hint.tmpl
      Log:
      GRASS GIS 7.2.0RC1
      
      Modified: grass/branches/releasebranch_7_2/include/VERSION
      ===================================================================
      --- grass/branches/releasebranch_7_2/include/VERSION	2016-10-27 14:50:30 UTC (rev 69741)
      +++ grass/branches/releasebranch_7_2/include/VERSION	2016-10-27 18:30:54 UTC (rev 69742)
      @@ -1,4 +1,4 @@
       7
       2
      -svn
      +0RC1
       2016
      
      Modified: grass/branches/releasebranch_7_2/mswindows/osgeo4w/setup.hint.tmpl
      ===================================================================
      --- grass/branches/releasebranch_7_2/mswindows/osgeo4w/setup.hint.tmpl	2016-10-27 14:50:30 UTC (rev 69741)
      +++ grass/branches/releasebranch_7_2/mswindows/osgeo4w/setup.hint.tmpl	2016-10-27 18:30:54 UTC (rev 69742)
      @@ -1,7 +1,7 @@
       sdesc: "GRASS GIS - daily builds of development version"
      -ldesc: "Geographic Resources Analysis Support System (GRASS GIS) - daily builds of SVN trunk"
      +ldesc: "Geographic Resources Analysis Support System (GRASS GIS) - daily builds of SVN release branch"
       category: Desktop
       requires: liblas avce00 gpsbabel gs gdal-python matplotlib msvcrt iconv libtiff gdal proj freetype-mingw pdcurses zlib fftw libpng wxpython python-numpy python-pil pyopengl cairo psycopg2
       maintainer: MartinLanda
      -curr: @GRASS_VERSION_NUMBER at -1
      +test: @GRASS_VERSION_NUMBER at -1
       prev: @GRASS_VERSION_NUMBER at -1
      
      
      From svn_grass at osgeo.org  Thu Oct 27 11:38:36 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Thu, 27 Oct 2016 11:38:36 -0700
      Subject: [GRASS-SVN] r69743 - grass/tags
      Message-ID: <20161027183836.7F8783901D3@trac.osgeo.org>
      
      Author: neteler
      Date: 2016-10-27 11:38:36 -0700 (Thu, 27 Oct 2016)
      New Revision: 69743
      
      Added:
         grass/tags/release_20161027_grass_7_2_0RC1/
      Log:
      Tagging release grass_7_2_0RC1
      
      
      From svn_grass at osgeo.org  Thu Oct 27 11:39:22 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Thu, 27 Oct 2016 11:39:22 -0700
      Subject: [GRASS-SVN] r69744 - grass/branches/releasebranch_7_2/include
      Message-ID: <20161027183922.D579E3901D3@trac.osgeo.org>
      
      Author: neteler
      Date: 2016-10-27 11:39:22 -0700 (Thu, 27 Oct 2016)
      New Revision: 69744
      
      Modified:
         grass/branches/releasebranch_7_2/include/VERSION
      Log:
      back to SVN
      
      Modified: grass/branches/releasebranch_7_2/include/VERSION
      ===================================================================
      --- grass/branches/releasebranch_7_2/include/VERSION	2016-10-27 18:38:36 UTC (rev 69743)
      +++ grass/branches/releasebranch_7_2/include/VERSION	2016-10-27 18:39:22 UTC (rev 69744)
      @@ -1,4 +1,4 @@
       7
       2
      -0RC1
      +svn
       2016
      
      
      From svn_grass at osgeo.org  Thu Oct 27 12:55:31 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Thu, 27 Oct 2016 12:55:31 -0700
      Subject: [GRASS-SVN] r69745 - grass-addons/tools/wingrass-packager
      Message-ID: <20161027195531.87ACF3901E5@trac.osgeo.org>
      
      Author: martinl
      Date: 2016-10-27 12:55:31 -0700 (Thu, 27 Oct 2016)
      New Revision: 69745
      
      Modified:
         grass-addons/tools/wingrass-packager/grass_addons.sh
         grass-addons/tools/wingrass-packager/grass_copy_wwwroot.sh
         grass-addons/tools/wingrass-packager/grass_packager_release.bat
      Log:
      wingrass: upgrade for 7.2.0RC1
      
      Modified: grass-addons/tools/wingrass-packager/grass_addons.sh
      ===================================================================
      --- grass-addons/tools/wingrass-packager/grass_addons.sh	2016-10-27 18:39:22 UTC (rev 69744)
      +++ grass-addons/tools/wingrass-packager/grass_addons.sh	2016-10-27 19:55:31 UTC (rev 69745)
      @@ -71,6 +71,7 @@
           compile ${SVN_PATH}/grass7 ${GISBASE_PATH}/grass704        ${ADDON_PATH}/grass704/${PLATFORM_DIR}/addons
           compile ${SVN_PATH}/grass7 ${GISBASE_PATH}/grass705        ${ADDON_PATH}/grass705/${PLATFORM_DIR}/addons
           compile ${SVN_PATH}/grass7 ${GISBASE_PATH}/grass70_release ${ADDON_PATH}/grass70/${PLATFORM_DIR}/addons
      +    compile ${SVN_PATH}/grass7 ${GISBASE_PATH}/grass720RC1     ${ADDON_PATH}/grass720RC1/${PLATFORM_DIR}/addons
           compile ${SVN_PATH}/grass7 ${GISBASE_PATH}/grass72_release ${ADDON_PATH}/grass72/${PLATFORM_DIR}/addons
           compile ${SVN_PATH}/grass7 ${GISBASE_PATH}/grass_trunk     ${ADDON_PATH}/grass73/${PLATFORM_DIR}/addons
       else
      
      Modified: grass-addons/tools/wingrass-packager/grass_copy_wwwroot.sh
      ===================================================================
      --- grass-addons/tools/wingrass-packager/grass_copy_wwwroot.sh	2016-10-27 18:39:22 UTC (rev 69744)
      +++ grass-addons/tools/wingrass-packager/grass_copy_wwwroot.sh	2016-10-27 19:55:31 UTC (rev 69745)
      @@ -89,6 +89,7 @@
           copy_addon 703       7.0.3
           copy_addon 704       7.0.4
           copy_addon 705       7.0.5
      +    copy_addon 720RC1    7.2.0RC1
       else
           copy        $2       $3
       fi
      
      Modified: grass-addons/tools/wingrass-packager/grass_packager_release.bat
      ===================================================================
      --- grass-addons/tools/wingrass-packager/grass_packager_release.bat	2016-10-27 18:39:22 UTC (rev 69744)
      +++ grass-addons/tools/wingrass-packager/grass_packager_release.bat	2016-10-27 19:55:31 UTC (rev 69745)
      @@ -12,8 +12,8 @@
       cd C:\Users\landa\grass_packager
       
       set MAJOR=7
      -set MINOR=0
      -set PATCH=5
      +set MINOR=2
      +set PATCH=0RC1
       set REV=1
       
       set GVERSION=%MAJOR%%MINOR%%PATCH%
      
      
      From svn_grass at osgeo.org  Thu Oct 27 14:20:55 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Thu, 27 Oct 2016 14:20:55 -0700
      Subject: [GRASS-SVN] r69746 - in grass/trunk: temporal
      	temporal/t.rast.neighbors temporal/t.rast.to.rast3
      	temporal/t.vect.observe.strds temporal/t.vect.what.strds
      	vector/v.buffer vector/v.db.select
      Message-ID: <20161027212055.8E3843901E5@trac.osgeo.org>
      
      Author: neteler
      Date: 2016-10-27 14:20:55 -0700 (Thu, 27 Oct 2016)
      New Revision: 69746
      
      Modified:
         grass/trunk/temporal/t.rast.neighbors/t.rast.neighbors.html
         grass/trunk/temporal/t.rast.to.rast3/t.rast.to.rast3.html
         grass/trunk/temporal/t.vect.observe.strds/t.vect.observe.strds.html
         grass/trunk/temporal/t.vect.what.strds/t.vect.what.strds.html
         grass/trunk/temporal/temporalintro.html
         grass/trunk/vector/v.buffer/v.buffer.html
         grass/trunk/vector/v.db.select/v.db.select.html
      Log:
      temporal manual: language improvements (contributed by veroandreo); minor vector manual improvements
      
      Modified: grass/trunk/temporal/t.rast.neighbors/t.rast.neighbors.html
      ===================================================================
      --- grass/trunk/temporal/t.rast.neighbors/t.rast.neighbors.html	2016-10-27 19:55:31 UTC (rev 69745)
      +++ grass/trunk/temporal/t.rast.neighbors/t.rast.neighbors.html	2016-10-27 21:20:55 UTC (rev 69746)
      @@ -7,19 +7,19 @@
       and the aggregation method can be chosen.
       

      The user must provide an input and an output space time raster dataset and -the basename of the resulting raster maps. The resulting STRDS will have +the basename of the resulting raster maps. The resulting STRDS will have the same temporal resolution as the input dataset. All maps will be processed using the current region settings.

      The user can select a subset of the input space time raster dataset for processing using a SQL WHERE statement. The number of CPU's to be used for parallel processing can be specified with the nprocs -option, to speedup the computation on multi-core system. +option to speedup the computation on multi-core system.

      EXAMPLE

      -To smooth the maps contained into a space time dataset run: +To smooth the maps contained in a space time dataset run:
       t.rast.neighbors input=tempmean_monthly output=smooth_tempmean_monthly \
      @@ -76,8 +76,7 @@
        +----------------------------------------------------------------------------+
       
       
      -# now compare the values between original data and the smoothed one
      -t.rast.list input=smooth_tempmean_monthly columns=name,start_time,min,max
      +# now compare the values between the original and the smoothed dataset
       
       t.rast.list input=smooth_tempmean_monthly columns=name,start_time,min,max
       name|start_time|min|max
      
      Modified: grass/trunk/temporal/t.rast.to.rast3/t.rast.to.rast3.html
      ===================================================================
      --- grass/trunk/temporal/t.rast.to.rast3/t.rast.to.rast3.html	2016-10-27 19:55:31 UTC (rev 69745)
      +++ grass/trunk/temporal/t.rast.to.rast3/t.rast.to.rast3.html	2016-10-27 21:20:55 UTC (rev 69746)
      @@ -27,6 +27,27 @@
       based granularity as well. This may result in millions of space time
       voxel cube layers!
       
      +

      Management of open file limits

      +The maximum number of raster maps that can be processed is given by the +per-user limit of the operating system. For example, both the the hard and soft +limit for users is typically 1024. The soft limit can be changed with e.g. +ulimit -n 4096 (UNIX-based operating systems) but not higher than the +hard limit. If the latter is too low, you can as superuser add an entry in + +
      +/etc/security/limits.conf
      +# <domain>      <type>  <item>         <value>
      +your_username  hard    nofile          4096
      +
      + +This will raise the hard limit to 4096 files. Also have a look at the overall +limit of the operating system +
      +cat /proc/sys/fs/file-max
      +
      +which, on modern Linux systems, is several 100,000 files. + +

      EXAMPLE

      To create a voxel map layer from a subset of the tempmean_monthly space time dataset, run: Modified: grass/trunk/temporal/t.vect.observe.strds/t.vect.observe.strds.html =================================================================== --- grass/trunk/temporal/t.vect.observe.strds/t.vect.observe.strds.html 2016-10-27 19:55:31 UTC (rev 69745) +++ grass/trunk/temporal/t.vect.observe.strds/t.vect.observe.strds.html 2016-10-27 21:20:55 UTC (rev 69746) @@ -11,11 +11,11 @@ start to end). A column name must be specified for each input space time raster dataset.

      -As results a new space time vector dataset is generated that contains -a single (new) vector map that links to as many time stamped attribute -tables as raster map layer are present in the input space time raster -dataset. Hence, for each time step in the space time raster dataset a -new attribute table is created. The GRASS GIS Temporal Framework allows +The result is a new space time vector dataset that contains a single +(new) vector map which links to as many time-stamped attribute tables +as raster map layers are present in the input space time raster dataset. +Hence, for each time step in the space time raster dataset a new +attribute table is created. The GRASS GIS Temporal Framework allows to time stamp attribute tables that can be linked to a single vector map layer.

      @@ -29,7 +29,7 @@

      EXAMPLE

      -The example show how to create a space time vector dataset and a vector +The example shows how to create a space time vector dataset and a vector layer starting from a point vector and a space time raster dataset:
      
      Modified: grass/trunk/temporal/t.vect.what.strds/t.vect.what.strds.html
      ===================================================================
      --- grass/trunk/temporal/t.vect.what.strds/t.vect.what.strds.html	2016-10-27 19:55:31 UTC (rev 69745)
      +++ grass/trunk/temporal/t.vect.what.strds/t.vect.what.strds.html	2016-10-27 21:20:55 UTC (rev 69746)
      @@ -1,14 +1,14 @@
       

      DESCRIPTION

      -The module t.vect.what.strds samples a space time raster dataset -at spatio-temporal locations of a space time vector dataset. +The module t.vect.what.strds samples a space time raster dataset +(STRDS) at the spatio-temporal locations of a space time vector dataset (STVDS).

      EXAMPLE

      The example is based on the space time vector dataset "precip_stations at climate_2009_2012" created in the t.vect.observe.strds example. -In below example the command fills the new column "new_temp" with values +In the example below, the module fills the new column "new_temp" with values extracted from the "tempmean_monthly" space time raster dataset:
      
      Modified: grass/trunk/temporal/temporalintro.html
      ===================================================================
      --- grass/trunk/temporal/temporalintro.html	2016-10-27 19:55:31 UTC (rev 69745)
      +++ grass/trunk/temporal/temporalintro.html	2016-10-27 21:20:55 UTC (rev 69746)
      @@ -1,7 +1,7 @@
       
       
       
      -The temporal enabled GRASS introduces three new datatypes that
      +The temporal enabled GRASS introduces three new data types that
       are designed to handle time series data:
       
      • Space time raster datasets (strds) are designed to manage @@ -20,15 +20,17 @@

        Temporal data management in general

        -

        Space time datasets are stored in a temporal database. -A core principle of the temporal framework is that temporal databases are mapset specific. -A new temporal databases is created, when a temporal command is invoked in a mapset -that does not contain a temporal database. For example if a mapset was recently created. -As a result, space-time datasets are mapset specific and can only register raster, 3D raster or -vector maps from the same mapset. By default space-time datasets can not register -maps from other mapsets. This is a security measure, since the registration of maps in -a space-time dataset will always modify the metadata of the registered map. This is critical if: -

        +Space time datasets are stored in a temporal database. A core principle of the +temporal framework is that temporal databases are mapset specific. A new temporal +database is created when a temporal command is invoked in a mapset that does not +contain any temporal databases yet. For example, when a mapset was recently created. +

        +Therefore, as space-time datasets are mapset specific, they can only register +raster, 3D raster or vector maps from the same mapset. +

        +By default, space-time datasets can not register maps from other mapsets. This is +a security measure, since the registration of maps in a space-time dataset will +always modify the metadata of the registered map. This is critical if:

        • The user has no write access to the maps from other mapsets he wants to register @@ -39,64 +41,63 @@
        -SQLite3 or PostgreSQL are supported as temporal database back end. -Temporal databases stored in other mapsets can be accessed as long as they are in the -user's current mapset search path (managed with g.mapsets). -Access to space-time datasets from other mapsets is read only. -They can not be modified or removed. +SQLite3 or PostgreSQL are supported as temporal database backends. +Temporal databases stored in other mapsets can be accessed as long as those +other mapsets are in the user's current mapset search path (managed with +g.mapsets). Access to space-time datasets from +other mapsets is read-only. They can not be modified or removed.

        Connection settings are performed with t.connect. -As default a sqlite3 database will be created in the current mapset that -stores all space time datasets and registered time series maps. -

        -New space time datasets are created in the temporal database with +As default, a SQLite3 database will be created in the current mapset that +stores all space-time datasets and registered time series maps. +

        +New space-time datasets are created in the temporal database with t.create. The name of the new dataset, the type (strds, str3ds, stvds), the title and the description must be -provided for creation. Optional the temporal type (absolute, relative) -and semantic information can be provided. +provided for creation. Optionally, the temporal type (absolute, relative) +and the semantic information can be provided.

        The module t.register is designed to register raster, 3D raster and vector maps in the temporal database and -in space time datasets. It supports different input options. Maps +in the space-time datasets. It supports different input options. Maps to register can be provided as a comma separated string at the command line, or in an input file. The module supports the definition of time stamps (time instances or intervals) for each map in the input file. With t.unregister maps can be unregistered -from space time datasets and the temporal database. -

        +from space-time datasets and from the temporal database. +

        Important
        Use only temporal commands like t.register to attach a time stamp to raster, 3D raster and vector maps. The commands r.timestamp, r3.timestamp and v.timestamp should not be used, since they do not register maps in the temporal database and modify only the metadata of the map in the -spatial database. However maps with timestamps attached with *.timestamp modules -and be registered in space-time datasets using the existing timestamp. +spatial database. However, maps with timestamps attached with *.timestamp modules +can be registered in space-time datasets using the existing timestamp.

        -The module t.remove will remove the space time datasets -from the temporal database and optionally all registered maps. It will take care of multiple map registration, -hence if maps are registered in several space-time datasets in the current mapset. -Use t.support +The module t.remove will remove the space-time datasets +from the temporal database and optionally all registered maps. It will take care +of multiple map registration, hence if maps are registered in several space-time +datasets in the current mapset. +Use t.support to modify the metadata of space time datasets or to update the metadata that is derived from registered maps. This module also checks for removed -and modified maps and updates the space time datasets accordingly. -Rename a space time dataset with t.rename. -

        -To print information about space time datasets or registered maps, the +and modified maps and updates the space-time datasets accordingly. +Rename a space-time dataset with t.rename. +

        +To print information about space-time datasets or registered maps, the module t.info can be used. -t.list will list all space time datasets and +t.list will list all space-time datasets and registered maps in the temporal database.

        -To compute and check the temporal topology of a space time datasets the +To compute and check the temporal topology of space-time datasets the module t.topology was designed. The module -t.sample samples input space time dataset(s) -with a sample space time dataset and print the result to standard output. -Several different sample methods are supported that can be combined. -

        +t.sample samples input space-time dataset(s) +with a sample space-time dataset and prints the result to standard output. +Different sampling methods are supported and can be combined.

        List of general management modules: -

        -

        Modules to visualize space time datasets and temporal data

        +

        Modules to visualize space-time datasets and temporal data

        -

        Modules to process space time raster datasets

        +

        Modules to process space-time raster datasets

        The focus of the temporal GIS framework is the processing and analysis of -raster time series. Hence the majority of the temporal modules are designed to process space time raster -datasets. However, there are several modules to process space time 3D raster datasets -and space time vector datasets. +raster time series. Hence, the majority of the temporal modules are designed +to process space-time raster datasets. However, there are several modules to +process space-time 3D raster datasets and space-time vector datasets.

        Querying and map calculation

        -Registered maps of a space time raster datasets can be listed using +Registered maps of a space-time raster dataset can be listed using t.rast.list. This module supports several -methods how the maps should be listed using SQL queries do determine how -they are selected and sorted. Subsets of space time raster datasets can +methods to list maps and uses SQL queries to determine how these maps +are selected and sorted. Subsets of space-time raster datasets can be extracted with t.rast.extract that -allows additionally to perform mapcalc operations on the selected raster +allows to perform additional mapcalc operations on the selected raster maps. -Additionally, there is v.what.strds. +Moreover, there is v.what.strds, that uploads +space-time raster dataset values at positions of vector points, to the +attribute table of the vector map.

        Aggregation and accumulation analysis

        -The temporal framework support the aggregation of space time raster +The temporal framework supports the aggregation of space-time raster datasets. It provides three modules to perform aggregation using different -approaches. To aggregate a space time raster map using a temporal +approaches. To aggregate a space-time raster map using a temporal granularity like 4 months, 7 days and so on use t.rast.aggregate. The module t.rast.aggregate.ds allows the -aggregation of raster map series using the intervals of the maps (raster, -3D raster and vector) of a 2. space time dataset. A simple interface to +aggregation of a raster map time series using the intervals of the maps (raster, +3D raster and vector) of another space-time dataset. A simple interface to r.series is the module t.rast.series that processes the whole -input space time raster dataset or a subset of it. +input space-time raster dataset or a subset of it.
        • t.rast.aggregate
        • @@ -171,14 +174,14 @@

          Export/import conversion

          -Space time raster datasets can be exported with t.rast.export -as compressed tar archive. Such archives can be imported -using t.rast.import, +Space-time raster datasets can be exported with t.rast.export +as a compressed tar archive. Such archives can then be imported +using t.rast.import.

          The module t.rast.to.rast3 converts -space time raster datasets into space time voxel cubes. All 3D raster modules -can be used to process such voxel cubes. This conversion allows the export of space time raster datasets -as netcdf files that include time as one dimension. +space-time raster datasets into space-time voxel cubes. All 3D raster modules +can be used to process such voxel cubes. This conversion allows the export of +space-time raster datasets as netCDF files that include time as one dimension.

          • t.rast.export
          • @@ -197,7 +200,7 @@

            Modules to manage, process and analyze STR3DS and STVDS

            -Several space time vector dataset modules were developed, to allow the handling +Several space-time vector dataset modules were developed to allow the handling of vector time series data. -The space time 3D raster dataset modules are doing exactly the same as their raster -pendants but with 3D raster map layers: +The space-time 3D raster dataset modules are doing exactly the same as their +raster pendants, but with 3D raster map layers: - Modified: grass/trunk/vector/v.buffer/v.buffer.html =================================================================== --- grass/trunk/vector/v.buffer/v.buffer.html 2016-10-27 19:55:31 UTC (rev 69745) +++ grass/trunk/vector/v.buffer/v.buffer.html 2016-10-27 21:20:55 UTC (rev 69746) @@ -125,6 +125,9 @@

            Buffer inside input areas

            +In this example, an internal buffer ("inward buffer" or "negative buffer") +is generated using a negative distance value: +
             v.buffer input=lakes output=lakes_buffer type=area distance=-50
             
            Modified: grass/trunk/vector/v.db.select/v.db.select.html =================================================================== --- grass/trunk/vector/v.db.select/v.db.select.html 2016-10-27 19:55:31 UTC (rev 69745) +++ grass/trunk/vector/v.db.select/v.db.select.html 2016-10-27 21:20:55 UTC (rev 69746) @@ -55,7 +55,7 @@
      -

      Select empty vector features (no data entries)

      +

      Select not empty vector features (no data entries)

       v.db.select geonames_wake where="ALTERNATEN IS NOT NULL"
      
      
      From svn_grass at osgeo.org  Thu Oct 27 14:24:04 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Thu, 27 Oct 2016 14:24:04 -0700
      Subject: [GRASS-SVN] r69747 - in grass/branches/releasebranch_7_2: temporal
      	temporal/t.rast.neighbors temporal/t.rast.to.rast3
      	temporal/t.vect.observe.strds temporal/t.vect.what.strds
      	vector/v.buffer vector/v.db.select
      Message-ID: <20161027212404.99E0C3901E5@trac.osgeo.org>
      
      Author: neteler
      Date: 2016-10-27 14:24:04 -0700 (Thu, 27 Oct 2016)
      New Revision: 69747
      
      Modified:
         grass/branches/releasebranch_7_2/temporal/t.rast.neighbors/t.rast.neighbors.html
         grass/branches/releasebranch_7_2/temporal/t.rast.to.rast3/t.rast.to.rast3.html
         grass/branches/releasebranch_7_2/temporal/t.vect.observe.strds/t.vect.observe.strds.html
         grass/branches/releasebranch_7_2/temporal/t.vect.what.strds/t.vect.what.strds.html
         grass/branches/releasebranch_7_2/temporal/temporalintro.html
         grass/branches/releasebranch_7_2/vector/v.buffer/v.buffer.html
         grass/branches/releasebranch_7_2/vector/v.db.select/v.db.select.html
      Log:
      temporal manual: language improvements (contributed by veroandreo); minor vector manual improvements (trunk, r69746); temporalintro man sync to trunk
      
      Modified: grass/branches/releasebranch_7_2/temporal/t.rast.neighbors/t.rast.neighbors.html
      ===================================================================
      --- grass/branches/releasebranch_7_2/temporal/t.rast.neighbors/t.rast.neighbors.html	2016-10-27 21:20:55 UTC (rev 69746)
      +++ grass/branches/releasebranch_7_2/temporal/t.rast.neighbors/t.rast.neighbors.html	2016-10-27 21:24:04 UTC (rev 69747)
      @@ -7,19 +7,19 @@
       and the aggregation method can be chosen.
       

      The user must provide an input and an output space time raster dataset and -the basename of the resulting raster maps. The resulting STRDS will have +the basename of the resulting raster maps. The resulting STRDS will have the same temporal resolution as the input dataset. All maps will be processed using the current region settings.

      The user can select a subset of the input space time raster dataset for processing using a SQL WHERE statement. The number of CPU's to be used for parallel processing can be specified with the nprocs -option, to speedup the computation on multi-core system. +option to speedup the computation on multi-core system.

      EXAMPLE

      -To smooth the maps contained into a space time dataset run: +To smooth the maps contained in a space time dataset run:
       t.rast.neighbors input=tempmean_monthly output=smooth_tempmean_monthly \
      @@ -76,8 +76,7 @@
        +----------------------------------------------------------------------------+
       
       
      -# now compare the values between original data and the smoothed one
      -t.rast.list input=smooth_tempmean_monthly columns=name,start_time,min,max
      +# now compare the values between the original and the smoothed dataset
       
       t.rast.list input=smooth_tempmean_monthly columns=name,start_time,min,max
       name|start_time|min|max
      
      Modified: grass/branches/releasebranch_7_2/temporal/t.rast.to.rast3/t.rast.to.rast3.html
      ===================================================================
      --- grass/branches/releasebranch_7_2/temporal/t.rast.to.rast3/t.rast.to.rast3.html	2016-10-27 21:20:55 UTC (rev 69746)
      +++ grass/branches/releasebranch_7_2/temporal/t.rast.to.rast3/t.rast.to.rast3.html	2016-10-27 21:24:04 UTC (rev 69747)
      @@ -27,6 +27,27 @@
       based granularity as well. This may result in millions of space time
       voxel cube layers!
       
      +

      Management of open file limits

      +The maximum number of raster maps that can be processed is given by the +per-user limit of the operating system. For example, both the the hard and soft +limit for users is typically 1024. The soft limit can be changed with e.g. +ulimit -n 4096 (UNIX-based operating systems) but not higher than the +hard limit. If the latter is too low, you can as superuser add an entry in + +
      +/etc/security/limits.conf
      +# <domain>      <type>  <item>         <value>
      +your_username  hard    nofile          4096
      +
      + +This will raise the hard limit to 4096 files. Also have a look at the overall +limit of the operating system +
      +cat /proc/sys/fs/file-max
      +
      +which, on modern Linux systems, is several 100,000 files. + +

      EXAMPLE

      To create a voxel map layer from a subset of the tempmean_monthly space time dataset, run: Modified: grass/branches/releasebranch_7_2/temporal/t.vect.observe.strds/t.vect.observe.strds.html =================================================================== --- grass/branches/releasebranch_7_2/temporal/t.vect.observe.strds/t.vect.observe.strds.html 2016-10-27 21:20:55 UTC (rev 69746) +++ grass/branches/releasebranch_7_2/temporal/t.vect.observe.strds/t.vect.observe.strds.html 2016-10-27 21:24:04 UTC (rev 69747) @@ -11,11 +11,11 @@ start to end). A column name must be specified for each input space time raster dataset.

      -As results a new space time vector dataset is generated that contains -a single (new) vector map that links to as many time stamped attribute -tables as raster map layer are present in the input space time raster -dataset. Hence, for each time step in the space time raster dataset a -new attribute table is created. The GRASS GIS Temporal Framework allows +The result is a new space time vector dataset that contains a single +(new) vector map which links to as many time-stamped attribute tables +as raster map layers are present in the input space time raster dataset. +Hence, for each time step in the space time raster dataset a new +attribute table is created. The GRASS GIS Temporal Framework allows to time stamp attribute tables that can be linked to a single vector map layer.

      @@ -29,7 +29,7 @@

      EXAMPLE

      -The example show how to create a space time vector dataset and a vector +The example shows how to create a space time vector dataset and a vector layer starting from a point vector and a space time raster dataset:
      
      Modified: grass/branches/releasebranch_7_2/temporal/t.vect.what.strds/t.vect.what.strds.html
      ===================================================================
      --- grass/branches/releasebranch_7_2/temporal/t.vect.what.strds/t.vect.what.strds.html	2016-10-27 21:20:55 UTC (rev 69746)
      +++ grass/branches/releasebranch_7_2/temporal/t.vect.what.strds/t.vect.what.strds.html	2016-10-27 21:24:04 UTC (rev 69747)
      @@ -1,14 +1,14 @@
       

      DESCRIPTION

      -The module t.vect.what.strds samples a space time raster dataset -at spatio-temporal locations of a space time vector dataset. +The module t.vect.what.strds samples a space time raster dataset +(STRDS) at the spatio-temporal locations of a space time vector dataset (STVDS).

      EXAMPLE

      The example is based on the space time vector dataset "precip_stations at climate_2009_2012" created in the t.vect.observe.strds example. -In below example the command fills the new column "new_temp" with values +In the example below, the module fills the new column "new_temp" with values extracted from the "tempmean_monthly" space time raster dataset:
      
      Modified: grass/branches/releasebranch_7_2/temporal/temporalintro.html
      ===================================================================
      --- grass/branches/releasebranch_7_2/temporal/temporalintro.html	2016-10-27 21:20:55 UTC (rev 69746)
      +++ grass/branches/releasebranch_7_2/temporal/temporalintro.html	2016-10-27 21:24:04 UTC (rev 69747)
      @@ -1,7 +1,7 @@
       
       
       
      -The temporal enabled GRASS introduces three new datatypes that
      +The temporal enabled GRASS introduces three new data types that
       are designed to handle time series data:
       
      • Space time raster datasets (strds) are designed to manage @@ -20,49 +20,84 @@

        Temporal data management in general

        -Space time datasets are stored in a temporal database. SQLite3 or -PostgreSQL are supported as SQL database back end. Temporal databases -stored in other mapsets can be used as long as they are in the -user's current mapset search path (managed with g.mapsets). +Space time datasets are stored in a temporal database. A core principle of the +temporal framework is that temporal databases are mapset specific. A new temporal +database is created when a temporal command is invoked in a mapset that does not +contain any temporal databases yet. For example, when a mapset was recently created.

        +Therefore, as space-time datasets are mapset specific, they can only register +raster, 3D raster or vector maps from the same mapset. +

        +By default, space-time datasets can not register maps from other mapsets. This is +a security measure, since the registration of maps in a space-time dataset will +always modify the metadata of the registered map. This is critical if: +

          +
        • + The user has no write access to the maps from other mapsets he wants to register +
        • +
        • + If registered maps are removed from other mapsets, the temporal database will not be updated + and will contain ghost maps +
        • +
        + +SQLite3 or PostgreSQL are supported as temporal database backends. +Temporal databases stored in other mapsets can be accessed as long as those +other mapsets are in the user's current mapset search path (managed with +g.mapsets). Access to space-time datasets from +other mapsets is read-only. They can not be modified or removed. +

        Connection settings are performed with t.connect. -As default a sqlite3 database will be created in the current mapset that -stores all space time datasets and registered time series maps. +As default, a SQLite3 database will be created in the current mapset that +stores all space-time datasets and registered time series maps.

        -New space time datasets are created in the temporal database with +New space-time datasets are created in the temporal database with t.create. The name of the new dataset, the type (strds, str3ds, stvds), the title and the description must be -provided for creation. Optional the temporal type (absolute, relative) -and semantic information can be provided. +provided for creation. Optionally, the temporal type (absolute, relative) +and the semantic information can be provided.

        -The module t.remove will remove the space time datasets -from the temporal database. Use t.support -to modify the metadata of space time datasets or to update the metadata -that is derived from registered maps. This module also checks for removed -and modified maps and updates the space time datasets accordingly. -Rename a space time dataset with t.rename. -

        -The module t.register is designed to +The module t.register is designed to register raster, 3D raster and vector maps in the temporal database and -optionally in a space time dataset. It supports different input options. Maps +in the space-time datasets. It supports different input options. Maps to register can be provided as a comma separated string at the command line, or -in an input file. The module supports the definition of time stamps +in an input file. The module supports the definition of time stamps (time instances or intervals) for each map in the input file. With t.unregister maps can be unregistered -from space time datasets and the temporal database. +from space-time datasets and from the temporal database.

        -To print information about space time datasets or registered maps, the + +Important
        +Use only temporal commands like t.register to attach a time stamp to +raster, 3D raster and vector maps. The commands r.timestamp, r3.timestamp and +v.timestamp should not be used, since they do not register maps in +the temporal database and modify only the metadata of the map in the +spatial database. However, maps with timestamps attached with *.timestamp modules +can be registered in space-time datasets using the existing timestamp. + +

        +The module t.remove will remove the space-time datasets +from the temporal database and optionally all registered maps. It will take care +of multiple map registration, hence if maps are registered in several space-time +datasets in the current mapset. +Use t.support +to modify the metadata of space time datasets or to update the metadata +that is derived from registered maps. This module also checks for removed +and modified maps and updates the space-time datasets accordingly. +Rename a space-time dataset with t.rename. +

        +To print information about space-time datasets or registered maps, the module t.info can be used. -t.list will list all space time datasets and +t.list will list all space-time datasets and registered maps in the temporal database.

        -To compute and check the temporal topology of a space time datasets the +To compute and check the temporal topology of space-time datasets the module t.topology was designed. The module -t.sample samples input space time dataset(s) -with a sample space time dataset and print the result to standard output. -Several different sample methods are supported that can be combined. +t.sample samples input space-time dataset(s) +with a sample space-time dataset and prints the result to standard output. +Different sampling methods are supported and can be combined.

        -List of general management modules: +List of general management modules:

        -

        Modules to visualize space time datasets and temporal data

        +

        Modules to visualize space-time datasets and temporal data

        -

        Modules to process space time raster datasets

        +

        Modules to process space-time raster datasets

        The focus of the temporal GIS framework is the processing and analysis of -raster time series. Hence the majority of the temporal modules are designed to process space time raster -datasets. However, there are several modules to process space time 3D raster datasets -and space time vector datasets. +raster time series. Hence, the majority of the temporal modules are designed +to process space-time raster datasets. However, there are several modules to +process space-time 3D raster datasets and space-time vector datasets.

        Querying and map calculation

        -Registered maps of a space time raster datasets can be listed using +Registered maps of a space-time raster dataset can be listed using t.rast.list. This module supports several -methods how the maps should be listed using SQL queries do determine how -they are selected and sorted. Subsets of space time raster datasets can +methods to list maps and uses SQL queries to determine how these maps +are selected and sorted. Subsets of space-time raster datasets can be extracted with t.rast.extract that -allows additionally to perform mapcalc operations on the selected raster +allows to perform additional mapcalc operations on the selected raster maps. -Additionally, there is v.what.strds. +Moreover, there is v.what.strds, that uploads +space-time raster dataset values at positions of vector points, to the +attribute table of the vector map.

        Aggregation and accumulation analysis

        -The temporal framework support the aggregation of space time raster +The temporal framework supports the aggregation of space-time raster datasets. It provides three modules to perform aggregation using different -approaches. To aggregate a space time raster map using a temporal +approaches. To aggregate a space-time raster map using a temporal granularity like 4 months, 7 days and so on use t.rast.aggregate. The module t.rast.aggregate.ds allows the -aggregation of raster map series using the intervals of the maps (raster, -3D raster and vector) of a 2. space time dataset. A simple interface to +aggregation of a raster map time series using the intervals of the maps (raster, +3D raster and vector) of another space-time dataset. A simple interface to r.series is the module t.rast.series that processes the whole -input space time raster dataset or a subset of it. +input space-time raster dataset or a subset of it.
        • t.rast.aggregate
        • @@ -137,14 +174,14 @@

          Export/import conversion

          -Space time raster datasets can be exported with t.rast.export -as compressed tar archive. Such archives can be imported -using t.rast.import, +Space-time raster datasets can be exported with t.rast.export +as a compressed tar archive. Such archives can then be imported +using t.rast.import.

          The module t.rast.to.rast3 converts -space time raster datasets into space time voxel cubes. All 3D raster modules -can be used to process such voxel cubes. This conversion allows the export of space time raster datasets -as netcdf files that include time as one dimension. +space-time raster datasets into space-time voxel cubes. All 3D raster modules +can be used to process such voxel cubes. This conversion allows the export of +space-time raster datasets as netCDF files that include time as one dimension.

          • t.rast.export
          • @@ -163,7 +200,7 @@

            Modules to manage, process and analyze STR3DS and STVDS

            -Several space time vector dataset modules were developed, to allow the handling +Several space-time vector dataset modules were developed to allow the handling of vector time series data. -The space time 3D raster dataset modules are doing exactly the same as their raster -pendants but with 3D raster map layers: +The space-time 3D raster dataset modules are doing exactly the same as their +raster pendants, but with 3D raster map layers: - Modified: grass/branches/releasebranch_7_2/vector/v.buffer/v.buffer.html =================================================================== --- grass/branches/releasebranch_7_2/vector/v.buffer/v.buffer.html 2016-10-27 21:20:55 UTC (rev 69746) +++ grass/branches/releasebranch_7_2/vector/v.buffer/v.buffer.html 2016-10-27 21:24:04 UTC (rev 69747) @@ -125,6 +125,9 @@

            Buffer inside input areas

            +In this example, an internal buffer ("inward buffer" or "negative buffer") +is generated using a negative distance value: +
             v.buffer input=lakes output=lakes_buffer type=area distance=-50
             
            Modified: grass/branches/releasebranch_7_2/vector/v.db.select/v.db.select.html =================================================================== --- grass/branches/releasebranch_7_2/vector/v.db.select/v.db.select.html 2016-10-27 21:20:55 UTC (rev 69746) +++ grass/branches/releasebranch_7_2/vector/v.db.select/v.db.select.html 2016-10-27 21:24:04 UTC (rev 69747) @@ -55,7 +55,7 @@
      -

      Select empty vector features (no data entries)

      +

      Select not empty vector features (no data entries)

       v.db.select geonames_wake where="ALTERNATEN IS NOT NULL"
      
      
      From svn_grass at osgeo.org  Fri Oct 28 07:01:13 2016
      From: svn_grass at osgeo.org (svn_grass at osgeo.org)
      Date: Fri, 28 Oct 2016 07:01:13 -0700
      Subject: [GRASS-SVN] r69748 - in grass/trunk: imagery/i.landsat.toar raster
      	raster/r.compress raster/r.patch temporal
      	temporal/t.rast.algebra temporal/t.select vector/v.generalize
      Message-ID: <20161028140113.993053901E5@trac.osgeo.org>
      
      Author: martinl
      Date: 2016-10-28 07:01:13 -0700 (Fri, 28 Oct 2016)
      New Revision: 69748
      
      Modified:
         grass/trunk/imagery/i.landsat.toar/landsat_set.c
         grass/trunk/raster/r.compress/r.compress.html
         grass/trunk/raster/r.patch/r.patch.html
         grass/trunk/raster/rasterintro.html
         grass/trunk/temporal/t.rast.algebra/t.rast.algebra.py
         grass/trunk/temporal/t.select/t.select.py
         grass/trunk/temporal/temporalintro.html
         grass/trunk/vector/v.generalize/v.generalize.html
      Log:
      Patch to fix various spelling errors (see #3194)
      
      Modified: grass/trunk/imagery/i.landsat.toar/landsat_set.c
      ===================================================================
      --- grass/trunk/imagery/i.landsat.toar/landsat_set.c	2016-10-27 21:24:04 UTC (rev 69747)
      +++ grass/trunk/imagery/i.landsat.toar/landsat_set.c	2016-10-28 14:01:13 UTC (rev 69748)
      @@ -378,7 +378,7 @@
           /* Spectral radiances at detector */
           double Lmax[][4] = {
       	{240., 170., 150., 127.},	/* before   April 6, 1984    */
      -	{268., 179., 159., 123.},	/* betweeen                  */
      +	{268., 179., 159., 123.},	/* between                   */
       	{268., 179., 148., 123.}	/* after    November 9, 1984 */
           };
           double Lmin[][4] = {
      
      Modified: grass/trunk/raster/r.compress/r.compress.html
      ===================================================================
      --- grass/trunk/raster/r.compress/r.compress.html	2016-10-27 21:24:04 UTC (rev 69747)
      +++ grass/trunk/raster/r.compress/r.compress.html	2016-10-28 14:01:13 UTC (rev 69748)
      @@ -114,7 +114,7 @@
       
      ZLIB
      ZLIB's deflate is the default compression method for all raster maps. GRASS GIS 7 uses by default 1 as ZLIB compression level which is the -best compromise betweeen speed and compression ratio, also when +best compromise between speed and compression ratio, also when compared to other available compression methods. Valid levels are in the range [1, 9] and can be set with the environment variable GRASS_ZLIB_LEVEL.
      Modified: grass/trunk/raster/r.patch/r.patch.html =================================================================== --- grass/trunk/raster/r.patch/r.patch.html 2016-10-27 21:24:04 UTC (rev 69747) +++ grass/trunk/raster/r.patch/r.patch.html 2016-10-28 14:01:13 UTC (rev 69748) @@ -84,7 +84,7 @@ from the input maps and creates these files for the patched, composite output map. This can be quite time consuming for certain maps, especially if there are many different category values -across the patched maps. The -s flag allows to disable the reading +across the patched maps. The -s flag allows disabling the reading and creation of these support files, meaning that the output map will have no category labels and no explicit color table. Modified: grass/trunk/raster/rasterintro.html =================================================================== --- grass/trunk/raster/rasterintro.html 2016-10-27 21:24:04 UTC (rev 69747) +++ grass/trunk/raster/rasterintro.html 2016-10-28 14:01:13 UTC (rev 69748) @@ -302,7 +302,7 @@
      ZLIB
      ZLIB's deflate is the default compression method for all raster maps. GRASS GIS 7 uses by default 1 as ZLIB compression level which is the -best compromise betweeen speed and compression ratio, also when +best compromise between speed and compression ratio, also when compared to other available compression methods. Valid levels are in the range [1, 9] and can be set with the environment variable GRASS_ZLIB_LEVEL.
      Modified: grass/trunk/temporal/t.rast.algebra/t.rast.algebra.py =================================================================== --- grass/trunk/temporal/t.rast.algebra/t.rast.algebra.py 2016-10-27 21:24:04 UTC (rev 69747) +++ grass/trunk/temporal/t.rast.algebra/t.rast.algebra.py 2016-10-28 14:01:13 UTC (rev 69748) @@ -65,7 +65,7 @@ #%flag #% key: d -#% description: Perform a dry run, compute all depenencies and module calls but don't run them +#% description: Perform a dry run, compute all dependencies and module calls but don't run them #%end import grass.script Modified: grass/trunk/temporal/t.select/t.select.py =================================================================== --- grass/trunk/temporal/t.select/t.select.py 2016-10-27 21:24:04 UTC (rev 69747) +++ grass/trunk/temporal/t.select/t.select.py 2016-10-28 14:01:13 UTC (rev 69748) @@ -42,7 +42,7 @@ #%flag #% key: d -#% description: Perform a dry run, compute all depenencies and module calls but don't run them +#% description: Perform a dry run, compute all dependencies and module calls but don't run them #%end Modified: grass/trunk/temporal/temporalintro.html =================================================================== --- grass/trunk/temporal/temporalintro.html 2016-10-27 21:24:04 UTC (rev 69747) +++ grass/trunk/temporal/temporalintro.html 2016-10-28 14:01:13 UTC (rev 69748) @@ -135,7 +135,7 @@ methods to list maps and uses SQL queries to determine how these maps are selected and sorted. Subsets of space-time raster datasets can be extracted with t.rast.extract that -allows to perform additional mapcalc operations on the selected raster +allows performing additional mapcalc operations on the selected raster maps.
        Modified: grass/trunk/vector/v.generalize/v.generalize.html =================================================================== --- grass/trunk/vector/v.generalize/v.generalize.html 2016-10-27 21:24:04 UTC (rev 69747) +++ grass/trunk/vector/v.generalize/v.generalize.html 2016-10-28 14:01:13 UTC (rev 69748) @@ -29,7 +29,7 @@

        Lines and boundaries are not translated if they would collapse to a single point. Boundaries are not translated if they would intersect -with themselves or other boundaries. Such erroneus features are written +with themselves or other boundaries. Such erroneous features are written to an optional error vector map. Overlaying the error map over the generalized map indicates the kind of error. Lines/boundaries collapsing to a point are written out as points, From svn_grass at osgeo.org Fri Oct 28 07:02:22 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Fri, 28 Oct 2016 07:02:22 -0700 Subject: [GRASS-SVN] r69749 - in grass/branches/releasebranch_7_2: imagery/i.landsat.toar raster raster/r.compress raster/r.patch temporal temporal/t.rast.algebra temporal/t.select vector/v.generalize Message-ID: <20161028140222.0D3E33901E5@trac.osgeo.org> Author: martinl Date: 2016-10-28 07:02:21 -0700 (Fri, 28 Oct 2016) New Revision: 69749 Modified: grass/branches/releasebranch_7_2/imagery/i.landsat.toar/landsat_set.c grass/branches/releasebranch_7_2/raster/r.compress/r.compress.html grass/branches/releasebranch_7_2/raster/r.patch/r.patch.html grass/branches/releasebranch_7_2/raster/rasterintro.html grass/branches/releasebranch_7_2/temporal/t.rast.algebra/t.rast.algebra.py grass/branches/releasebranch_7_2/temporal/t.select/t.select.py grass/branches/releasebranch_7_2/temporal/temporalintro.html grass/branches/releasebranch_7_2/vector/v.generalize/v.generalize.html Log: Patch to fix various spelling errors (relbr72; see #3194) Modified: grass/branches/releasebranch_7_2/imagery/i.landsat.toar/landsat_set.c =================================================================== --- grass/branches/releasebranch_7_2/imagery/i.landsat.toar/landsat_set.c 2016-10-28 14:01:13 UTC (rev 69748) +++ grass/branches/releasebranch_7_2/imagery/i.landsat.toar/landsat_set.c 2016-10-28 14:02:21 UTC (rev 69749) @@ -378,7 +378,7 @@ /* Spectral radiances at detector */ double Lmax[][4] = { {240., 170., 150., 127.}, /* before April 6, 1984 */ - {268., 179., 159., 123.}, /* betweeen */ + {268., 179., 159., 123.}, /* between */ {268., 179., 148., 123.} /* after November 9, 1984 */ }; double Lmin[][4] = { Modified: grass/branches/releasebranch_7_2/raster/r.compress/r.compress.html =================================================================== --- grass/branches/releasebranch_7_2/raster/r.compress/r.compress.html 2016-10-28 14:01:13 UTC (rev 69748) +++ grass/branches/releasebranch_7_2/raster/r.compress/r.compress.html 2016-10-28 14:02:21 UTC (rev 69749) @@ -114,7 +114,7 @@

        ZLIB
        ZLIB's deflate is the default compression method for all raster maps. GRASS GIS 7 uses by default 1 as ZLIB compression level which is the -best compromise betweeen speed and compression ratio, also when +best compromise between speed and compression ratio, also when compared to other available compression methods. Valid levels are in the range [1, 9] and can be set with the environment variable GRASS_ZLIB_LEVEL.
        Modified: grass/branches/releasebranch_7_2/raster/r.patch/r.patch.html =================================================================== --- grass/branches/releasebranch_7_2/raster/r.patch/r.patch.html 2016-10-28 14:01:13 UTC (rev 69748) +++ grass/branches/releasebranch_7_2/raster/r.patch/r.patch.html 2016-10-28 14:02:21 UTC (rev 69749) @@ -84,7 +84,7 @@ from the input maps and creates these files for the patched, composite output map. This can be quite time consuming for certain maps, especially if there are many different category values -across the patched maps. The -s flag allows to disable the reading +across the patched maps. The -s flag allows disabling the reading and creation of these support files, meaning that the output map will have no category labels and no explicit color table. Modified: grass/branches/releasebranch_7_2/raster/rasterintro.html =================================================================== --- grass/branches/releasebranch_7_2/raster/rasterintro.html 2016-10-28 14:01:13 UTC (rev 69748) +++ grass/branches/releasebranch_7_2/raster/rasterintro.html 2016-10-28 14:02:21 UTC (rev 69749) @@ -302,7 +302,7 @@
        ZLIB
        ZLIB's deflate is the default compression method for all raster maps. GRASS GIS 7 uses by default 1 as ZLIB compression level which is the -best compromise betweeen speed and compression ratio, also when +best compromise between speed and compression ratio, also when compared to other available compression methods. Valid levels are in the range [1, 9] and can be set with the environment variable GRASS_ZLIB_LEVEL.
        Modified: grass/branches/releasebranch_7_2/temporal/t.rast.algebra/t.rast.algebra.py =================================================================== --- grass/branches/releasebranch_7_2/temporal/t.rast.algebra/t.rast.algebra.py 2016-10-28 14:01:13 UTC (rev 69748) +++ grass/branches/releasebranch_7_2/temporal/t.rast.algebra/t.rast.algebra.py 2016-10-28 14:02:21 UTC (rev 69749) @@ -65,7 +65,7 @@ #%flag #% key: d -#% description: Perform a dry run, compute all depenencies and module calls but don't run them +#% description: Perform a dry run, compute all dependencies and module calls but don't run them #%end import grass.script Modified: grass/branches/releasebranch_7_2/temporal/t.select/t.select.py =================================================================== --- grass/branches/releasebranch_7_2/temporal/t.select/t.select.py 2016-10-28 14:01:13 UTC (rev 69748) +++ grass/branches/releasebranch_7_2/temporal/t.select/t.select.py 2016-10-28 14:02:21 UTC (rev 69749) @@ -42,7 +42,7 @@ #%flag #% key: d -#% description: Perform a dry run, compute all depenencies and module calls but don't run them +#% description: Perform a dry run, compute all dependencies and module calls but don't run them #%end Modified: grass/branches/releasebranch_7_2/temporal/temporalintro.html =================================================================== --- grass/branches/releasebranch_7_2/temporal/temporalintro.html 2016-10-28 14:01:13 UTC (rev 69748) +++ grass/branches/releasebranch_7_2/temporal/temporalintro.html 2016-10-28 14:02:21 UTC (rev 69749) @@ -135,7 +135,7 @@ methods to list maps and uses SQL queries to determine how these maps are selected and sorted. Subsets of space-time raster datasets can be extracted with t.rast.extract that -allows to perform additional mapcalc operations on the selected raster +allows performing additional mapcalc operations on the selected raster maps.
          Modified: grass/branches/releasebranch_7_2/vector/v.generalize/v.generalize.html =================================================================== --- grass/branches/releasebranch_7_2/vector/v.generalize/v.generalize.html 2016-10-28 14:01:13 UTC (rev 69748) +++ grass/branches/releasebranch_7_2/vector/v.generalize/v.generalize.html 2016-10-28 14:02:21 UTC (rev 69749) @@ -29,7 +29,7 @@

          Lines and boundaries are not translated if they would collapse to a single point. Boundaries are not translated if they would intersect -with themselves or other boundaries. Such erroneus features are written +with themselves or other boundaries. Such erroneous features are written to an optional error vector map. Overlaying the error map over the generalized map indicates the kind of error. Lines/boundaries collapsing to a point are written out as points, From svn_grass at osgeo.org Fri Oct 28 12:04:25 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Fri, 28 Oct 2016 12:04:25 -0700 Subject: [GRASS-SVN] r69750 - grass-addons/grass7/raster/r.mcda.promethee Message-ID: <20161028190425.5A1A9390157@trac.osgeo.org> Author: gianluca Date: 2016-10-28 12:04:25 -0700 (Fri, 28 Oct 2016) New Revision: 69750 Modified: grass-addons/grass7/raster/r.mcda.promethee/Makefile grass-addons/grass7/raster/r.mcda.promethee/promethee.c Log: bug with <-nan> negative flow corrected Modified: grass-addons/grass7/raster/r.mcda.promethee/Makefile =================================================================== --- grass-addons/grass7/raster/r.mcda.promethee/Makefile 2016-10-28 14:02:21 UTC (rev 69749) +++ grass-addons/grass7/raster/r.mcda.promethee/Makefile 2016-10-28 19:04:25 UTC (rev 69750) @@ -1,4 +1,5 @@ MODULE_TOPDIR = ../.. + PGM = r.mcda.promethee LIBES = $(RASTERLIB) $(GISLIB) $(MATHLIB) @@ -6,4 +7,5 @@ include $(MODULE_TOPDIR)/include/Make/Module.make + default: cmd Modified: grass-addons/grass7/raster/r.mcda.promethee/promethee.c =================================================================== --- grass-addons/grass7/raster/r.mcda.promethee/promethee.c 2016-10-28 14:02:21 UTC (rev 69749) +++ grass-addons/grass7/raster/r.mcda.promethee/promethee.c 2016-10-28 19:04:25 UTC (rev 69750) @@ -30,7 +30,9 @@ if (nweight != ncriteria) + { G_fatal_error(_("criteria number and weight number are different")); + } for (i = 0; i < nweight; i++) @@ -59,7 +61,7 @@ /* make pairwise comparation and build positive flow matrix */ for (i = 0; i < ncriteria; i++) { - G_percent(i, (ncriteria), 1); + G_message("Processing criteria #%d ...",i+1); for (row1 = 0; row1 < nrows; row1++) { for (col1 = 0; col1 < ncols; col1++) @@ -70,18 +72,23 @@ //G_percent(row2, (nrows), 2); for (col2 = 0; col2 < ncols; col2++) { + G_percent(row2, (nrows), 2); threshold = (decision_vol[row1][col1][i] - decision_vol[row2][col2][i]); + if (threshold>0) /* if therehold is positive, it fill the positive flow*/ { positive_flow_vol[row1][col1]=positive_flow_vol[row1][col1]+(threshold*weight_vect[i]); negative_flow_vol[row1][col1]=negative_flow_vol[row1][col1]; } - else /* if thershold is negative, it fill the negative flow*/ + else if (threshold<0)/* if thershold is negative, it fill the negative flow*/ { negative_flow_vol[row1][col1]=negative_flow_vol[row1][col1]+(-threshold*weight_vect[i]); positive_flow_vol[row1][col1]=positive_flow_vol[row1][col1]; } + else + negative_flow_vol[row1][col1]=negative_flow_vol[row1][col1]; + positive_flow_vol[row1][col1]=positive_flow_vol[row1][col1]; } } } From svn_grass at osgeo.org Fri Oct 28 13:55:24 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Fri, 28 Oct 2016 13:55:24 -0700 Subject: [GRASS-SVN] r69751 - grass/trunk/lib/raster Message-ID: <20161028205524.8694D3901E5@trac.osgeo.org> Author: mmetz Date: 2016-10-28 13:55:24 -0700 (Fri, 28 Oct 2016) New Revision: 69751 Modified: grass/trunk/lib/raster/close.c grass/trunk/lib/raster/open.c Log: rasterlib: fix memory leak for compressed null files Modified: grass/trunk/lib/raster/close.c =================================================================== --- grass/trunk/lib/raster/close.c 2016-10-28 19:04:25 UTC (rev 69750) +++ grass/trunk/lib/raster/close.c 2016-10-28 20:55:24 UTC (rev 69751) @@ -155,6 +155,8 @@ if (fcb->null_bits) G_free(fcb->null_bits); + if (fcb->null_row_ptr) + G_free(fcb->null_row_ptr); if (fcb->null_fd >= 0) close(fcb->null_fd); fcb->null_fd = -1; @@ -478,6 +480,9 @@ G_free(fcb->null_bits); + if (fcb->null_row_ptr) + G_free(fcb->null_row_ptr); + if (fcb->map_type != CELL_TYPE) Rast_quant_free(&fcb->quant); Modified: grass/trunk/lib/raster/open.c =================================================================== --- grass/trunk/lib/raster/open.c 2016-10-28 19:04:25 UTC (rev 69750) +++ grass/trunk/lib/raster/open.c 2016-10-28 20:55:24 UTC (rev 69751) @@ -708,6 +708,7 @@ fcb->null_temp_name = tempname; + fcb->null_row_ptr = NULL; if (R__.compress_nulls) { fcb->null_row_ptr = G_calloc(fcb->cellhd.rows + 1, sizeof(off_t)); G_zero(fcb->row_ptr, (fcb->cellhd.rows + 1) * sizeof(off_t)); From svn_grass at osgeo.org Fri Oct 28 14:25:12 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Fri, 28 Oct 2016 14:25:12 -0700 Subject: [GRASS-SVN] r69752 - grass-addons/grass7/vector/v.surf.tps Message-ID: <20161028212512.93B0B390157@trac.osgeo.org> Author: mmetz Date: 2016-10-28 14:25:12 -0700 (Fri, 28 Oct 2016) New Revision: 69752 Modified: grass-addons/grass7/vector/v.surf.tps/main.c grass-addons/grass7/vector/v.surf.tps/tps.c grass-addons/grass7/vector/v.surf.tps/v.surf.tps.html Log: v.surf.tps: reduce tiling artefacts Modified: grass-addons/grass7/vector/v.surf.tps/main.c =================================================================== --- grass-addons/grass7/vector/v.surf.tps/main.c 2016-10-28 20:55:24 UTC (rev 69751) +++ grass-addons/grass7/vector/v.surf.tps/main.c 2016-10-28 21:25:12 UTC (rev 69752) @@ -113,7 +113,7 @@ ov_opt->key = "overlap"; ov_opt->type = TYPE_DOUBLE; ov_opt->required = NO; - ov_opt->answer = "0.8"; + ov_opt->answer = "0.1"; ov_opt->label = _("Overlap factor <= 1"); ov_opt->description = Modified: grass-addons/grass7/vector/v.surf.tps/tps.c =================================================================== --- grass-addons/grass7/vector/v.surf.tps/tps.c 2016-10-28 20:55:24 UTC (rev 69751) +++ grass-addons/grass7/vector/v.surf.tps/tps.c 2016-10-28 21:25:12 UTC (rev 69752) @@ -214,8 +214,10 @@ break; } } - if (isnull) + if (isnull) { + Rast_set_d_null_value(&outbuf[col], 1); continue; + } } result = B[0]; @@ -544,6 +546,13 @@ wmin = 10; wmax = 0; + if (overlap > 1.0) + overlap = 1.0; + if (overlap < 0.0) + overlap = 0.0; + /* keep in sync with weight calculation below */ + overlap = exp((overlap - 1.0) * 8.0); + for (ridx = 0; ridx < nrows; ridx++) { G_percent(ridx, nrows, 1); @@ -851,15 +860,12 @@ } } - dx = abs(icol - col) / dxi; - dy = abs(irow - row) / dyi; + dx = fabs(2.0 * icol - (icol2 + icol1)) / dxi; + dy = fabs(2.0 * irow - (irow2 + irow1)) / dyi; - dx = fabs(icol - (icol2 + icol1) / 2.0) / dxi; - dy = fabs(irow - (irow2 + irow1) / 2.0) / dyi; - dist2 = (dx * dx + dy * dy); - weight = exp(-dist2 * 2); + weight = exp(-dist2 * 4.0); if (wmin > weight) wmin = weight; Modified: grass-addons/grass7/vector/v.surf.tps/v.surf.tps.html =================================================================== --- grass-addons/grass7/vector/v.surf.tps/v.surf.tps.html 2016-10-28 20:55:24 UTC (rev 69751) +++ grass-addons/grass7/vector/v.surf.tps/v.surf.tps.html 2016-10-28 21:25:12 UTC (rev 69752) @@ -30,7 +30,8 @@ the min option is smaller than the numer of input points. Tiling artefacts occur with low values for the min option and the overlap option. Increasing both options will reduce tiling -artefacts but processing will take more time. +artefacts but processing will take more time. Values for the +overlap option must be between 0 and 1.

          The module works best with evenly spaced sparse points. In case of From svn_grass at osgeo.org Fri Oct 28 15:00:40 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Fri, 28 Oct 2016 15:00:40 -0700 Subject: [GRASS-SVN] r69753 - grass/branches/releasebranch_7_2/lib/raster Message-ID: <20161028220040.6D3A53901E5@trac.osgeo.org> Author: mmetz Date: 2016-10-28 15:00:39 -0700 (Fri, 28 Oct 2016) New Revision: 69753 Modified: grass/branches/releasebranch_7_2/lib/raster/close.c grass/branches/releasebranch_7_2/lib/raster/open.c Log: rasterlib: fix memory leak for compressed null files (backport from trunk r69751) Modified: grass/branches/releasebranch_7_2/lib/raster/close.c =================================================================== --- grass/branches/releasebranch_7_2/lib/raster/close.c 2016-10-28 21:25:12 UTC (rev 69752) +++ grass/branches/releasebranch_7_2/lib/raster/close.c 2016-10-28 22:00:39 UTC (rev 69753) @@ -155,6 +155,8 @@ if (fcb->null_bits) G_free(fcb->null_bits); + if (fcb->null_row_ptr) + G_free(fcb->null_row_ptr); if (fcb->null_fd >= 0) close(fcb->null_fd); fcb->null_fd = -1; @@ -478,6 +480,9 @@ G_free(fcb->null_bits); + if (fcb->null_row_ptr) + G_free(fcb->null_row_ptr); + if (fcb->map_type != CELL_TYPE) Rast_quant_free(&fcb->quant); Modified: grass/branches/releasebranch_7_2/lib/raster/open.c =================================================================== --- grass/branches/releasebranch_7_2/lib/raster/open.c 2016-10-28 21:25:12 UTC (rev 69752) +++ grass/branches/releasebranch_7_2/lib/raster/open.c 2016-10-28 22:00:39 UTC (rev 69753) @@ -708,6 +708,7 @@ fcb->null_temp_name = tempname; + fcb->null_row_ptr = NULL; if (R__.compress_nulls) { fcb->null_row_ptr = G_calloc(fcb->cellhd.rows + 1, sizeof(off_t)); G_zero(fcb->row_ptr, (fcb->cellhd.rows + 1) * sizeof(off_t)); From svn_grass at osgeo.org Sat Oct 29 15:01:54 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 29 Oct 2016 15:01:54 -0700 Subject: [GRASS-SVN] r69754 - in grass/trunk/gui/wxpython: mapdisp mapwin Message-ID: <20161029220154.435B93901E5@trac.osgeo.org> Author: annakrat Date: 2016-10-29 15:01:52 -0700 (Sat, 29 Oct 2016) New Revision: 69754 Modified: grass/trunk/gui/wxpython/mapdisp/frame.py grass/trunk/gui/wxpython/mapwin/buffered.py Log: fix d.to.rast, which was broken since new rendering Modified: grass/trunk/gui/wxpython/mapdisp/frame.py =================================================================== --- grass/trunk/gui/wxpython/mapdisp/frame.py 2016-10-28 22:00:39 UTC (rev 69753) +++ grass/trunk/gui/wxpython/mapdisp/frame.py 2016-10-29 22:01:52 UTC (rev 69754) @@ -665,7 +665,7 @@ dlg.Destroy() - def DOutFile(self, command): + def DOutFile(self, command, callback=None): """Saves map to image by running d.out.file from gui or d.mon. Command is expected to be validated by parser. """ @@ -699,7 +699,7 @@ if each['ext'] == extType: bitmapType = each['type'] break - self.MapWindow.SaveToFile(name, bitmapType, int(width), int(height)) + self.MapWindow.SaveToFile(name, bitmapType, int(width), int(height), callback) def DOutFileOptData(self, dcmd, layer, params, propwin): """Dummy function which is called when d.out.file is called @@ -713,6 +713,49 @@ def DToRast(self, command): """Saves currently loaded composition of layers as a raster map. """ + def _DToRastDone(): + # import back as red, green, blue rasters + returncode, messages = RunCommand( + 'r.in.gdal', flags='o', input=pngFile, output=tmpName, quiet=True, + overwrite=overwrite, getErrorMsg=True) + if not returncode == 0: + self._giface.WriteError(_('Failed to run d.to.rast:\n') + messages) + return + # set region for composite + grass.use_temp_region() + returncode, messages = RunCommand('g.region', raster=tmpName + '.red', + quiet=True, getErrorMsg=True) + if not returncode == 0: + grass.del_temp_region() + self._giface.WriteError(_('Failed to run d.to.rast:\n') + messages) + return + # composite + returncode, messages = RunCommand( + 'r.composite', red=tmpName + '.red', green=tmpName + '.green', + blue=tmpName + '.blue', output=outputRaster, quiet=True, + overwrite=overwrite, getErrorMsg=True) + grass.del_temp_region() + RunCommand( + 'g.remove', + type='raster', + flags='f', + quiet=True, + name=[tmpName + '.red', tmpName + '.green', tmpName + '.blue']) + if not returncode == 0: + self._giface.WriteError(_('Failed to run d.to.rast:\n') + messages) + grass.try_remove(pngFile) + return + + # alignExtent changes only region variable + oldRegion = self.GetMap().GetCurrentRegion().copy() + self.GetMap().AlignExtentFromDisplay() + region = self.GetMap().GetCurrentRegion().copy() + self.GetMap().region.update(oldRegion) + RunCommand('r.region', map=outputRaster, n=region['n'], s=region['s'], + e=region['e'], w=region['w'], quiet=True) + grass.try_remove(pngFile) + + if self.IsPaneShown('3d'): self._giface.WriteError( _('d.to.rast can be used only in 2D mode.')) @@ -734,55 +777,10 @@ tmpName = 'd_to_rast_tmp' pngFile = grass.tempfile(create=False) + '.png' dOutFileCmd = ['d.out.file', 'output=' + pngFile, 'format=png'] - self.DOutFile(dOutFileCmd) - # import back as red, green, blue rasters - returncode, messages = RunCommand( - 'r.in.gdal', flags='o', input=pngFile, output=tmpName, quiet=True, - overwrite=overwrite, getErrorMsg=True) - if not returncode == 0: - self._giface.WriteError(_('Failed to run d.to.rast:\n') + messages) - return - # set region for composite - grass.use_temp_region() - returncode, messages = RunCommand('g.region', raster=tmpName + '.red', - quiet=True, getErrorMsg=True) - if not returncode == 0: - grass.del_temp_region() - self._giface.WriteError(_('Failed to run d.to.rast:\n') + messages) - return - # composite - returncode, messages = RunCommand( - 'r.composite', red=tmpName + '.red', green=tmpName + '.green', - blue=tmpName + '.blue', output=outputRaster, quiet=True, - overwrite=overwrite, getErrorMsg=True) - grass.del_temp_region() - RunCommand( - 'g.remove', - type='raster', - flags='f', - quiet=True, - name=[ - tmpName + - '.red', - tmpName + - '.green', - tmpName + - '.blue']) - if not returncode == 0: - self._giface.WriteError(_('Failed to run d.to.rast:\n') + messages) - grass.try_remove(pngFile) - return + self.DOutFile(dOutFileCmd, callback=_DToRastDone) + - # alignExtent changes only region variable - oldRegion = self.GetMap().GetCurrentRegion().copy() - self.GetMap().AlignExtentFromDisplay() - region = self.GetMap().GetCurrentRegion().copy() - self.GetMap().region.update(oldRegion) - RunCommand('r.region', map=outputRaster, n=region['n'], s=region['s'], - e=region['e'], w=region['w'], quiet=True) - grass.try_remove(pngFile) - def DToRastOptData(self, dcmd, layer, params, propwin): """Dummy function which is called when d.to.rast is called and returns parsed and validated command which is then passed Modified: grass/trunk/gui/wxpython/mapwin/buffered.py =================================================================== --- grass/trunk/gui/wxpython/mapwin/buffered.py 2016-10-28 22:00:39 UTC (rev 69753) +++ grass/trunk/gui/wxpython/mapwin/buffered.py 2016-10-29 22:01:52 UTC (rev 69754) @@ -671,7 +671,7 @@ event.Skip() - def SaveToFile(self, FileName, FileType, width, height): + def SaveToFile(self, FileName, FileType, width, height, callback=None): """This draws the pseudo DC to a buffer that can be saved to a file. @@ -689,18 +689,22 @@ self._fileName = FileName self._fileType = FileType + self._saveToFileCallback = callback self._busy = wx.BusyInfo(message=_("Please wait, exporting image..."), parent=self) wx.Yield() self.Map.ChangeMapSize((width, height)) - self.Map.Render(force=True, windres=self._properties.resolution) renderMgr = self.Map.GetRenderMgr() + # this seems wrong, rendering should have callback + # when callback present, rendering does not emit signal + # just calls callback renderMgr.renderDone.disconnect(self._updateMFinished) renderMgr.renderDone.connect(self._saveToFileDone) + self.Map.Render(force=True, windres=self._properties.resolution) - def _saveToFileDone(self): + def _saveToFileDone(self, callback=None): renderMgr = self.Map.GetRenderMgr() renderMgr.renderDone.disconnect(self._saveToFileDone) @@ -756,6 +760,8 @@ self.UpdateMap(render=True) self.Refresh() + if self._saveToFileCallback: + self._saveToFileCallback() def GetOverlay(self): """Converts rendered overlay files to wx.Image From svn_grass at osgeo.org Sat Oct 29 15:19:12 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sat, 29 Oct 2016 15:19:12 -0700 Subject: [GRASS-SVN] r69755 - in grass/branches/releasebranch_7_2/gui/wxpython: mapdisp mapwin Message-ID: <20161029221912.DCD673901E5@trac.osgeo.org> Author: annakrat Date: 2016-10-29 15:19:12 -0700 (Sat, 29 Oct 2016) New Revision: 69755 Modified: grass/branches/releasebranch_7_2/gui/wxpython/mapdisp/frame.py grass/branches/releasebranch_7_2/gui/wxpython/mapwin/buffered.py Log: fix d.to.rast, which was broken since new rendering (merge from trunk, r69754) Modified: grass/branches/releasebranch_7_2/gui/wxpython/mapdisp/frame.py =================================================================== --- grass/branches/releasebranch_7_2/gui/wxpython/mapdisp/frame.py 2016-10-29 22:01:52 UTC (rev 69754) +++ grass/branches/releasebranch_7_2/gui/wxpython/mapdisp/frame.py 2016-10-29 22:19:12 UTC (rev 69755) @@ -665,7 +665,7 @@ dlg.Destroy() - def DOutFile(self, command): + def DOutFile(self, command, callback=None): """Saves map to image by running d.out.file from gui or d.mon. Command is expected to be validated by parser. """ @@ -699,7 +699,7 @@ if each['ext'] == extType: bitmapType = each['type'] break - self.MapWindow.SaveToFile(name, bitmapType, int(width), int(height)) + self.MapWindow.SaveToFile(name, bitmapType, int(width), int(height), callback) def DOutFileOptData(self, dcmd, layer, params, propwin): """Dummy function which is called when d.out.file is called @@ -713,6 +713,49 @@ def DToRast(self, command): """Saves currently loaded composition of layers as a raster map. """ + def _DToRastDone(): + # import back as red, green, blue rasters + returncode, messages = RunCommand( + 'r.in.gdal', flags='o', input=pngFile, output=tmpName, quiet=True, + overwrite=overwrite, getErrorMsg=True) + if not returncode == 0: + self._giface.WriteError(_('Failed to run d.to.rast:\n') + messages) + return + # set region for composite + grass.use_temp_region() + returncode, messages = RunCommand('g.region', raster=tmpName + '.red', + quiet=True, getErrorMsg=True) + if not returncode == 0: + grass.del_temp_region() + self._giface.WriteError(_('Failed to run d.to.rast:\n') + messages) + return + # composite + returncode, messages = RunCommand( + 'r.composite', red=tmpName + '.red', green=tmpName + '.green', + blue=tmpName + '.blue', output=outputRaster, quiet=True, + overwrite=overwrite, getErrorMsg=True) + grass.del_temp_region() + RunCommand( + 'g.remove', + type='raster', + flags='f', + quiet=True, + name=[tmpName + '.red', tmpName + '.green', tmpName + '.blue']) + if not returncode == 0: + self._giface.WriteError(_('Failed to run d.to.rast:\n') + messages) + grass.try_remove(pngFile) + return + + # alignExtent changes only region variable + oldRegion = self.GetMap().GetCurrentRegion().copy() + self.GetMap().AlignExtentFromDisplay() + region = self.GetMap().GetCurrentRegion().copy() + self.GetMap().region.update(oldRegion) + RunCommand('r.region', map=outputRaster, n=region['n'], s=region['s'], + e=region['e'], w=region['w'], quiet=True) + grass.try_remove(pngFile) + + if self.IsPaneShown('3d'): self._giface.WriteError( _('d.to.rast can be used only in 2D mode.')) @@ -734,55 +777,10 @@ tmpName = 'd_to_rast_tmp' pngFile = grass.tempfile(create=False) + '.png' dOutFileCmd = ['d.out.file', 'output=' + pngFile, 'format=png'] - self.DOutFile(dOutFileCmd) - # import back as red, green, blue rasters - returncode, messages = RunCommand( - 'r.in.gdal', flags='o', input=pngFile, output=tmpName, quiet=True, - overwrite=overwrite, getErrorMsg=True) - if not returncode == 0: - self._giface.WriteError(_('Failed to run d.to.rast:\n') + messages) - return - # set region for composite - grass.use_temp_region() - returncode, messages = RunCommand('g.region', raster=tmpName + '.red', - quiet=True, getErrorMsg=True) - if not returncode == 0: - grass.del_temp_region() - self._giface.WriteError(_('Failed to run d.to.rast:\n') + messages) - return - # composite - returncode, messages = RunCommand( - 'r.composite', red=tmpName + '.red', green=tmpName + '.green', - blue=tmpName + '.blue', output=outputRaster, quiet=True, - overwrite=overwrite, getErrorMsg=True) - grass.del_temp_region() - RunCommand( - 'g.remove', - type='raster', - flags='f', - quiet=True, - name=[ - tmpName + - '.red', - tmpName + - '.green', - tmpName + - '.blue']) - if not returncode == 0: - self._giface.WriteError(_('Failed to run d.to.rast:\n') + messages) - grass.try_remove(pngFile) - return + self.DOutFile(dOutFileCmd, callback=_DToRastDone) + - # alignExtent changes only region variable - oldRegion = self.GetMap().GetCurrentRegion().copy() - self.GetMap().AlignExtentFromDisplay() - region = self.GetMap().GetCurrentRegion().copy() - self.GetMap().region.update(oldRegion) - RunCommand('r.region', map=outputRaster, n=region['n'], s=region['s'], - e=region['e'], w=region['w'], quiet=True) - grass.try_remove(pngFile) - def DToRastOptData(self, dcmd, layer, params, propwin): """Dummy function which is called when d.to.rast is called and returns parsed and validated command which is then passed Modified: grass/branches/releasebranch_7_2/gui/wxpython/mapwin/buffered.py =================================================================== --- grass/branches/releasebranch_7_2/gui/wxpython/mapwin/buffered.py 2016-10-29 22:01:52 UTC (rev 69754) +++ grass/branches/releasebranch_7_2/gui/wxpython/mapwin/buffered.py 2016-10-29 22:19:12 UTC (rev 69755) @@ -671,7 +671,7 @@ event.Skip() - def SaveToFile(self, FileName, FileType, width, height): + def SaveToFile(self, FileName, FileType, width, height, callback=None): """This draws the pseudo DC to a buffer that can be saved to a file. @@ -689,18 +689,22 @@ self._fileName = FileName self._fileType = FileType + self._saveToFileCallback = callback self._busy = wx.BusyInfo(message=_("Please wait, exporting image..."), parent=self) wx.Yield() self.Map.ChangeMapSize((width, height)) - self.Map.Render(force=True, windres=self._properties.resolution) renderMgr = self.Map.GetRenderMgr() + # this seems wrong, rendering should have callback + # when callback present, rendering does not emit signal + # just calls callback renderMgr.renderDone.disconnect(self._updateMFinished) renderMgr.renderDone.connect(self._saveToFileDone) + self.Map.Render(force=True, windres=self._properties.resolution) - def _saveToFileDone(self): + def _saveToFileDone(self, callback=None): renderMgr = self.Map.GetRenderMgr() renderMgr.renderDone.disconnect(self._saveToFileDone) @@ -756,6 +760,8 @@ self.UpdateMap(render=True) self.Refresh() + if self._saveToFileCallback: + self._saveToFileCallback() def GetOverlay(self): """Converts rendered overlay files to wx.Image From svn_grass at osgeo.org Sun Oct 30 11:05:17 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 30 Oct 2016 11:05:17 -0700 Subject: [GRASS-SVN] r69756 - grass/branches/releasebranch_7_2/vector/v.what Message-ID: <20161030180517.EE73B3901E5@trac.osgeo.org> Author: annakrat Date: 2016-10-30 11:05:17 -0700 (Sun, 30 Oct 2016) New Revision: 69756 Modified: grass/branches/releasebranch_7_2/vector/v.what/what.c Log: v.what: use layer information (by mlennert), see #3172 (merge from trunk, r69647) Modified: grass/branches/releasebranch_7_2/vector/v.what/what.c =================================================================== --- grass/branches/releasebranch_7_2/vector/v.what/what.c 2016-10-29 22:19:12 UTC (rev 69755) +++ grass/branches/releasebranch_7_2/vector/v.what/what.c 2016-10-30 18:05:17 UTC (rev 69756) @@ -538,13 +538,16 @@ } /* if area > 0 */ if (Cats->n_cats > 0) { - int j; + int j, k; char *formbuf1; char *formbuf2; if (json) { fprintf(stdout, ",\n\"Categories\": ["); } + k = 0; for (j = 0; j < Cats->n_cats; j++) { + if (field[i] == -1 || Cats->field[j] == field[i]) { + k++; G_debug(2, "field = %d category = %d\n", Cats->field[j], Cats->cat[j]); if (script) { @@ -552,7 +555,7 @@ Cats->cat[j]); } else if (json) { - fprintf(stdout, "%s\n{\"Layer\": %d, \"Category\": %d", j == 0 ? "": ",", + fprintf(stdout, "%s\n{\"Layer\": %d, \"Category\": %d", k == 1 ? "": ",", Cats->field[j], Cats->cat[j]); } else { @@ -597,6 +600,7 @@ if (json) { fprintf(stdout, "}"); /* for cat */ } + } } if (json) { fprintf(stdout, "]"); /* for list of cats */ From svn_grass at osgeo.org Sun Oct 30 11:19:06 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Sun, 30 Oct 2016 11:19:06 -0700 Subject: [GRASS-SVN] r69757 - grass/branches/releasebranch_7_0/vector/v.what Message-ID: <20161030181906.811B33901E5@trac.osgeo.org> Author: annakrat Date: 2016-10-30 11:19:06 -0700 (Sun, 30 Oct 2016) New Revision: 69757 Modified: grass/branches/releasebranch_7_0/vector/v.what/what.c Log: v.what: use layer information (by mlennert), see #3172 (merge from trunk, r69647) Modified: grass/branches/releasebranch_7_0/vector/v.what/what.c =================================================================== --- grass/branches/releasebranch_7_0/vector/v.what/what.c 2016-10-30 18:05:17 UTC (rev 69756) +++ grass/branches/releasebranch_7_0/vector/v.what/what.c 2016-10-30 18:19:06 UTC (rev 69757) @@ -538,13 +538,16 @@ } /* if area > 0 */ if (Cats->n_cats > 0) { - int j; + int j, k; char *formbuf1; char *formbuf2; if (json) { fprintf(stdout, ",\n\"Categories\": ["); } + k = 0; for (j = 0; j < Cats->n_cats; j++) { + if (field[i] == -1 || Cats->field[j] == field[i]) { + k++; G_debug(2, "field = %d category = %d\n", Cats->field[j], Cats->cat[j]); if (script) { @@ -552,7 +555,7 @@ Cats->cat[j]); } else if (json) { - fprintf(stdout, "%s\n{\"Layer\": %d, \"Category\": %d", j == 0 ? "": ",", + fprintf(stdout, "%s\n{\"Layer\": %d, \"Category\": %d", k == 1 ? "": ",", Cats->field[j], Cats->cat[j]); } else { @@ -597,6 +600,7 @@ if (json) { fprintf(stdout, "}"); /* for cat */ } + } } if (json) { fprintf(stdout, "]"); /* for list of cats */ From svn_grass at osgeo.org Mon Oct 31 03:49:51 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 31 Oct 2016 03:49:51 -0700 Subject: [GRASS-SVN] r69758 - grass/branches/releasebranch_7_2/display/d.rast.arrow Message-ID: <20161031104951.A4CB93901E5@trac.osgeo.org> Author: neteler Date: 2016-10-31 03:49:51 -0700 (Mon, 31 Oct 2016) New Revision: 69758 Added: grass/branches/releasebranch_7_2/display/d.rast.arrow/d_rast_arrow_wind.png Modified: grass/branches/releasebranch_7_2/display/d.rast.arrow/ grass/branches/releasebranch_7_2/display/d.rast.arrow/d.rast.arrow.html Log: d.rast.arrow manual: screenshot added Property changes on: grass/branches/releasebranch_7_2/display/d.rast.arrow ___________________________________________________________________ Modified: svn:ignore - OBJ.* + OBJ.* *.tmp.html Modified: grass/branches/releasebranch_7_2/display/d.rast.arrow/d.rast.arrow.html =================================================================== --- grass/branches/releasebranch_7_2/display/d.rast.arrow/d.rast.arrow.html 2016-10-30 18:19:06 UTC (rev 69757) +++ grass/branches/releasebranch_7_2/display/d.rast.arrow/d.rast.arrow.html 2016-10-31 10:49:51 UTC (rev 69758) @@ -73,6 +73,12 @@ d.rast.arrow map=direction type=grass magnitude_map=magnitude skip=3 grid=none

      + +
      +
      +Sea wind speed (magnitude) and direction shown in the Tasmanian Sea +
      +

      SEE ALSO

      Added: grass/branches/releasebranch_7_2/display/d.rast.arrow/d_rast_arrow_wind.png =================================================================== (Binary files differ) Property changes on: grass/branches/releasebranch_7_2/display/d.rast.arrow/d_rast_arrow_wind.png ___________________________________________________________________ Added: svn:mime-type + image/png From svn_grass at osgeo.org Mon Oct 31 03:50:44 2016 From: svn_grass at osgeo.org (svn_grass at osgeo.org) Date: Mon, 31 Oct 2016 03:50:44 -0700 Subject: [GRASS-SVN] r69759 - grass/trunk/display/d.rast.arrow Message-ID: <20161031105044.33AA03901E5@trac.osgeo.org> Author: neteler Date: 2016-10-31 03:50:44 -0700 (Mon, 31 Oct 2016) New Revision: 69759 Added: grass/trunk/display/d.rast.arrow/d_rast_arrow_wind.png Modified: grass/trunk/display/d.rast.arrow/ grass/trunk/display/d.rast.arrow/d.rast.arrow.html Log: d.rast.arrow manual: screenshot added Property changes on: grass/trunk/display/d.rast.arrow ___________________________________________________________________ Modified: svn:ignore - OBJ.* + OBJ.* *.tmp.html Modified: grass/trunk/display/d.rast.arrow/d.rast.arrow.html =================================================================== --- grass/trunk/display/d.rast.arrow/d.rast.arrow.html 2016-10-31 10:49:51 UTC (rev 69758) +++ grass/trunk/display/d.rast.arrow/d.rast.arrow.html 2016-10-31 10:50:44 UTC (rev 69759) @@ -73,6 +73,12 @@ d.rast.arrow map=direction type=grass magnitude_map=magnitude skip=3 grid=none
      + +
      +
      +Sea wind speed (magnitude) and direction shown in the Tasmanian Sea +
      +

      SEE ALSO

      Added: grass/trunk/display/d.rast.arrow/d_rast_arrow_wind.png =================================================================== (Binary files differ) Property changes on: grass/trunk/display/d.rast.arrow/d_rast_arrow_wind.png ___________________________________________________________________ Added: svn:mime-type + image/png