Skip to content

SHRIMP: Sub SetSKageForCPb

sbodorkos edited this page Jul 22, 2019 · 1 revision

SQUID 2.50 Sub: SetSKageForCPb

This subroutine (which is solely for Grouped-sample sheets in Group Me sequences where pbGrpCommPbSpecific = FALSE) implements iterative polishing of the Stecey-Kramers model common-Pb age on a post-by-spot basis, to match the preferred (common-Pb corrected) Group Date Type defined by the user.

Usage

SetSKageForCPb FirstRw, LastRw, GrpAgeTypeCol, SKageCol, NumIters

Mandatory variables

FirstRw: Integer index number of the first row containing spot-by-spot data.
LastRw: Integer index number of the last row containing spot-by-spot data.
GrpAgeTypeCol: Integer index number of the column containing the user-preferred Group Date Type.
SKageCol: Integer index number of the column containing the Stacey-Kramers model age value ["Age S-K ComPb"].
NumIters: Integer number of iterationsto be performed as part of the polishing process.


Definition of variables

Values of type Integer
i, Iter

Values of type Variant
TempVal

Values of type Double
AgeVal, SK_Age


In Excel, this subroutine comprises nothing more than a matching of GrpAgeTypeCol[i] and SKageCol[i], followed by a re-evaluation of the formula linking the two. The rest of the subroutine is error-trapping to reflect that only dates between 0 Ma and 3700 Ma are suitable GrpAgeTypeCol[i] values from which to start.

For Iter = 1 To NumIters --number of times to iterate

  For i = FirstRw To LastRw --row-by-row calculations

    TempVal = GrpAgeTypeCol[i]

    If IsNumeric(TempVal) = TRUE 
  
      AgeVal = GrpAgeTypeCol[i] --remember values are always Ma in SQUID 2.50!
                                                                
      If (AgeVal < 0) OR (AgeVal > 3700)
        SK_Age = MIN( MAX( AgeVal, 0 ), 3700 )
      Else
        SK_Age = MIN( 3700, MAX( GrpAgeTypeCol[i], 0 ) )
      End If
                                                                  
    Else --IsNumeric(TempVal) = FALSE
  
      SK_Age = 0
   
    End If
    
    SKageCol[i] = SK_Age
  
  Next i

  [APPLICATION.CALCULATE/EVALUTE]
  
Next Iter

End Sub
Clone this wiki locally