-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculate_target.py
28 lines (24 loc) · 1020 Bytes
/
calculate_target.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
'''Calculate training values for the grid from other source data.
Chooses an appropriate calculator based on the geometry type of the input table.
'''
import rum
import rum.calculate
argparser = rum.defaultArgumentParser(__doc__)
argparser.add_argument('table', help='calculation source table name')
argparser.add_argument('source_field', help='source value field for target')
argparser.add_argument('-n', '--output-name',
help='name for output target table (created from source table and value field by default)')
argparser.add_argument('-r', '--relative', action='store_true',
help='the values in source field are relative')
argparser.add_argument('-o', '--overwrite', action='store_true',
help='overwrite existing grid target field'
)
if __name__ == '__main__':
args = argparser.parse_args()
rum.calculate.TargetCalculator.fromArgs(args).run(
args.table,
args.source_field,
target=args.output_name,
relative=args.relative,
overwrite=args.overwrite
)