Pages

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.


33 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
    6. Hello All,

      Does anyone know of a resource that describes (in detail) the contents of the hdf files created by HEC-RAS? I'm interested in extracting the terrain maps. The HDF viewers show a number of related tables (Cells Center Coordinate, Cells Face and Orientation Info, Cells Face and Orientation values, etc...) but it is unclear what data to use to plot the terrain.

      Delete
  6. Hi Chris, I ran a 2D only model with a years worth of flow hydrograph data. I have been asked to get the inundation area numbers for every half hour for year. Any ideas?

    ReplyDelete
    Replies
    1. That's 17,520 inundation maps! Who asked you for that and do they realize what they're asking for? First, by "inundation area numbers" what do you mean? The area of inundation? If that is the case, you'll have to set the mapping interval to 30 minutes. Then your only hope is to write a script that can retrieve the data you need from the plan hdf file (which will be HUGE for a years worth of 1/2-hour mapping data). If you are to actually produce 17,000+ maps, you'll need at least 20 Tb of dedicated hard drive storage(probably more), a very fast and robust computer, a lot of patience, and a lot of luck. I think it might be a good time to sit down with whoever is directing you to do this and find out exactly what they really need. I bet they don't really need data every 1/2 hour. But if I'm wrong, you are in for a challenge. Good luck. This could quickly spiral out of control (budget wise), so if you aren't experienced with writing code, let me know-I and some of my staff have experience doing this kind of thing.

      Delete
  7. That's what I said. We are looking at wetted acre duration for wetland carbon sequestration so my colleague wants to know the area of inundation and how long the areas remain inundated. I will most likely try and scale back the time interval and how many days we are looking at. Luckily there is no need to produce the associated maps as they are only interested in the acreage of inundation. How much would generating a script cost? I have some experience but this seems above my capabilities.

    ReplyDelete
    Replies
    1. Lyle-

      It really depends on what ultimately you need, how accurate you need it, and if you want to be able to use the script for other models (or is it a one-off). Shoot me an email and we can discuss in more detail if you wish. cgoodell@westconsultants.com

      Delete
  8. Hello Chris,

    Thank you for a wonderful blog.
    I followed the same steps as you did, in order to export maps. But I still got the same error "Map not created" for 1d model. Because of that I could not map the velocity and depth profile in Ras Mapper.

    Also, in case of 2D model, I could create the .tif file for velocity and depth profile but as soon as I uploaded those .tif file in ArcGIS, ArcGIS got crashed. What do you think might be reason behind these issues?
    Thank you for your help.

    Sam

    ReplyDelete
  9. Hello Chris,

    Thank you for wonderful post. I am trying to export velocity and shear stress mapping from 2d modeling. I could make the .tif file. While loading them in ArcGIS, ArcGIS got crashed as soon as I uploaded them.I tried several times creating new .tif and uploaded them but still got the same problem. What might be the reason behind this?

    Thank you

    ReplyDelete
    Replies
    1. Not quite sure. I've never had that problem. You might try and see if you can load them up in another GIS application like QGIS (it's free).

      Delete
  10. Thank you Chris. One another question. Can we map the result of 1d in Ras Mapper? After running the model, I could see the result on RAS Mapper listed in layers but I could not see the mapping of result. How should I proceed to map that result?
    Thank you.

    ReplyDelete
    Replies
    1. Yes, if there is water in the 1D reach(es), and you have a terrain associated with your geometry, you should see water in the 1D reaches. If you are not seeing any mapping, first make sure you actually computed water in those areas. Second, did you try animating the layer? Are all the check boxes checked in the tree view? Third, if it's really a mystery, try removing the output layer from the tree view, close RAS Mapper, then reopen it. Fourth, try deleting your plan hdf file, rerunning RAS, then reopening RAS Mapper and see if that helps.

      Delete
  11. Hi Chris, is there a way to script Ras Mapper to run without using the GUI?

    ReplyDelete
    Replies
    1. Hi Edsel. I don’t think so that’s possible. At least I can’t think of a way to do it. Just curious, what are you trying to do?

      Delete
  12. I am doing an automation in generating depth map.

    ReplyDelete
  13. Is possible to get an animated view of inundation of the generated output after doing 2D Unsteady analysis?

    ReplyDelete
    Replies
    1. Yes. You can animate any output layer in RAS Mapper. If you want to create an animation file, you'll need to use a screen capture video recording application. I use SnagIt.

      Delete
  14. Why is it that when I export my "Depth Max", i get a different result from the original..? The depth is higher...

    ReplyDelete
  15. Hi Chris,

    I have a few of questions related to this topic:

    1) Is there a way to export all of your results to the same folder?
    2) Is there a way to change the file name of your results layers using the .rasmap file?
    For my purposes, it would be convenient to have all of my results maps in one folder and to have a consistent and descriptive naming structure like "Depth Results XXX cfs" for example. I've tried to do this by editing the path and filename in the "StoredFilename" Map Parameter, but when I recompute the stored map in RasMapper it saves over my edits, reverting to the default file naming convention and path. Would be great if I could just make RasMapper organize things for me.

    3) Have you ever automated the .rasmapper file setup with a script? Say you wanted depth results maps at the final timestep of a large quantity of runs. The method described in this blog post is certainly faster than using the RasMapper interface, but does still require some laborious repetition. I admittedly have done little research on this, but can you point me in the right direction of how I might automate this process to more efficiently produce large batches of results maps?

    Thank you for maintaining this blog, it is such a useful resource!

    Nic

    ReplyDelete
    Replies
    1. You might consider checking the box "Floodplain Modeling" in the unsteady flow analysis window. That should automatically create a static map for the MAX WS.

      Delete
  16. Hello,

    I'm using RASMapper profile lines, and I'm wondering what the difference is between the "Compute Engine" and the "Post Processed" hydrographs they produce. The two are usually very similar, but are sometimes drastically different.

    Thanks!

    ReplyDelete

Note: Only a member of this blog may post a comment.