import sys; sys.path.insert(0,".") import json, collections, io from swdots import dots B=json.load(open('swpos.json',encoding='utf-8')) o=io.open('swcops.txt','w',encoding='utf-8') OFF=344716.3 D=dots(19000,30000,-277200,-271000,maxlen=80) sz=collections.Counter((d[2],d[3]) for d in D); o.write(u'dots %d sizes %s\n'%(len(D),sz.most_common(10))) M=[] for mk,L in B.items(): if not (mk.startswith('C') or mk.startswith('S')): continue for b in L: bb=b['bb']; ext=[bb[3]-bb[0],bb[4]-bb[1],bb[5]-bb[2]] if ext[0]>800 and ext[1]<60 and ext[2]<60: M.append(((bb[1]+bb[4])/2,(bb[2]+bb[5])/2-OFF,mk,ext[0])) o.write(u'model end-on (x-direction long) bars: %d marks %s\n'%(len(M),collections.Counter(m[2] for m in M))) pts=[d for d in D if d[2]==d[3] and d[2]<60] cs=collections.Counter(d[2] for d in pts); o.write(u'dot size list %s\n'%cs) # 중심 x 추정: 모델 y 범위와 맞춰 보기 xs=sorted(set(round(d[0],1) for d in pts)); o.write(u'drawn dot x min %.1f max %.1f\n'%(xs[0],xs[-1])) ys=sorted(set(round(d[1],1) for d in pts)); o.write(u'drawn dot y levels %d: %s\n'%(len(ys),ys[:40])) mz=sorted(set(round(m[1],1) for m in M)); o.write(u'model z levels %d: %s\n'%(len(mz),mz[:40]))