# ---------------------------------------------------------------------------- # This software is in the public domain, furnished "as is", without technical # support, and with no warranty, express or implied, as to its usefulness for # any purpose. # # PoQ001_fm_QPF # # Author: # ---------------------------------------------------------------------------- ToolType = "numeric" WeatherElementEdited = "PoQ001" from Numeric import * # You can screen the elements for which your tool will appear by using # a ScreenList. For example: # #ScreenList = ["T","Td"] #ScreenList = ["SCALAR","VECTOR","WEATHER","DISCRETE"] ### If desired, Set up variables to be solicited from the user: ##VariableList = [ ## ("Variable name1" , defaultValue1, "numeric"), ## ("Variable name2" , "default value2", "alphaNumeric"), ## ("Variable name3" , ["default value1", "default value2"], "check", ## ["value1", "value2", "value3"]), ## ("Variable name4" , "default value4", "radio", ## ["value1", "value2", "value3"]), ## ("Variable name5" , defaultValue, "scale", ## [minValue, maxValue], resolution), ## ("Variable name6" , "", "model"), ## ("Variable name7" , "", "D2D_model"), ## ("Label contents" , "", "label"), ## ("", dialogHeight, "scrollbar"), ## ] # Set up Class import SmartScript ## For available commands, see SmartScript class Tool (SmartScript.SmartScript): def __init__(self, dbss): SmartScript.SmartScript.__init__(self, dbss) # Required Method: Execute # Called once for each grid # Fill in the arguments you want to use -- WeatherElement1, WeatherElement2... def execute(self, QPF_SumGrid,PoQ001,PoP, varDict): "PoQ001 from qpf" # this is the exceedence threshold value precipValue=0.01 QPF0Mask=equal(QPF_SumGrid,0) aqpf=(QPF_SumGrid/(PoP*.01 + .0001)) PoQ001=where(QPF0Mask,0, (exp(-precipValue/aqpf) * PoP )) # Return the new value return PoQ001