Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation
Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement.Téléchargez la présentation en cliquant sur ce lien.Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.
Overview • Part 1 • What are Smart Tools? • Executing Smart Tools • Creating Smart Tools • Part 2 • Creating Smart Tools (cont) • SmartScript Library Methods • Part 3 • Procedures • Utilities Smart Tools and Procedures
Smart Tool User Input Modify Meteorological Algorithms Numerical Python Numerical Models Observations Topography Forecast Grids "On-the-fly" Elements What are Smart Tools? Smart Tools and Procedures
Executing Smart Tools • Make Weather Element Editable • Set up Selection Time Range • Set up Edit Area • Execute Tool from Edit Action Dialog or Spatial Editor MB3 Popup Menu Smart Tools and Procedures
Creating Smart Tools • From Edit Action Dialog MB3 Popup: • Info... • Cut, Copy, Paste • Modify... or View... • New... • Rename... • Delete... Smart Tools and Procedures
CreatingSmart Tools ToolType = "numeric" from Numeric import * WeatherElementEdited = "T" import SmartScript class Tool (SmartScript.SmartScript): def __init__(self, dbss): SmartScript.SmartScript__init__(self,dbss) def execute(self, T): T = T + 5 return T Smart Tools and Procedures
Level = “SFC” Model = “Fcst” TimeRange Element = “T” Mode = “TimeWtAverage” self.getGrids Numeric Grid for “T” SmartScript LibraryGrid Access getGrids Smart Tools and Procedures
SmartScript LibraryModel # Fcst or Official self.getGrids(“Fcst”, “T”, “SFC”, GridTimeRange) # siteID_type_model_modeltime self.getGrids(“BOU__Eta_Oct0112”, “T”, “SFC”, GridTimeRange) self.getGrids(“BOU__Eta”, “T”, “SFC”, GridTimeRange) self.getGrids(“BOU_D2D_ETA”, “t”, “MB750”, GridTimeRange) Smart Tools and Procedures
SmartScript LibraryModel # Using Site ID for portability def execute(self, GridTimeRange, varDict): siteID = self.getSiteID() model = self.siteID + “__Eta” self.getGrids(model, “T”, “SFC”,GridTimeRange) Smart Tools and Procedures
Model = “BOU_D2D_ETA” Element = “t” TimeRange Levels self.makeNumericSounding Numeric Cube for “gh” and Numeric Cube for “t” SmartScript LibraryNumeric Sounding Smart Tools and Procedures
Trouble-shooting Ideas • Run from terminal window to see Python error messages. • Use "print" statements. print "Made it to this point." print "myVariable=", myVariable print "value at 25, 25 is", T[25][25] Smart Tools and Procedures
Smart Tool Repository (STR)http://isl715.nws.noaa.gov/STR/index.php3 • Provides an easy to use interface between developers of STs and the users. Promotes sharing of STs so that others can benefit from work done and not duplicate work. • Register tools when downloaded to received bug notification, version updates, and comments on the ST. • Users can also submit bugs and comments to the developer. • Upload a newly developed tool along with documentation and an installation guide. You can even post a ST idea that is in development without submitting the actual code. Smart Tools and Procedures
Smart Tool Repository (STR)Downloading and Adding a Tool • Use the “Site Interface” and choose your region and WFO ID • Choose “Info on Tools” and go to the ST you wish to download • Right click on the “Download Software” and use “Save Link as”. Do the same for the Documentation and Install files if available. • Move the ST to a location where GFE is running and open the ST with an editor such as vi or nedit. Smart Tools and Procedures
Smart Tool Repository (STR)Downloading and Adding a Tool (cont.) • 5) Make the downloaded ST part of the GFE • Use the new ifpServerText program to save the “flat file” into the GFESuite ifpServer. The program takes care of the metadata file needed. • 6) Use the STR to register this tool to receive e-mail notices of bugs and updates. Smart Tools and Procedures
height (height1, value1) (height2, value2) self.interpolateValues Interpolated value at height SmartScript LibraryInterpolateValues Smart Tools and Procedures
height (height1, value1) (height2, value2) self.interpolateValues Interpolated value at height SmartScript LibraryInterpolateValues Smart Tools and Procedures
height (height1, value1) (height2, value2) self.extrapolate Extrapolated value at height SmartScript LibraryExtrapolate Smart Tools and Procedures
Vector Weather Elements WeatherElementEdited = "Wind" import SmartScript class Tool (SmartScript.SmartScript): def __init__(self, dbss): SmartScript.SmartScript__init__(self,dbss) def execute(self, Wind): mag = Wind[0] dir = Wind[1] mag = mag + 5 return (mag, dir) Smart Tools and Procedures
Working with Weather Numeric Weather is a 2-tuple: wxValues -- Numeric Grid of bytes keys -- list of "ugly strings" where the the index of the ugly string corresponds to the byte value in the wxValues grid. Keys = ["Sct:RW:-:<NoVis>:", "Chc:T:-:<NoVis>:", "Chc:SW:-:<NoVis>:" ] Then the wxValues grid is 0 where "Sct:RW:-:<NoVis>:" 1 where "Chc:T:-:<NoVis>:" 2 where "Chc:SW:-:<NoVis>:" Smart Tools and Procedures
Working with Weather Assigning Weather values: getIndex -- given a list of keys, returns the associated index byteValue = self.getIndex("SChc:RW:-:<NoVis>:",keys) byteValue = self.getIndex("Chc:RW:-:<NoVis>:",keys) # Special case for "NoWx" byteValue = self.getIndex("",keys) Smart Tools and Procedures
Working with Weather #See examples/smartTools/Convective_SmartTool.py # Creating Wx from PoP def execute(self, PoP, Wx): wxValues, keys = Wx wxValues = \ where(less(PoP, 10), self.getIndex("",keys), where(less(PoP,20) , self.getIndex("SChc:RW:-:<NoVis>:",keys), self.getIndex("Chc:RW:-:<NoVis>:",keys))) return (wxValues, keys) Smart Tools and Procedures
Working with Weather Querying Weather values: wxMask -- given a Wx tuple and a string expression, return 1 if there is a match found = self.wxMask(Wx, "Iso:") found = self.wxMask(Wx, ":R:") Smart Tools and Procedures
Working with Weather # See examples/smartTools/PoP_From_Wx.py # Creating PoP from Wx def execute(self, PoP,Wx): PoP = where(self.wxMask(Wx, "Iso:"), 10, PoP) PoP = where(self.wxMask(Wx, "Sct:"), 20, PoP) return PoP Smart Tools and Procedures
SmartScript LibraryEdit Area Methods editArea = self.getEditArea(“Boulder”) areaMask = self.encodeEditArea(editArea) T = where(areaMask, T+10, T) Smart Tools and Procedures
Smart Script LibraryMissing Data Mode • Set from GFE-->Editing Modes Menu • When there is missing data: • Stop -- stop execution • Skip -- Skips the grid and reports it • Create -- If possible, creates a grid via interpolation. If in the Fcst database, the new grid can be saved. Smart Tools and Procedures
SmartScript Library"On-the-Fly" Elements • "On-the-fly" Elements • ISC Discrepancies • Creating temporary weather elements self.createGrid(model, element, elementType, numericGrid, timeRange) Smart Tools and Procedures
SmartScript Library"On-the-Fly" Elements WeatherElementEdited = “None” self.createGrid("Diff", "T_Diff", "Scalar", myGrid, GridTimeRange) Smart Tools and Procedures
WEname GridTimeRange exactMatch self.getComposite Primary Grid plus corresponding ISC data Numeric mask indicating valid points SmartScript LibraryISC Data Smart Tools and Procedures
Smart Script LibraryError Handling • abort -- abort with user-supplied error message • noData -- abort with a No Data error • cancel -- abort with no error message • statusBarMsg -- sends message to the Status Bar Smart Tools and Procedures
Creating Smart Tools Reserved Methods • execute • preProcessTool, postProcessTool • Actions that need to be done once per tool class Tool (SmartScript.SmartScript): def __init__(self, dbss): SmartScript.SmartScript.__init__(self, dbss) def preProcessTool(self, varDict): self._thunder = varDict["Thunder Y/N"] def execute(self, Wx): if self._thunder == "Y": # assign thunder Smart Tools and Procedures
Creating Smart Tools Creating Your Own Methods • Name preceeded by underscore • "self" used in call and in "def" argument list Class Tool (SmartScript.SmartScript): def __init__(self, dbss): SmartScript.SmartScript.__init__(self, dbss) def execute(self, QPF, T): SnowRatio =self._getSnowRatio(T) SnowAmt = QPF * SnowRatio return SnowAmt def _getSnowRatio(self, T): return where( less(T, 20), 18, where( less(T, 21), 14, 10) Smart Tools and Procedures
SmartScript LibraryComing Soon • A library of meteorological functions • Gradient • Curl • Dot product • Cross product • Advection • Others Smart Tools and Procedures
SmartScript LibraryExercises • SmartScript-5 : Making and Accessing Soundings • SmartScript-6 : Creating Elements "On-the-Fly" • SmartScript-7 : Working with Weather • SmartScript-8 : Working with Weather Smart Tools and Procedures
Connexion au compte
Connectez-vous pour publier votre contenu sur SlideServe.