Skip to content
Permalink
Browse files
[processing] fixed frequency algorithm
  • Loading branch information
volaya committed Jul 12, 2014
1 parent e536905 commit f5b84ca101ff3c2708bca13b2c5361a0cf6bb50b
Showing with 4 additions and 5 deletions.
  1. +4 −5 python/plugins/processing/algs/qgis/scripts/Frequency_analysis.py
@@ -8,16 +8,16 @@
from processing.core.TableWriter import TableWriter
from collections import defaultdict

layer = processing.getObject(input)
layer = processing.getObject(Input)
inputFields = layer.pendingFields()
fieldIdxs = []
fields = fields.split(',')
fields = Fields.split(',')
for f in fields:
idx = inputFields.indexFromName(f)
if idx == -1:
raise GeoAlgorithmExecutionException('Field not found:' + f)
fieldIdxs.append(idx)
writer = TableWriter(output, None, fields + ['FREQ'])
writer = TableWriter(Output, None, fields + ['FREQ'])

counts = {}
feats = processing.features(layer)
@@ -26,8 +26,7 @@
for i, feat in enumerate(feats):
progress.setPercentage(int(100 * i / nFeats))
attrs = feat.attributes()
clazz = tuple([attrs[idx] for idx in fieldIdxs])
print clazz
clazz = tuple([attrs[idx] for idx in fieldIdxs])
counts[clazz] += 1

for c in counts:

0 comments on commit f5b84ca

Please sign in to comment.