Engines Home  |  DATAMINEBLOCKTOCSV

datamineBlockToCsv

Contents:

Description
register_datamine_api.bat
Input Files
Output Files
Command Line Usage
Configuration File
Usage Examples
Notes

 


Description

datamineBlockToCsv.exe is a command line executable that allows you to convert a Datamine block model file into an ASCII .csv file for use with MSDART.  As part of this conversion a number of helper files are output to assist the user in correctly reblocking the model (in the case of sub-blocked models) or importing directly in the case of a simple model.

Note:  This version of the Datamine model to CSV converter works with non-rotated models only.

register_datamine_api.bat

If you are unable to run datamineBlockToCsv.exe, the Datamine import library (DmFile.DLL) might not be properly registered on your system.  If you have administrative privileges on your computer, you will need to run the batch file register_datamine_api.bat to register the import library.  This batch file is found in the %medexe% folder.

Input Files

There are only two input files for using utility:

Datamine Block Model file:  *.dm, required. This is the file that we are reading and converting

Configuration File: *.ini, optional.  dmToCsvConfiguration.ini is provided by default. This allows the users to share settings for conversion of their block model files and easily batch this utility.

Output Files

This utility creates several output files to allow for importing to a MineSight block model, provide information about the characteristics of the Datamine block model, and utility files for ease of importing in the case of a simple, non-sub-blocked model.

Unless the output file names are specified, their names are generated. If the csv output file is specified, the schema and grade items files will have the same name + appropriate extension. For example if the csv output file is specified as block1.csv, the other output files would be block1.schema and block1.dat. Otherwise, the same naming convention is used but based on the input block model file name.

CSV file:

*.csv. This file is the comma separated file which contains the data from the block model.

Format:  xWorld, yWorld, zWorld, xCenter, yCenter, zCenter, xLength, yLength, zLength, Grade items......, blockNum, Volume, extentXMin, extentYMin, extentZMin, extentXMax, extentYMax, extentZMax

Grade Items:  Grade items are one or more variable columns (custom variables) in the Datamine block model.

Numeric Grade Items:  these are output as-is with the precision specified as part of the command-line or configuration. By default the precision is 3 decimal places.

String Grade Items:  string grade items are output as integers for ease of importing into MineSight. The translation tables for string grade items can be found in the schema output file as long as the "-schema" flag was not specified.

Schema file:

*.schema.  This file contains information about the characteristics of the block model. This file is purely informational for the user.

Contents:

  • Model Extent

  • World Extent

  • Model origin

  • Schemas - the block size schemas present in the model. Each has

    • Extent

    • Size

    • Dimensions

  • Grade items - lists the grade items in the model, including the numbers of both numeric and string variables split by type.

    • If using the -schema flag, only the name of the variable will be listed.

    • Numeric variables

      • name

      • (truncated name used in grade items file)

      • min

      • max

    • String variables

      • name

      • (truncated name used in grade items file)

      • translation table for that variable in the form: string value : integer value, and sorted ascending by integer value

Grade Items:

*.dat. This file contains a list of the grade items present in the csv file and formatted for being input to the MineSight block model. This can be used when initializing model.

Format: Truncated variable name min max precision

*note: min is represented as a lower bound integer (rounded down) and max is an upper bound integer (rounded up) based on the min and max found in the model.

Truncation of Item Names:  because this file is intended to be used for importing to File 15, we have a character limit of 5. Names are truncated to 5 characters and upper-cased. If matches are found, these are further truncated and given an index. This may still result in duplicates. It is the user's responsibility to then edit this file. These truncated names can also be found in the schema file. In an attempt to make truncated names conform to the 6bit requirement for MineSight block model files, truncated names are also modified to remove invalid characters. Valid characters are ASCII 32-94. Underscores _ are replaced with a dash -.  All other invalid characters are replaced with a ?.

Command Line Usage

datamineBlockToCsv.exe - this is the executable name for this utility

-bmfin file :

Input Datamine block model file (*.dm). The input file must be present in either the command line or configuration file.

-confin file :

Input configuration file (*.ini). You can run this utility with only a configuration file, but it must specifiy the block model input file.

-csvout file :

Ouput comma separated file (*.csv). Optional.

-schemaout file :

Output schma file (*.schema). Optional.

-itemout file :

Output grade items file (*.dat). Optional.

-p (--precision) int :

Override default of using 3 decimal places for precision. Must be an integer > 0. e.g. 4 is equivalent to .0001. Optional.

-xMin double :

Min value for use in extent filtering with respect to x axis in model coordinates and not world coordinates. Optional.

-xMax double :

Max value for use in extent filtering with respect to x axis in model coordinates and not world coordinates. Optional.

-yMin double :

Min value for for use in extent filtering with respect to y axis in model coordinates and not world coordinates. Optional.

-yMax double :

Max value for use in extent filtering with respect to y axis in model coordinates and not world coordinates. Optional.

-zMin double :

Min value for for use in extent filtering with respect to z axis in model coordinates and not world coordinates. Optional.

-zMax double :

Max value for use in extent filtering with respect to z axis in model coordinates and not world coordinates. Optional.

-o (--overrwrite):

Do not prompt for overwrite. This prevents the application for prompting you before overwriting pre-existing files. This could be useful in batch processing when certain that there is no harm in overwriting existing files.

-s (--schemaonly) :

Print only the schema file. This prints a limited schema file only (does not provide extended variable information) and does not process the block model in order to create a comma separated file or grade items file.

-h (--help) :

Prints the help for the application.

-c (--complete):

-Includes xCenter, yCenter, zCenter, and the extents in the csv output file.

Configuration File

A configuration file can be used to configure the datamineBlockToCsv.exe utility. This .ini file is not required as all options are available via the command line. The command line or configuration file must specify the block model to be converted at the bare minimum.

A sample configuration file is provided as "dmToCsvConfiguration.ini".

*Note

The configuration file used in conjunction with the command line arguments will overwrite any settings specified in the command line arguments. For example, if in the command line arguments you specify "--precision 6" and in the configuration file you specify "precision=2", the precision will be 2. If on the command line you specify "--precision 6" and in the configuration file you specify "precision=", the precision will remain at 6 because you did not specify a value.

[files]

bmfin=filename :

The Datamine block model file name. Only required if not specified via the command line. This is likely not to be used often.

csvFileOut=filename :

Optionally override the default naming for the comma separated file (*.csv) that is output.

schemaFileOut=filename :

Optionally override the default naming for the schema file (*.schema) that is output.

itemsFileOut=filename :

Optionally override the default naming for the grade items file (*.dat) that is output.

[options]

complete=false(true) :

If false, xCenter, yCenter, zCenter and extents will be omitted from the output csv file.

promptForOverwrite=true(false) :

If "true" you will be prompted before overwriting existing files. This is the default. If "false", no warning will be given before ovewriting existing files.

schemaFileOnly=false(true) :

If "false", the block model will be completely evaluated and all output files will be created. This is default. If "true", only the limited schema file will be output.

[precision]

precision=int.

Optionally override the default precision of 3 decimal places. Precision is specified as an integer value >0, e.g. a precision of 4 is equivalent to .0001

[extents]

You can optionally specify a series of min and max values for use in extent filtering. Any combination of these filters can be used and extents can be negative, positive, and zero. If no extent filters are supplied, all blocks will be output to the comma separated file. Extent filters are with respect to model extent values and not world extent values.

xMin=double

yMin=double

zMin=double

xMax=double

yMax=double

zMax=double

Example Configuration File:

Usage Examples:

datamineBlockToCsv.exe -bmfin someBlockModel.dm

  • Precision will be 3 decimal places, no extent filtering

  • CSV file: someBlockModel.csv

  • Schema file: someBlockModel.schema

  • Grade items file: someBlockModel.dat

datamineBlockToCsv.exe –s -bmfin someBlockModel.dm

  • only someBlockModel.schema is output

datamineBlockToCsv.exe –o -bmfin someBlockModel.dm -csvout filteredModel.csv -confin dmToCsvConfiguration.ini

  • overwrite without prompting

  • Input file: someBlockModel.dm

  • CSV file: filteredModel.csv

  • Schema file: filteredModel.schema

  • Grade items file: fileteredModel.dat

  • precision and extent filtering come from dmToCsvConfiguration.ini

Notes

  • Simplest usage of this utility is to supply just the input file

  • If the block model file cannot be opened, ensure that no other applications are accessing the block model. If the block model has been opened and not been closed properly, there will be a lock file in the same directory as the model. This lock file prevents this utility from opening the model file.

  • Undefined values in the block model will appear as -9 or -99 depending on what the model supplies.

  • Extent filters which are invalid for the block model and result in 0 output blocks will prevent the application from continuing. An error message will be displayed.

  • Configuration files must have the .ini extension.