
set form {
  GuidoForm form_1 {
    -default_buttons
    -label "Cut outliers"
    GuidoPanel panel_1 {
    -layout BoxLayout Y_AXIS
      GuidoTextArea gainfocus {
      -visible true
      -default "This text area is here to remove focus and highlighting from the second GuidoTextArea
                This text area must have visible set to true in order to gain focus"
      -height 0
      -width 0
      }
      GuidoLabel space {
      -height 0.5
      }
      GuidoScrollPane scroll_1 {
      -height 35
      -width 80
        GuidoTextArea text_1 {
        -wrap_style_word true
        -linewrap true
        -input true
        -font_highlight 0 0 0
        -default "Variograms and subsequent block model estimations are sensitive to outliers (relatively large values).  One method of dealing with these data are to reduce, or 'cut' them to some lesser value.  The value used to cut outliers can be determined by one of several methods, including:
1. The upper limit of a given confidence interval
2. A given percentile
3. An arbitrarily chosen value

In this example, we will use the value which defines the upper limit of a 95% confidence interval

A confidence interval is an estimated range of values which is likely to include a given percentage of the data values.  Since a confidence interval is based on the data alone, it is useful where there is little or no knowledge of the deposit.  The calculation for the upper limit of a 95% confidence interval (CI) is:
95% CI = mean + (1.96 * standard deviation)

For this data set,  mean = 3.828  and  standard deviation = 6.831
95% CI = 3.828 + (1.96 * 6.831)
95% CI = 17.217

For simplicity, we will use the nearest integer value of 17 to cut the outlier data.

As stated above, other methods can be used to select the outlier cutoff, such as a percentile, or an arbitrarily chosen value.

A percentile is that data value at which a given percentage of all other data values fall below.  Any given percentile value could be selected as the outlier cutoff, such as the 90th, 95th, or 99th percentile.  Recall the following percentile values were given in the basic statistics report:
90th Percentile:    5.120
95th Percentile:    9.280
99th Percentile:   44.112

An arbitrarily chosen value based on knowledge of the deposit and sampling methods may also be used.  For example, if part of an ore zone has been mined, information from grade control samples and reconciliation studies may provide a good idea of what the maximum mined block value will be.  If the deposit has not yet been mined, information from similar deposits may be useful in determining the outlier cutoff.

Whatever method is chosen, values in a description field in a string file can be cut with the use of STR MATHS."
        }
      }


      GuidoLabel space {
      -height 0.5
      }
    }
  }
}

SclCreateGuidoForm form_handle $form {
}

$form_handle SclRun {
}

set status [ SclFunction "GEOLOGY DATABASE DISCONNECT" {} ]

set status [ SclFunction "BM EXIT" {
  frm20103={
    {
      exit_mode="E"
    }
  }
}]

set status [ SclFunction "EXIT GRAPHICS" {} ]

set status [ SclFunction "TOOL MODE TRADITIONAL" {} ]

set status [ SclFunction "RECALL ANY FILE" {
  file="gold_comp2.str"
  mode="openInNewLayer"
}]

set status [ SclFunction "SAVE FILE" {
  frm00287={
    {
      location="gold_cut"
      rid="17"
      ftype="S"
      purpose="2m gold composites cut to 17g/t"
      range=""
      format="text"
    }
  }
}]

set status [ SclFunction "EXIT GRAPHICS" {}]

set status [ SclFunction "STR MATHS" {
  frm00700={
    {
      _action=display
      file_loc="gold_cut"
      file_id="17"
      result_loc="gold_cut"
      main=table { str_range constraint field expr } {
        { "" "" "d1" "iif(d1>17,17,d1)" }
        { "" "" "" "" }
        { "" "" "" "" }
        { "" "" "" "" }
        { "" "" "" "" }
        { "" "" "" "" }
        { "" "" "" "" }
        { "" "" "" "" }
        { "" "" "" "" }
        { "" "" "" "" }
      }
    }
  }
  frm00701={
    {
      _action="apply"
    }
  }
  frm00121={
    {
      _action="apply"
    }
  }
}]


set status [ SclFunction "BASIC STATISTICS" {} ]

set status [ SclFunction "STATS RELOAD" {
  frm20400={
    {
      _action=display
      location="gold_cut"
      id="17"
      str="1,2"
      dfields={
        {
          dfield="D1"
          label="Gold"
          min=""
          max=""
        }
      }
      min0=""
      min1=""
      min2=""
      max0=""
      max1=""
      max2=""
      binNum_or_Width="WIDTH"
      bin_width="1"
      negative="NEGATIVES"
    }
  }
}]

set status [ SclFunction "STATS STATISTICS" {
  frm20431={
    {
      _action=display
      range="25,75,25"
      fname="gold_cut17"
      report_format=".not - Surpac Note File"
      file_append_overwrite="OVERWRITE"
    }
  }
}]

set status [ SclFunction "STATS HISTOGRAM" {} ]

set form {
  GuidoForm form_2 {
    -default_buttons
    -label "Cut outliers"
    GuidoPanel panel_2 {
    -layout BoxLayout Y_AXIS
      GuidoTextArea gainfocus {
      -visible true
      -default "This text area is here to remove focus and highlighting from the second GuidoTextArea
                This text area must have visible set to true in order to gain focus"
      -height 0
      -width 0
      }
      GuidoLabel space {
      -height 0.5
      }
      GuidoScrollPane desc_panel {
      -height 9
      -width 70
        GuidoTextArea text_2 {
        -wrap_style_word true
        -linewrap true
        -input true
        -font_highlight 0 0 0
        -default "
The D1 field in the file gold_cut17.str contains the D1 values from gold_comp2.str.

As displayed by this histogram, you can see that the maximum value is 17.000.

The D1 field in gold_cut17.str will now be used for all subsequent variography analysis, as well as block model estimation."
        }
      }
      GuidoLabel space {
      -height 0.5
      }
    }
  }
}

SclCreateGuidoForm form_handle $form {
}

$form_handle SclRun {
}

set status [ SclFunction "STATS EXIT" {} ]
puts ""
puts ""
puts " macro _03_cut_outliers.tcl completed"
puts ""



