Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting results from HEC-HMS #67

Open
devacharan opened this issue Jan 23, 2025 · 7 comments
Open

Extracting results from HEC-HMS #67

devacharan opened this issue Jan 23, 2025 · 7 comments

Comments

@devacharan
Copy link

I successfully ran my model in HEC-HMS software, but I want to extract the hydrographs from each basin into TXT or CSV files so that I can use that data further.
However, I am unable to do that with the options provided in this package. can someone guide me through it or suggest any other ways to extract the data?

@oskarhurst
Copy link
Contributor

oskarhurst commented Feb 18, 2025

Hello @devacharan, were you able to successfully read the data from the DSS file into a TimeSeries python object. If this was successful we then recommend you use existing python tools to write your data to the file of your choice.
Basic example

dss_file_path = "example.dss"

# Define the path for the time series data in the DSS file
path = "/path/to/data//1Hour/Time Series/"

# Open the DSS file for reading
with HecDss(dss_file_path) as dss:
    # Read the time series data from the DSS file
    ts = dss.get(path)

    # Convert the time series data to a pandas DataFrame
    df = pd.DataFrame({
        'Time': ts.times,
        'Value': ts.values,
        'Path': [path for _ in range(len(ts.times))]
    })

    # Save the DataFrame to a CSV file
    df.to_csv('output.csv', index=False)

    # Print the first few rows of the DataFrame
    print(df.head())

@ktarbet
Copy link
Contributor

ktarbet commented Mar 10, 2025

closing issue, no activity in 3-weeks.

@ktarbet ktarbet closed this as completed Mar 10, 2025
@devacharan
Copy link
Author

devacharan commented Mar 11, 2025

@ktarbet , sorry for not being active I am on vacation

@oskarhurst Thanks a lot for the reply, but I am a little confused,
no, I wasn't able to successfully read the data from the DSS file into a TimeSeries Python object

Can you please suggest where I can get that path for the time series data in the DSS file?
In HEC-HMS software, in time-series gage, mine is a manual entry, so, I couldn't see a DSS Pathname. currently, I am using '//gage/precip-inc//5min/gage/' but it's giving KeyError: '//gage/precip-inc//5min/gage/'

Best wishes,
Charan

@oskarhurst
Copy link
Contributor

@devacharan could you please send me an attach copy of the dss file that you are trying to read from so I can see that data within it.

@oskarhurst oskarhurst reopened this Mar 11, 2025
@devacharan
Copy link
Author

Hallo @oskarhurst,

I cannot attach the DSS file here (not supported), could you provide your email or something? so that I can transfer

Best,
Charan

@oskarhurst
Copy link
Contributor

Hallo @oskarhurst,

I cannot attach the DSS file here (not supported), could you provide your email or something? so that I can transfer

Best, Charan

Questions on DSS, bugs and resources to replicate them can be submitted to [email protected]

@ktarbet
Copy link
Contributor

ktarbet commented Apr 14, 2025

Hi @devacharan ,

Your file is formatted as DSS Version 6. The DSS python library only supports DSS version 7 files.
Please first convert to DSS 7. That can be done with the HEC-DSSVue - Tools menu.

You can attach a DSS file (in github) by first zipping to a zip file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants