| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 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 |
|
| 35 |
if True: |
| 36 |
jim0=jl.createJim(**dict) |
| 37 |
jim0.d_pointOpBlank(500) |
| 38 |
|
| 39 |
jim1=jl.createJim(jim0,copyData=False) |
| 40 |
|
| 41 |
print("jim0.getGeoTransform:{}".format(jim0.getGeoTransform())) |
| 42 |
print("jim1.getGeoTransform:{}".format(jim1.getGeoTransform())) |
| 43 |
if jim0.getGeoTransform() != jim1.getGeoTransform(): |
| 44 |
print("Failed: geoTransform") |
| 45 |
throw() |
| 46 |
print("stats jim0:{}".format(jim0.getStats({'function':['min','max','mean']}))) |
| 47 |
print("stats jim1:{}".format(jim1.getStats({'function':['min','max','mean']}))) |
| 48 |
|
| 49 |
if jim0.isEqual(jim1): |
| 50 |
print("Failed: isEqual") |
| 51 |
throw() |
| 52 |
print("Success: create image using template") |
| 53 |
try: |
| 54 |
print("ok") |
| 55 |
except: |
| 56 |
print("Failed: create image using template") |
| 57 |
jim1.close() |