Exploiting the Internet to Automate the Execution of Mesoscale Models

Total Page:16

File Type:pdf, Size:1020Kb

Exploiting the Internet to Automate the Execution of Mesoscale Models

10.16 EXPLOITING THE INTERNET TO AUTOMATE THE EXECUTION OF MESOSCALE MODELS

Stephen F. Kirby* Young Yee Patrick Haines Teizi Henmi US Army Research Lab, White Sands Missile Range, NM

B. A. Malloy Clemson University, Clemson, SC

1. INTRODUCTION 1. Edit the NOGAPS run time date and process id values found in a shell script, In an effort to minimize the manual effort which concatenates the untarred required to prepare meteorological data for input NOGAPS GRIB files by order of time to mesoscale models (such as the Battlescale and parameter. Run the shell script. Forecast Model (BFM)) (Henmi and Dumais, 2. Edit one of the C programs required for 1996), a web page based on Perl and Common the GRIB decoding by setting the user’s Gateway Interface (CGI) protocol has been desired path for decoded GRIB output. developed. Then, recompile the suite of GRIB C code. Using the output file described in 2. METHODOLOGY (1) above for input, run the newly compiled GRIB decoder. 2.1 Manually Intensive NOGAPS Processing 3. Edit FORTRAN code that reads the height, temperature, dew point In order to perform case studies or depression, and u- and v-components demonstrations involving the BFM at Army from the decoded GRIB data output in Research Lab (ARL), the appropriate (2) above. The user was required to meteorological (met) data has to be gathered and reset the central latitude and longitude, reformatted. The first step is to obtain the large- the grid spacing, as well as delineate scale initialization data, which is Navy three names for the output ASCII Operational Global Atmospheric Prediction NOGAPS files. Recompile and run. System (NOGAPS) data. To obtain NOGAPS data for BFM, one is required to know: (1) which Assuming the user had no omissions and Internet site to go to (the Master Environment gave acceptable values in all three steps Library site is used here) and (2) the correct above, the user would have NOGAPS files parameter and pressure levels. A highly ready for BFM input. However, user error convoluted procedure involving script and code invariably occurred, requiring re-edits, editing/recompilation would then yield the desired recompiling, re-executing and thus, lost time. BFM input NOGAPS files. Unfortunately, the One can easily see how time consuming the NOGAPS processing had become a puzzle entire process had become. As a first step solvable by only the select few who were aware toward lessening the burden on users of the of and able to correctly manipulate all the BFM, a shell script was written which components. This earlier, inefficient version of sequentially queried the user for all the NOGAPS processing involved these steps: requisite code/script inputs as described above. However, the automation was only partially realized as “vi” editor commands were used throughout requiring the user to make the necessary changes and then close the file before the script could proceed. This first attempt was quickly deemed unacceptable. Instead, a web page was designed which would circumvent the prerequisite of a detailed understanding of all of the code/script components.

* Corresponding author address: Stephen F. Kirby, US Army Research Laboratory, White Sands Missile Range, NM 88002-5501 e-mail: [email protected] dew point depression, and u- and v- 2.2 Perl/Common Gateway Interface (CGI) component information. Since the process id Web based solution for Met Data for this NOGAPS set has been saved from Preprocessing the form to a file, the GRIB decoder can simply open this file. This obviates the need In the first, primitive script for NOGAPS to edit and recompile the GRIB C code. processing, the user was required to provide Lastly, the ASCII NOGAPS files are inputs to delineate the grid domain and to created by FORTRAN code. Again, because identify which GRIB files were to be used. the HTML form user inputs have been saved This script was an improvement; however, to a file that the FORTRAN code can read, the user was still required to: (1) know which the requirement to edit and recompile lines in which files had to be changed (2) FORTRAN code has been eliminated. First know the proper order for file execution and the latitude and longitude points of the grid (3) close out files brought up in vi editor domain desired by the user are calculated. mode. A much simpler technique was Then, after reading in the NOGAPS data, needed. The natural solution was a Web two geopotential heights required by the based system created through a Perl script BFM but unavailable in the source data are using CGI. CGI is a protocol for interpolated using the hypsometric communicating between Web forms and the relationship. Finally, since the original processing program. The processing NOGAPS file contains data points spanning program chosen for our application was the the entire globe, only those within the user’s Perl script language because it is a high- desired domain are extricated based on the level language well suited for processing previously calculated latitude and longitude form data. What makes the Perl script a CGI grid points. program is the fact that a web page is If the user has filled in the HTML form generated, in this case, one indicating what completely, with valid entries, the CGI the NOGAPS user inputs were and the program will display a web page indicating: results of the NOGAPS processing run. (1) user inputs to the HTML form (2) total processing time, and (3) where to find the 2.2.1 The NOGAPS processing Perl script NOGAPS files ready for input to the BFM. If the user omits any HTML form entries, the From the HTML form, data is sent to the program will indicate to the user which CGI program (i.e. the Perl script) either entries were left out and then exit. through the “GET” or “POST” method. The “GET” method was chosen for this application because of its simplicity. Inputs from the HTML form are sent as part of the Universal Resource Locator (URL) and saved in one of the CGI environment variables, “QUERY_STRING”. Within the Perl script, the convenient “split” function (Wall et. al., 1996) is then used to separate out all the parameters for later use in other programs. This extraction of the HTML form inputs comprises the first main module in the Perl script. Next, an error-checking function call is made and currently consists of simply checking whether or not all of the HTML form entries have been filled in. This module will be expanded to include bounds checking for numerical inputs as well as doing string analysis on the non-numerical inputs to ensure BFM will accept the input string name. In the third function call the input file for the GRIB decoder is prepared. This is accomplished by concatenating all the GRIB files grouped by parameter name, pressure level, and time. The GRIB decoder then deciphers the binary file, producing an ASCII file containing pressure-level, temperature, 2.2.2 The Web pages and Form for Met Data Processing

Figure 1. Home Page for Met Data Processing for BFM.

Figure 2. The Form for User Inputs to Create BFM Format NOGAPS files. Figure 3. Web page displayed upon successful completion of NOGAPS processing. Figure 1 is the home page for met data processing. From here, the user can request 3. Conclusions NOGAPS data and radiosonde observation (raob) data. A capability to request surface This Web-based solution for processing met data will be added. Currently, processing NOGAPS data for BFM has proven to be a is available only to create BFM format dramatic timesaver. The old method of NOGAPS data. The option to reformat raob processing NOGAPS took 30 minutes or data for BFM input will not be difficult to more and could only be accomplished by a incorporate. The current raob reformatting select few with intimate knowledge of all the process consists of numerous file edits and requisite code and scripts. The new input file creation, similar to the original technique requires a processing time of only NOGAPS reformat process. Depending on a few minutes and involves only nine user the web site(s) used for obtaining surface inputs to a Web page. In addition to the met data, algorithms will need to be written timesaving aspect, all users of BFM will now to reformat surface met data for BFM. be able to prepare their own input datasets. Figure 2 displays the HTML form the user The addition of raob processing and will fill out detailing the desired geographical surface met data ordering/processing domain and the appropriate GRIB files to capabilities will greatly enhance the BFM use. Figure 3 is the web page displayed user’s ability to perform model runs. upon completion of an actual 1-degree Since MM5 has recently been chosen as resolution NOGAPS processing case. For the mesoscale model that will reside on the this case the FORTRAN code created Meteorological Measuring Set Profiler Proof- vertical profiles using NOGAPS data points of-Concept under development at the Army within an 81x81 grid at 10 km resolution Research Lab, Computational Sciences and centered at a latitude/longitude pair input by Information Directorate, Battlefield the user. The FORTRAN program extracted Environment Division, functionality will also 63 vertical profiles for each forecast hour. be added to the Web page enabling the user The parameters for each vertical profile are to obtain and process input data required by pressure, height, temperature, dew point MM5. depression, and the u- and v-components of the wind. Displayed are all the user inputs, job run time, and the location of the resultant ASCII NOGAPS files. 4. References

Henmi, T. and R. E. Dumais, “Description of the Battlescale Forecast Model,” US Army Research Laboratory, White Sands Missile Range, NM, ARL-TR-1032, 1996.

Wall, Larry, T. Christiansen, R.L. Schwartz, Programming Perl, O’Reilly & Associates, Inc. 1996.

Recommended publications