In this section, we will continue testing the HYSPLIT installation. We will start by looking at batch file scripting. However, before opening this, go back to testing the air concentration calculation. You can see here on the top, there are two icons, one for batch files, and one for Linux shell scripts. When these icons are found on a page, that means there is a script that you have available to you that can reproduce the calculations that are shown on this page. So for instance, if we look at this batch file, this is called test_conc.bat. This is the same name as the window that we are opening for this example. This shows the batch file that can be run to do the test concentration calculation.  In the same way as the Linux side of this, open that, and you can see almost identical commands, but in a slightly different syntax, so that it can run as a bash file shell script.

So now if we go on to look at the batch file scripting, normally we can find all these batch files in the …, I'm going to move this aside for a moment, in the tutorial directory.  Open Windows Explorer and look under the tutorial directory, under batch. This is where these files can be found.  So the one we were just looking at was test_conc.bat. 

So normally what you can do, if you want to run the example for that particular case that were looking at, for this situation, the previous calculation, you could just double-click on this batch file.  And the calculation runs and you get your answer.  However, if there are some technical issues, perhaps error messages that occur, or something in your computer is not correct, you would not necessarily see those error messages doing it this way.

So the other approach is to just to open up a DOS command line window. So if you do not have the command prompt on your desktop, you can find it under the windows section, Windows System here, command prompt, and you can open it up that way. So if we change directory to tutorial and change directory to batch, you could simply just run that batch file by just typing the command test_conc. The .bat is implicit here. Just hit enter and it runs, and we get our answer.

Now, let’s look at actually what happens in this calculation. So I'm going to open this up in Notepad showing the different sections of the batch file.  It starts off with turning off echoes, telling the system that variables within the batch file will not be expanded until the file is run.  We're setting some variables. An important one here is where the script can find the HYSPLIT4 code, so it looks for it under C:\hysplit4, that's the directory for hysplit4, and we change directory here to working, under \hysplit4\working, because that's where all the calculations are done. It then checks for the existence of an ASCDATA.CFG file.  This file tells HYSPLIT were to find the boundary files directory, the land-use, terrain, and roughness length files.  So if it's not there, it creates that file.  Then it creates the CONTROL file by just echoing the various lines into this CONTROL file.  We'll discuss the…, we mentioned briefly previously, what these different lines represent. But that's the CONTROL file that's read by the model.  And we clean up if there's any output files available here, we remove them, and then we go just go ahead and run the model.  When the calculation’s completed, we execute the, we generate a file for the labels, that's read by concplot, we haven't talked about the details of concplot yet, and then we just execute the concentration plotting program, providing some command line options, the input file, the zoom factor, and where it can find the graphics map background file. And the last command just opens up the plot. 

If I change directory to the working directory, change directory to \hysplit4\working, that is where the results are located.  You could just type …, this is just like a batch file, you can type things on the command line, concplot.ps, and it will open up the graphic.

If I were to type simply the name of the concentration plotting program, which happens to reside in the exec directory, without any command line arguments, it lists all the different options that are available for concplot.  These are all the command line options. So there are many more command line options available than, for most of the programs, that are possible to set in the GUI.  The GUI only provides options to change some of these, some of the most important ones, but not all of them. 

The last point I want to make about batch files is that the kind of commands that are available to you are relatively limited.  There're only a few.  If you type help, for instance, on the command prompt, these are all the commands that you can use from the command line on a windows system.  There aren't that many. In fact, if you look at many of the batch files here, you'll see that maybe only half a dozen or so commands are ever used. If you need more information about a command, you can just type help and the name of the command. For example, help DIR, gives you all the possible options within the directory command.

So this summarizes scripting.  We will be using the scripts in some of the other sections, mainly to do variations of the original calculation. The first calculation will be done through the GUI, but subsequent might be done using a script because it is much easier to make a small modification to rerun the example.

So this concludes the discussion about batch files.