Basic Functions

Constant

Purpose:

To hold constants (numbers or text codes) in your models.

Type Name: ‘constant’

Definition Syntax:

[constant_value]

where:

  • ‘constant_value’ is the constant to use

Note that constant values are always interpreted literally, even when their values match a raw data field key or another JFunction key in the value dictionary.

Example:

  1. Assign value ‘3.141593’ to key ‘f_pie’
  2. Assign value ‘asphalt’ to key ‘f_ac’

Comment:

Typically you will set constant values at the top of your function definition set. For most applications, the evaluation stage for constants will be set to ‘all’ so that constants can be used in all of the stages of model execution.

Value Copy

Purpose:

To extract values from the value dictionary and make them available against another key.

Type Name: ‘value_copy’

Definition Syntax:

[field_name or key]

where:

  • ‘field_name or key’ maps to either a raw data field, a model parameter name or a JCass information key. If the field name or key is not found in the

Note that unlike Constant values, in the case of a Value Copy the key or field name will be used to extract the matching value from the value dictionary. When no match is found, the key itself will be returned as a constant.

Example:

  1. Assign value ‘surface_age’ to extract the value in the raw data under field ‘surface_age’
  2. Assign value ‘par_material’ to extract the current value matching parameter ‘par_material’

Comment:

Value Copy is very similar to Constants but are more flexible. They can either represent constants or field values. It is, however, better to define any literal constants as Constant JFunction types.

Min Value

Purpose:

To extract minimum from a set of values, optionally excluding any negative values.

Type Name: ‘min’

Definition Syntax:

[var1]|[var2] : [exclude negatives] : [default]

where:

  • ‘var1’ and ‘var2’ represent either constant values or keys mapping to the values in the value dictionary.
  • ‘exclude_negatives’ is a TRUE or FALSE value indicating if negative values should be excluded.
  • ‘default’ is an optional default value to assign when all values in the list are negative and you want to exclude negative values. If no default is provided, a value of -1 will be used as a default.
Important

Note that currently the value you supply for ‘default’ must be a number and can not be a key mapping to a value in the value dictionary. This constraint will be removed in future upgrades if requested by users.

Examples:

  1. Use ‘par_a | par_b | par_c : TRUE : 0’ to return the minimum from parameters ‘par_a’, ‘par_b’ and ‘par_c’ in the value dictionary, but exclude negative values. If all values are negative, return zero.
  2. Use ‘lwp_rut | rwp_rut : TRUE : 2’ to return the minimum of the values mapping to keys ‘lwp_rut’ and ‘rwp_rut’ in the value dictionary. Ignore any negative values and return 2 if both values are negative.

Comment:

The option to exlcude negative values is a useful addition for the case where missing data is designated with a negative value (e.g. -1 to represent ‘no data’). In such a case, it makes it easier to extract the minimum value whilst ignoring the missing data.

Note that you can use spaces between the various values/keys and the pipe symbol. This is not mandatory but it makes your setup code easier to read by eye.

Max Value

Purpose:

To extract maximum from a set of values, optionally excluding any negative values.

Type Name: ‘max’

Definition Syntax:

[var1]|[var2] : [exclude negatives] : [default]

where:

  • ‘var1’ and ‘var2’ represent either constant values or keys mapping to the values in the value dictionary.
  • ‘exclude_negatives’ is a TRUE or FALSE value indicating if negative values should be excluded.
  • ‘default’ is an optional default value to assign when all values in the list are negative and you want to exclude negative values. If no default is provided, a value of -1 will be used as a default.
Important

Note that currently the value you supply for ‘default’ must be a number and can not be a key mapping to a value in the value dictionary. This constraint will be removed in future upgrades if requested by users.

Examples:

  1. Use ‘par_a | par_b | par_c : TRUE : 0’ to return the maximum from parameters ‘par_a’, ‘par_b’ and ‘par_c’ in the value dictionary, but exclude negative values. If all values are negative, return zero.
  2. Use ‘lwp_rut | rwp_rut : TRUE : 2’ to return the maximum of the values mapping to keys ‘lwp_rut’ and ‘rwp_rut’ in the value dictionary. Ignore any negative values and return 2 if both values are negative.

Comment:

The option to exlcude negative values is a useful addition for the case where missing data is designated with a negative value (e.g. -1 to represent ‘no data’). In such a case, it makes it easier to extract the maximum value whilst ignoring the missing data.

Note that you can use spaces between the various values/keys and the pipe symbol. This is not mandatory but it makes your setup code easier to read by eye.