Procedure Methods
copyCmd
copyToCmd
deleteCmd
zeroCmd
interpolateCmd
createFromScratchCmd
timeShiftCmd
splitCmd
fragmentCmd
assignValueCmd
Command Arguments
# These commands always apply to the
mutable
model only.
# name1, name2, name3 is a list of the
weather element names
# startHour is the starting hour for
the command offset from modelbase
# endHour is the ending hour for the
command offset from modelbase.
# The ending hour is NOT included in
the processing of the
# command.
# modelbase is the name of the model
to be used to determine base times
# Note that if this is "", then 0000z
from today will be
# used for the base time.
# modelsource is the name of the model
to be used in the copy command
# copyOnly is 0 for move and 1 for copy
only in the time shift command
# hoursToShift is the number of hours
to shift the data in time
# shift command
# DatabaseID
# Can be obtained in various ways:
# --By calling findDatabase (see below)
# --By calling getDatabase (see below)
with the result
# of a VariableList entry of type
"model"
or "D2D_model"
# TimeRange.
# Can be obtained in various ways:
# --As an argument passed into Smart
Tool or Procedure,
# --By calling getTimeRange (see below)
# --By calling createTimeRange (see
below)
copyCmd
def copyCmd(self, elements, databaseID, timeRange):
# copyCmd(['name1', 'name2', 'name3'],
databaseID, timeRange)
# Copies all grids for each weather
element from the given database
# into the weather element in the
mutable
database that overlaps
# the time range.
# Example:
# databaseID
= self.findDatabase("NAM") # Most recent NAM model
# timeRange
= self.createTimeRange(0, 49, "Database", databaseID)
#
self.copyCmd(['T',
'Wind'], databaseID, timeRange)
# will copy the Temperature and Wind
fields analysis through 48 hours
# from the latest NAM and place them
into the forecast.
#
copyToCmd
def copyToCmd(self, elements, databaseID, timeRange):
# copyCmd([('srcName1', 'dstName1),
('srcName2', 'dstName2')], databaseID, timeRange)
# Copies all grids for each weather
element from the given database
# into the weather element in the
mutable
database that overlaps
# the time range. Both the source
# and destination names are given.
# Example:
# databaseID
= self.findDatabase("NAM") # Most recent NAM model
# timeRange
= self.createTimeRange(0, 49, "Database", databaseID)
#
self.copyToCmd([('T',
'MaxT'), ('MaxT', 'MinT')], databaseID, timeRange)
# will copy T to MaxT and MaxT to MinT
# from the latest NAM and place them
into the forecast.
#
deleteCmd
def deleteCmd(self, elements, timeRange):
# deleteCmd(['name1', 'name2', 'name3'],
timeRange)
# Deletes all grids that overlap the
input time range for element
# in the mutable database.
# Example:
# databaseID
= self.findDatabase("NAM") # Most recent NAM model
# timeRange
= self.createTimeRange(0, 49, "Database", databaseID)
#
self.deleteCmd(['T',
'Wind'], databaseID, timeRange)
# will delete the Temperature and Wind
fields analysis up to
# but not including 48 hours relative
to the start time of
# the latest NAM model.
#
zeroCmd
def zeroCmd(self, elements, timeRange):
# zeroCmd(['name1', 'name2', 'name3'],
timeRange)
# Assigns the minimum possible value
for scalar and vector, and ""
# for weather for the parameter in the
mutable database for all grids
# that overlap the specified time range.
# Example:
# databaseID
= self.findDatabase("NAM") # Most recent NAM model
# timeRange
= self.createTimeRange(0, 49, "Database", databaseID)
#
self.zeroCmd(['T',
'Wind'], databaseID, timeRange)
# will zero the Temperature and Wind
grids through 48 hours
# relative to the start time of the
latest NAM model.
#
interpolateCmd
def interpolateCmd(self, elements, timeRange, interpMode="GAPS",
interpState="SYNC",
interval=0, duration=0):
# interpolateCmd(['name1', 'name2',
'name3'], timeRange,
# interpMode="GAPS", interpState="SYNC",
interval=0, duration=0)
# Interpolates data in the forecast
for the named weather elements
# for the given timeRange.
# Example:
# databaseID
= self.findDatabase("NAM") # Most recent NAM model
# timeRange
= self.createTimeRange(0, 49, "Database", databaseID)
#
self.interpolateCmd(['T',
'Wind'], timeRange, "GAPS","SYNC")
# will interpolate the Temperature and
Wind grids up to but
# but not including 48 hours relative
to the start time of
#the latest NAM model.
# The interpolation will run in SYNC
mode i.e. completing before
# continuing with the procedure.
#
createFromScratchCmd
def createFromScratchCmd(self, elements, timeRange, repeat=0,
duration=0):
# createFromScratchCmd(['name1',
'name2'],
timeRange, repeat, duration)
# Creates one or more grids from scratch
over the given timeRange
# and assigns the default (minimum
possible
value for scalar
# and vector, "" for weather).
# The repeat interval and duration (both
specified in hours) are
# used to control the number of grids
created. If 0 is specified for
# either one, than only 1 grid is
created
for the given time range. If
# valid numbers for duration and repeat
are given, then grids will
# be created every "repeat" hours and
they will have a duration
# of "duration" hours. If there is not
enough room remaining to create
# a grid with the full duration, then
no grid will be created in the space
# remaining. If you don't get the
desired
results, be sure that your input
# time range starts on a valid time
constraint for the element. If the
# element's time constraints (not the
values supplied in this routine) contains
# gaps (i.e., duration !=
repeatInterval),
then the repeat interval and
# duration will be ignored and grids
will be created for each possible
# constraint time.
# Example:
# databaseID
= self.findDatabase("NAM") # Most recent NAM model
# timeRange
= self.createTimeRange(0, 49, "Database", databaseID)
#
self.createFromScratchCmd(['T',
'Wind'], timeRange, 3, 1)
# will create the 1-hour Temperature
grids through 48 hours at
# 3 hour intervals relative to the start
time of the latest NAM model.
#
timeShiftCmd
def timeShiftCmd(self, elements, copyOnly, shiftAmount, timeRange):
# timeShiftCmd(['name1', 'name2'],
copyOnly,
shiftAmount, timeRange)
# Performs a time shift by the
shiftAmount
for all elements that
# overlap the time range.
# Example:
# databaseID
= self.findDatabase("NAM") # Most recent NAM model
#
timeRange
= self.createTimeRange(0, 49, "Database", databaseID)
#
self.timeShiftCmd(['T',
'Wind'], 1, 3, timeRange)
#
splitCmd
def splitCmd(self, elements, timeRange):
# splitCmd(elements, timeRange)
# Splits any grid that falls on the
start time or ending time of the
# specified time range for the given
parameter in the mutable database.
#
fragmentCmd
def fragmentCmd(self, elements, timeRange):
# fragmentCmd(elements, timeRange)
# Fragments any grids that overlap the
input time range for the parm
# identified in the mutable database.
#
assignValueCmd
def assignValueCmd(self, elements, timeRange, value):
# assignValueCmd(elements, timeRange,
value)
# Assigns the specified value to all
grids points for the grids that
# overlap the specified time range,
for the weather element in the mutable
# database specified.
# value is:
# an Integer or Float for SCALAR
# a magnitude-direction tuple for
VECTOR:
e.g. (55,120)
# a text string for Weather which can
be obtained via the
# WxMethods WxString method
# Example:
#
# Scalar
# value = 60
#
self.assignValue(["T","Td"],
0, 12, 'NAM', value)
#
# Vector
# value = (15,
120)
#
self.assignValue(["Wind"],
0, 12, 'NAM', value)
#
# Weather
# from WxMethods
import *
# value
= WxString("Sct RW")
#
self.assignValue(["Wx"],
0, 12, 'NAM', value)