Dfs0

Dfs0(self, filename)

Attributes

Name Description
items List of items.
n_items Number of items.
n_timesteps Number of time steps.
start_time File start time.
time File all datetimes.
timestep Time step size in seconds.

Methods

Name Description
from_dataframe Create a dfs0 from a pandas Dataframe.
read Read data from a dfs0 file.
to_dataframe Read data from the dfs0 file and return a Pandas DataFrame.

from_dataframe

Dfs0.from_dataframe(df, filename, itemtype=None, unit=None, items=None)

Create a dfs0 from a pandas Dataframe.

Parameters

Name Type Description Default
df pd.DataFrame Dataframe with data required
filename str filename to write output required
itemtype EUMType | None Same type for all items None
unit EUMUnit | None Same unit for all items None
items Sequence[ItemInfo] | None Different types, units for each items None

read

Dfs0.read(items=None, time=None, **kwargs)

Read data from a dfs0 file.

Parameters

Name Type Description Default
items str | int | Sequence[str | int] | None Read only selected items, by number (0-based), or by name None
time int | str | slice | None Read only selected time steps, by default None (=all) None
**kwargs Any Additional keyword arguments are ignored {}

Returns

Name Type Description
Dataset A Dataset with data dimensions [t]

to_dataframe

Dfs0.to_dataframe(unit_in_name=False, round_time='ms')

Read data from the dfs0 file and return a Pandas DataFrame.

Parameters

Name Type Description Default
unit_in_name bool include unit in column name, default False False
round_time str round time to avoid problem with floating point inaccurcy, set to False to avoid rounding 'ms'

Returns

Name Type Description
pd.DataFrame