| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 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") |