2014-05-21 7 views

답변

1

-resulthandler ResultWriter을 사용하여 텍스트로 출력하면 클러스터 크기가 각 클러스터 파일의 맨 위에 표시됩니다.

현재 시각화 프로그램이 클러스터 크기를 표시하지 않는 것 같습니다.

0

-resulthandler ResultWriter를 사용하여 텍스트로 출력하면 클러스터 크기는 각 클러스터 파일의 맨 위에 있습니다.

clusterout_path = "path/to/where/files/all/go/" 
finalout_path = "/path/for/single/merged/file/" 
consol_filename= "single_merged_file.txt" 

cll_file = open(finalout_path + consol_filename,"a") 
cll_file.write("ClusterID"+ "\t" + "Lon" + "\t" + "Lat" + "\n") 
def readFile(file): 
    f = open(clusterout_path + file) 
    counter = 0 
    cluster = "" 
    lon = "" 
    lat = "" 
    for line in f.readlines(): 
     counter+=1 
     if counter == 1: 
      cluster = line.split(":")[1].strip().lower() 

     if counter > 4 and line.startswith("ID"): 
      arr = line.split(" ") 
      lon = arr[1] 
      lat = arr[2] 
      cll_file.write(cluster + "\t" + lon + "\t" + lat + "\n") 
    f.close() 

listing = os.listdir(clusterout_path) 
for infile in listing: 
    print "Processing file: " + infile 
    readFile(infile) 

cll_file.close() 
을 : 당신은 하나의 파일로 모든 결과를 병합 할 경우

또한, 여기에 작동하는 파이썬 스크립트입니다

관련 문제