Debian Codegraph @

test/pytest_createreference.py

raw symbols SCIP
1 ###############################################################################
2 # pytest_createreference.py: Create a reference image
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/24 - 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("-min","--min",help="min value for pixel values",dest="min",required=False,type=float,default=1000)
21 parser.add_argument("-max","--max",help="max value for pixel values",dest="max",required=False,type=float,default=2000)
22 args = parser.parse_args()
23
24 ULX=600000.0
25 ULY=4000020.0
26 LRX=709800.0
27 LRY=3890220.0
28 projection='epsg:32612'
29 dict={'ulx':ULX,'uly':ULY,'lrx':LRX,'lry':LRY,'a_srs':projection}
30 dict.update({'nrow':args.nrow,'ncol':args.ncol})
31 dict.update({'uniform':[args.min,args.max+1]})
32 dict.update({'otype':'GDT_UInt16'})
33 dict.update({'seed':10915})
34 try:
35 jim0=jl.createJim(**dict)
36 #create a reference
37 jim1=jim0
38 jim0.d_pointOpBlank(500)
39 print(jim0)
40 if not jim1.isEqual(jim0):
41 print("Failed: isEqual")
42 throw()
43 theStats0=jim0.getStats({'function':['max']})
44 theStats1=jim1.getStats({'function':['max']})
45 jim0=None
46 if theStats0['max']!=500:
47 print("Failed: jim0 max")
48 throw()
49 else:
50 print("theStats0: ",theStats0)
51 print("debug5")
52 if theStats1['max']!=500:
53 print("Failed: jim1 max")
54 throw()
55 else:
56 print("theStats1: ",theStats1)
57 print("Success: Create a reference image")
58 except:
59 print("Failed: Create a reference image")
60 jim1.close()