To Use the Lamodelbasecalculations Spreadsheet and Macros

Total Page:16

File Type:pdf, Size:1020Kb

To Use the Lamodelbasecalculations Spreadsheet and Macros

To use the “LaModelBaseCalculations” spreadsheet and macros:

The LaModelBaseCalculations EXCELworkbook is intended for the user to read in grid files (*.grd) that have been pulled from the LaModel output files (*.f1, *.f2, etc.) using the Stability Mapping software in AutoCAD. These grid files are then transformed into a 2D array complementary to the LaModel grid using the EXCEL macro “MakeArrayFromGrid”. Once in the 2D array, the LaModel output can be manipulated in an unlimited number of ways using EXCEL.

1. To import the grid file:

A) Open the “LaModelBaseCalculations” spreadsheet B) In the spreadsheet in EXCEL, go to "File -> Open". C) In the "Open" dialog, Change to the directory where the grid file is located. D) In the "Open" dialog, Change the file window to show "All Files (*.*)". E) Select your *.grd file. F) In the "Text Import Wizard - Step 1 of 3", Change file type to "Delimited", click the "Next" button G) In the "Text Import Wizard - Step 2 of 3", Change the "Delimiters" to "Comma" and "Space" only, Check the box "Treat consecutive delimiters as one", click the "Finish" button H) This will import the entire grid file into a new EXCEL spreadsheet. I) Copy the entire new worksheet to the "Grid" worksheet in the “LaModelBaseCalculations” workbook J) Delete (or save if you want) the newly created EXCEL file. The data is now redundant since we have copied it into the "Grid" worksheet.

The original grid file, and now the “Grid” worksheet, contains the data from the LaModel grid in one long column. The first 4 rows contain the northing and easting coordinates of the lower left and upper right corner of the grid (these coordinates may be in inches if you were working in feet). The fifth and sixth rows contain the number of elements in the X direction and the number of elements in the Y direction. Then the remaining rows contain the data values. These data values are organized with the first data value being at X=1, Y=1 and then moving up the column before moving to the next column. The “MakeArrayFromGrid” macro reads the number of columns and rows of data from the “Grid” worksheet and then parses the data back into a 2D array in the “Array” worksheet with the original form of the LaModel grid. Note that EXCEL number the rows from the top down as opposed to numbering the rows from the bottom up as done in LaModel 2. Now you are ready to use the “MakeArrayFromGrid.”

A) First, clear any old data from the “Array” worksheet B) To access the macros, go to the top tool bar "View", and then click on the "Macros" on the far right, then click "View Macros" C) You should see the macro “MakeArrayFromGrid” D) To execute any macro, select the desired macro in the "Macro" dialog and click the "Run" button. E) This will parses the data back into a 2D array in the “Array” worksheet. F) Rename the worksheet with an appropriate name G) Now you are ready to plot or manipulate the data using EXCEL 1) Typically, to start, the user might want to calculate the change in subsidence between the "OriginalSubsidence" and the "FinalSubsidence".

A) The "MakeDelta" macro will subtract the "OriginalSubsidence" worksheet from the "FinalSubsidence" worksheet, and put the result into the "DeltaSubsidence" worksheet.

2) Then, the user might want to calculate the change in slopes and strain associated with this change in subsidence.

A) To calculate slopes and strain, first the desired subsidence needs to be put in the "Array" worksheet. B) The "MakeDeltaArray" macro will take the single column subsidence values from the "DeltaSubsidence" worksheet and put them in array form in the "Array" worksheet. (This is a pre-requisite for then calculating slopes and strains.) C) Similarly, the "MakeOriginalArray" and "MakeFinalArray" macros will move the subsidence values from the "OriginalSubsidence" or "FinalSubsidence" worksheet, respectively, into the "Array" worksheet. D) Then, the "CalcSlopeStrain" macro will take the subsidence in the "Array" worksheet, and use it to calculate and populates the: "XSlope", "YSLope", XStrain, YStrain, "MaxPositive" strain and "MaxNegative" strains worksheets. E) The CalcSlopeStrain" macro also calls the "Output" macro. The "Output" macro takes the slope and strain values from the "XSlope", "YSLope", XStrain, YStrain, "MaxPositive" strain and "MaxNegative" strains worksheets and puts them into the "Output" worksheet in a single column form suitable for output as a LaModel grid file.

3) To output a file of the subsidence calculations suitable for reading into LamPlt and/or the Stability Mapping software:

A) In EXCEL, open the "Output" worksheet B) In EXCEL, go to "File -> Save As" C) In the "Save As" dialog, change the file type to "CSV (Comma delimited) (*.csv)" D) In the "Save As" dialog, click the "Save" button E) In the message box, click "OK" to just save the current worksheet. F) In the next message box, click "No" to keep the spreadsheet in the same format. G) Exit the "Save AS" dialog 4) The "SubsidenceCalculations" spreadsheet also provides the capability to scale your subsidence and/or strain values to help with calibrating the LaModel subsidence. The two macros, "AdjustSub" and "AdjustStrain" do this scaling using the input scale factors from the "Parameters" worksheet.

A) The "AdjustSub" macro takes the subsidence in the "Array" worksheet and multiples it by the "Sub Factor" (Row 2, Col 1) in the "Parameters" worksheet. B) The "AdjustStrain" macro takes the strain values in the XStrain, YStrain, "MaxPositive" and "MaxNegative" worksheets and multiples them by the "Strain Factor" (Row 2, Col 2) in the "Parameters" worksheet. The "AdjustStrain" macro also calls the "Output" macro to take the slope and strain values from the "XSlope", "YSLope", XStrain, YStrain, "MaxPositive" strain and "MaxNegative" strains worksheets and puts them into the "Output" worksheet in a single column form suitable for output as a LaModel grid file.

Note: to find the maximum and/or minimum subsidence and/or strain values in any of the single- column format worksheets ("OriginalSubsidence", "FinalSubsidence", "DeltaSubsidence", or "Output"), the user can use the visual basic commands, max() or min(), on the values in a column.

Keith

Recommended publications