Catalogue of Metadata, Syntax and Functions

The features described in this topic are only available if you are licensed to use Leapfrog EDGE with Leapfrog Geo.

This catalogue details each of the items in the pinnable Insert list. Each item includes an intentionally trivial example to illustrate the use of the item, along with an explanation of the effect of the expression.

Existing Items

This section covers the items listed in the left-hand side of the pinnable Insert list:

To pin these lists to the Calculations tab, enable the Pin Window option:

Metadata

xc, yc and zc

These three metadata items are the variables for locating the centroid of the block, in X, Y and Z coordinates. Select an item to add it to the expression at the insertion point. Note that whenever one of these metadata items is added to an expression, it is wrapped in square brackets.

Example

Explanation

The numeric calculation top will be assigned the value of the location of [zc] the altitude of the block centroid from the zero reference, plus half the height of the block.

dx, dy and dz

These three metadata items are the variables for the block dimensions in X, Y and Z coordinates. Select an item to add it to the expression at the insertion point. Note that whenever one of these metadata items is added to an expression, it is wrapped in square brackets.

Example

Explanation

The numeric calculation surface area will be calculated by figuring the area of each face of the block by multiplying the X and Y dimensions, X and Z dimensions and Y and Z dimensions and adding them together.

volume

This metadata item provides the volume for each block. Note that when this metadata item is added to an expression, it is wrapped in square brackets.

Example

Explanation

The numeric calculation density will be assigned the value of the variable [mass] divided by the metadata item [volume].

xi, yi and zi

These three metadata items are the variables for locating the block by X, Y and Z index. Select an item to add it to the expression at the insertion point. Note that whenever one of these metadata items is added to an expression, it is wrapped in square brackets.

Example

Explanation

The numeric calculation Part2 will be assigned the value of the RBF estimation, unless [zi] the Z index of the block is greater than or equal to 40, in which case the block status will be set to the invalid value outside.

Evaluations

Each of these items are automatically added to the list whenever an evaluation is added to the block model. When added to an expression, the item represents a placeholder in the calculation for a block value, as the expression is evaluated for each of the blocks in turn.

Note you can expand each evaluation in the list to see the attributes for the estimation evaluation that may also be selected instead of or in addition to the estimated value.

Example

Explanation

The numeric calculation strange is defined by [OK Kr, Zn_pc in LMS1: 2x2x2] the product of the Kriging estimate and [DD, Ag_ppm in GM: LMS1: AvgD] the average distance to sample attribute for the Data Density estimator. Each block in the block model will have its own values for the Kriging estimate and the Data Density AvgD attribute, and this calculation uses those values to create a new value named strange for each block , using the formula above.

Variables, Calculations and Filters

Each time you create a new variable, numeric calculation, category calculation, or filter in Calculations, it will also be added to the Existing items list. You can select them from this list and they will be inserted into your new expression at the insertion point. Note that whenever one of these named items is added to an expression, it is wrapped in square brackets.

Example

Explanation

This example is only attempting to illustrate how variables, calculations and filters that have already been defined can be referenced by name in new calculations; there is nothing useful about the calculation jumble.

It is good practice to break your calculations down into parts, giving each part a relevant and readily identifiable, unambiguous and easily understood name. This will make your calculations more readable and clear. Using Variables to define a constant with a name makes it easy to understand the utility of that particular constant when you use it in a calculation. You may also be able to re-use certain parts such as filters or constant variables, so you do not need to define the same thing repeatedly. As a counterpoint, compare the following calculation that does the same jumble calculation above, but it is more difficult to interpret because everything is thrown in together:

Be careful not to inadvertently name something incorrectly, such as naming a volume as "area", as this could give rise to difficult-to-locate errors in your calculation.

Syntax and Functions

This section covers the items listed in the right-hand side of the pinnable Insert list.

To pin these lists to the Calculations tab, enable the Pin Window option:

Statements

(…) Brackets

Brackets are used to enclose an expression so the operations on the values within the brackets take precedence over operations outside the brackets.

Example

Explanation

2 + [price] will be calculated prior to [volume] * the result of the expression in the brackets.

if(::) If block

The If block is used for conditional logic. This allows multiple pathways to results depending on selected conditions, or categorisation based on values.

An If block will be evaluated by each test → result, row by row, separately and in order downwards by row. Each test has an output that can be ‘true’, ‘false’, or an invalid value ‘error’, ‘blank’, ‘without_grade’ or ‘outside’. The result output is produced by the execution of the result expression. The If block output follows these rules:

  • If a test output is ‘error’, the If block output is ‘error’ and no further processing of subsequent rows is done.
  • If a test output is ‘false’, the result expression is not executed, and the next row is considered.
  • If a test is ‘true’, the result expression is executed and the result output is used for the If block output and no further processing of subsequent rows is done.
  • If all the tests are ‘false’, the ‘otherwise’ result expression is executed and its output is used.
  • If a test output is an invalid value (without_grade, blank, outside) the result expression is not executed and the test output’s invalid value is remembered. The subsequent rows are then run.
  • If a subsequent test output is ‘true’ after an earlier one produced an invalid value, the previous test output is discarded and the new row’s result expression output is used as the output for the If block.
  • If all test outputs are invalid status values, the highest priority status of all the remembered invalid statuses is used as the output result. The priority of non-error invalid status values is: outside > without_grade > blank.

Additionally, it is possible to choose to produce invalid values as the output of result expressions.

Example

Explanation

[OK Kr, Zn_pc in LMS1: 2x2x2] is the automatically generated variable name for the block estimate from a Kriging estimate of Zn_pc (Zinc, percentage) values in a LMS1 domain with 2x2x2 discretisation. As the if(::) If block calculation is run for each of the blocks in the model, the estimate for that block replaces this variable name in the expression. If the value is greater than the value of the constant pi, the result will be the text string ‘Blue’. Otherwise, if the value is less than or equal to pi, the result will be the string ‘Red’.

Additional rows may be added. Each row follows on from the left-over results of the line before, simplifying the logical expression that may be used.

Explanation

Note the addition of the line [OK Kr, Zn_pc in LMS1: 2x2x2] > 2 ‘Purple’. This line can be interpreted to mean: if the value estimated for the block is less than or equal to pi, but greater than 2, the result shall be ‘Purple’. The part about it being less than or equal to pi is implied because the line follows the previous line [OK Kr, Zn_pc in LMS1: 2x2x2] > pi ‘Blue’.

Note that expression elements before and after the if expression can be entered. This allows the if(::) If block to form part of a more complex or extensive expression.

Explanation

The earlier conditional classification has now been embedded within a concatenation function, forming the first part of a two-part string concatenation. The concatenation function is adding the text string “-ish” to whatever is produced by the if(::) If block. Thus, if the value of the block being evaluated is 1.2, the result of the Class categorisation calculation will be ‘Red-ish’.

Basic Operators

+ Add

An arithmetic addition operation.

Example

Explanation

variable is assigned the value of [volume] plus [price].

- Subtract

An arithmetic subtraction operation.

Example

Explanation

variable is assigned the value of [volume] minus [price].

* Multiply

An arithmetic multiplication operation.

Example

Explanation

block_vol is assigned the value of [dx] times [dy] times [dz]. Note: you do not need to calculate the block volume like this, as the volume metadata item already exists under Existing items.

/ Divide

An arithmetic division operation.

Example

Explanation

variable is assigned the value of [volume] divided by [price].

^ Power

A mathematical exponentiation operation where a base is raised to the power of the exponent.

Example

Explanation

variable is assigned the value of pi * [radius]2 (because ^2 is interpreted as ‘exponent 2’ or 'squared'). Because [radius] happened to be defined as equalling 1, the result of pi * 12 equals pi, as can be seen from the result at the end of the expression 3.141592653589…

and Logical and

A logical and operation.

Example

Explanation

filter will be true if the RBF estimate for the block is greater than e AND the data density function is less than 100, but it will be false otherwise.

or Logical or

A logical or operation.

Example

Explanation

filter will be true if the RBF estimate for the block is greater than e OR the data density function is less than 100, but it will be false otherwise.

not Logical not

A logical not operation.

Example

Explanation

filter will be true if the result of the function is_normal using the block RBF estimate value as input returns false; filter will be false if the result of the is_normal function returns true. The logical operator not inverts the logical expression that follows the operator.

= Equal

A logical equality operator.

Example

Explanation

filter will be true when the value of the RBF estimate for the block is equal to 0, and will be false for all other values.

!= Not equal

A logical not-equal operator.

Example

Explanation

filter will be true when the value of the RBF estimate for the block is not equal to 0, and will be false when it does equal 0.

< Less than

A logical less-than operator.

Example

Explanation

filter will be true when the value from the Nearest Neighbour estimate for the block is less than e, and false otherwise.

< Less or equal

A logical less-than-or-equals operator.

Example

Explanation

filter will be true when the value from the Nearest Neighbour estimate for the block is less than or equal to e, and false otherwise.

< Greater than

A logical greater-than operator.

Example

Explanation

filter will be true when the value from the Nearest Neighbour estimate for the block is greater than e, and false otherwise.

< Greater or equal

A logical greater-than-or-equals operator.

Example

Explanation

filter will be true when the value from the Nearest Neighbour estimate for the block is greater or equal to e, and false otherwise.

Complex Comparisons

Lower < n < upper

A pair of comparisons, with a logical result to indicate if the tested value n is between the lower value provided and the upper value provided.

Example

Explanation

filter will be true when the Kriging estimation for the block is between the values of 20 and 100 (but not equalling 20 or 100); it will be false otherwise.

Lower <= n < upper

A pair of comparisons, with a logical result to indicate if the tested value n is between the lower value provided and the upper value provided, or equal to the lower value.

Example

Explanation

filter will be true when the Kriging estimation for the block is equal to 20 or between the values of 20 and 100 (but not equalling 100); it will be false otherwise.

Lower < n <= upper

A pair of comparisons, with a logical result to indicate if the tested value n is between the lower value provided and the upper value provided, or equal to the upper value.

Example

Explanation

filter will be true when the Kriging estimation for the block is between the values of 20 and 100 or equal to 100 (but not equal to 20); it will be false otherwise.

Lower <= n <= upper

A pair of comparisons, with a logical result to indicate if the tested value n is between (or equal to either) the lower value provided and the upper value provided.

Example

Explanation

filter will be true when the Kriging estimation for the block is greater than or equal to 20 and less than or equal to 100; it will be false otherwise.

x in {a,b,...}

A logical inclusion expression. This will return true if x matches any element of the set of listed items.

Example

Explanation

If [colour] is one of the items in the list within the curly brackets, filter will be true. If [colour] is anything else, filter will be false.

x not in {a,b,...}

A logical exclusion expression. This will return true if x fails to match any element of the set of listed items.

Example

Explanation

If [colour] is not one of the items in the list within the curly brackets, filter will be true. If [colour] matches any item in the list, filter will be false.

Invalid Values

Invalid values are different types of results for “numeric” categorisation calculations that need special non-numeric results for certain category results. These have special meanings of their own without having to resort to interpreting negative numbers and zero as having special meaning.

blank means having no value, the value in the imported file is blank or has non-numeric data

without_grade is often used to mean the estimator cannot produce a value

outside is used to indicate the block is outside the boundary of the domain

error generates an error, and provides an ‘error’ status value for the affected block

error(‘message’) is similar to error but includes a custom message.

Multiple case example

Explanation

if the Kriging estimate is greater than 5, the result will be the Kriging estimate. If the Kriging estimate is between 0 and 5, the block will be marked as having a without_grade result and status. If the Kriging estimate is exactly 0, the block will have a result and status of blank. If the Kriging estimate is negative, the block will have a result and status of outside. This should cover all the valid cases for the Kriging estimate value, but the if(::) If block requires an otherwise clause. In this case, the result of the otherwise will be to produce an error result and status with the message “impossible value”.

is_normal(a)

A function that tests a to see if it is a normal value or an invalid value. If a is normal, it returns true. If a is invalid, it returns false.

Example

Explanation

If [Kr, Ag_ppm in GM: LMS1: 2x2x2] produces a normal value for a block, filter will be true for that block. If it produces an invalid value, filter will be false.

is_blank(a)

A function that tests a to see if it is a blank invalid value. If a is blank, it returns true. If a is normal or another invalid value, it returns false.

Example

Explanation

If [Kr, Ag_ppm in GM: LMS1: 2x2x2] produces a blank status for a block, filter will be true for that block. If it produces any other invalid value or a normal value, filter will be false.

is_without_grade(a)

A function that tests a to see if it is a without_grade invalid value. If a is without_grade, it returns true. If a is normal or another invalid value, it returns false.

Example

Explanation

If [Kr, Ag_ppm in GM: LMS1: 2x2x2] produces a without_grade status for a block, filter will be true for that block. If it produces any other invalid value or a normal value, filter will be false.

is_outside(a)

A function that tests a to see if it is an outside invalid value. If a is outside, it returns true. If a is normal or another invalid value, it returns false.

Example

Explanation

If [Kr, Ag_ppm in GM: LMS1: 2x2x2] produces an outside status for a block, filter will be true for that block. If it produces any other invalid value or a normal value, filter will be false.

Mathematics

pi Constant

The constant pi is an existing item you do not need to define yourself. It is defined to 15 decimal places as 3.141592653589793.

Example

Explanation

area will be calculated as pi multiplied by the square of [radius]. Note that pi is not enclosed in square brackets like user-created variables and constants, as it is an internal constant.

e Constant

The constant e, the base of the natural logarithm, is an existing item you do not need to define yourself. It is defined to 15 decimal places as 2.718281828459045.

Example

Explanation

comp will be calculated as e to the power of [rate] minus 1. Note that e is not enclosed in square brackets like user-created variables and constants, as it is an internal constant.

log(n) Base 10

The common logarithm, the logarithm with base 10, i.e. log10(n) or lg(n). This function will calculate the common logarithm of the value provided as n.

Example

Explanation

scaled will be calculated as log10 of [measure].

log(n, base)

The logarithm of a number n to the base base.

Example

Explanation

scaled will be calculated as log2 of [measure].

ln(n) Natural log, base e

The natural logarithm, the logarithm with base e, i.e. loge(n). This function will calculate the natural logarithm of the value provided as n.

Example

Explanation

scaled will be calculated as loge of [measure].

exp(n) Natural exponent

The natural exponent. This function will provide the result of en.

Example

Explanation

y will be calculated as e [measure].

sqrt(n) Square root

The principle square root of the provided number n.

Example

Explanation

y will be calculated as the square root of [measure].

abs(n) Absolute value

The absolute value of a number is it's value with the sign of the number disregarded. The absolute value of -42 is 42. The absolute value of 42 is also 42.

Example

Explanation

y will be whatever [measure] is, but without its sign; it will always be positive as a result.

Limits and rounding

min (n, m, ...)

Returns the lowest of all the values in the set provided.

Example

Explanation

low will be the lowest of the three values provided, the metadata items for the X index, Y index, and Z index.

max (n, m, ...)

Returns the highest of all the values in the set provided.

Example

Explanation

high will be the highest of the three values provided, the metadata items for the X index, Y index, and Z index.

clamp(n, lower)

This clamp function tests the value n against the threshold lower and if it is less than lower the result will be lower; otherwise the result will be n. The effect is to push all the values below the threshold up to the threshold.

Example

Explanation

The output for ClippedAg:Zn will range from 0.25 up to the maximum value of [Ag to Zn Ratio].If [Ag to Zn Ratio] is less than 0.25, the output will be 0.25 instead. Otherwise, the output will be [Ag to Zn Ratio].

clamp(n, lower, upper)

This clamp function tests the value n against the threshold lower and if it is less than lower the result will be lower; it tests the value n against the threshold upper and if it is more than upper the result will be upper; otherwise the result will be n. The effect is to squish all the values into a box between the lower and upper thresholds.

Example

Explanation

The output for ClippedAg:Zn will range from 0.25 up to 0.7. If [Ag to Zn Ratio] is less than 0.25, the output will be 0.25 instead. If [Ag to Zn Ratio] is more than 0.7, the output will be 0.7 instead. Otherwise, the output will be [Ag to Zn Ratio].

round(n)

This function rounds the input value n to the nearest whole number.

Example

Explanation

The variable bill246 will be given the value 3 as the nearest whole number to pi used as the input to the function.

round(n, dp)

This function rounds the input value n to the number of decimal places specified by dp.

Example

Explanation

The input value [Zn Price Per Pound] will be rounded to two decimal places to provide a dollars-and-cents result for price, with no fractional cents.

Text

'abc' Text value

Use this item to add a text sequence to an expression. Selecting the item will add two single quotation marks with the cursor between, ready for the text sequence to be typed. You can of course simply type the quote marks into the expression yourself. Double quotations marks also work identically to the single quotation marks used by this item. If you need to include a quote mark inside your text sequence, you need to "escape" the character so it is not interpreted as the end of the text sequence, by entering two quotation marks for each quotation mark you want inside the text sequence. Alternatively, you can use a different type of quotation mark as the sequence wrappers; for instance to write Leda's LMS1 with an internal apostrophe, you might wrap the sequence with double quotation marks: "Leda's LMS1".

Example

Explanation

The text sequence Leda's LMS1 (note: without the wrapping quotation marks and with only one possessive apostrophe) will be used wherever the variable name is used in expressions.

Enter text...

This selection opens a dialog box prompting you for text. After you enter it and click OK, the text will be entered at the cursor, wrapped with quotation marks. This is an easy way to resolve any issues about internal quotation marks, as the dialog box will convert the text into the necessary character sequence required to generate your desired text.

Example

Explanation

This will produce a converted character sequence that produces a valid string and insert it to the expression at the insertion point.

concat(t, u, ...)

This concatenates a series of text sequences together.

Example

Explanation

Each of the text sequences in the input are run together and combined. If [metal] is 'Zinc' then name will be Leda_Zinc_LMS1. If [metal] is 'Silver' then name will be Leda_Silver_LMS1.

startswith(t, 'prefix')

This function returns true if the text sequence t starts with prefix, and false otherwise. This is case insensitive; 'prefix' will match 'PREFIX'.

Example

Explanation

filter will be true if [name] starts with LMS1.

endswith(t, 'suffix')

This function returns true if the text sequence t ends with suffix, and false otherwise. This is case insensitive; 'suffix' will match 'SUFFIX'.

Example

Explanation

filter will be true if [name] ends with _LMS1.

contains(t, 'part')

This function returns true if the text sequence t contains part somewhere within, and false otherwise. This is case insensitive; 'part' will match 'PART'.

Example

Explanation

filter will be true if [name] contains LMS somewhere within the character sequence.

like(t, 'pattern')

This function returns true if the text sequence t matches pattern, where [pattern] is follows SQL-style LIKE matching rules. This is case insensitive, and pattern must match the whole of t, not just a portion of it. Use _ as a wildcard for a single character, and % as a wildcard for any number of characters (including no characters).

Example

Explanation

filter will be true if [name] matches the pattern %LMS_Leda%. Examples of [name] that will match include:

  • LMS1Leda
  • LMS1LEDA
  • LMS2Leda
  • MoreLMS1Leda
  • LMS3LedaExtra
  • #lmsXleda#

Examples that will not match include:

  • LMS12Leda
  • LM1SLeda
  • LMSLeda

Unit conversion

Mass/weight...

This selection opens a dialog box prompting for the From Unit and To Unit for the conversion.

When you have selected the two units, the dialog box disappears and the conversion function you require will have been inserted into the expression at the cursor, and the cursor repositioned so you can enter the source of the value to be converted.

Example

Explanation

The troy_oz_to_g function has been entered by the dialog box, and the variable [troy_oz] has been entered as the input. The numeric calculation grams will be given the output of the troy_oz_to_g function.

Distance...

This selection opens a dialog box prompting for the From Unit and To Unit for the conversion.

When you have selected the two units, the dialog box disappears and the conversion function you require will have been inserted into the expression at the cursor, and the cursor repositioned so you can enter the source of the value to be converted.

Example

Explanation

The ft_to_m function has been entered by the dialog box, and the variable [feet] has been entered as the input. The numeric calculation metres will be given the output of theft_to_m function.

Area...

This selection opens a dialog box prompting for the From Unit and To Unit for the conversion.

When you have selected the two units, the dialog box disappears and the conversion function you require will have been inserted into the expression at the cursor, and the cursor repositioned so you can enter the source of the value to be converted.

Example

Explanation

The ha_to_acre function has been entered by the dialog box, and the variable [hectares] has been entered as the input. The numeric calculation acres will be given the output of theha_to_acre function.

Volume...

This selection opens a dialog box prompting for the From Unit and To Unit for the conversion.

When you have selected the two units, the dialog box disappears and the conversion function you require will have been inserted into the expression at the cursor, and the cursor repositioned so you can enter the source of the value to be converted.

Example

Explanation

The acre_ft_to_m3 function has been entered by the dialog box, and the variable [acre-ft] has been entered as the input. The numeric calculation volm3 will be given the output of theacre_ft_to_m3 function.

Temperature...

This selection opens a dialog box prompting for the From Unit and To Unit for the conversion.

When you have selected the two units, the dialog box disappears and the conversion function you require will have been inserted into the expression at the cursor, and the cursor repositioned so you can enter the source of the value to be converted.

Example

Explanation

The degF_to_K function has been entered by the dialog box, and the variable [fahrenheit] has been entered as the input. The numeric calculation Kelvin will be given the output of thedegF_to_K function.

Pressure...

This selection opens a dialog box prompting for the From Unit and To Unit for the conversion.

When you have selected the two units, the dialog box disappears and the conversion function you require will have been inserted into the expression at the cursor, and the cursor repositioned so you can enter the source of the value to be converted.

Example

Explanation

The psi_to_kPa function has been entered by the dialog box, and the variable [pressure_psi] has been entered as the input. The numeric calculation pressure_kPa will be given the output of thepsi_to_kPa function.

Energy...

This selection opens a dialog box prompting for the From Unit and To Unit for the conversion.

When you have selected the two units, the dialog box disappears and the conversion function you require will have been inserted into the expression at the cursor, and the cursor repositioned so you can enter the source of the value to be converted.

Example

Explanation

The MJ_to_kWh function has been entered by the dialog box, and the variable [MegaJoules] has been entered as the input. The numeric calculation kiloWatt Hours will be given the output of theMJ_to_kWh function.

 

Got a question? Visit the My Leapfrog forums at https://forum.leapfrog3d.com/c/open-forum or technical support at http://www.leapfrog3d.com/contact/support