======================== ``grail.data.dh`` module ======================== .. include:: ../../version.h .. contents:: Table of Contents :backlinks: top -------- Overview -------- A drillhole set has three components: 1. drillhole or blasthole files: a PCF, an assay or composite file (called the interval file), and possibly a survey file. 2. a method of naming the drillholes or blastholes. 3. a method of defining the drillhole or blasthole geometry. All three of the above components must be specified when defining a drillhole set. A drillhole set is analogous to a drillhole view in MineSightŪ. Methods are provided for defining (opening) a drillhole set (See `Opening a Drillhole Set`_) and for querying each of its attributes, and reading and writing data to the drillhole files (See `Manipulating Drillhole Data`_). ----------------------- Opening a Drillhole Set ----------------------- Relevant functions: * :f:`opendhset` * :f:`opentypicaldhset` * :f:`duplicateiddhcount` * :f:`totaldhcount` * :f:`totaldhlist` There are six ways a drillhole name can be defined and five methods for defining the set geometry (see `ID Naming Methods`_ and `Geometry Definitions`_ below). The allowed file-ID-geometry configurations are summarized below (see `Set Configurations`_). Sets are defined (opened) using one of two functions: :f:`opendhset` or :f:`opentypicaldhset`. :f:`opendhset` is the more flexible function allowing a set to be defined using any possible configuration. For most sets (eg, just an assay and survey file with the usual drillhole naming), this function is cumbersome. :f:`opentypicaldhset` will define a set using the usual configuration based on the chosen interval and survey file. It is much, much easier to open your drillhole set using :f:`opentypicaldhset`. Both ways of opening a drillhole set produce a :c:`DHSet` object. Open Drillhole Sets (Generalized) --------------------------------- :f:`opendhset` The :f:`opendhset` function is the most generalized way to define a drillhole set. Each of the above three components (files, ID, geometry) is specified as an argument of :f:`opendhset`. If :f:`opendhset` cannot define a set using the information an exception is set. Arguments to :f:`opendhset`: ============== ====== ======================================= argument type description ============== ====== ======================================= PCF path string path (relative or absolute) to the PCF interval file string file name of the assay or composite file survey file string file name of the survey file or None if not used ID type int constant specifying naming method ID items list item names (strings) used for naming geometry type int constant specifying geometry method geometry items list item names (strings) used for defining the set geometry ============== ====== ======================================= Files ----- Each set requires a PCF path and at least an interval file and possibly a survey file. Enter the interval and survey file *names*, not their paths. The interval and survey file *must* exist in the same directory as the PCF. See `Set Configurations`_ for required files. ID Naming Methods ----------------- The drillhole name or ID can come from items in the survey file or items in the interval file. Below are the six methods for defining the drillhole naming method. ======================== ========================================= constant items ======================== ========================================= :d:`dh.idSURVEY` None (use empty item list) :d:`dh.idSURVEY_ALPHA1` alpha survey file item :d:`dh.idSURVEY_ALPHA2` first then second alpha survey file items :d:`dh.idREF` alpha or integer composite file item :d:`dh.idDHID1` first sixbit composite file item :d:`dh.idDHID2` first then second sixbit composite file items ======================== ========================================= Geometry Definitions -------------------- You may or may not choose to have interval geometry computed for loaded drillholes in your set. If you choose to compute the geometry, the XYZ locations of the interval start and end points are computed for each loaded drillhole. Note that some methods are only available for blasthole sets. Also, all the geometry items must be float items, not alpha. The XYZ location is computed using one of several methods: ====================== =========================================== constant description ====================== =========================================== :d:`dh.geomNONE` No geometry :d:`dh.geomSURVEY` Geometry is computed using the surveys defined in the survey file. This is the usual method for defining geometry from drillhole (as opposed to blasthole) sets. :d:`dh.geomSTART_END` Use items in the composite file to define the starting and ending interval locations :d:`dh.geomEND_BENCH` Use items in the blasthole composite file to define the end of a blasthole and use the bench height to compute the top of the blasthole. This is the usual method for determining geometry for a blasthole set. :d:`dh.geomEND_LENGTH` Use items in the blasthole composite file to define the end of a blasthole and a length item to determine the top of the blasthole. ====================== =========================================== The geometry type and corresponding geometry item list must be one of the following. The order of the items is important. If no items are required, use an empty list ([]) as the argument. ======================= ============================================== constant items ======================= ============================================== :d:`dh.geomNONE` None (use empty item list) :d:`dh.geomSURVEY` None (use empty item list) :d:`dh.geomSTART_END` The interval starting easting, northing, and elevation items followed by the interval ending easting, northing, and elevation items. :d:`dh.geomEND_BENCH` The interval ending easting, northing, and elevation items. :d:`dh.geomEND_LENGTH` The interval ending easting, northing, and elevation items followed by the interval length item. ======================= ============================================== Set Configurations ------------------ The following is a list of available configurations for each file combination. Each line represents an allowed configuration. Note that :d:`dh.geomNONE` can always be substituted for the geometry method regardless of the file combination or chosen ID naming method. Note the configurations are ordered by drillhole and blasthole groups. **Drillhole assay and survey files** =================== ======================= ID Naming Method Geometry Method =================== ======================= dh.idSURVEY dh.geomSURVEY dh.idSURVEY_ALPHA1 dh.geomSURVEY dh.idSURVEY_ALPHA2 dh.geomSURVEY =================== ======================= **Drillhole composite and survey files** =================== ======================= ID Naming Method Geometry Method =================== ======================= dh.idSURVEY dh.geomSURVEY dh.idSURVEY dh.geomSTART_END dh.idSURVEY_ALPHA1 dh.geomSURVEY dh.idSURVEY_ALPHA1 dh.geomSTART_END dh.idSURVEY_ALPHA2 dh.geomSURVEY dh.idSURVEY_ALPHA2 dh.geomSTART_END =================== ======================= **Drillhole composite file only** =================== ======================= ID Naming Method Geometry Method =================== ======================= dh.idREF dh.geomSTART_END dh.idDHID1 dh.geomSTART_END dh.idDHID2 dh.geomSTART_END =================== ======================= **Blasthole composite and survey files** =================== ======================= ID Naming Method Geometry Method =================== ======================= dh.idSURVEY dh.geomSTART_END dh.idSURVEY dh.geomEND_BENCH dh.idSURVEY dh.geomEND_LENGTH =================== ======================= **Blasthole composite file only** =================== ======================= ID Naming Method Geometry Method =================== ======================= dh.idREF dh.geomSTART_END dh.idREF dh.geomEND_BENCH dh.idREF dh.geomEND_LENGTH dh.idDHID1 dh.geomSTART_END dh.idDHID1 dh.geomEND_BENCH dh.idDHID1 dh.geomEND_LENGTH dh.idDHID2 dh.geomSTART_END dh.idDHID2 dh.geomEND_BENCH dh.idDHID2 dh.geomEND_LENGTH =================== ======================= Examples: Open a stand-alone drillhole composite file using REF# for the drillhole ID and composite file items to determine the interval starting and ending points. .. Python:: geom = ['XTOP', 'YTOP', 'ZTOP', 'XBOT', 'YBOT', 'ZBOT'] drillhole_set = dh.opendhset( 'd:\\cow\\comp10.dat', 'comp09.dat', None, dh.idREF, ['REF#'], dh.idSTART_END, geom) Open a blasthole composite and survey file using the shot names in the survey file. Don't bother with geometry .. Python:: bhset = dh.opendhset('mbhs10.dat', 'mbhs09.dat', 'mbhs12.dat', dh.idSURVEY, [], dh.geomNONE, []) Open Drillhole Sets (Typical) ----------------------------- :f:`opentypicaldhset` Use :f:`opentypicaldhset` to define the usual drillhole set configurations. These are the configurations to use if your drillhole files were built using the default options in MS-Compass. The arguments to :f:`opentypicaldhset` are: ============== ====== ======================================= argument type description ============== ====== ======================================= PCF path string path (relative or absolute) to the PCF interval file string file name of the assay or composite file survey file string file name of the survey file. CANNOT be None. ============== ====== ======================================= For a drillhole assay or composite file plus a survey file, :f:`opentypicaldhset` is equivalent to .. Python:: opendhset(pcfpath, intervalFile, surveyFile, dh.idSURVEY, [], dh.geomSURVEY, []) For a blasthole composite plus survey file, :f:`opentypicaldhset` is equivalent to .. Python:: opendhset(pcfpath, intervalFile, surveyFile, dh.idSURVEY, [], dh.geomEND_BENCH, ['EAST', 'NORTH', 'ELEV.']) Functions Relevant to Creating the Drillhole Set ------------------------------------------------ If the set could not be defined using the typical configuration corresponding to the file combination as specified in the argument list, NULL will be returned and an error raised. The set will then need to be constructed using :f:`opendhset`. As in MineSightŪ, drillhole names must be unique. It is possible using some of the more exotic drillhole naming mechanisms (especially :d:`dh.idREF`) that duplicate IDs can be generated. After opening the drillhole set, use :f:`duplicateiddhcount` to count the number of drillholes that were not included in the set because they had non-unique IDs. Drillhole data is accessed via its drillhole name. Use :f:`totaldhlist` to generate a list of drillhole names in the set. --------------------------- Manipulating Drillhole Data --------------------------- The functions found with the :c:`DHSet` object can be grouped into five broad categories: `Loading Drillholes`_, `Accessing Drillhole Data`_, `Storing Drillhole Data`_, `Accessing Item Parameters`_, and `Miscellaneous functions`_. In general, after a drillhole set is opened, some or all of the drillholes are 'loaded' at which point their data can be accessed, manipulated, and stored using the functions described in this section. Drillhole data is accessed on an individual drillhole basis. Functions that operate on individual drillholes begin with the letters 'dh' and always take the drillhole name (string) and the first argument. Use :f:`totaldhlist` to generate a list of all the drillholes in the set. Loading Drillholes ------------------ Relevant functions: * :f:`dhload` * :f:`dhloaded` * :f:`loadalldhs` * :f:`loaddhsbyextent` * :f:`dhunload` * :f:`unloadalldhs` * :f:`dhbytes` * :f:`intervalloaditems` Drillhole data is available to the set from two places: 1) the survey file (if any) 2) the interval file If a survey file is specified as part of the set and used to define the geometry (ie, :d:`dh.geomSURVEY` was the Geometry type), then the survey coordinates for each drillhole are always available in the drillhole set. If when the survey file was initialized (eg, in MS-Compass), additional survey items were specified, then these additional survey items are also available in the drillhole set. You cannot access, nor should you need to access, the default survey items (eg, LOC09, DLAB1) via the drillhole set. To conserve memory, data from the interval file (item data and interval coordinates) is not stored in the drillhole set until a drillhole is 'loaded'. With sufficient memory, all drillhole data can be loaded. Or you can choose to load a subset of the drillholes or a subset of the available item data. Use :f:`dhbytes` to determine the bytes required to load an individual drillhole. If you want to limit the items for which interval data is retrieved, use :f:`intervalloaditems` before loading the drillholes. By default, item values are available for all items except those used to define the drillhole ID for ID types :d:`dh.idDHID1` and :d:`dh.idDHID2` (ie, special composite file sixbit items). Although almost all item values are loadable, items used to define the drillhole ID or geometry, plus several specially named items, are not storable. See `Accessing Item Parameters`_ for determining the storable items. Drillholes can be loaded individually (:f:`dhload`), by the location of their survey (:f:`loaddhsbyextent`), or en masse (:f:`loadalldhs`). :f:`dhloaded` returns :d:`dh.TRUE` if a dh is loaded. All the drillholes can be unloaded using :f:`unloadalldhs` or individual drillholes can be unloaded using :f:`dhunload`. Accessing Drillhole Data ------------------------ Relevant functions: * :f:`dhsurveydataat` * :f:`dhsurveycoordsat` * :f:`dhsurveycount` * :f:`dhsurveysetfloatdataat` * :f:`dhsurveysetalphadataat` * :f:`dhintervaldataat` * :f:`dhintervalcoordsat` * :f:`dhintervalcount` * :f:`dhintervalsetfloatdataat` * :f:`dhintervalsetalphadataat` * :f:`badintervaldhcount` * :f:`dhbadintervalcount` * :f:`dhbadintervalat` All drillhole data access functions operate on a single drillhole and thus a drillhole name is required in the argument list. Functions that retrieve coordinate data operate on a single survey or interval and require the survey or interval index (offset from one). Functions that retrieve item data also operate on a single survey or interval and additionally require the item name in the argument list. Values for items used to define the drillhole ID or geometry can be retrieved and modified, but cannot be stored back to the drillhole files. This means that the drillhole names and geometry cannot be modified either in the drillhole set or in the drillhole files. See `Accessing Item Parameters`_ for more details. Coordinates are retrieved as python float values. Item values that are *missing* have values equivalent to :d:`dh.MISSING`. Data is retrieved as either a python float or a python string depending on the item's data type. Float and string values can be set for survey and interval item data. The :f:`setalphadataat` functions automatically convert strings to exactly four characters (how they are stored in and retrieved from the files) by truncating or padding with blanks as necessary. You can set float item values to *missing* using :d:`dh.MISSING`. Alpha values are never *missing*. If a drillhole has multiple surveys, each survey has the same data as the collar survey. You can modify the non-collar survey data but when the data is stored back to the file, only collar data will be stored. Note that the values in the drillhole set are not permanently stored in the data files until the drillhole is explicitly stored using :f:`dhstore` or :f:`storealldhs`. When a drillhole is loaded, it is possible that its geometry is badly specified. For example, say the item EAST was used to define the interval's easting, but the value for EAST was *missing*. In this case the interval coordinates cannot be computed and are set to :d:`dh.MISSING`. Such drillholes should not be used in operations that require well-specified geometry. Use :f:`badintervaldhcount` to see if any drillholes have bad geometry. Individual intervals in a specific drillhole can be checked for bad geometry by using :f:`dhbadintervalcount` or :f:`dhbadintervalat`. Storing Drillhole Data ---------------------- Relevant functions: * :f:`dhstore` * :f:`storealldhs` It's a good idea to backup your files before storing data, especially if you are debugging a script. Data for all drillholes can be stored using :f:`storealldhs` or data for an individual drillhole can be stored via :f:`dhstore`. If the drillhole is not loaded, then only survey data (if any) will be stored. Accessing Item Parameters ------------------------- Relevant functions: * :f:`surveyitemcount` * :f:`surveyitemlist` * :f:`surveystorableitemlist` * :f:`intervalitemcount` * :f:`intervalitemlist` * :f:`intervalloadeditemcount` * :f:`intervalloadeditemlist` * :f:`intervalstorableitemlist` * :f:`surveyitemstorable` * :f:`surveyitemmin` * :f:`surveyitemmax` * :f:`surveyitemmaxstorable` * :f:`surveyitemprecision` * :f:`surveyitemalpha` * :f:`intervalitemstorable` * :f:`intervalitemmin` * :f:`intervalitemmax` * :f:`intervalitemmaxstorable` * :f:`intervalitemprecision` * :f:`intervalitemalpha` There are differences between the way survey and interval items are handled in the drillhole set. These differences cause some peculiarities in the way the item parameter functions work. First, if the set has a survey file and the survey file has additional items (eg, you defined items in addition to the default items when the file was initialized in MS-Compass), then values for the additional items are accessible from the drillhole set regardless of the drillhole's load state. The default survey file items are not accessible; you cannot get data for them or query their parameters in any way. So :f:`surveyitemlist` returns a list of the additional survey file items. In contrast, :f:`intervalitemlist` returns a list of all interval file items. Secondly, you can limit the interval items for which data is retrieved. Thus interval items can be loaded or not, whereas additional survey items are always loaded. Use :f:`intervalloadeditemlist` to see which interval items are loaded. Note that all interval file items can be loaded except any special sixbit items used to define the drillhole ID with ID types :d:`dh.idDHID1` or :d:`dh.idDHID2`. These special items cannot be loaded. Since all additional survey file items are always loaded, there is no corresponding function to return a list of the loaded survey file items. Common to both survey and interval items is storability. Although all items (except the special sixbit items noted above) can be retrieved and modified, not all items can be stored back to the survey and interval files. Any item used to define the drillhole ID or geometry cannot be stored back to the file. Additionally, any items with the following names are also not storable: * REF# * FROM * -TO- * -AI- * EAST * NORTH * DHTOE * ELEV. * BHS# * ELVBH * LNGTH This means that you cannot edit the drillhole name or geometry in the drillhole file. Neither will modifying ID or geometry items in the set have an affect on drillhole's name or geometry in the set. The drillhole name and geometry are computed directly from the values in the file. Functions to query the item parameters (like the item's minimum value) work the same for both survey and interval items. All functions take a string containing the item name as the argument. :f:`surveyitemstorable` and :f:`intervalitemstorable`: Returns :d:`dh.TRUE` if this is a storable item. Note that for an interval item, the item must be loaded in order to be storable. :f:`surveyitemalpha` and :f:`intervalitemalpha`: Returns :d:`dh.TRUE` if this is an alpha item. Otherwise the item is a float. :f:`surveyitemmin` and :f:`intervalitemmin`: Returns the minimum value for the item. If you try to store a float value less than the item minimum, :d:`dh.MISSING` will be stored in the file. :f:`surveyitemmax` and :f:`intervalitemmax`: Returns the value requested as the item maximum when the file was initialized. :f:`surveyitemmaxstorable` and :f:`intervalitemmaxstorable`: Returns the maximum storable value for this item which, because of the item packing algorithm, is usually slightly larger than the maximum initialized value. Stored float values will be limited by the maximum storable value for the item. :f:`surveyitemprecision` and :f:`intervalitemprecision`: The precision of the item. Miscellaneous Functions ----------------------- Relevant functions: * :f:`epsilon` * :f:`setepsilon` * :f:`bh` * :f:`intervaltype` * :f:`idtype` * :f:`geometrytype` * :f:`iditemlist` * :f:`geometryitemlist` * :f:`intervalfile` * :f:`surveyfile` * :f:`survey` Each set carries an epsilon value. By default epsilon is 0.1. Epsilon is used internally in the drillhole set functions to determine if drillhole (not blasthole) surveys and intervals are contiguous. If the starting point of a survey or interval is within :f:`epsilon` of the previous survey or interval's end point, then the end point coordinates are set exactly equal to the start point coordinates of the subsequent survey or interval. Also, if using the :d:`dh.geomEND_BENCH` geometry type, end points within epsilon of a bench are assumed to be on that bench. The epsilon value can be retrieved using the :f:`epsilon` function or the value can be set using the :f:`setepsilon` function. Function :f:`bh` will return :d:`dh.TRUE` for a blasthole set. Function :f:`intervaltype` returns the type of interval file, either 9 or 11. Function :f:`idtype` returns the constant specifying the ID naming method and function :f:`iditemlist` returns a list of the items used to name the drillholes. Function :f:`geometrytype` returns the constant specifying the geometry definition method and function :d:`geometryitemlist` returns a list of the items used to define the geometry. :f:`intervalfile` and :f:`surveyfile` return the path to the interval and survey file used by the set. :f:`surveyfile` will return an empty string if the set does not have a survey file. function :f:`survey` returns :d:`dh.TRUE` if this set has a survey file. ---------------------------------------------- Function Definitions ---------------------------------------------- Defining a :c:`DHSet` object :df:`opendhset(pcf, intvFile, survFile, idType, idList, geomType, geomList)` Define a drillhole set. See details above under `Opening a Drillhole Set`_. Arguments: :a:`pcf` : string path (relative or absolute) to the pcf. :a:`intvFile`: string interval file name. :a:`survFile` : string survey file name. :a:`idType` : int dh naming method. See `Constants`_ :a:`idList` : list of strings items used in the dh naming method. :a:`geomType` : int geometry definition method. See `Constants`_ :a:`geomList` : list of strings items used to define dh geometry. Returns a DHSet object. :df:`opentypicaldhset(pcf, intvFile, survFile)` Define a drillhole set. See details above under `Opening a Drillhole Set`_. Arguments: :a:`pcf` : string path (relative or absolute) to the pcf. :a:`intvFile`: string interval file name. :a:`survFile` : string survey file name. Returns a DHSet object. class :dc:`DHSet` MineSightŪ drillhole and blasthole data is accessed in Python via a drillhole set object (DHSet). See details under `Opening a Drillhole Set`_ and `Manipulating Drillhole Data`_. :df:`badintervaldhcount()` Returns the number of dhs (int) in this set having at least one interval with badly defined coordinates. :df:`bh()` Returns :d:`dh.TRUE` if this is this a blasthole set. :df:`dhbadintervalat(dh, intv)` Check if the specified interval has bad coordinates. Arguments: :a:`dh` : string drillhole name :a:`intv` : int interval (from 1 to :f:`dhintervalcount`) Returns :d:`dh.TRUE` or :d:`dh.FALSE` :df:`dhbadintervalcount(dh)` Determine the number of intervals in this dh having bad geometry coordinates. Arguments: :a:`dh` : string drillhole name Returns (int) the number of intervals with bad geometry coordinates. :df:`dhbytes(dh)` Determine the estimated number of bytes required to load a drillhole. Arguments: :a:`dh` : string drillhole name Returns (int) estimated bytes required to load dh. :df:`dhintervalcoordsat(dh, intv)` Returns the starting xyz and ending xyz coordinates for one interval in a loaded dh. Arguments: :a:`dh` : string drillhole name :a:`intv` : int interval (from 1 to :f:`dhintervalcount`) Returns (list of floats) start and end interval coordinates of loaded dh. :df:`dhintervalcount(dh)` Determine the number of intervals in a loaded dh. Arguments: :a:`dh` : string drillhole name Returns (int) the number of intervals in a loaded dh. :df:`dhintervaldataat(dh, intv, item)` Returns the data for the specified interval and item. The data is either a float or a string depending on the item. Arguments: :a:`dh` : string drillhole name :a:`intv` : int interval (from 1 to :f:`dhintervalcount`) :a:`item` : string item Returns (float or string) item data for an interval. :df:`dhintervalsetalphadataat(dh, intv, item, val)` Set an alpha value for the specified interval and item. The string will be converted to exactly 4 char. Arguments: :a:`dh` : string drillhole name :a:`intv` : int interval (from 1 to :f:`dhintervalcount`) :a:`item` : string item :a:`val` : string the alpha value to set :df:`dhintervalsetfloatdataat(dh, intv, item, val)` Set a float value for the specified interval and item. Arguments: :a:`dh` : string drillhole name :a:`intv` : int interval (from 1 to :f:`dhintervalcount`) :a:`item` : string item :a:`val` : float the float value to set :df:`dhload(dh)` Loads a dh. If the dh is loaded, it will be unloaded then loaded. This function only affects interval data. Arguments: :a:`dh` : string drillhole name :df:`dhloaded(dh)` Check if a drillhole is loaded. Arguments: :a:`dh` : string drillhole name Returns :d:`dh.TRUE` if the dh is loaded. :df:`dhstore(dh)` Stores interval and survey (if any) data for a dh. Arguments: :a:`dh` : string drillhole name :df:`dhsurveycoordsat(dh, survey)` Returns the starting xyz and ending xyz coordinates for one survey in a dh. Arguments: :a:`dh` : string drillhole name :a:`survey` : int survey (from 1 to :f:`dhsurveycount`) Returns (list of floats) start and end survey coordinates of a dh. :df:`dhsurveycount(dh)` Determine the number of surveys in a dh. Arguments: :a:`dh` : string drillhole name Returns (int) the number of surveys in a dh. :df:`dhsurveydataat(dh, survey, item)` Returns the data for the specified survey and item. The data is either a float or a string depending on the item. Arguments: :a:`dh` : string drillhole name :a:`survey` : int survey (from 1 to :f:`dhsurveycount`) :a:`item` : string item Returns (float or string) item data for an survey. :df:`dhsurveyreload(dh)` Reloads survey data for a dh. Arguments: :a:`dh` : string drillhole name :df:`dhsurveysetalphadataat(dh, survey, item, val)` Set an alpha value for the specified survey and item. The string will be converted to exactly 4 char. Arguments: :a:`dh` : string drillhole name :a:`survey` : int survey (from 1 to :f:`dhsurveycount`) :a:`item` : string item :a:`val` : string the alpha value to set :df:`dhsurveysetfloatdataat(dh, survey, item, val)` Set a float value for the specified survey and item. Arguments: :a:`dh` : string drillhole name :a:`survey` : int survey (from 1 to :f:`dhsurveycount`) :a:`item` : string item :a:`val` : float the float value to set :df:`dhunload(dh)` Unloads a dh Arguments: :a:`dh` : string drillhole name :df:`duplicateiddhcount()` Returns (int) the number of dhs not put in the set because they had duplicate ids :df:`epsilon()` Returns (float) the epsilon value for the set. :df:`free()` Explicitly free the dhset object's memory. :df:`geometryitemlist()` Returns (list of strings) items used for set geometry. :df:`geometrytype()` Returns constant indicating the set geometry type. See `Constants`_ :df:`iditemlist()` Returns (list of strings) items used for set ID. :df:`idtype()` Returns constant indicating the set ID type. See `Constants`_. :df:`intervalfile()` Returns (string) the path of the interval file. :df:`intervalitemalpha(item)` Check if this interval item is alpha. Arguments: :a:`item` : string item Returns :d:`dh.TRUE` if this is an interval alpha item. :df:`intervalitemcount()` Returns (int) the number of items in the interval file. :df:`intervalitemlist()` Returns (list of strings) the items in the interval file :df:`intervalitemmax(item)` Determine the maximum initialized value for this interval item. Arguments: :a:`item` : string item Returns (float) the max value for the specified interval item or :d:`dh.ITEM_MAX` for alpha and fullword items. :df:`intervalitemmaxstorable(item)` Determine the maximum storable value for this interval item. In general, the maximum storable value is slightly larger than the initialized value. Arguments: :a:`item` : string item Returns (float) the max value for the specified interval item or :d:`dh.ITEM_MAX` for alpha and fullword items. :df:`intervalitemmin(item)` Determine the minimum value for this interval item. Arguments: :a:`item` : string item Returns (float) the min value for the specified interval item or :d:`dh.ITEM_MIN` for alpha and fullword items. :df:`intervalitemprecision(item)` Arguments: :a:`item` : string item Returns (float) the precision for the specified interval item. :df:`intervalitemstorable(item)` Check if an interval item is storable. Note that only loaded items are storable. Arguments: :a:`item` : string item Returns :d:`dh.TRUE` is a specified interval item is storable. :df:`intervalloadallitems()` Resets the loaded interval items to include all file items. Loaded drillholes will be unloaded and loaded. If drillhole values have changed in the set, store the drillholes before resetting the items or the changes will be lost. :df:`intervalloadeditemcount()` Returns (int) the number of items for which interval data is loaded. :df:`intervalloadeditemlist()` Returns (list of strings) then items for which interval data is loaded . :df:`intervalloaditems(list)` Resets the loaded interval items to the items in the list. Loaded drillholes will be unloaded and loaded. If drillhole values have changed in the set, store the drillholes before resetting the items or the changes will be lost. Arguments: :a:`list` : list of strings item names :df:`intervalstorableitemlist()` Returns (list of strings) storable items in the loaded item list :df:`intervaltype()` Returns (int) the type of interval file: 11 or 9. :df:`loadalldhs()` Loads all the dhs in this set. Loaded dhs will be unloaded then reloaded. :df:`loaddhsbyextent(collaronly, xmin, xmax, ymin, ymax,zmin, zmax)` Loads all the dhs with surveys intersecting a given cube. The dhset survey type must be :d:`dh.geomSURVEY`. Arguments: :a:`collaronly` : integer :d:`dh.TRUE` will only check if the survey collar intersects the cube. :a:`xmin` : double cube xmin :a:`xmax` : double cube xmax :a:`ymin` : double cube ymin :a:`ymax` : double cube ymax :a:`zmin` : double cube zmin :a:`zmax` : double cube zmax :df:`loadeddhcount()` Returns (int) the number of loaded dhs in this set. :df:`loadeddhlist()` Returns (list of strings) the loaded dhs in this set. :df:`setepsilon(epsilon)` Set the epsilon value for the set. Arguments: :a:`epsilon` : float :df:`storealldhs()` Stores the data for all loaded dhs :df:`survey()` Returns :d:`dh.TRUE` if this set has a survey file :df:`surveyfile()` Returns (string) the survey file path, if any. :df:`surveyitemalpha(item)` Check if a survey item is alpha. Arguments: :a:`item` : string item Returns :d:`dh.TRUE` if this is an alpha item :df:`surveyitemcount()` Returns (int) the number of accessible items in the survey file. :df:`surveyitemlist()` Returns (list of strings) the accessible items in the survey file. :df:`surveyitemmax(item)` This function is provided for symmetry. All survey items are alpha or fullword and thus have maximum value :d:`dh.ITEM_MAX`. Arguments: :a:`item` : string item Returns :d:`dh.ITEM_MAX` :df:`surveyitemmaxstorable(item)` This function is provided for symmetry. All survey items are alpha or fullword and thus have maximum value :d:`dh.ITEM_MAX`. Arguments: :a:`item` : string item Returns :d:`dh.ITEM_MAX` :df:`surveyitemmin(item)` This function is provided for symmetry. All survey items are alpha or fullword and thus have minimum value :d:`dh.ITEM_MIN`. Arguments: :a:`item` : string item Returns :d:`dh.ITEM_MIN` :df:`surveyitemprecision(item)` Arguments: :a:`item` : string item Returns (float) the precision for the specified survey item. :df:`surveyitemstorable(item)` Arguments: :a:`item` : string item Returns :d:`dh.TRUE` if the specified survey item is storable. :df:`surveystorableitemlist()` Returns (list of strings) the storable items in the survey file. :df:`totaldhcount()` Returns (int) the total number of dhs in this set. :df:`totaldhlist()` Returns (list of strings) all the dhs in this set. :df:`unloadalldhs()` Unloads all the dhs in this set. ---------------------------- Examples of Drillhole Access ---------------------------- The following two examples should help provide details on accessing the drillholes via Python scripts. Simple Drillhole Access ----------------------- The following example will loop over all drillhole data and perform the following calculation, EQCU = TOTCU + 10 * MOLY It assumes that we have a drillhole project called "SAMP". .. Python:: from grail.data import dh # open function for typical dh set drillhole_set = dh.opentypicaldhset("SAMP10.DAT", "SAMP09.DAT", "SAMP12.DAT") # get a list of all the drillholes in the set drillholes = dhset.totaldhlist() # load all the drillholes dhset.loadalldhs() # loop over all the drillholes and make the calculation for drillhole in drillholes: # loop over all the intervals in the drillhole for intv in range(1, dhset.dhintervalcount(drillhole)+1): # get the TOTCU and MOLY values for this interval vtotcu = dhset.dhintervaldataat(drillhole, intv, "TOTCU") vmoly = dhset.dhintervaldataat(drillhole, intv, "MOLY") # if either the TOTCU or MOLY value is MISSING, # set the EQCU value to MISSING, too. if cmp(vtotcu,dh.MISSING)==0 or cmp(vmoly,dh.MISSING)==0: veqcu = dh.MISSING else: veqcu = vtotcu + 10 * vmoly # put the EQCU value in the drillhole dhset.dhintervalsetfloatdataat(drillhole, intv, "EQCU", veqcu) # store all the drillholes dhset.storealldhs() Saving Memory During Drillhole Access ------------------------------------- The following example illustrates how you can save memory during drillhole access. Instead of loading intervals containing all the available items, we will just load intervals containing the items of interest. We will perform the same calculation shown in the `Simple Drillhole Access`_ above. In addition, we will use the generalized open function discussed in `Open Drillhole Sets (Generalized)`_. .. Python:: from grail.data import dh # generalized open function dhset = dh.opendhset("SAMP10.DAT", "SAMP09.DAT", "SAMP12.DAT", dh.idSURVEY, [], dh.geomSURVEY, []) # get a list of all the drillholes in the set drillholes = dhset.totaldhlist() # save memory: only load a subset of the items loadeditems = ["TOTCU", "MOLY", "EQCU"] dhset.intervalloaditems(loadeditems) dhset.loadalldhs() # loop over all the drillholes and make the calculation for drillhole in drillholes: # loop over all the intervals in the drillhole for intv in range(1, dhset.dhintervalcount(drillhole)+1): # get the TOTCU and MOLY values for this interval vtotcu = dhset.dhintervaldataat(drillhole, intv, "TOTCU") vmoly = dhset.dhintervaldataat(drillhole, intv, "MOLY") # if either the TOTCU or MOLY value is MISSING, # set the EQCU value to MISSING, too. if cmp(vtotcu,dh.MISSING)==0 or cmp(vmoly,dh.MISSING)==0: veqcu = dh.MISSING else: veqcu = vtotcu + 10 * vmoly # put the EQCU value in the drillhole dhset.dhintervalsetfloatdataat(drillhole, intv, "EQCU", veqcu) # store all the drillholes dhset.storealldhs() --------- Constants --------- True/False constants :dd:`FALSE` :dd:`TRUE` Defines 0 for False and 1 for True. Constant for *missing* data :dd:`MISSING` Constants for defining drillhole IDs :dd:`idCOUNT` :dd:`idDHID1` :dd:`idDHID2` :dd:`idREF` :dd:`idSURVEY` :dd:`idSURVEY_ALPHA1` :dd:`idSURVEY_ALPHA2` :dd:`idUNKNOWN` Constants for defining drillhole Geometry :dd:`geomCOUNT` :dd:`geomEND_BENCH` :dd:`geomEND_LENGTH` :dd:`geomNONE` :dd:`geomSTART_END` :dd:`geomSURVEY` :dd:`geomUNKNOWN` Constants for item range :dd:`ITEM_MAX` :dd:`ITEM_MIN`