GridVolume2
The GridVolume2 method calculates the volume between two surfaces and displays the results in a report window. Returns a Boolean. Returns 'True' if the volume is calculated successfully, else returns 'False'.
Syntax
object. GridVolume( Upper, Lower, pResults, ShowReport, zScale, SaveReportAs, ReportFormat )
Parameter |
Type |
Required/ Optional |
Default |
Description |
Upper |
Variant |
Required |
|
This specifies the upper grid surface path and file name or constant value. |
Lower |
Variant |
Required |
|
This specifies the lower grid surface path and file name or constant value. |
pResults |
Array of Doubles |
Required |
|
This is the array with the modified coordinates. It has base-0 and is indexed using the enumeration. |
ShowReport |
Boolean |
Optional |
|
This enables the show grid volume report. The report is shown only if ShowReport is true and Surfer is visible. |
zScale |
Double |
Optional |
|
This specifies the z scaling factor to be added to the volume calculation. |
SaveReportAs |
Variant |
Optional |
This specifies the path and file name to which the volume report is saved. The Surfer application must be visible and ShowReport must be True to save the volume report |
|
ReportFormat |
Optional |
srfReportFormatRTF |
This specifies the saved volume report format, RTF or TXT. |
Remarks
There are 11 values numbered from 0 to 10 in the srfGridVolumeParam enumeration. The GridVolume method copies an array of 11 doubles to the pResults parameter. The 11 different values correspond to the different enumerated values. For example, the first value in the array (at index 0) is the volume calculated by the trapezoidal rule (srfGVTrapVol). The second value (at index 1) is the volume calculated by Simpson’s rule (srfGVSimpVol), and so on. So you should use the enumerations as the indices into the pResults array, to get the individual value that you are interested in.
The Surfer application must be visible and ShowReport must be set to True to save the volume report with the SaveReportAs and ReportFormat parameters. The report is saved via the user interface functionality. Any errors in saving the report will happen via the user interface as well, and the error will block the script from proceeding.
Example 1
This example demonstrates how to calculate the volume between the upper surface ("demogrid.grd") and the lower surface (a constant of 50) and display the grid volume report.
Dim Results() As Double
SurferApp.GridVolume(Upper:=SurferApp.Path+"\Samples\demogrid.grd", _
Lower:=50, pResults:=Results, ShowReport:=True)
Since the Results array is an outgoing parameter, the value of the elements within the array can be returned.
Dim Element As Integer
For Element = 0 to 9 Step 1
Debug.Print Results(Element)
Next
Or store the elements as variables to be used later.
Dim TrapezoidalRule As Double
TrapezoidalRule = Results(srfGVTrapVol)
Example 2
This script displays all the methods in the Application object.
Used by: Application object