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

dfsu file created by old version of MIKE MeshGenerator cannot be opened #24

Open
Hendrik1987 opened this issue Dec 22, 2022 · 9 comments

Comments

@Hendrik1987
Copy link

Hendrik1987 commented Dec 22, 2022

Describe the bug
I have a dfsu file of a friction map, which I would like to open in mikeio. I get the following error messages:
image

The file is accepted by a MIKE 21 HD run and in the data utility it looks like this:
image

What I tried
I did create, save and reload a mikeio.dataset with EUMType.Mannings_M, EUMUnit.meter_pow__1_per_3__per_sec without any problems. I did then also open this 2nd dfsu file in the data utility and could not find a difference.

System information:

  • Python 3.11.0
  • MIKE IO version 1.2.4
@jsmariegaard
Copy link
Member

Could you send the file to me? Then I can try.

@jsmariegaard
Copy link
Member

This seems to be due to an empty item name. Will try to confirm with another file. If this is indeed the problem it can be transferred to https://github.com/DHI/mikecore-python

@Hendrik1987
Copy link
Author

I have created a .dfsu file in Mesh Generator with empty item. I have also imported the problematic dfsu file in Mesh Generator and exported again as .dfsu with an item name. Will send you both files.

I can read both files in mikeio. I am still puzzled what the problem or combination of problems in the original file is... But my problem at hand is solved now.

@jsmariegaard
Copy link
Member

Thanks. Strange. Could you please send me the files? Then I can see if I can find a difference between those and the one you send me last time.

@jsmariegaard
Copy link
Member

I wonder if it could be due to the missing type/units of the static items?

image

@jsmariegaard
Copy link
Member

It is actually surprising that the file "works" when you consider the names of the static items: It contains two items named "Z-coordinates" (4 and 5) and two items named "Nodes per element" (8 and 9). Item 5 should have been "code" and item 9 should have been "connectivity". But when the dfsu file is read by MIKE core, the name, type and unit are not checked, it just read the static items assuming that they are: 1:node id, 2:x, 3:y, 4:z, 5:code, 6:element id, 7:element type, 8:num of nodes, 9:connectivity.

@Hendrik1987
Copy link
Author

Hendrik1987 commented Jan 3, 2023

I wonder if it could be due to the missing type/units of the static items?

Good observation! This appears to have been fixed by the import and export through Mesh generator.
Although MIKE seems to be more forgiving (.dfsu can be opened in MIKE Zero and used for MIKE 21 HD run), I would consider the file as incomplete / incorrect.

@Hendrik1987
Copy link
Author

Hendrik1987 commented Jan 3, 2023

It is actually surprising that the file "works" when you consider the names of the static items: [...]

I wonder if that happens in the mesh generator export to .dfsu functionality. The QGIS add-in does actually not accept .dfsu files exported from the mesh generator - only speculating but maybe that is related.
The duplicated static items seem to be acceptable for MIKE core / mikeio, as the left file in your screenshot can be read. This might suggest that only the names of the static items are duplicated, but the data (values of 5: "code" and 9: "connectivity") are correct, right?

@jsmariegaard jsmariegaard changed the title dfsu file of manning M cannot be opened dfsu file created by old version of MIKE MeshGenerator cannot be opened Jan 4, 2023
@jsmariegaard jsmariegaard transferred this issue from DHI/mikeio Jan 4, 2023
@jsmariegaard jsmariegaard reopened this Jan 4, 2023
@jsmariegaard
Copy link
Member

Status: @Hendrik1987 has a 2d dfsu file created a long time ago with a previous version of MeshGenerator. It can be opened in MIKE Zero and the MIKE FM engines also accept it. It cannot be opened with MIKE Core's DfsuFile.Open(). The problematic file had a single item with an empty string as name. All static items in the file have undefined type and unit. The static item names are non-unique and some a wrong compared to other dfsu files.

Even though the file is "wrong" in some sense, I still think MIKE Core should be able to read it (if MZ and the engines can).

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

2 participants