TUgridTrim TCL UTILITIES USER MANUAL TUdgridTrim
SYNOPSIS
Trim blank rows and columns off a grid.
PACKAGE
TCLUTILS
NAME
TUgridTrim
USAGE
set rV  TUgridTrim  CmD Grid gNorm gInfo Ops]
INPUT DEFINITIONS
CmD - Defines what action the procedure should take.
REGRID - Identify the outer blank rows and columns in Grid and regrid the grid removing these. This results in a new grid information array.
REGRIDX - Identify the outer blank columns in Grid and regrid the grid removing these. This results in a new grid information array.
REGRIDY - Identify the outer blank rows in Grid and regrid the grid removing these. This results in a new grid information array.
EDGES - Identify the outer blank rows in Grid and return this information. There is no regridding performed.
Grid - The input data grid.
gInfo - The grid information array.
Ops - An array of input options
Ops(0) - All cells in the grid with values below or equal to this threshold are considered empty. In general set this to gInfo(11) which is an empty grid is initialized to.
Ops(1) - Set to 0 if you want the absolute edge positions returned or 1 if you and the edges returned as the distance from the inner and outer grid edges. The latter is suitable as into into TUgridFill2D
RETURN DEFINITION
Returns a list of the effective grid edges. The list elements in order are: the lower and upper column numbers and the lower and upper row numbers.
DESCRIPTION
TUgridTrim locates the first and last column and row number which contain data above a threshold value set in Ops(0). These are returned through the procedure. In addition the procedure can regrid the input grid to eliminate the unused rows and/or columns. Regridding distroys both the input grid and the input grid definition array. Both are overwritten.
ERRORS
None Generated
C BACKING
No
EXAMPLE(S)
EXAMPLE 1:PLOT multiple rows of data through a grid.
# PLOT rows of data through a grid

# SET up a data set consisting of two Gaussians

set nP 0
for { set X -6.0 } { $X <= 6.0 } { set X [expr $X + .1] } {
   for { set Y -6.0 } { $Y <= 6.0 } { set Y [expr $Y + .1] } {
       set Yy($nP) $Y
       set Xx($nP) $X
       set rA [expr ($X - 3.0) * ($X - 3.0) + $Yy($nP) * $Yy($nP)]
       set rB [expr ($X + 3.0) * ($X + 3.0) + $Yy($nP) * $Yy($nP)]
       set Vv($nP) [expr 2.0 * exp(-$rA / 8.0) + 1.5 * exp(-$rB / 8.0)]
       incr nP
   }
}

# SET up the grid information array. 

set gInfo(0) -6.0
set gInfo(1) 6.0
set gInfo(2) -6.0
set gInfo(3) 6.0
set gInfo(4) 100
set gInfo(5) 100
set gInfo(6) POINT
set gInfo(7) POINT
set gInfo(8) COLUMN
set gInfo(9) IGNORE
set gInfo(10) NEW:ADD:END
set gInfo(11) -1
set gInfo(12) -5
set gInfo(13) -1.0e30
set gInfo(14)  1.0e30
set gInfo(15)  NO
set gInfo(16)  NO

# GRID the data

TUdataGrid $nP 1 Xx Xx 1 Yy Yy Vv Grid Norm gInfo

# TURN on plotting

set GphInfo(xScrL) 500
set GphInfo(yScrL) 800

GraphicsOn TK ETones SWAP

GenWindow 1 0.0 0.0 0.0 1.0 1.0 0.0  0. 0. 0. 1. 1. 0. XY
set WinInfo(8,corFmt) 1
RelWindow 8 1 75.0 375.0 0. 475. 775. 0. -6. -6. 0. 6. 6. 0.
DefinePlot 8 8 $gInfo(4) $gInfo(5)
set WinInfo(9,corFmt) 1
RelWindow 9 1 75.0 75.0 0. 475. 275. 0. -6. 0. 0. 6. 2. 0.
DefinePlot 9 9 -1 -1

# COLOR runs from 0 to 2.0

PLTcolorMap 0.0 2.0 LINEAR 0 cA

# PLOT the Grid

Plot3D 8 Xb Yb Dummy Dummy Grid AUTO Dummy cA
PlotOutlines 8 [list "X" 1.0 "Y" 1.0] [list BOT BOT BOTH BOTH]

# GET the X centers of a row of cells.

TUgridInfo 32 gInfo Xc 

# PLOT all cell rows from 0 to 50 incrementing by 5 rows.

for { set I 0 } { $I <= 50 } { incr I 5 } {
   set nE [expr [TUgridTrim Grid gInfo Vc RETRIEVE ROW $I] - 1]
   Plot2D 9 Xb Yb Xc Vc 0 $nE  LINE [list $GphInfo(White) NONE]
}

# PLOT axis and labels

PlotOutlines 9 [list "X " 1.0 "V" 1.0] [list BOT BOT BOTH BOTH]
update
      
Sept 27, 2006