APPENDIXScheduler scripting

Scripting is a powerful function that allows Digital Atmosphere to do various tasks while unattended. You can have it download data every half hour and always have the latest map displayed, or send charts to the printer automatically. The possibilities are up to you.

 Scripting basics

To run a single script command
Simply type in the script command in the "command" line on the scripts toolbar. Hit return or click "Enter" and it will be processed. Note that this does not run a script; it just runs a script command. A list of commands is below.

To write a script
Use any text editor or click on Create Script on the scripts toolbar and you can begin typing your script. Note that scripts should use the file extension .dsf in order to be properly recognized in Digital Atmosphere. To "comment out" a line of code simply place a # (octothorpe), : (colon), or ; (semicolon) at the beginning of the line. Commands are generally not case-sensitive.

To run a script in run-time
Go to the scripts toolbar and select the Run Script button.

To run a script at startup
Advanced users can run scripts on Digital Atmosphere startup by using standard command-line parameters. A space and the full name of the script file is simply appended after the filename at the command prompt or in the shortcut property for Digital Atmosphere.

To use the scheduler
Go to the scripts toolbar and select the Scheduler button (it will say "Scheduler on..." or "Scheduler off..."). This will bring up a configuration window (see below) where the scheduler will coordinate which script files run at which time.

• You must set "Enable scheduler" for the scheduler to take effect.
• When the scheduler is no longer wanted, bring up this window again and unset "Enable scheduler".
• To specify the execution time for each script, write the execution time in 4-digit UTC time in hhmm format (i.e. 7:45 am is 0745 and 2:15 pm is 1415), followed by a space, and the name of the file (including its .dsf extension).
• Be sure to specify the full pathname of the file, otherwise Digital Atmosphere will assume it is located in your Digital Atmosphere directory.
• There can be an unlimited number of scripts and execution times in this list.
• Advanced users: You can edit or swap out this schedule list if you wish; it's located in the Digital Atmosphere directory under digatmos.sft .

 Valid script commands

 DATA DISPLAY COMMANDS

PRODUCT,type,level,title
Overlays a meteorological product on the map. The appropriate data must have already been imported. Valid type parameters are documented at the end of this section. Levels are specified as follows: for surface data, the level is 0 (zero); for millibar levels the level equals the millibar level (500, etc); and for FT height levels the level equals the ten-thousands and thousands digits multiplied by -1 (so 34,000 ft equals -34). The title parameter is optional and contains a text title that will be placed in the legend. Derived fields are not supported at this time.

ANALYZE,scriptstring
Performs an analysis using an analysis script command. For information on building an analysis script command please see the Analysis section.

FONTTRUETYPE
Forces workchart fonts to TrueType mode.  Takes effect when new products or contours are displayed.

FONTNCEP
Forces workchart fonts to NCEP raster font mode.  Takes effect when new products or contours are displayed.

SFCPLOTMODEL,filename
Loads a particular surface plot model. Filename must be the fully qualified filename with path and extension (*.sps).

 DATA MANAGEMENT COMMANDS

Downloads a product from an Internet source. The url is the fully qualified, RFC 1738 standard URL (including filename), and filename is the full local name where the file will be stored.

Uploads a product to an Internet source. The url is the fully qualified, RFC 1738 standard URL (including filename), and filename is the full local name of the file to be uploaded.

Note that you can set a password privately by using the DIGATMOS.PWD file (if there isn't one, you may create it).  This will make your scripts secure and prevent passwords from showing up in the status windows. This file must be located in the Digital Atmosphere directory.  Make entries as follows:
token=value
So if you have a login for your blog site, you might have something like this in your DIGATMOS.PWD file:
When Digital Atmosphere encounters %%something%% in your URL, it will replace it with the values you defined in DIGATMOS.PWD.  Thus, in the example above %%myusername%% would get replaced with joeblow, and %%mypassword%% would get replaced with 12341234.

INGEST,filename
Imports the specified data file (filename is a fully qualified file name).

Retrieves the desired radar product from the given station.  Station is a 3-letter station identifier (e.g. FWS, EWX, etc).  Multiple stations are separated by one space character.  Product is the Radar Product Code from the table below.

Plots the latest retrieved radar data.

Saves the latest retrieved radar data to a given filename.

 DERIVED PRODUCT COMMANDS

HURRICANE
Imports hurricane bulletins.

HURRMODEL,type
Plots hurricane models.  The type is as follows: 0, splines only; 1, splines and datapoints; 2, splines, datapoints, and labels.

FLEET
Plots all fleetcode information.

FLEETHL
Plots fleetcode bulletins with only highs and lows.

FLEETF
Plots fleetcode bulletins with only fronts.

FLEETI
Plots fleetcode bulletins with only isobars.

 GRAPHICS COMMANDS

Loads a map. IMPORTANT: You must specify the .dmf file in your filename, e.g. c:\da20\bin\mymap.dmf . The associated map will also be loaded.

SAVE,filename
Saves a map. The filename parameter is the fully qualified filename without the extension (i.e. without .bmp).

EXPORT,filename
Exports a map (i.e. saves it to a variety of formats and without the accompanying .atr file). The filename parameter is the fully qualified filename with a valid extension (may be bmp, gif, jpg, png, pcx, or tif). Compressed TIFF saving is not available.

IMPORT,filename
Imports a map.

SOUNDING,station
Plots a sounding for the given station.

ERASE
Erases all of the overlays on the map.

BLANK
Erases the overlays as well as the basemap.

STAMP
Imprints a timestamp at the top of the map that says "GENERATED (date) (time)".

CLIP
Copies the map to the clipboard.

Sets one of the File > Preferences > Misc > settings to a particular value. This allows the script to change a contour gradient scheme on the fly.

 PROGRAMMING COMMANDS

SET,keywordnumber,keyword
Sets a specified keyword (1 through 9) to a certain value. You can then use this keyword later on in the same script simply by placing the token $$x anywhere in the code, where x is the keywordnumber. This is useful for managing large scripts. Example: SET 1 500 Sets keyword 1 to "500" PRODUCT$$1 HGT $$1 indicates "500", so here 500 mb heights are plotted PRODUCT$$1 TMP $$1 indicates "500", so here 500 mb temperatures are plotted TIMERON Enables the script timer. It will adhere to the current timer script schedule. TIMEROFF Turns off the script timer. PRINT Prints the map to the default printer using default settings. SLEEP,seconds Causes Digital Atmosphere to pause for the specified number of seconds. An hourglass cursor will be displayed during this time. SPAWN,filename Executes an executable file or MS-DOS batch file specified by filename (must be a fully qualified filename with correct path; e.g. "c:\utilities\myprogram.exe"). MINIMIZE The Digital Atmosphere application window is minimized. MAXIMIZE The Digital Atmosphere application window is maximized. NORMAL The Digital Atmosphere application window is neither minimized nor maximized. QUIT Quits the program  MAPMAKING COMMANDS MAKE,lat,long,zoom,width,height Makes a map using the given coordinates. Lat is negative in the southern hemisphere. Long is negative in the western hemisphere. Zoom is a value equal to 3964/x, where x is the width of the map in statute miles. Width and height are the map sizes in pixels. TOPO Makes a topographic underlay on the map (takes some time). POINT Plots points. BASEMAP Plots the basemap. CITY Plots cities. COOUT Plots county outlines. CONAME Plots county names HIGHWAY Plots Interstate highways (U.S. only). ROAD Plots major roads (U.S. only). CUSTOM Plots custom overlays. REMOVE Removes the last product from the display.  DEPRECATED COMMANDS THESE COMMANDS ARE NOT SUPPORTED AS OF THIS BUILD CENTER,station,zoom,width,height Makes a map with the chosen station in the center of the screen. Zoom is a value equal to 3964/x, where x is the width of the map in statute miles. Width and height are the map sizes in pixels. ARCHIVE,cddriveletter,yymm,yymmddhh Accesses data from the Weather Graphics Technologies Surface Archives or Upper Archives CD-ROM. The cddriveletter parameter is the drive letter, while yymm is the year and month (full four digits) and yymmddhh is the year, month, date, and hour (full eight digits). Caution: This command has not been fully tested and may not work. GRADIENT,on|off Turns on or turns off the File > Preferences > Contours > option. ISOPLETH,on|off Turns on or turns off the File > Preferences > Contours > option.  LIST OF VALID PRODUCT TYPES For a list of valid codes, see the appendix showing Valid Product Types.  Sample scripts This script downloads synoptic data from Albany, imports it, displays plots and sea level pressure, and outputs it to a file. Note that this will probably not work on your computer without changes, and is only intended to demonstrate the appearance of script commands. download,http://www.atmos.albany.edu/weather/data1/surface/syn/@Y@M@D@S_syn.wmo,c:\digatm\data\test.dat import,c:\digatm\data\*.* product,plf,0,Test plot product,slp,0,Test plot export,d:\da20\bin\map\out.jpg This script plots a series of upper air charts for 1200 UTC August 27, 1990 from our Upper Archives CD-ROM and saves the completed charts for 250 mb, 500 mb, 700 mb, and 850 mb to individual files (1990082712250.gif, etc). Again this may not work on your computer without some changes. set,1,9008 set,2,90082712 archive,f,$$1,$$2 product,plf,250,PLOT export,d:\da20\bin\shannon\19$$2250.gif

erase

product,plf,500,PLOT

export,d:\da20\bin\shannon\19$$2500.gif erase product,plf,700,PLOT export,d:\da20\bin\shannon\19$$2700.gif

erase

product,plf,850,PLOT

export,d:\da20\bin\shannon\192850.gif