Tuesday, March 8, 2016

Post-Processing with RAS Mapper: Exporting a Large Number of Results Maps

Written by Shaina Sabatine  |  Watershed Science & Engineering, Seattle, WA
Copyright © The RAS Solution 2016.  All rights reserved.

The new and improved RAS Mapper interface in HEC-RAS 5.0 makes managing and exporting model results like an inundation extents shapefile or a depth grid for use outside of HEC-RAS/RAS Mapper easy.  The process (which is described in detail in Chapter 5 of the HEC-RAS 5.0 2D Modeling User’s Manual) requires the user to add desired results maps one by one using the ‘Add New Map’ button in the ‘Manage Results Maps’ window shown in Figure 1 below.

Figure 1: Manage Results Maps window for the results of a completed simulation.  Two results layers have been exported: an inundation boundary shapefile and a depth grid.

Imagine you have a large number of outputs from a simulation that need to be exported.  Because only one new results map can be added to the list in the ‘Manage Results Maps’ window at a time using the ‘Add New Map’ button, the process can become tedious.  One way to make the process
faster is to directly edit the file that is created in your project directory with the extension “.rasmap”.  This is a text file in XML format that RAS Mapper uses to identify the Geometries, Results, Map Layers, and Terrains that it will load into the interface along with some other settings (see Figure 2).

Figure 2: XML document tree showing the elements in a “.rasmap” file.

Each executed plan in a RAS project is listed as a <Layer> sub-element under the <Results> element, and each results layer that RAS Mapper will display is described in another <Layer> sub-element underneath that (see Figure 3).  Note: the saved results of a HEC-RAS 5.0 simulation are stored in the file with the extension “.p##.hdf” where ## denotes the plan number. The “.rasmap” file stores information about outputs from the “.p##.hdf” file that will be displayed in the RAS Mapper interface.


Figure 3: XML document tree for the “.rasmap” file associated with the results in the window shown in Figure 1.  The tree has been expanded to show plan <Layer> sub-elements and result <Layer> sub-elements which are under the <Results> element.

Figure 3 shows that 6 results layers will be loaded into RAS Mapper for the plan named “RampFlows2DArea” including an inundation polygon for January 02 at 00:00:00 and a depth grid for January 02 at 00:00:00.  Say you would like to export inundation polygons and depth grids for multiple more profiles in this plan.  Because the “.rasmap” file is simply a text file, it can be opened in a text editor and manipulated.  In this example, one inundation polygon and one depth grid have already been created for the “RampFlows2DArea” plan.  Rather than adding each additional desired results map layer using the ‘Add New Map’ button in the RAS Mapper interface (Figure 1), the “.rasmap” file can be directly edited.  Additional desired results maps can be added by copying the associated block(s) of text, pasting a block in the correct location for each desired results map, and editing as needed.  At a minimum, both the name of the layer and the date/time of the profile being exported will need to be edited (see Figures 3 and 4).  **IMPORTANT- do not have HEC-RAS open while editing the “.rasmap” file.** 

Figure 4: Example of the edited “.rasmap” file.  Blocks of text were inserted for profiles for January 03 through January 07 at time 00:00:00.  The red boxes highlight where edits were made.

Figure 4 shows a portion of what was edited in the “.rasmap” file.  The red boxes in Figure 4 highlight where edits were made.  In this example, it was desired to have an inundation boundary and a depth grid exported for every simulated day at time 00:00:00.    After editing the “.rasmap” file, save it and open your HEC-RAS project and then RAS Mapper.  The results maps will be listed under their plan name under Results in RAS Mapper as shown in Figure 5.

Figure 5: Inundation boundary and depth grid results maps loaded into RAS Mapper after editing the “.rasmap” file.

Inundation boundaries and depth grid results maps have been loaded into RAS Mapper for every day from January 02 through January 20 at time 00:00:00.  Note that a red asterisk means a map has not been created or exported yet.  To create/export maps, select all of the maps and click ‘Compute/Update Stored Maps’ in the ‘Manage Results Maps’ window as shown in Figure 6.

Figure 6: Selecting and creating/exporting the results maps.

Now, all you have to do is wait.  Exporting this many layers could take a while.  Note: This model run was set up so that all the profiles that needed to be exported were at time 00:00:00.  This is why the time stamp was not edited in the “.rasmap” file.


13 comments:

  1. You can also do the same for Profile Lines as there is not a way to import in a shapefile for them.

    ReplyDelete
  2. Thanks, Chris. The issue I'm having is the Shapefile for the maximum water surface elevation for a dam break looks like a series of disconnected sausage links. We've tried interpolating cross-sections down to 100' spacings, decreasing the time step from 10 seconds to 5 seconds, even adding a deeper secondary pilot channel, and still no success. In cross-section view, it shows the high water line. The only thing I haven't tried is re-importing the GRID file on a much tighter grid spacing.

    Any thoughts on how to cure this scenario?

    Many thanks in advance.

    Paul Currier, P.E.
    Water Resource Consultants, LLC

    ReplyDelete
  3. please family can i help me to build a lateral structure in hec-ras

    ReplyDelete
    Replies
    1. Best thing to do to get started is to open up one of the lateral structure example data sets that comes with HEC-RAS. If you don't have the example data sets, go to the Help menu item in RAS and select "Install Example Projects..." There are a lot of data sets that have lateral structures that you can use as guides for building your own. "Beaver Cr. -Lateral Structure" located in the Unsteady Examples folder would be a good start. You can also work through the example in the Applications Guide in Chapter 15. Good luck.

      Delete
  4. Hello I realize a 1D / 2D model and I notice problems of instability during the simulations. Can you help me solve this model instability problem? thank you to help me.

    Finished Processing Geometry

    Writing Event Conditions
    Event Conditions Complete

    Performing Unsteady Flow Simulation HEC-RAS 5.0.3 September 2016

    **** ERROR: Solution Solver Failed ****

    Unstable for Initial Iteration at 31DEC1987 2400



    **** The Model Has One Or More Error(s) ****

    Unsteady Flow Simulation Terminated

    Writing Results to DSS

    No output to write to DSS

    ReplyDelete
  5. Hello,

    I'm wrapping an optimization algorithm around a HEC-RAS model and need to extract the pixel values from the depth map and read them into python several thousand times. Using the "Compute/Update Stored Maps" feature to export the Depth map as a static map, then opening the raster in python using GDAL, is simply too slow. I'm curious to know whether there is a way to access these values in the dynamic map without exporting them to the disk as a GeoTIFF. Is it possible to do this via the *.p*.hdf file or through the HEC-RAS API?

    Thanks for your help,
    Jesse

    ReplyDelete
    Replies
    1. Jesse- You should be able to get what you need from the p.hdf file using the HDFViewer. HDF has some libraries you can install that allows you to programatically read and extract data from hdf files.

      Delete
    2. Hi Chris, thanks for your response. I've been looking at the p.hdf file in the HDFViewer, but I can't seem to find the 2D array of depth values. Do you have any suggestions for where I should look?

      Delete
    3. Try drilling down through this path in the HDF file:

      Results/Unsteady/Output/Output Blocks/Unsteady Time Series/2D Flow Areas/[your 2D area]/Depth

      Delete
    4. Is it possible to do this with a steady flow analysis, or just unsteady flow?

      Delete
    5. 2D can only be done in unsteady.

      Delete