Skip to content

Suggestion on exporting dfs2 to csv #356

Answered by ecomodeller
bakjee asked this question in Q&A
Discussion options

You must be logged in to vote

It can certainly be done, but .txt is not a well defined format.

If you only need the values from a single item, and a single timestep and no info about time, geography, just the actual values you can use NumPy.savetxt.

import numpy as np
import mikeio

ds = mikeio.read("../tests/testdata/gebco_sound.dfs2", time=0)
X = ds.Elevation.to_numpy()
Xud = np.flipud(X)
np.savetxt("elevation.csv",Xud, fmt="%5.2f", delimiter=",")

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bakjee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants