ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/RandomCodeRequests/3Rings.txt
Revision: 742
Committed: Tue Apr 13 20:36:48 2021 UTC (4 years, 11 months ago) by nino.borges
Content type: text/plain
File size: 1064 byte(s)
Log Message:
added some missing code request txt files

File Contents

# Content
1 #### An extreamly simple request to take a bunch of overlay files which are just bates
2 #### and the search set that it hit on in LAW and combine these into one overlay file
3 #### so that you can load into 1 field and make Eclipse seawrches from values in that field
4
5 >>> startDir = r"C:\Temp\3Rings"
6 >>> matrix = {}
7 >>> for f in os.listdir(startDir):
8 ... contents = open(os.path.join(startDir,f)).readlines()
9 ... contents = contents[1:]
10 ... for line in contents:
11 ... line = line.replace("\n","")
12 ... line = line.replace('"','')
13 ... if line in matrix.keys():
14 ... matrix[line].append(os.path.splitext(f)[0])
15 ... else:
16 ... matrix[line] = [os.path.splitext(f)[0],]
17 ...
18 >>> len(matrix.keys())
19 6468
20 >>> outputFile = open(os.path.join(startDir,"OverlayCombined.DAT"),'w')
21 >>> batesList = matrix.keys()
22 >>> batesList.sort()
23 >>> for bates in batesList:
24 ... sList = matrix[bates]
25 ... outputFile.write(bates + "|")
26 ... for s in sList:
27 ... outputFile.write(s + "; ")
28 ... outputFile.write("\n")
29 ...
30 >>> outputFile.close()