Professional Documents
Culture Documents
PR Python
PR Python
at Canadian Natural
March 2012
CNQ
Slide 2
Who is Canadian Natural?
• Canadian based E&P company
with international exposure
• ~US$50 billion enterprise value
• 594-604 MBOE/d – 2011F
– ~65% crude oil weighted
• 675-726 MBOE/d – 2012B
– ~70% crude oil weighted
• Returns focused
• Major oil sands player
– Major thermal in situ producer
with several projects in
inventory
– Major mining project with
110,000 bbl/d of SCO
production capacity
Information taken from the November 2011 Investor Presentation
CNQ
Slide 3
Horizon Oil Sands Operation
• Horizon Oil Sands Operation
– First Synthetic Crude Oil (SCO) was delivered on February 28, 2009
– Large open pit mining operation
– 2 tons of oil sands to produce 1 barrel SCO
– Bitumen extraction and upgrading facilities
– Current production capacity (Phase 1): 110,000 bbl/d
• Future expansions up to 500,000 bbl/d
CNQ
Slide 4
MineSight & Python
• Mintec’s Grail library
– Provides access to the core of MineSight.
– Modify and create geometry objects and model files
– Use the CAD Engines to calculate volumes, create partials files, intersect
surfaces, polygons, verify surfaces, and more.
– Access to Compass Multiruns
CNQ
Slide 5
Repetitive Tasks & Python
• Time consuming tasks:
– Intersecting surfaces
– Creating/Intersecting solids
– Calculating volumes
– When a user has to click the mouse, create an object, and repeat the
process multiple times
Overburden
Ore
Ore Solids
Overburden Solids
CNQ
Slide 7
Select Objects with the Data Manager
• Highlighted objects in the datamanager can be accessed with
the grail.ms3d.datamanager module
CNQ
Slide 8
Sort objects with loops
• Loop through the objects to sort the geometry objects into
categories for the script.
Loop through
geometry objects
CNQ
Slide 9
Run tasks prior to main loop
• Execute ‘Run once’ tasks prior to the main loop
–Eg. Create a solid to intersect with future solids
CNQ
Slide 10
Main loop
• Loop through the objects while performing tasks on them
–Eg. Get data from EOPs.
Loop through
surfaces
Create geometry
object to store result
CNQ
Slide 11
Main loop – Continued
• Continue performing tasks on the geometry objects
–Eg. Intersect and create excavation solid, and intersect newly
created EOP solid against the Ore solid
CNQ
Slide 12
Main loop & Exit Script
• Finish performing tasks on the geometry objects
–Eg. Intersect EOP solid against the Ore solid
• Outside of the main loop, close all objects and refresh Data
Manager when complete
CNQ
Slide 13
Results from the Python script
• The script:
– Makes the folders and geometry
objects
– Selects surfaces for surface and
solid intersection
– Stores results to a geometry
object
– Open and close objects as
needed
• Example: 18 EOPs & 1 Ore Top
selected
– 5 minutes 13 seconds later
– 18 Total excavation solids
– 18 Overburden solids
– 18 Ore solids Video clipped to reduce play time
CNQ
Slide 14
Calculate volumes
• Use grail.data.partialsfile & grail.engines.voxel to create partials files for solids and
report volumes
• Example: 1 LGO, 5 Dyke Shells,
and 9 Dyke Zone Solids
– 6 minutes 11 seconds later
– Fill solids for each dyke shell
– Zone solids for each dyke
shell
– Volumes calculated and
saved to CSV
CNQ
Slide 15
Compass MultiRuns
• Pass arguments to the script and execute Multi-run if needed
• When would you do this?
– Using MSEP for inventory calculation and adjustments to RCODE are required
CNQ
Slide 16
Compass MultiRuns
• Weekly GSM Rebuild multirun
– Multiple tasks – Dump data, Build GSM, Clone GSM, Dilute GSM
CNQ
Slide 17
WIN32 API
• Interact with Microsoft Outlook
– Send emails with attachments
CNQ
Slide 18
WIN32 API – Continued
• Interact with Microsoft Outlook
– Read emails and find MSR attachments
CNQ
Slide 19
OS.Startfile
• Start any file from within MineSight
– Eg. Excel/Word/PowerPoint files, Video capture program, etc
CNQ
Slide 20
Python Imaging Library – Tile Image
• Texturing Surfaces inside MineSight
• Tile images for hardware
rendering (4096px x 4096px)
Load image
Crop image
CNQ
Slide 22
Convert PNG to PDF
• Convert PNGs to PDFs using reportlab.pdfgen
Load image
Check orientation
and page size
Save to PDF
CNQ
Slide 23
Search the Data Manager
• Use os.walk to get the contents of the data manager
folder
• Use grail.project module for the resource directory path
CNQ
Slide 24
Resources
• MineSight Grail Documentation
• Google – Many searches for code tutorials and examples
• http://effbot.org/tkinterbook/ – TKinter reference
CNQ
Slide 25
Questions?
CNQ
Slide 26
THE FUTURE
CLEARLY DEFINED
Canadian Natural Resources Limited
2500, 855 - 2 Street SW
Calgary Alberta
T2P 4J8
phone: 403.517.6700
fax: 403.517.7350
email: ir@cnrl.com
www.cnrl.com