class AgwxGrids::GridMetaData

Attributes

badVal[RW]
xDim[R]
xEnd[R]
xIncr[R]
xStart[R]
yDim[R]
yEnd[R]
yIncr[R]
yStart[R]
zDim[RW]
zEnd[RW]
zIncr[RW]
zStart[RW]

Public Class Methods

new(gridFile) click to toggle source
# File lib/agwx_grids/grid.rb, line 80
def initialize(gridFile)
  readMeta(gridFile)
end

Public Instance Methods

calcXIncr() click to toggle source
# File lib/agwx_grids/grid.rb, line 45
def calcXIncr
  if @xStart != nil && @xEnd != nil && @xDim != nil then
    @xIncr = (@xEnd - @xStart) / (@xDim - 1)
  end
end
calcYIncr() click to toggle source
# File lib/agwx_grids/grid.rb, line 66
def calcYIncr
  if @yStart != nil && @yEnd != nil && @yDim != nil then
    @yIncr = (@yEnd - @yStart) / (@yDim - 1)
  end
end
readMeta(gridFile) click to toggle source
# File lib/agwx_grids/grid.rb, line 84
def readMeta(gridFile)
  @xDim,@yDim,@zDim = gridFile.gets.scan(/\d+/).collect { |s| s.to_f }
  @xStart,@xEnd = gridFile.gets.scan(/-*\d+.\d+/).collect {|s| s.to_f }
  calcXIncr
  @yStart,@yEnd = gridFile.gets.scan(/-*\d+.\d+/).collect {|s| s.to_f }
  calcYIncr
  @zStart,@zEnd,@zIncr = gridFile.gets.scan(/\d+/).collect {|s| s.to_i }
  @badVal = gridFile.gets.scan(/-*\d+.\d+/).collect {|s| s.to_f }
end
to_s() click to toggle source
# File lib/agwx_grids/grid.rb, line 72
def to_s
  x = "xDim="+@xDim.to_s+",xStart="+@xStart.to_s+",xEnd="+@xEnd.to_s+",xIncr="+xIncr.to_s
  y = "yDim="+@yDim.to_s+",yStart="+@yStart.to_s+",yEnd="+@yEnd.to_s+",yIncr="+yIncr.to_s
  z = "zDim="+@zDim.to_s+",zStart="+@zStart.to_s+",zEnd="+@zEnd.to_s+",zIncr="+zIncr.to_s
  badVal = "badVal="+@badVal.to_s
  x+"\n"+y+"\n"+z+"\n"+badVal
end
xDim=(newXDim) click to toggle source
# File lib/agwx_grids/grid.rb, line 32
def xDim=(newXDim)
  @xDim = newXDim
  calcXIncr
end
xEnd=(newXEnd) click to toggle source
# File lib/agwx_grids/grid.rb, line 40
def xEnd=(newXEnd)
  @xEnd = newXEnd
  calcXIncr
end
xStart=(newXStart) click to toggle source
# File lib/agwx_grids/grid.rb, line 36
def xStart=(newXStart)
  @xStart = newXStart
  calcXIncr
end
yDim=(newYDim) click to toggle source
# File lib/agwx_grids/grid.rb, line 51
def yDim=(newYDim)
  @yDim = newYDim
  calcYIncr
end
yEnd=(newYEnd) click to toggle source
# File lib/agwx_grids/grid.rb, line 61
def yEnd=(newYEnd)
  @yEnd = newYEnd
  calcYIncr
end
yStart=(newYStart) click to toggle source
# File lib/agwx_grids/grid.rb, line 56
def yStart=(newYStart)
  @yStart = newYStart
  calcYIncr
end