Open Achton-Boel opened 2 years ago
That seems useful, I just have to figure out how the landvalue is actually stored in the dfs2 file. I imagine it is stored here somehow @JesperGr can you explain what is necessary to store a landvalue correctly in a dfs2 file?
Land value is stored in the custom block named "M21_Misc", the 4th value, as is also seen from the attached image. To store that correctly in a dfs2 file, check out e.g. (C# code): https://github.com/DHI/MIKECore-Examples/blob/47b5c74130d57091df2853254fb0718462c1c3b5/Examples/CSharp/ExamplesDfs2.cs#L220
builder.AddCustomBlock(factory.CreateCustomBlock("M21_Misc", new float[] { 327f, 0.2f, -900f, 10f, 0f, 0f, 0f }));
There is a similar example for Python in the mikecore-python repository:
builder.AddCustomBlock(factory.CreateCustomBlock("M21_Misc", np.array([ 327, 0.2, -900, 10, 0, 0, 0 ], np.float32)));
Well, there is actually a full example of making a bathymetry dfs2 file, look for CreateM21Bathymetry
:
This issue has been raised earlier #202 so we will consider how to best support this in mikeio, and in the meantime, you should be able to get by just fine with the example that @JesperGr posted above, using mikecore directly.
Hello Henrik and Jesper
Thanks for your quick respons. It helped a great deal.
We will look forward to see it implemented in MIKEIO 👍
There does not seem to be an option to define a landvalue when wrtiting a dfs2-file from python with Dfs2().write. The landvalue is greyed out when opening the file in MIKE Zero. We neeed the functionallity when importing a bathymetry into a simulation-setup such as .m21fm. When the dfs2 is used as a domain/mesh we are prompted with the error: "no landvalue set". How can we specify a custom landvalue?