Need help on writing script

This is the place to get help with Digital Atmosphere, suggest improvements, and get tips.
Klaus Breddemann
Junior Member
Posts: 9
Joined: Sat Aug 28, 2004 1:49 pm
Location: Singapore

Need help on writing script

Post by Klaus Breddemann »

I am using DAWS 1.1 with patch 1.1c. Although quite computer savvy, I am having trouble with writing a script to automize retrieving data from the internet and then to run an analyses/data.

I am trying to achieve the following:

1. Download data from one of the ready available sites in the program menu/Internet/retrieve data. BTW I have edited my favorite sites and copied the http address already.

2. After downloading data from the sites I want to run analyses such as slp, wind speed, etc. to be displayed on my map.

3. Then I want to display hurricane tracking on my map

4. Copy the new created maps on my desktop with different filenames, such as map1, map2, etc.

4. Finally schedule at regular intervals, say every 2 hrs to perform an update with the script

That's about it. Can anybody help me with a sample script? I have tried the sample in the .pdf manual/appendix and I am getting nowhere.

I also suggest, that forum members may post their favorite (working) scripts in order that more people can benefit from their experience.
Weasel

Post by Weasel »

Klaus,

This script will do two of the things you talked about, slp and wind speed, and then export it to a jpg file. I'm not sure how to plot hurricane tracks, or how to get them to display on the desktop. DAWS would also have to generate a map for the location of the hurricane. Anyway this may help you some, just remember to create a folder named C:\TEST and analyses will run and the map saved to that same directory.
Here is the simple script:

download,http://www.atmos.albany.edu/weather/dat ... T\test.dat
import,c:\TEST\test.dat
ANALYZE,CONT COLOR=0:200:0 VKNT WSPD
ANALYZE,HILO CONT CINT=4 LINE=2 SLPR
export,c:\TEST\out.jpg

Copy this script, go to the scripting tab in DAWS, click the create button, paste the script, then save the file. For example, name it downloader.dsf

Now to create two hour time intervals, again click the scripting tab, click the schedular button, then enter times like this:
0000 downloader.dsf
0200 downloader.dsf
0400 downloader.dsf

Time stamps and the like can also be added in order not to delete your map each two hours, but this should get you started a little.

Pat
Weasel

Post by Weasel »

Make certain the enable scheduler check box is checked while under the scheduler button
texsky
Senior Member
Posts: 172
Joined: Fri Dec 12, 2003 9:42 pm

Post by texsky »

Just a minor correction to the above..."import" should be changed to "ingest" for V1.1c.

Also, I don't think hurricane tracking is currently available via scripting, but I could be mistaken.

A few of my favorite scripts.
1. for Colored Isobars try...
ANALYZE,HILO CONT LSTN=1000 COLOR=247:30:35 CONT GRTN=1024 COLOR=55:90:250 CONT EQUA=1004 COLOR=235:110:45 CONT EQUA=1008 COLOR=230:160:55 CONT EQUA=1012 COLOR=185:180:100 CONT EQUA=1016 COLOR=40:165:165 CONT EQUA=1020 COLOR=45:145:250 CINT=4 LINE=2 SLPR
2. for Vorticity Advection try...
ANALYZE,MXMN CONT DADD EQUA=0 COLOR=160:0:128 CONT CINT=50 DOTS LSTN=0 COLOR=255:0:0 CONT CINT=50 DOTS GRTN=0 COLOR=0:0:255 ADVT SMLC=1:10000 STOR=1 AVRT WIND
3. for Isallobars try...
ANALYZE,MXMN CONT DADD EQUA=0 COLOR=160:0:128 CONT CINT=2 LSTN=0 COLOR=255:0:0 CONT DOTS CINT=2 GRTN=0 COLOR=0:0:255 PTEN

Note...Running the Isallobars script frequently requires corrections to stations that report spurious data. Also, the exact units of these results are unknown at this time.

hth,
Bob
Weasel

Post by Weasel »

Thanks for clearing it up a bit, Bob!!

Pat
Klaus Breddemann
Junior Member
Posts: 9
Joined: Sat Aug 28, 2004 1:49 pm
Location: Singapore

Problem partly solved

Post by Klaus Breddemann »

My very thanks to Weasel and Texsky for their invaluable help and suggestion. I got my script running perfectly with all the xtras included by myself. However, whenever running my script (and even the sample script from Weasel) the script halts during execution and the following information message is displayed:
"No warning tables found. Please choose File>Recompile Tables"

When I click the OK-button or simply press <Enter>, the script continues to execute and I get the required results. I also noted from the status window that the interruption occurs at the line: Processing Warnings.

I tried various HTTp sites but no resolve.

How do I get rid of the Information Message? It beats completely the automation process of the script, since a manual user input <Enter> is required.

Thanks in advance for further suggestions.
texsky
Senior Member
Posts: 172
Joined: Fri Dec 12, 2003 9:42 pm

Post by texsky »

Klaus,

The "no warning table" message probably has something to do with the fact that the warning module hasn't been written into DAWS yet. It was supposed to have been carried over from DA2000 but apparently requires an extensive rewriting of the code, so it's been left out for the time being.

If DAWS keeps asking you to "recompile tables", I would go ahead and do it. Hopefully, this will clear up the error message you're getting. Most scripts, when properly written, should pretty much run error-free.

hth,
Bob
Klaus Breddemann
Junior Member
Posts: 9
Joined: Sat Aug 28, 2004 1:49 pm
Location: Singapore

Post by Klaus Breddemann »

Thanks, Bob, it worked. Can't tell you how much I appreciate your help. Was sitting here for 8 hours straight to solve the mystery. Thanks heaven for forums.

Now to a more general note:

By browsing through various forum topics I found out that
1. my appetite for exploiting the full potential of scripts has been raised and
2. my frustration has been also increased wrt of not knowing how to do it correctly, other than trial and error (see above).

Is there any tutorial available, which gives an indepth introduction for writing scripts in DAWS?

Here's something else I am curious about:

a) Is it possible to plot fronts on the map in DAWS 1.1 ?

b) I noticed from earlier version 1.0, that waves/swell data could be displayed on the map but apparently not in the new version. Writing script by using "analyzing waves" rendered no results

c) Hurricane tracks can be imported from the site JTWC as txt.files. Is there a way to utilize the data to plot the tracks on the map? Since DAWS 1.1 allows now to plot tracks from the file menu then why is it not possible to plot with a script?

Thanks and rgds
Klaus
texsky
Senior Member
Posts: 172
Joined: Fri Dec 12, 2003 9:42 pm

Post by texsky »

Klaus,

There's no tutorial that I'm aware of. You just have to play around with it to become acquainted with its capabilities. If you have specific requests that you're having trouble with, you can post them here and someone will likely be able to help.

a.) Fronts can be plotted with a script like the one given below, but be aware that there is a bug of some kind that you may experience where "random" lines and fronts get drawn as well. I've discovered a workaround is to make sure that the "fronts" bulletin gets downloaded last. There's a fairly recent thread that goes into this in some detail--you may want to read it.

Here's the script...
PRODUCT,WXP,0,FRONTS

Of course, you'll want to download and ingest the frontal bulletin first, then run the script.

b) I don't think sea swells and whatnot are fully implemented as of now. Maybe Tim will work on this when he starts on the next patch.

c.) The reason you can't plot hurricane tracks is because "Analysis" scripting is a little bit different than "Scheduler" scripting. They use a slightly different syntax and not every analysis function can be used with the scheduler simply because Tim has it programmed that way. There's a sticky thread here in the forum that you can use to post bug-fixes or "wish-list" type items. I would suggest you add hurricane tracking via the script scheduler to the list.

hth,
Bob
Weasel

Post by Weasel »

Bob,

Just out of curiosity, why do import and ingest seem to work in the same manner?

Pat
Post Reply