-
Notifications
You must be signed in to change notification settings - Fork 1
/
uiNormMinMax.py
44 lines (40 loc) · 1.44 KB
/
uiNormMinMax.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import sys
import lib.som.normMinMax
def normalize(inName,outName,start,end,direction,minEqMax,fieldNames,decimalPlaces):
"""
Creates a DBF with minimum-maxiumum normalized values from an existing DBF.
:arguments:
inName
The input DBF filename.
outName
The ouput DBF filename.
start
The minimum value to contain in the output range.
end
The maximum value to caontain in the output range.
direction
The direction in which to determine minimum and maximum values in the input range.
minEqMax
The value to assign if the minimum is equal to the maxium. (division by zero)
fieldNames
The fields on which to perform the normalization.
decimalPlace
The number of decimal places to which numbers should be rounded.
"""
lib.som.normMinMax.normalize(inName,outName,start,end,direction,minEqMax,fieldNames,decimalPlaces)
if __name__ == "__main__":
inName = sys.argv[1]
direction = sys.argv[2]
outName = sys.argv[3]
start = float(sys.argv[5])
end = float(sys.argv[6])
minEqMax = float(sys.argv[4])
if sys.argv[8]=="#":
fieldNames = []
else:
fieldNames=sys.argv[8].split(";")
if sys.argv[7]=="#":
decimalPlaces=0
else:
decimalPlaces=int(sys.argv[7])
normalize(inName,outName,start,end,direction,minEqMax,fieldNames,decimalPlaces)