Transforming Node Time Series Model Result to EE Field File
In many situations, a modeler may need to incorporate results from an external model into an EFDC+ model. Perhaps direct measurements of specific properties are lacking or more refined inputs are needed. A common example is the need to import weather data (e.g., wind speed, wind direction, pressure, precipitation, etc.) from another grid-based model.
EEMS 10’s newly added field file feature allows users to set up a unique time series for each cell within an EFDC+ model to serve as the model’s boundary conditions. This feature opens up the possibility of setting up a hurricane wind field, for example, and incorporating time-series data from external model results. We described the creation of field files in one our previous post.
Transforming Node Time Series Model Result to EE Field File – EFDC+ Explorer Modeling System
In this blog post, we demonstrate how to to transform node-like data into an EE- compatible field file to incorporate into your EFDC+ model. In this case, we used the field file feature to process the data from the unstructured grid model HydroGeoSphere (HGS).
This process requires some familiarity with basic GIS software and scripting capabilities. We use QGIS in this example and provide the python script for your reference.
Data Processing Steps for Generating EFDC+ Field File
- Pre-process Node Data
To prepare the node time series result, we combined the HGS model output into a single data frame. Depending on the original model result output, other steps may be required before combining all results into one file. In our example, the original data comes with multiple .csv files, each representing a snapshot for all nodes within the model domain. Figure 1 provides an example of our node data. Because these model results can contain large amounts of data, file size may be a problem, so it is advisable to keep these large files in the Hierarchical Data Format (HDF5), which allows us to pack down the file size significantly. In our example, the final table resulted in a combination of 11,421 time series (for each node) for 10 years (3,650 days of data); in other words, a matrix of 3,650 rows by 11,421 columns. This file size is about 3 to 4 times smaller than it would have been in separate .csv files.
- Map Node to EFDC+ cell
The next step was to map the node data to the EFDC+ model cells. We loaded the x and y coordinates of these nodes in QGIS and created a new Voronoi polygon layer, which transforms dots into a plane reflecting the node density distribution. This transformation allowed us to map the entire node dataset onto the EFDC+ cell-base grid. Figure 2 shows the Voronoi polygons (the hexagonal polygons) generated from each single node, overlaid on the EFDC+ grid of the model (the rectangular grids).
Figure 2. Intersection of the Voronoi polygon layer and the model grid cell layer
To map the nodes to the model grid, we calculated the polygon area ratio for each node in each cell. For this calculation, the Voronoi polygon (pre-processed HGS model output) and the EFDC+ model grid cells were intersected in QGIS. After intersection, we calculated each piece’s area (highlighted red polygon in Figure 2) and then divided each one by the cell area it accommodates. This process resulted in a table (Row: Nodes; Columns: Cells) of each node’s area ratio within each cell. A quick way to verify this calculation is to sum up the columns. With each cell sharing areas with multiple nodes, the area ratio of each node within each cell should add up to 1, meaning the entire cell.
- Matrix Multiplication
The previous steps resulted in two matrices, one showing the time series for each node and other showing the node area ratio for each cell. The matrix multiplication of these two results in the cell time series. In our example, the node data time series matrix had a size of 3,650 days by 11,421 nodes (Rows: Time; Columns: Nodes) and the node area ratio matrix had a size of 11,421 nodes by 29,632 cells (Rows: Nodes; Columns: Cells). After matrix multiplication, the resulting table presented an area-weighted time series for each EFDC+ model cell (3,650 Rows by 29,632 columns).
- Generating the EFDC+ Field File
The EFDC+ field file starts with a fixed format header. Users can find detailed information for the header and parameters in the EFDC+ Time-Varying Field File Format document. After writing all headers, the actual data block starts with a float number indicating the time stamp for this data block, then an integer showing the number of active cells, and then the corresponding value for every model grid cell at that time. The field file can be in either ASCII text or binary format; we recommend using the binary format for smaller file sizes.
With the above steps, users can benefit from this field file feature as an extension for EFDC+, further expanding its capabilities. As another example, here is a model incorporating both wind and pressure field files. If the field file feature sounds like it might be useful or you’re interested in getting familiar with this process, don’t hesitate to try it out!