Grid Access Methods
getGrids
taperGrid
directionTaperGrid
getComposite (numeric only)
getGridInfo
getGrids
def getGrids(self, model, element, level, timeRange,
mode="TimeWtAverage",
noDataError=1, mostRecentModel=0, cache=1):
# Get the value(s) for the given model,
element, and level
# at the x, y coordinate and over the
given timeRange.
#
# The resulting grid values can be
accessed
as follows:
# PoPGrid =
self.getGrids("Fcst","PoP","SFC",
GridTimeRange)
# popValue = PoPGrid[x][y]
#
# where x and y are integer grid
coordinates.
taperGrid
def taperGrid(self, editArea, taperFactor=5):
# Returns a 2-D Grid of values between
0-1 about the
# given edit area.
# These values can be applied by smart
tools to taper results.
#
# Argument:
# editArea: Reference data or None
# (use editArea tool argument)
# taperFactor: If set to zero, will
do Full Taper
#
# Example:
# def preProcessTool(self, editArea):
# self._tGrid
= self.getTaperGrid(editArea, 5)
# def execute(self, variableElement):
# return =
variableElement + self._tGrid * 10.0
#
directionTaperGrid
def directionTaperGrid(self, editArea, direction):
# Returns a 2-D Grid of values between
0-1 within the
# given edit area.
# E.g. if the Dir is W and x,y is
half-way
along the
# W to E vector within the given edit
area, the value of
# directionTaperGrid at x,y will be
.5
# These values can be applied by smart
tools to show
# spatial progress across an edit area.
#
# Argument:
# editArea : ReferenceData
or None
# (use editArea tool argument)
# direction : 16 point text direction
e.g. "NNW", "NW", etc.
#
# Example:
# def preProcessTool(self, editArea):
# self._spaceProgress
= self.directionTaperGrid(editArea, "NW")
# def execute(self, variableElement):
# return
variableElement * self._spaceProgress
#
getComposite (numeric only)
def getComposite(self, WEname, GridTimeRange, exactMatch=1, onlyISC=0):
# Returns a composite grid
consisting
of the primary grid and any
# corresponding ISC grid, blended
together based on the mask information
# derived from the Grid Data
History.
Primary grid must exist. Returns
# the set of points that are valid
in the output grid. (Note the output
# grid consists of the primary
grid and isc grid. Any "invalid" points,
# indicate those areas that have
no isc data and are outside the home
# site's region. The returned
grid will have the primary data in
# the site's region.)
#
# A Python tuple is returned.
# For Scalar elements, the tuple
contains:
# a numeric grid of 1's and 0's
where 1 indicates a valid point
# a numeric grid of scalar values
# For Vector elements, the tuple
contains:
# a numeric grid of 1's and 0's
where 1 indicates a valid point
# a numeric grid of scalar values
representing magnitude
# a numeric grid of scalar values
representing direction
# For Weather elements, the tuple
contains:
# a numeric grid of 1's and 0's
where 1 indicates a valid point
# a numeric grid of byte values
representing the weather value
# list of keys corresponding to
the weather values
#
# For example:
# isc
= self.getComposite(WEname, GridTimeRange)
# if isc
is None:
#
self.noData()
# # See
if we are working with a Scalar or Vector element
# wxType
= variableElement_GridInfo.type()
# if
wxType
== 0: # SCALAR
#
bits, values = isc
# elif
wxType == 1: # VECTOR
#
bits, mag, dir = isc
getGridInfo
def getGridInfo(self, model, element, level, timeRange,
mostRecentModel=0):
# Return the GridInfo object for the given weather element and timeRange
# Example:
# timeRange = self.getTimeRange("Today")
# infoList = self.getGridInfo("Fcst", "T", "SFC", timeRange)
# for info in infoList:
# print "grid", info.gridTime()
#
# @param model: The model for which grid info is requested.
# @type model: DatabaseId or String
# @param element: The element for which grid info is requested.
# @type element: String
# @param level: The level for which grid info is requested.
# @type level: String
# @param timeRange: A time range over which grid info is requested.
# @type timeRange: com.raytheon.uf.common.time.TimeRange or TimeRange
# @param mostRecentModel: whether to use current time in request expr.
# @type mostRecentModel: integer or boolean
# @return: Java GridParmInfo object