Eric Jones and Dr. Jim Nelson, Civil and Environmental Engineering
My project is to convert the file system of the program WMS (Watershed Modeling System) from an ASCII text file format to an updated HDF5, or XMDF file format.
WMS was created and is maintained by BYU’s EMRL or Environmental Modeling Research Laboratories. The program is used to model, simulate, and predict results from hydrologic events. It predicts where and how much water would flow during a storm within a canyon, city, or water basin.
An ASCII text file is an ordinary text file which contains characters like our alphabet, except it has many more characters. An example of an ASCII file is shown in figure 1. These are files that can be read or created with Windows Notepad. XMDF is an HDF5 file format which is written in binary, and can only be viewed with an HDF5 file viewer; however it has many advantages. It can write to one file and organize it with folders. It is also much quicker than conventional ASCII files and may be compressed for smaller files.
The major thrust of this project was to build an API for the cross-sections of WMS. In other words, we wanted to develop basic functions that we could pack inside a ‘dll’ file, which we could distribute to other companies. They could then use these function to write and read their own cross-sections, but more importantly, read WMS saved cross-sections, and use them in their models. The most common cross-section used in WMS is the profile section of a river.
The most difficult problem involved with developing an API was saving out the information, before some basic data types are defined. Basically, the computer ‘didn’t know yet’ what text was, and I had to use the only data type that the computer knew. This data type was primitive and previous to this project, knew very little about how it functions. Other problems that came to our attention are assorted little quirks about dlls and exporting functions. For example, you can allocate a portion of your memory inside your dll, and then in your code outside your dll free the memory (or let the computer know you no longer need it).
There were parts that just fell seamlessly together, however. XMDF uses objects called the standard template library. Specifically, it uses collections called vectors. Vectors hold whatever type of information needed, and are packaged in a way that they hold as many items as wanted, and can conveniently access it. It is a more advanced data type that is very convenient for the user. Outside of the cross-sections, I was able to utilize vectors of my data. The easiest part of the project was implementing DEM, which are Digital Elevation Maps. DEM’s have about 5 numbers, and then one long stream of numbers, which coincidently all fit into one vector.
The project itself is very large. To enable WMS to model watersheds, or predict the flow accumulations in a valley, WMS uses an enormous amount of data. This project has helped me understand how much data is needed to make a more accurate prediction. The project is still continuing as I find more and more data to save out and read in. As I search through the program, data which in the past has not been saved out, but would be convenient to keep, I’ve added to XMDF, making it more versatile and convenient file system than our former ASCII text files.
XMDF will completely change the way that WMS writes and reads information. It will have a more advanced system which is quicker, smaller, more organized, and will be reduced to one single file. I am grateful that I had the opportunity to research it and implement it.