Hi, 2017-02-20 8:58 GMT+01:00 Huidae Cho <[email protected]>: > no problem, I'll backport it.
ok, thanks for taking care about it. Note that only bugfixes or cosmetics issues (we are close to freeze period) should be backported to relb72. After releasing 7.2.1 also non-bug (minor new functionality) issues can be backported. It's good to note such waiting backports on wiki [1]. Ma [1] https://trac.osgeo.org/grass/wiki/Grass7Planning#a7.2.2tobebackported >> > if cols[catcol] == '-1' or cols[catcol] == '0': >> > continue >> > @@ -115,7 +116,6 @@ >> > >> > if len(records1) == 0: >> > try: >> > - f = grass.vector_db(map=mapname)[int(layer)] >> > grass.fatal(_("There is a table connected to input >> > vector map '%s', but " >> > "there are no categories present in the >> > key column '%s'. Consider using " >> > "v.to.db to correct this.") % (mapname, >> > f['key'])) >> > @@ -142,6 +142,7 @@ >> > for r2 in records2: >> > records3.append(filter(lambda r1: r1[catcol] == r2[0], >> > records1)[0] + r2[1:]) >> > else: >> > + catcol = 0 >> > records1 = [] >> > p = grass.pipe_command('v.category', inp=mapname, layer=layer, >> > option='print') >> > for line in p.stdout: >> > @@ -172,15 +173,18 @@ >> > numcols = len(colnames) + len(extracolnames) >> > >> > # calculate percents if requested >> > - if units != '' and units in ['p', 'percent']: >> > - # calculate total area value >> > - areatot = 0 >> > + if units == 'percent' and option != 'coor': >> > + # calculate total value >> > + total = 0 >> > for r in records3: >> > - areatot += float(r[-1]) >> > + total += float(r[-1]) >> > >> > - # calculate area percentages >> > - records4 = [float(r[-1]) * 100 / areatot for r in records3] >> > - records3 = [r1 + [r4] for r1, r4 in zip(records1, records4)] >> > + # calculate percentages >> > + records4 = [float(r[-1]) * 100 / total for r in records3] >> > + if type(records1[0]) == int: >> > + records3 = [[r1] + [r4] for r1, r4 in zip(records1, >> > records4)] >> > + else: >> > + records3 = [r1 + [r4] for r1, r4 in zip(records1, >> > records4)] >> > >> > # sort results >> > if options['sort']: >> > >> > _______________________________________________ >> > grass-commit mailing list >> > [email protected] >> > https://lists.osgeo.org/mailman/listinfo/grass-commit >> >> >> >> -- >> Martin Landa >> http://geo.fsv.cvut.cz/gwiki/Landa >> http://gismentors.cz/mentors/landa > > -- Martin Landa http://geo.fsv.cvut.cz/gwiki/Landa http://gismentors.cz/mentors/landa _______________________________________________ grass-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/grass-dev
