DHI / mikecore-python

MIKE Core in Python
5 stars 0 forks source link

MIKECoreCUtil: Support for Read/WriteDfs0DataDouble #9

Closed JesperGr closed 3 years ago

JesperGr commented 3 years ago

ReadDfs0DataDouble and WriteDfs0DataDouble on DfsFile class - with support from new Windows dll.

Usage:

import sys; 
sys.path.insert(0, "C:\Work\python\mikecore");
from mikecore.DfsFile import *
dfs = DfsFile()
dfs.Open("testdata/TS_non_ascii.dfs0")
d = dfs.ReadDfs0DataDouble()

And in edit mode:

dfs.WriteDfs0DataDouble(d)
JesperGr commented 3 years ago

Not currently handling Linux version. Options: Either code directly in Python, or throw an error?

JesperGr commented 3 years ago

We could put this C-code directly into ufs.dll, and then it would be readily available in both linux and windows

jsmariegaard commented 3 years ago

Somehow, after using this in my downstream projects I get a lot of these types of warnings:

"UserWarning: Discarding nonzero nanoseconds in conversion"

e.g. in comparisons such like: obs.end_time < mod.start_time. Should we handle rounding errors in some way?

jsmariegaard commented 3 years ago

@ecomodeller, I think this PR is ready - would be good to create release with this if you agree :)

JesperGr commented 3 years ago

I am fine with that. Looking good :-)