TrackModelResult

TrackModelResult(
    self,
    data,
    *,
    name=None,
    item=None,
    quantity=None,
    x_item=0,
    y_item=1,
    keep_duplicates='first',
    aux_items=None,
)

Model result for a track.

Construct a TrackModelResult from a dfs0 file, mikeio.Dataset, pandas.DataFrame or a xarray.Datasets

Parameters

Name Type Description Default
data types.TrackType The input data or file path required
name Optional[str] The name of the model result, by default None (will be set to file name or item name) None
item str | int | None If multiple items/arrays are present in the input an item must be given (as either an index or a string), by default None None
x_item str | int | None Item of the first coordinate of positions, by default None 0
y_item str | int | None Item of the second coordinate of positions, by default None 1
quantity Quantity Model quantity, for MIKE files this is inferred from the EUM information None
keep_duplicates (str, bool) Strategy for handling duplicate timestamps (wraps xarray.Dataset.drop_duplicates) “first” to keep first occurrence, “last” to keep last occurrence, False to drop all duplicates, “offset” to add milliseconds to consecutive duplicates, by default “first” 'first'
aux_items Optional[list[int | str]] Auxiliary items, by default None None

Attributes

Name Description
gtype Geometry type
n_points Number of data points
name Name of time series (value item name)
plot Plot using the ComparerPlotter
quantity Quantity of time series
time Time index
values Values as numpy array
x x-coordinate
y y-coordinate

Methods

Name Description
equals Check if two TimeSeries are equal
sel Select data by label
to_dataframe Convert matched data to pandas DataFrame
trim Trim observation data to a given time interval

equals

TrackModelResult.equals(other)

Check if two TimeSeries are equal

sel

TrackModelResult.sel(**kwargs)

Select data by label

to_dataframe

TrackModelResult.to_dataframe()

Convert matched data to pandas DataFrame

Include x, y coordinates only if gtype=track

Returns

Name Type Description
pd.DataFrame data as a pandas DataFrame

trim

TrackModelResult.trim(start_time=None, end_time=None, buffer='1s')

Trim observation data to a given time interval

Parameters

Name Type Description Default
start_time pd.Timestamp start time None
end_time pd.Timestamp end time None
buffer str buffer time around start and end time, by default “1s” '1s'