-
Notifications
You must be signed in to change notification settings - Fork 58
Change dfs datatype #830
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
Change dfs datatype #830
Conversation
mikeio/generic.py
Outdated
n_time_steps = dfs_in.FileInfo.TimeAxis.NumberOfTimeSteps | ||
deletevalue = dfs_in.FileInfo.DeleteValueFloat | ||
|
||
# Write data to outputfile with new datatype |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can done in a simpler way, take a look at this example from mikecore: https://github.com/DHI/mikecore-python/blob/6ebbb1a1abebb88cd2060346611fa628eac57a82/tests/examples_misc.py#L59-L63
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good, yes i had the feeling it could be simplified
tests/test_generic.py
Outdated
assert np.allclose(org, new, rtol=1e-08, atol=1e-10, equal_nan=True) | ||
|
||
|
||
def test_change_datatype_dfsu(tmp_path: Path) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is a good idea to change the data type on dfsu, Mike Zero will refuse to open it. It is good enough with a test for dfs0.
Add generic function + test to change the datatype of a DFS:s file