| 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("-mean","--mean",help="mean value for pixel values",dest="mean",required=False,type=float,default=1000) |
| 21 |
parser.add_argument("-stdev","--stdev",help="stdev value for pixel values",dest="stdev",required=False,type=float,default=100) |
| 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({'otype':'GDT_Float32'}) |
| 31 |
dict.update({'nrow':args.nrow,'ncol':args.ncol}) |
| 32 |
dict.update({'mean':args.mean,'stdev':args.stdev}) |
| 33 |
jim0=jl.createJim(**dict) |
| 34 |
theStats=jim0.getStats({'function':['mean','stdev']}) |
| 35 |
print(theStats) |
| 36 |
if theStats['mean']<args.mean-1 or theStats['mean']>args.mean+1: |
| 37 |
print("Failed: mean") |
| 38 |
if theStats['stdev']<args.stdev-1 or theStats['stdev']>args.stdev+1: |
| 39 |
print("Failed: stdev") |
| 40 |
else: |
| 41 |
print("Success: create georeferenced image with random pixel values") |
| 42 |
jim0.close() |