Absolute-time dfs0 files use calendar timestamps (pandas.DatetimeIndex), while relative-time dfs0 files use elapsed time (pandas.TimedeltaIndex).
import pandas as pdds_abs = mikeio.read("../data/da_diagnostic.dfs0")type(ds_abs.time), ds_abs.time[:3]ds_rel = mikeio.read("../data/eq_relative.dfs0")type(ds_rel.time), ds_rel.time[:3]
(pandas.TimedeltaIndex,
TimedeltaIndex(['0 days 00:00:00.000000', '0 days 00:00:00.111803',
'0 days 00:00:00.223606'],
dtype='timedelta64[ns]', freq=None))
To convert relative times to calendar timestamps, choose a reference start time and add the timedeltas:
<mikeio.Dataset>
dims: (time:720)
time: 1958-03-01 00:00:00 - 2018-09-01 00:00:00 (720 non-equidistant records)
geometry: GeometryUndefined()
items:
0: Average <Concentration 1> (gram per meter pow 3)
File title
DFS files have a title field shown e.g. in MIKE Zero. The title is read from the file and preserved through processing. You can set it before writing:
ds = mikeio.read("mauna_loa_co2.dfs0")ds.title ="Mauna Loa CO2"ds.to_dfs("mauna_loa_co2.dfs0")
Accumulated datavalue type
Some dfs0 items use an accumulated data value type rather than the default instantaneous type. This is common for precipitation data and can be specified using the data_value_type argument of mikeio.ItemInfo. Refer to the MIKE documentation for guidance on which type to use for your setup.
Rainfall amounts (e.g. mm) are often configured as StepAccumulated:
from mikeio import ItemInfo, EUMTypeitem = ItemInfo("Rainfall", EUMType.Rainfall, data_value_type="StepAccumulated",)item