Skip to content

Conversation

otzi5300
Copy link
Collaborator

Add generic function + test to change the datatype of a DFS:s file

n_time_steps = dfs_in.FileInfo.TimeAxis.NumberOfTimeSteps
deletevalue = dfs_in.FileInfo.DeleteValueFloat

# Write data to outputfile with new datatype
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

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

@otzi5300 otzi5300 marked this pull request as ready for review May 23, 2025 12:03
assert np.allclose(org, new, rtol=1e-08, atol=1e-10, equal_nan=True)


def test_change_datatype_dfsu(tmp_path: Path) -> None:
Copy link
Member

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.

@otzi5300 otzi5300 requested a review from ecomodeller June 3, 2025 06:53
@ecomodeller ecomodeller merged commit 40d7bdc into main Jun 3, 2025
9 checks passed
@ecomodeller ecomodeller deleted the change_dfs_datatype branch June 3, 2025 07:05
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

Successfully merging this pull request may close these issues.

2 participants