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

Read/modify dfs custom blocks #202

Open
ryan-kipawa opened this issue Apr 30, 2021 · 8 comments · May be fixed by #675
Open

Read/modify dfs custom blocks #202

ryan-kipawa opened this issue Apr 30, 2021 · 8 comments · May be fixed by #675
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ryan-kipawa
Copy link

I don't believe mikeio can read/write custom blocks to dfs2 files yet. These have info that's sometimes used by other tools. Therefore, it'd be nice to be able to read/write these.

@ecomodeller
Copy link
Member

Are custom blocks relevant for all types of dfs files or only dfs2?

You are welcome to investigate how to read/write custom blocks.
To get started:

  1. supply a file with some custom blocks
  2. create a script that reads some custom blocks

Then we can start thinking about where this functionality belongs in mikeio.

@ryan-kipawa
Copy link
Author

I don't know how exactly how it's used in every DFS file, but it seems it's at least possible:

http://docs.mikepoweredbydhi.com/core_libraries/dfs/dfs-file-system/#custom-blocks

I'm mostly familiar with DFS2 custom blocks. For example, the M21_Misc custom block contains the land value as item #4.

How / where can I upload the sample file and script? Here's an image of the code for now...

Capture

@JesperGr
Copy link

JesperGr commented May 9, 2022

Custom block are relevant for dfs2, dfs3 and dfsu, and also for some generic dfs files (like .res1d).

There are some examples on how to work with custom blocks in Python here:

https://github.com/DHI/mikecore-python/blob/master/tests/test_dfs_custom_block.py

The following example shows how to handle custom block for dfs2 files, and also how to create file with a valid custom block.

https://github.com/DHI/mikecore-python/blob/master/tests/examples_dfs2.py

@ecomodeller ecomodeller added the enhancement New feature or request label Jul 1, 2022
@ecomodeller ecomodeller added the help wanted Extra attention is needed label Oct 18, 2022
@jurjendejong
Copy link

Any progress on this feature? I think MikeIO is a great toolbox and prefer using it without necessity for MikeCore.

@sweco-sejurj
Copy link

Also still hoping to see this feature implemented :)

(now posting from my corporate GitHub account...)

@ecomodeller ecomodeller linked a pull request Mar 17, 2024 that will close this issue
@ecomodeller
Copy link
Member

@rywm-dhi @jurjendejong @sweco-sejurj Is the functionality in #675 sufficient?

@ryan-kipawa
Copy link
Author

Nice! I think that's sufficient for writing blocks. Is it also possible to read the values?

@sweco-sejurj
Copy link

Awesome! This looks like it should do the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants