Debian Codegraph @

test/pytest_statprofile.py

raw symbols SCIP
1 ###############################################################################
2 # pytest_statprofile.py: statprofile
3 # Author(s): [email protected]
4 # Copyright (c) 2016-2019 European Union (Joint Research Centre)
5 # License EUPLv1.2
6 #
7 # This file is part of jiplib
8 ###############################################################################
9
10 # History
11 # 2017/12/13 - Created by Pieter Kempeneers ([email protected])
12 # Change log
13
14
15 import argparse
16 import os
17 import math
18 import jiplib as jl
19
20 parser=argparse.ArgumentParser()
21 parser.add_argument("-input","--input",help="Path of the raster dataset",dest="input",required=True,type=str)
22 parser.add_argument("-function","--function",help="Statistical functions to perform",dest="function",required=True,type=str,nargs='+')
23 parser.add_argument("-perc","--perc",help="Percentiles to calculate",dest="percentile",required=False,type=str,nargs='*')
24 parser.add_argument("-output","--output",help="Path of the output vector dataset",dest="output",required=False,type=str)
25 args = parser.parse_args()
26
27 try:
28 print('calculating functions:',args.function)
29 jim0=jl.createJim(args.input)
30 if args.percentile:
31 jim1=jim0.statProfile({'function':args.function,'perc':args.percentile})
32 else:
33 jim1=jim0.statProfile({'function':args.function})
34 if jim1.nrOfBand() < len(args.function):
35 throw()
36 if args.output:
37 jim1.write({'filename':args.output})
38 jim1.close()
39 jim0.close()
40 print("Success: statprofile")
41 except:
42 print("Failed: statprofile")