GuidoApp check_bm "CHECK BM CONNECTED"
$check_bm setParam functionName "BM GSLIB KT3D"
set result [$check_bm invoke]
$check_bm destroy
if { $result == "0" } {
GuidoApp appHandle "BM GSLIB KT3D"
$appHandle setParam license "test"
set appStatus [$appHandle invoke]
$appHandle destroy
if {$appStatus == "-10311"} {
return
}
if [catch {
set variogram_rows [GuidoGetParamBufferValue [GuidoExecServer GetLastValues {function_name = "BM GSLIB KT3D" form_name = "KT3DParameters." table = "variograms" table_row = 0 field_name = "__num_instances"}] constant]
} result] {
set variogram_rows 1
}
GuidoForm KT3DParameters {
-help_id 1125
-default_buttons
-label "GSLIB interface: 3D kriging (kt3d)"
-tip GSLIB_KT3D_FORM_TIP
-defaults_management true
-layout BoxLayout Y_AXIS
GuidoTabbedPane tabPane {
GuidoPanel panel1 {
-layout BoxLayout Y_AXIS
-label "FILES_FILTER_TEXT"
GuidoPanel panel1a {
-layout CentreLineLayout
-border etched true
-label "Input"
-width 50
GuidoFileBrowserField string_file_location {
-display_length 26
-file_mask *.str
-link string_file_id
-format none
-input true
-label "Location"
-max_length 252
-null false
-tip GSLIB_KT3D_STRING_FILE_TIP
}
GuidoField string_file_id {
-display_length 10
-font_style bold
-format none
-input true
-label "ID Number"
-max_length 16
-null false
-tip GSLIB_KT3D_STRING_FILE_TIP
}
GuidoField range {
-default 1
-display_length 10
-format range
-label "String range"
-max_length 26
-null false
-tip GSLIB_KT3D_STRING_FILE_TIP
-translate none
}
GuidoComboBox field {
-display_length 3
-exclusive true
-label "D-field"
-max_length 4
-default D1
-null false
-tip GSLIB_KT3D_STRING_FILE_TIP
-value_in D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 D16 D17 D18 D19 D20 D21 D22 D23 D24 D25 D26 D27 D28 D29 D30 D31 D32 D33 D34 D35 D36 D37 D38 D39 D40 D41 D42 D43 D44 D45 D46 D47 D48 D49 D50 D51 D52 D53 D54 D55 D56 D57 D58 D59 D60 D61 D62 D63 D64 D65 D66 D67 D68 D69 D70 D71 D72 D73 D74 D75 D76 D77 D78 D79 D80 D81 D82 D83 D84 D85 D86 D87 D88 D89 D90 D91 D92 D93 D94 D95 D96 D97 D98 D99 D100
}
GuidoField tmin {
-display_length 10
-label "Minimum"
-default -1E+21
-null false
-tip GSLIB_IK3D_TMIN_TIP
-format double
}
GuidoField tmax {
-display_length 10
-label "Maximum"
-default 1E+21
-null false
-tip GSLIB_IK3D_TMAX_TIP
-format double
}
}
GuidoPanel panel1b {
-layout CentreLineLayout
-border etched true
-label "Output"
-width 50
GuidoBMAttributeBrowser attribute {
-label "Estimate"
-display_length 10
-max_length BM_MAX_ATT_NAME_LEN
-null false
-format none
-translate none
-exclusive false
-attribute_types real
-tip GSLIB_KT3D_ATTRIBUTE_TIP
}
GuidoBMAttributeBrowser variance_attribute {
-label "Estimation variance"
-display_length 10
-max_length BM_MAX_ATT_NAME_LEN
-null true
-format none
-translate none
-exclusive false
-attribute_types real
-tip GSLIB_KT3D_VARIANCE_ATTRIBUTE_TIP
}
GuidoCheckBox constrain_interpolation {
-label "Constrain interpolation"
-default false
-tip GSLIB_IK3D_CONSTRAIN_TIP
}
GuidoFileBrowserField debug_file {
-display_length 26
-file_mask *.dbg
-format none
-input true
-label "Debug file"
-max_length 252
-null false
-tip GSLIB_DEBUG_TIP
}
GuidoComboBox debug_level {
-dependency {"[ $debug_file getCurrentValue]" != ""}
-label "Debug level"
-display_length 8
-exclusive true
-null false
-tip GSLIB_DEBUG_LEVEL_TIP
-value_in 0 1 2 3
-alternative_values "none (0)" "low (1)" "medium (2)" "high (3)"
-default 0
}
GuidoCheckBox remove_intermediate_files {
-label "Clean up"
-default true
-tip GSLIB_KT3D_CLEANUP_TIP
}
}
}
GuidoPanel panel2 {
-label "Kriging Options"
-layout BoxLayout Y_AXIS
GuidoPanel panel2_a {
-layout CentreLineLayout
GuidoPanel panel2a {
-border etched true
-label "Kriging parameters"
-layout BoxLayout Y_AXIS
GuidoPanel top {
-layout CentreLineLayout
GuidoComboBox kriging_type {
-label "Kriging type"
-display_length 27
-exclusive true
-null false
-tip GSLIB_KT3D_KRIGING_TYPE_TIP
-value_in 0 1 2 3
-alternative_mlt_keys "Stationary simple kriging (0)" "Ordinary kriging (1)" "Non-stationary simple kriging with means (2)" "Kriging with an external drift (3)"
-default 1
}
GuidoFiller filler {
}
GuidoPanel top_field {
-layout OverlayLayout
GuidoPanel skmean_field_panel {
-layout CentrelineLayout
-dependency {"[ $kriging_type getCurrentValue]" == "0"}
GuidoField skmean {
-label "Mean"
-display_length 6
-default 0.0
-null false
-tip GSLIB_KT3D_SKMEAN_TIP
-format double
}
}
GuidoPanel mean_attribute_field_panel {
-layout CentrelineLayout
-dependency {"[ $kriging_type getCurrentValue]" == "2"}
GuidoBMAttributeBrowser mean_attribute {
-label "Mean attribute"
-display_length 10
-max_length BM_MAX_ATT_NAME_LEN
-null false
-format none
-translate none
-exclusive true
-attribute_types real integer calculated
-tip GSLIB_KT3D_MEAN_ATTRIBUTE_TIP
}
GuidoComboBox mean_field {
-display_length 3
-exclusive true
-label "D-field"
-max_length 4
-default D1
-null false
-tip GSLIB_KT3D_SKMEAN_FIELD_TIP
-value_in D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 D16 D17 D18 D19 D20 D21 D22 D23 D24 D25 D26 D27 D28 D29 D30 D31 D32 D33 D34 D35 D36 D37 D38 D39 D40 D41 D42 D43 D44 D45 D46 D47 D48 D49 D50 D51 D52 D53 D54 D55 D56 D57 D58 D59 D60 D61 D62 D63 D64 D65 D66 D67 D68 D69 D70 D71 D72 D73 D74 D75 D76 D77 D78 D79 D80 D81 D82 D83 D84 D85 D86 D87 D88 D89 D90 D91 D92 D93 D94 D95 D96 D97 D98 D99 D100
}
}
GuidoPanel drift_attribute_field_panel {
-layout CentrelineLayout
-dependency {"[ $kriging_type getCurrentValue]" == "3"}
GuidoBMAttributeBrowser drift_attribute {
-label "Drift attribute"
-display_length 10
-max_length BM_MAX_ATT_NAME_LEN
-null false
-format none
-translate none
-exclusive true
-attribute_types real integer calculated
-tip GSLIB_KT3D_DRIFT_ATTRIBUTE_TIP
}
GuidoComboBox drift_field {
-display_length 3
-exclusive true
-label "Drift D-field"
-max_length 4
-default D1
-null false
-tip GSLIB_KT3D_DRIFT_FIELD_TIP
-value_in D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 D16 D17 D18 D19 D20 D21 D22 D23 D24 D25 D26 D27 D28 D29 D30 D31 D32 D33 D34 D35 D36 D37 D38 D39 D40 D41 D42 D43 D44 D45 D46 D47 D48 D49 D50 D51 D52 D53 D54 D55 D56 D57 D58 D59 D60 D61 D62 D63 D64 D65 D66 D67 D68 D69 D70 D71 D72 D73 D74 D75 D76 D77 D78 D79 D80 D81 D82 D83 D84 D85 D86 D87 D88 D89 D90 D91 D92 D93 D94 D95 D96 D97 D98 D99 D100
}
}
}
}
GuidoFiller fill1 {
-height 0.5
}
GuidoPanel panel2ab {
-layout CentreLineLayout
GuidoField max_per_octant {
-display_length 6
-label "Maximum samples per octant"
-default 0
-null false
-tip GSLIB_IK3D_MAX_PER_OCTANT_TIP
-format integer
}
GuidoField min_samples {
-display_length 6
-label "Minimum samples to krige a block"
-default 4
-null false
-tip GSLIB_IK3D_MIN_SAMPLES_TIP
-format integer
}
GuidoField max_samples {
-display_length 6
-label "Maximum samples to krige a block"
-default 8
-null false
-tip GSLIB_IK3D_MAX_SAMPLES_TIP
-format integer
}
}
GuidoFiller fill2 {
-height 0.5
}
GuidoPanel panel2ac {
-layout CentreLineLayout
GuidoPanel panel2aca {
-layout BoxLayout Y_AXIS
GuidoLabel label {
-label " "
-height 1.1
}
GuidoLabel label {
-label "Block descretization"
-height 1.1
}
GuidoLabel label {
-label " "
-height 1.1
}
GuidoLabel label {
-label "Search radius"
-height 1.1
}
GuidoLabel label {
-label " "
-height 1.1
}
GuidoLabel label {
-label "Search angles"
-height 1.1
}
}
GuidoPanel panel2acb {
-layout GridLayout 6 3
GuidoLabel labelx {
-label "X"
}
GuidoLabel labely {
-label "Y"
}
GuidoLabel labelz {
-label "Z"
}
GuidoField x_descretization {
-display_length 6
-default 1
-null false
-tip GSLIB_KT3D_X_DESCRETIZATION_TIP
-format integer
}
GuidoField y_descretization {
-display_length 6
-default 1
-null false
-tip GSLIB_KT3D_Y_DESCRETIZATION_TIP
-format integer
}
GuidoField z_descretization {
-display_length 6
-default 1
-null false
-tip GSLIB_KT3D_Z_DESCRETIZATION_TIP
-format integer
}
GuidoLabel labelx {
-label "hMax"
}
GuidoLabel labely {
-label "hMin"
}
GuidoLabel labelz {
-label "Vert"
}
GuidoField x_search_radius {
-display_length 6
-default 20
-null false
-tip GSLIB_IK3D_X_SEARCH_RADIUS_TIP
-format double
}
GuidoField y_search_radius {
-display_length 6
-default 20
-null false
-tip GSLIB_IK3D_Y_SEARCH_RADIUS_TIP
-format double
}
GuidoField z_search_radius {
-display_length 6
-default 20
-null false
-tip GSLIB_IK3D_Z_SEARCH_RADIUS_TIP
-format double
}
GuidoLabel labelx {
-label "Angle1"
}
GuidoLabel labely {
-label "Angle2"
}
GuidoLabel labelz {
-label "Angle3"
}
GuidoField x_search_angle {
-display_length 6
-default 0
-null false
-tip GSLIB_IK3D_X_SEARCH_ANGLE_TIP
-format double
}
GuidoField y_search_angle {
-display_length 6
-default 0
-null false
-tip GSLIB_IK3D_Y_SEARCH_ANGLE_TIP
-format double
}
GuidoField z_search_angle {
-display_length 6
-default 0
-null false
-tip GSLIB_IK3D_Z_SEARCH_ANGLE_TIP
-format double
}
}
}
}
GuidoPanel panel2b {
-layout BoxLayout Y_AXIS
GuidoPanel panel2ba {
-border etched true
-label "Drift indicators"
-layout CentreLineLayout
-width 18
-dependency {"[ $kriging_type getCurrentValue]" == "1" ||
"[ $kriging_type getCurrentValue]" == "3"}
GuidoCheckBox linear_drift_in_x {
-label "Linear drift in X"
-default false
-tip GSLIB_KT3D_LINEAR_DRIFT_IN_X
}
GuidoCheckBox linear_drift_in_y {
-label "Linear drift in Y"
-default false
-tip GSLIB_KT3D_LINEAR_DRIFT_IN_Y
}
GuidoCheckBox linear_drift_in_z {
-label "Linear drift in Z"
-default false
-tip GSLIB_KT3D_LINEAR_DRIFT_IN_Z
}
GuidoCheckBox quadratic_drift_in_x {
-label "Quadratic drift in X"
-default false
-tip GSLIB_KT3D_QUADRATIC_DRIFT_IN_X
}
GuidoCheckBox quadratic_drift_in_y {
-label "Quadratic drift in Y"
-default false
-tip GSLIB_KT3D_QUADRATIC_DRIFT_IN_Y
}
GuidoCheckBox quadratic_drift_in_z {
-label "Quadratic drift in Z"
-default false
-tip GSLIB_KT3D_QUADRATIC_DRIFT_IN_Z
}
GuidoCheckBox quadratic_drift_in_xy {
-label "Cross quadratic drift in XY"
-default false
-tip GSLIB_KT3D_QUADRATIC_DRIFT_IN_XY
}
GuidoCheckBox quadratic_drift_in_xz {
-label "Cross quadratic drift in XZ"
-default false
-tip GSLIB_KT3D_QUADRATIC_DRIFT_IN_XZ
}
GuidoCheckBox quadratic_drift_in_yz {
-label "Cross quadratic drift in YZ"
-default false
-tip GSLIB_KT3D_QUADRATIC_DRIFT_IN_YZ
}
}
GuidoPanel panel2bb {
-layout CentreLineLayout
GuidoComboBox trend_option {
-display_length 12
-exclusive true
-label "Trend option"
-null false
-tip GSLIB_KT3D_TREND_OPTION_TIP
-value_in 0 1
-alternative_mlt_keys "Estimate variable (0)" "Estimate trend (1)"
-default 0
}
}
}
}
}
GuidoPanel panel3 {
-label "Variograms"
-layout BoxLayout Y_AXIS
GuidoPanel 3a {
-layout BoxLayout Y_AXIS
-border etched true
-label "Variograms"
GuidoPanel 3aa {
-layout CentreLineLayout
GuidoField nugget {
-display_length 5
-label "Nugget"
-default 1
-null false
-tip GSLIB_KT3D_NUGGET_TIP
-format double
-action valueChanged {[
set sill_value [$nugget getCurrentValue]
for {set row_idx 0} {$row_idx < [$variograms getRowCount]} {incr row_idx} {
set val [$cc getCurrentValue $row_idx]
set sill_value [expr $sill_value + $val]
}
$sill setCurrentValue $sill_value
]}
}
GuidoLabel sill_label {
-label "Sill"
}
GuidoLabel sill {
-label "2"
}
}
GuidoScrollPane variogram_scroll {
-scroll_size 60 11
GuidoTable variograms {
-instances $variogram_rows 1 100
-interactive true
-action rowAdded {[
set sill_value [$nugget getCurrentValue]
for {set row_idx 0} {$row_idx < [$variograms getRowCount]} {incr row_idx} {
set val [$cc getCurrentValue $row_idx]
set sill_value [expr $sill_value + $val]
}
$sill setCurrentValue $sill_value
]}
-action rowInserted {[
set sill_value [$nugget getCurrentValue]
for {set row_idx 0} {$row_idx < [$variograms getRowCount]} {incr row_idx} {
set val [$cc getCurrentValue $row_idx]
set sill_value [expr $sill_value + $val]
}
$sill setCurrentValue $sill_value
]}
-action rowDeleted {[
set sill_value [$nugget getCurrentValue]
for {set row_idx 0} {$row_idx < [$variograms getRowCount]} {incr row_idx} {
set val [$cc getCurrentValue $row_idx]
set sill_value [expr $sill_value + $val]
}
$sill setCurrentValue $sill_value
]}
GuidoComboBox type {
-label "Type"
-display_length 10
-exclusive true
-null false
-tip GSLIB_IK3D_TYPE_1_TIP
-value_in 1 2 3 4 5
-alternative_mlt_keys "Spherical (1)" "Exponential (2)" "Gaussian (3)" "Power (4)" "Hole effect (5)"
-default 1
}
GuidoField cc {
-display_length 5
-label "Cc"
-default 1
-null false
-tip GSLIB_IK3D_CC_1_TIP
-format double
-action valueChanged {[
set sill_value [$nugget getCurrentValue]
for {set row_idx 0} {$row_idx < [$variograms getRowCount]} {incr row_idx} {
set val [$cc getCurrentValue $row_idx]
set sill_value [expr $sill_value + $val]
}
$sill setCurrentValue $sill_value
]}
}
GuidoField hmax {
-label "hMax"
-display_length 5
-default 1
-low_bound 0.0001
-null false
-tip GSLIB_IK3D_HMAX_1_TIP
-format double
}
GuidoField hmin {
-label "hMin"
-display_length 5
-default 1
-low_bound 0.0001
-null false
-tip GSLIB_IK3D_HMIN_1_TIP
-format double
}
GuidoField hvert {
-label "Vert"
-display_length 5
-default 1
-low_bound 0.0001
-null false
-tip GSLIB_IK3D_HVERT_1_TIP
-format double
}
GuidoField angle1 {
-label "Angle1"
-display_length 5
-default 0
-null false
-tip GSLIB_ROTATION_ANGLE_TIP
-format double
}
GuidoField angle2 {
-label "Angle2"
-display_length 5
-default 0
-null false
-tip GSLIB_ROTATION_ANGLE_TIP
-format double
}
GuidoField angle3 {
-label "Angle3"
-display_length 5
-default 0
-null false
-tip GSLIB_ROTATION_ANGLE_TIP
-format double
}
}
}
}
}
}
}
$KT3DParameters setActionCallback mouseEntered {[
set val [$string_file_location getCurrentValue]
if {$val > ""} {
if {[string match *.str $val]} {
set len [string length $val]
incr len -5
set val [string range $val 0 $len]
}
set filen "$val.dbg"
$debug_file setCurrentValue $filen
}
]}
$string_file_location setActionCallback focusLost {[
set val [$string_file_location getCurrentValue]
if {$val > ""} {
if {[string match *.str $val]} {
set len [string length $val]
incr len -5
set val [string range $val 0 $len]
}
set filen "$val.dbg"
$debug_file setCurrentValue $filen
}
]}
$tabPane setActionCallback mousePressed {[
set sill_value [$nugget getCurrentValue]
for {set row_idx 0} {$row_idx < [$variograms getRowCount]} {incr row_idx} {
set val [$cc getCurrentValue $row_idx]
set sill_value [expr $sill_value + $val]
}
$sill setCurrentValue $sill_value
]}
$tabPane setActionCallback keyReleased {[
set sill_value [$nugget getCurrentValue]
for {set row_idx 0} {$row_idx < [$variograms getRowCount]} {incr row_idx} {
set val [$cc getCurrentValue $row_idx]
set sill_value [expr $sill_value + $val]
}
$sill setCurrentValue $sill_value
]}
$attribute updateBrowserList
$drift_attribute updateBrowserList
$mean_attribute updateBrowserList
$variance_attribute updateBrowserList
set formStatus [$KT3DParameters interact]
if {$formStatus == "apply"} {
GuidoApp appHandle "BM GSLIB KT3D"
$appHandle setParam string_file_location [$string_file_location getCurrentValue]
$appHandle setParam string_file_id [$string_file_id getCurrentValue]
$appHandle setParam range [$range getCurrentValue]
$appHandle setParam field [$field getCurrentValue]
$appHandle setParam tmin [$tmin getCurrentValue]
$appHandle setParam tmax [$tmax getCurrentValue]
$appHandle setParam attribute [$attribute getCurrentValue]
$appHandle setParam variance_attribute [$variance_attribute getCurrentValue]
$appHandle setParam constrain_interpolation [$constrain_interpolation getCurrentValue]
$appHandle setParam debug_file [$debug_file getCurrentValue]
$appHandle setParam debug_level [$debug_level getCurrentValue]
$appHandle setParam remove_intermediate_files [$remove_intermediate_files getCurrentValue]
$appHandle setParam kriging_type [$kriging_type getCurrentValue]
if {"[ $kriging_type getCurrentValue]" == "0"} {
$appHandle setParam skmean [$skmean getCurrentValue]
} else {
$appHandle setParam skmean 0.0
}
if {"[ $kriging_type getCurrentValue]" == "2"} {
$appHandle setParam mean_attribute [$mean_attribute getCurrentValue]
$appHandle setParam mean_field [$mean_field getCurrentValue]
}
if {"[ $kriging_type getCurrentValue]" == "3"} {
$appHandle setParam drift_attribute [$drift_attribute getCurrentValue]
$appHandle setParam drift_field [$drift_field getCurrentValue]
}
$appHandle setParam max_per_octant [$max_per_octant getCurrentValue]
$appHandle setParam min_samples [$min_samples getCurrentValue]
$appHandle setParam max_samples [$max_samples getCurrentValue]
$appHandle setParam x_descretization [$x_descretization getCurrentValue]
$appHandle setParam y_descretization [$y_descretization getCurrentValue]
$appHandle setParam z_descretization [$z_descretization getCurrentValue]
$appHandle setParam x_search_radius [$x_search_radius getCurrentValue]
$appHandle setParam y_search_radius [$y_search_radius getCurrentValue]
$appHandle setParam z_search_radius [$z_search_radius getCurrentValue]
$appHandle setParam x_search_angle [$x_search_angle getCurrentValue]
$appHandle setParam y_search_angle [$y_search_angle getCurrentValue]
$appHandle setParam z_search_angle [$z_search_angle getCurrentValue]
if {"[ $kriging_type getCurrentValue]" == "1" ||
"[ $kriging_type getCurrentValue]" == "3"} {
$appHandle setParam linear_drift_in_x [$linear_drift_in_x getCurrentValue]
$appHandle setParam linear_drift_in_y [$linear_drift_in_y getCurrentValue]
$appHandle setParam linear_drift_in_z [$linear_drift_in_z getCurrentValue]
$appHandle setParam quadratic_drift_in_x [$quadratic_drift_in_x getCurrentValue]
$appHandle setParam quadratic_drift_in_y [$quadratic_drift_in_y getCurrentValue]
$appHandle setParam quadratic_drift_in_z [$quadratic_drift_in_z getCurrentValue]
$appHandle setParam quadratic_drift_in_xy [$quadratic_drift_in_xy getCurrentValue]
$appHandle setParam quadratic_drift_in_xz [$quadratic_drift_in_xz getCurrentValue]
$appHandle setParam quadratic_drift_in_yz [$quadratic_drift_in_yz getCurrentValue]
} else {
$appHandle setParam linear_drift_in_x 0
$appHandle setParam linear_drift_in_y 0
$appHandle setParam linear_drift_in_z 0
$appHandle setParam quadratic_drift_in_x 0
$appHandle setParam quadratic_drift_in_y 0
$appHandle setParam quadratic_drift_in_z 0
$appHandle setParam quadratic_drift_in_xy 0
$appHandle setParam quadratic_drift_in_xz 0
$appHandle setParam quadratic_drift_in_yz 0
}
$appHandle setParam trend_option [$trend_option getCurrentValue]
$appHandle setParam nugget [$nugget getCurrentValue]
for {set row_idx 0} {$row_idx < [$variograms getRowCount]} {incr row_idx} {
set variogramType [$type getCurrentValue $row_idx]
regexp {([0-9]+)} $variogramType number
$appHandle setParam "type($row_idx)" $number
$appHandle setParam "cc($row_idx)"     [$cc getCurrentValue $row_idx]
$appHandle setParam "angle1($row_idx)" [$angle1 getCurrentValue $row_idx]
$appHandle setParam "angle2($row_idx)" [$angle2 getCurrentValue $row_idx]
$appHandle setParam "angle3($row_idx)" [$angle3 getCurrentValue $row_idx]
$appHandle setParam "hmax($row_idx)"   [$hmax getCurrentValue $row_idx]
$appHandle setParam "hmin($row_idx)"   [$hmin getCurrentValue $row_idx]
$appHandle setParam "hvert($row_idx)"  [$hvert getCurrentValue $row_idx]
}
$appHandle invoke
$appHandle destroy
}
$KT3DParameters destroy
}
