1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3....
Transcript of 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3....
![Page 1: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/1.jpg)
![Page 2: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/2.jpg)
![Page 3: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/3.jpg)
1. GENERATE FOLDERS FROM LIST
2. COPY EXCEL SHEET
3. EXTRACTING DATA FROM LAS FILES
4. CONTROLLING MOUSE & KEYBOARD
5. DIGITIZE OLD LOGS
![Page 4: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/4.jpg)
PRACTICAL SCRIPTING IDEAS FOR DATA MANAGERS WITH PYTHON
Alvin Alexander
Geotechnician
JX Nippon Oil & Gas Exploration
![Page 5: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/5.jpg)
Why Automate?
1. Menial tasks are boring.
2. HSE concern. Wrist Pain.
3. Minimize mistakes.
4. Time Saving in the long run.
5. Writing code is fun and creative.
![Page 6: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/6.jpg)
WHEN TO AUTOMATE?Real Examples
![Page 7: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/7.jpg)
![Page 8: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/8.jpg)
1. GENERATE FOLDERS FROM LIST
2. COPY EXCEL SHEET
3. EXTRACTING DATA FROM LAS FILES
4. CONTROLLING MOUSE & KEYBOARD
5. DIGITIZE OLD LOGS
Incr
easi
ng
Co
mp
lexi
ty
![Page 9: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/9.jpg)
1
![Page 10: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/10.jpg)
![Page 11: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/11.jpg)
1. Open List
2. Copy one item
3. Create Folder
4. Rename and paste
5. Repeat 2 to 4 until finish
Before Automation
![Page 12: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/12.jpg)
Python Script Automation
The list
The 5 linesof code
Generatedfolders
![Page 13: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/13.jpg)
2
![Page 14: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/14.jpg)
![Page 15: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/15.jpg)
1. Create Destination Excel
2. Open Origin Excel
3. Copy target cells
4. Paste into Destination
5. Close Origin Excel
6. Repeat 2 – 5
Before Automation
![Page 16: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/16.jpg)
Python Script Automation
![Page 17: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/17.jpg)
3
![Page 18: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/18.jpg)
![Page 19: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/19.jpg)
Manual Extract Data From LAS
1. Open LAS using text editor
2. Paste to excel
3. Copy one column
4. Paste into another excel
5. Repeat for all files
…or you can use some software that can read LAS files
Before Automation
![Page 20: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/20.jpg)
Python Script Automation
Essentially the code do the following,
1. Look for the “~Ascii” keyword
2. Copy data as table into intermediary format
3. Copy data only at specific depth zones
4. Save data table as desired format
![Page 21: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/21.jpg)
Method to look for keyword
Method to copy data
Method to copy specific depth zones
![Page 22: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/22.jpg)
4
![Page 23: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/23.jpg)
Manual Mouse Movement
1. Movement of mouse depends solely on our hands which is often less than perfect and irregular.
Before Automation
![Page 24: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/24.jpg)
Python Script AutomationPerfect square
Perfect square
![Page 25: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/25.jpg)
Python Script AutomationPerfect square
Perfect spiral
![Page 26: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/26.jpg)
Python Script AutomationPerfect square
Perfect sine wave
Hand drawn sine wave
![Page 27: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/27.jpg)
5
![Page 28: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/28.jpg)
![Page 29: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/29.jpg)
Manually Digitize old Logs
1. Load image into software with
2. Draw to follow the lines as seen on screen
Before Automation
![Page 30: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/30.jpg)
Python Script Automation
![Page 31: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/31.jpg)
Essentially,
1. The script automatically detects the black as data
2. Calculate against the width of the image to determine the value
3. Calculate against the length of the image to determine the depth
Python Script Automation
![Page 32: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/32.jpg)
Bonus Example
![Page 33: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/33.jpg)
Bonus
![Page 34: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/34.jpg)
Batch File Automation
![Page 35: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/35.jpg)
Friendly Tools
Anaconda Python Distribution
Help you manage data science packages for Python
For Python it’s like
Android’s “Play Store”
Apple’s “App Store”
![Page 36: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/36.jpg)
![Page 37: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/37.jpg)
Friendly Tools
Jupyter Notebook
Full IDE is usually hard to learn while coding using text file is too tedious
Notebook Cells
• it is so much easy to edit & run specific lines of codes using Notebook cells.
![Page 38: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/38.jpg)
![Page 39: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/39.jpg)
Final Tips
Scripts should never not be general purpose
Write simple first, then combine
Writing scripts is fun, try it!
![Page 40: 1. GENERATE FOLDERS FROM LIST 2. COPY EXCEL SHEET 3. …3b3088bd9c47f407a4d2-5a46b125adfc01d909dffba6766a3f2c.r32.c… · 3. Copy one column 4. Paste into another excel 5. Repeat](https://reader035.fdocuments.net/reader035/viewer/2022081405/5f0d18477e708231d438a732/html5/thumbnails/40.jpg)