Average of Recovery lengths

I'm trying to write a function to calculate the average of the recovery lengths and the average of the depths for 5 runs at a time (without weighting it). For example, I need the average of the recovery lengths and depth corresponding to Run numbers R-1 to R-5. I've included an image below.

I'm new at this and need a help. Thank you.

Vinod

 

Parents
  • If the example provided by calan produces the correct numbers, restricting the output to only print every 5th run can be done by inserting the condition:

    <<Calc(<<Abs(<<Int(<<RightNum(<<Sample.Number>>)>>/5)>>-<<RightNum(<<Sample.number>>)>>/5)>>>0.001)>>

    In the output condition property of the entity. 

    It uses the RightNum function to extract the actual run number from the your combined sample type and number text field and then determines if that number is a multiple of 5 (ie the number divided by 5 is an integer).  The use of the greater than in the condition above allows for a tolerance in the comparison so that slight inaccuracies introduced by computer math do not impact the result.  I have not tested this particular equation in gINT and just wrote it from memory so I may have a few syntax or spelling errors but you should be able to work those out.  You will also have to replace the field names with your actual field names.

    You could also consider this formula that averages the last 2 values (instead of the last 5) In lieu of the SQL function that calan provided:

    <<Calc((<<LookUp(<<Sample.RQD>>,<<Sample.Depth>>=<<PrevDepth(<<Sample.Depth)>>)>>+<<Sample.RQD>>)/2)>>

    Again I have not tested this in gINT so there may be some syntax/spelling errors (or I may be missing an important consideration... you never know until you try it out) and you will have to replace the field names with your field names (including replacing <<Sample.RQD>> with the equation to calculate percent RQD from your RQD length and sample length).  It simply looks up the previous RQD using the Lookup function combined with the PrevDepth Function and then averages it with the current RQD.  Output would be restricted to every other run by using the same method provided above with the divisor set to 2 instead of 5

    As an alternative to solve your overall problem of too much text data to display on a small scale graphic column, consider the following.

    Doing an arbitrary average of every 5 values may produce misleading and skewed results.  It is better to display all the data.  The way to accomplish this is graphically rather than text.  The example below shows the recovery and RQD data displayed adjacent to the graphic column using overlapping bar graphs.  The recovery is shown by the hatched bar and the RQD is shown by the solid bar.  The length of the sample is depicted graphically by the height of the bar and is scaled to match the adjacent lithology column (note the longer and shorter runs about midway down the example). Note that if no sample was collected for a particular interval, no bar would be plotted. Since Recovery must always be greater than or equal to the RQD, the RQD bar is shown on top of the recovery bar.

    This works no matter how short your runs are and what scale you plot your fence at and provides an easy visual overview of the quality of your rock wrt depth (the more bar the better the rock; solid black graphs imply excellent quality rock).  It also presents all of your data so it is easy to identify results that are abnormal and do not represent the trend.  If the user wants the actual numbers, they should go back to the original text log that provides all the numbers.

    Creating this graph is not that hard to do.  It involves creating the underlying axis dotted lines and axis labels, creating a bar graph for the recovery, and creating a bar graph for the RQD.  The print order on these three entities is set to -1, 0, and 1 respectively so they stack up on top of each other.

    The axis labels and top bar are just simple graphic elements drawn on your fence diagram.  The vertical dashed lines are vertical line to depth entities with the bottom depth property set to the depth of the hole and the top depth property set to zero.  Again the print order of these lines is set to -1 so they printer UNDER everything else.

    The recovery graph is a bar chart vs depth entity with settings as shown in the following 4 dialogs:

    Main tab:

    Configuration tab:

    Data representation tab:

    Background tab:

    In the above, note the print order set to 0 and note the background fill set to solid white so it blocks out the underlying vertical dotted lines.

    The RQD graph is set up similarly with properties as in the following 3 dialogs

    Main tab:

    Configuration tab

    Data representation tab

    Again note the print order set to 1 so it prints on top of the Recovery bar graph.

    You will have to replace the field names in the above with your equivalent field names.  Note that I have separate fields for the Recovery and RQD expressed as a percentage and you would have to calculate these values as the recovery or rqd length divided by the sample length times 100.

  • Yes, this looks to be a much better solution. Thank you so much. I will try this out now. Thanks again.

    Vinod

  • Here are two expressions that will work on Log reports and Fence reports.

    Average Depth:

    <<Sql(_
      SELECT AVG([SAMPLE].[Depth]) _
      From [SAMPLE] _
      Where [SAMPLE].[PointID] = '<<PointID>>' _
        And [SAMPLE].[Group ID] = <<SAMPLE.Group ID>>; _
        0.000_
    )>>

    Average Recovery Length:

    <<Sql(_
      SELECT AVG([SAMPLE].[Recovery Length]) _
      From [SAMPLE] _
      Where [SAMPLE].[PointID] = '<<PointID>>' _
        And [SAMPLE].[Group ID] = <<SAMPLE.Group ID>>; _
      0.000_
    )>>

    You can then use either <<SAMPLE.Depth>> or just <<DEPTH>> for the Depth Expressions. The values that get printed will be printed at the top of each "group" interval.

    In addition, on the Configuration tab of the Text vs Depth entity mark the "Remove Repeated Text" property. This will remove the duplicated values in the column because each of the above expressions will print the same result for each depth that has the same Group ID value entered. What is this Group ID? This is one small consolation to make the expressions easier to write and it allows you to group the results in Input manually. I know one of the earlier postings stated that you did not want to have an additional field added to the Sample table, but instead of being locked into the same number of values for all the boreholes by using the Group ID field you can group four together or five or six, etc. And, you would not need to modify any expressions. If you do not mark the Remove Repeated Text property you will get the same output that was displayed in an earlier posting where there is a good chance that the printed numbers will extend below the bottom of each borehole.

    The numbers that are returned by each SQL expression are also formatted to three decimal places, this can be changed as necessary.

     

     

Reply
  • Here are two expressions that will work on Log reports and Fence reports.

    Average Depth:

    <<Sql(_
      SELECT AVG([SAMPLE].[Depth]) _
      From [SAMPLE] _
      Where [SAMPLE].[PointID] = '<<PointID>>' _
        And [SAMPLE].[Group ID] = <<SAMPLE.Group ID>>; _
        0.000_
    )>>

    Average Recovery Length:

    <<Sql(_
      SELECT AVG([SAMPLE].[Recovery Length]) _
      From [SAMPLE] _
      Where [SAMPLE].[PointID] = '<<PointID>>' _
        And [SAMPLE].[Group ID] = <<SAMPLE.Group ID>>; _
      0.000_
    )>>

    You can then use either <<SAMPLE.Depth>> or just <<DEPTH>> for the Depth Expressions. The values that get printed will be printed at the top of each "group" interval.

    In addition, on the Configuration tab of the Text vs Depth entity mark the "Remove Repeated Text" property. This will remove the duplicated values in the column because each of the above expressions will print the same result for each depth that has the same Group ID value entered. What is this Group ID? This is one small consolation to make the expressions easier to write and it allows you to group the results in Input manually. I know one of the earlier postings stated that you did not want to have an additional field added to the Sample table, but instead of being locked into the same number of values for all the boreholes by using the Group ID field you can group four together or five or six, etc. And, you would not need to modify any expressions. If you do not mark the Remove Repeated Text property you will get the same output that was displayed in an earlier posting where there is a good chance that the printed numbers will extend below the bottom of each borehole.

    The numbers that are returned by each SQL expression are also formatted to three decimal places, this can be changed as necessary.

     

     

Children
No Data