Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

HEC-HMS schematics in Versions 2.2.1 & 3.0.0 1

Status
Not open for further replies.

KatieTX

Civil/Environmental
Mar 14, 2006
34
Harris County, TX requires the use of HEC-HMS version 2.2.1. So most of my HEC-HMS files are in version 2.2.1.

I thought I'd try out 3.0.0 and see if I liked it. Once I worked with or saved files in 3.0.0, and opened them back up in 2.2.1, the basin schematics were destroyed.

Using Notepad (text editor), I opened a .basin file from version 2.2.1 and a .basin file from 3.0.0 and hand-edited the 3.0.0 one to match the format of the 2.2.1 one, but it was extremely tedious. I had to delete the "latitude" and "longitude" lines from every single hydrologic element, and then I had to change the Canvas Y values from scientific format (1.3900000E7) to regular decimal format (13900000.000). I had to do this for EVERY single hydrologic element (my model has about 70).

Has anyone else had this problem? Is there an easy fix? Is there a macro or batch file out there that will do this automatically? Is there a way I could automate it a little bit using Excel or something? I had many scenarios saved in this file, so they all have different .basin files, and I'll have to modify each one by hand.

Katie
 
Replies continue below

Recommended for you

Submit a bug report to the USACE and I'm sure they'll make a change to allow saving in v2.1.1 format in v3.0.1!

In the mean time, you could probably set up an Excel file to save your output into 2.1.1 format. You can save Excel files as formatted text files (.prn) where column width = number of characters (so a blank column of width 10 will transfer to ten spaces, or a text cell with 11 letters but width of 10 will only allow ten characters to transfer to the .prn file). You could format your number fields as Number with 3 decimal places (instead of scientific) and make sure the column is at least 12 points wide to ensure that you don't lose any digits.
 
Thanks Francesca. I've browsed this forum before, and I just *knew* you'd respond :)

I will try the Excel thing.

I am still curious if anyone else has run into this before. I haven't really checked to see if I could duplicate the problem intentionally, and I don't want to submit a bug report if it's just user error!
 
I played around with Excel, but I couldn't figure out a way to get it to work properly. Here's an example from the .basin file:

Subbasin: m112a
Description: da m112a hyd
Latitude Degrees: 0.0
Longitude Degrees: 0.0
Canvas X: 3049281.8
Canvas Y: 1.3970893E7

If you read it in as space delimited, you end up with two columns on the first row, 4 on the 2nd, 3 on the rest. Then if you save it as a .prn, there are tons of extra spaces, so the 2nd line would look something like:

Description: da m112a hyd

and it ends up messing everything up.
 
Open it in Excel as a text file. It'll either open it with all text in one column, or else as it opens it'll put you through the Import Text Wizard. If it opens in one column, highlight the column and select "Text to Columns" from the "Data" menu.

Going through the wizard, you want to select the following options:
Fixed Width (select next)
Now specify your columns in convenient locations:
5, 15 should do it.


After you hit "Finish," it'll look a little weird in Excel because you'll need to set your column widths.


Column A should be 5 points wide. Column B should be 10 points wide. Column C can be any width at this stage.


Next you want to format the number to be a number with three decimal places.


Once you've done that, you need to determine which is the longest string in the column (which has the most characters -- letters and spaces). In the example this is cell C2, which has 15 characters. We therefore need to set column C to a width of at least 15 - more won't hurt though.


The final step is to left-align your number fields (or all of column C). Now save your file as formatted text. (Answer yes to losing the formatting - that's the idea!) Close Excel (say no to saving your changes because you just saved the file exactly as you want it).


When you open it up in notepad or wordpad, it should look right.


You can probably record a macro to do this - the challenge might be formatting the number correctly, but if the Canvas X: number can have three decimal places, you could probably get away with formatting the whole C column to be a number with three decimal places. Excel should ignore that formatting for the text fields without any trouble.
 
I should point out that the image of the column widths have column B set to 11, not 10. It won't work if you set it to anything other than 10!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor