DFSU 3D structure from 2D mesh/DFSU? #518
-
Hi Can anyone offer advice on generating a 3D DFSU structure from a MESH/2D DFSU file, within MIKEIO? While it is possible to generate a 3D spatial structure manually from 2D mesh and sigma level values (which I can use to e.g. interpolate, using scipy.interpolate.griddata), I cannot work out how to create a suitable 3D geometry that would allow me to write the interpolated data to a Dataset and consequently a new DFSU file (i.e. recognized and used correctly by the "geometry" argument of Dataset). Presently I must first generate a "template" 3D file either by making a short simulation in MIKE, or functions within the MIKE Matlab toolbox (depending on the process case). A self-contained Python solution would be desirable. Thanks in advance for any pointers. Tom |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Post above was unnecessary - now solved. In case it helps someone else, this can be done by creating Geometry directly using the lower-level function e.g. geo = mikeio.spatial.FM_geometry.GeometryFM3D(node_coordinates=nc, where nc and et are appropriately constructed numpy arrays (figured out structure by comparing node_coordinates and element_table between Dfsu(mesh) and Dfsu(3dOutputFile)). "geo" can then be used to create a 3d DFSU file by e.g. newds = mikeio.Dataset(data,time,items,geometry=geo,zn=zn) |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot, @tomadams-ssf, nice of you to take the time to provide the solution yourself! I couldn't even remember that you could do that 😆 |
Beta Was this translation helpful? Give feedback.
Post above was unnecessary - now solved. In case it helps someone else, this can be done by creating Geometry directly using the lower-level function e.g.
geo = mikeio.spatial.FM_geometry.GeometryFM3D(node_coordinates=nc,
element_table=et,
n_sigma=10)
where nc and et are appropriately constructed numpy arrays (figured out structure by comparing node_coordinates and element_table between Dfsu(mesh) and Dfsu(3dOutputFile)).
"geo" can then be used to create a 3d DFSU file by e.g.
newds = mikeio.Dataset(data,time,items,geometry=geo,zn=zn)
newds.to_dfs('outputFilename)