Debian Codegraph @

test/pytest_init.py

raw symbols SCIP
1 ###############################################################################
2 # pytest_init.py: Create a georeferenced image with initialized pixel values
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/10/23 - Created by Pieter Kempeneers ([email protected])
12 # Change log
13
14 import argparse
15 import jiplib as jl
16
17 parser=argparse.ArgumentParser()
18 parser.add_argument("-nrow","--nrow",help="Number of rows",dest="nrow",required=False,type=int,default=1024)
19 parser.add_argument("-ncol","--ncol",help="Number of cols",dest="ncol",required=False,type=int,default=1024)
20 parser.add_argument("-value","--value",help="Initial value for image pixels",dest="value",required=False,type=float,default=1000)
21 args = parser.parse_args()
22
23 ULX=600000.0
24 ULY=4000020.0
25 LRX=709800.0
26 LRY=3890220.0
27 projection='epsg:32612'
28 dict={'ulx':ULX,'uly':ULY,'lrx':LRX,'lry':LRY,'a_srs':projection}
29 dict.update({'otype':'GDT_Float32'})
30 nrow=1098
31 ncol=1098
32 # dict.update({'nrow':args.nrow,'ncol':args.ncol,'mean':args.value})
33 dict.update({'nrow':args.nrow,'ncol':args.ncol})
34 jim0=jl.createJim(**dict)
35 print("gds before pointOpBlank:{}".format(jim0.getDataset()))
36 jim0=jim0.pointOpBlank(args.value)
37 print("gds after pointOpBlank:{}".format(jim0.getDataset()))
38 theStats=jim0.getStats({'function':['min','max']})
39 print("gds:{}".format(jim0.getDataset()))
40 print("statistics:{}".format(theStats))
41 if theStats['max']!=args.value:
42 print("Failed: max")
43 if theStats['min']!=args.value:
44 print("Failed: min")
45 else:
46 print("Success: create georeferenced image with initialized pixel values")
47 print("gds:{}".format(jim0.getDataset()))
48 jim0.close()