text stringlengths 0 93.6k |
|---|
proc.wait() |
'''now extract the position informaiton ''' |
# scale factor x y z: 0.0001 0.0001 0.0001 |
# offset x y z: 467000 7786000 1000 |
# min x y z: 467106.6526 7786476.5504 1612.2718 |
# max x y z: 467161.9851 7786494.3574 1612.8824 |
p1 = POINT(0,0) |
p2 = POINT(1,1) |
rectangle = RECT(p1, p2) |
f = open(outfilename, 'r') |
for line in f: |
if line.lstrip().lower().startswith('min x'): |
line = line.lstrip() |
line = line.rstrip() |
line = line.replace("(", "") |
line = line.replace(")", "") |
line = line.replace(" ", " ") |
line = line.replace(" ", " ") |
line = line.replace(" ", " ") |
line = line.replace(" ", " ") |
line = line.replace(" ", " ") |
line = line.replace(" ", " ") |
line = line.replace(" ", " ") |
line = line.replace(" ", " ") |
line = line.replace(",", "") |
words = line.split(" ") |
x = float(words[4]) |
y = float(words[5]) |
z = float(words[6]) |
ll = POINT(x,y,z) |
if line.lstrip().lower().startswith('max x'): |
line = line.lstrip() |
line = line.rstrip() |
line = line.replace("(", "") |
line = line.replace(")", "") |
line = line.replace(" ", " ") |
line = line.replace(" ", " ") |
line = line.replace(" ", " ") |
line = line.replace(" ", " ") |
line = line.replace(" ", " ") |
line = line.replace(" ", " ") |
line = line.replace(" ", " ") |
line = line.replace(" ", " ") |
line = line.replace(",", "") |
words = line.split(" ") |
x = float(words[4]) |
y = float(words[5]) |
z = float(words[6]) |
ur = POINT(x,y,z) |
rectangle = RECT(ll, ur) |
f.close() |
fileutils.deletefile(outfilename) |
return rectangle |
############################################################################### |
def makedirs(odir): |
if not os.path.isdir(odir): |
os.makedirs(odir, exist_ok=True) |
odirlog = os.path.join(odir, "log").replace('\\','/') |
if not os.path.isdir(odirlog): |
os.makedirs(odirlog) |
return odirlog |
############################################################################### |
def getcpucount(requestedcpu): |
'''control how many CPU's we use for multi processing''' |
if int(requestedcpu) == 0: |
requestedcpu = multiprocessing.cpu_count() |
stat = MEMORYSTATUSEX() |
ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) |
# print("MemoryLoad: %d%%" % (stat.dwMemoryLoad)) |
# print("MemoryAvailable: %d%%" % (stat.ullAvailPhys/(1024*1024*1024))) |
availablememoryingigs = stat.ullAvailPhys/(1024*1024*1024) |
# make sure we have enough memory per CPU |
requiredgigspercpu = 4 |
maxcpu = max(1, int(availablememoryingigs/ requiredgigspercpu)) |
# ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) |
# print("MemoryLoad: %d%%" % (stat.dwMemoryLoad)) |
# ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) |
# print("MemoryLoad: %d%%" % (stat.dwMemoryLoad)) |
# ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) |
# print("MemoryLoad: %d%%" % (stat.dwMemoryLoad)) |
# ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) |
# print("MemoryLoad: %d%%" % (stat.dwMemoryLoad)) |
if int(requestedcpu) > maxcpu: |
requestedcpu = maxcpu |
return int(requestedcpu) |
############################################################################### |
def log(msg, error = False, printmsg=True): |
if printmsg: |
print (msg) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.