VerticalModelResult

VerticalModelResult(
    data,
    *,
    name=None,
    item=None,
    quantity=None,
    z_item=0,
    x=None,
    y=None,
    keep_duplicates='first',
    aux_items=None,
)

Model result for a vertical column.

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

Parameters

Name Type Description Default
data (str, Path, pd.DataFrame, mikeio.Dfs0, mikeio.Dfs0, xr.Dataset) The input data or file path required
name str | None 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
z_item str | int | None Item of the first coordinate of positions, by default None 0
x float lateral coordinate of point position, inferred from data if not given, else None None
y float zonal coordinate of point position, inferred from data if not given, else None None
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 list[int | str] | None 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)
node node-coordinate
plot Plot using the ComparerPlotter
quantity Quantity of time series
time Time index
values Values as numpy array
x x-coordinate
y y-coordinate
z z-coordinate

Methods

Name Description
align Align model result to observation by matching nearest times and interpolating to observation depths.
copy Create a deep copy of the TimeSeries.
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

align

VerticalModelResult.align(vo, temporal_tolerance=None)

Align model result to observation by matching nearest times and interpolating to observation depths.

Observation depths outside the model depth range are assigned NaN values; no extrapolation is performed.

Parameters

Name Type Description Default
vo VerticalObservation Vertical observation to align with required
temporal_tolerance pd.Timedelta Maximum allowed time difference for matching, by default None None

Returns

Name Type Description
xr.Dataset Aligned model result

copy

VerticalModelResult.copy()

Create a deep copy of the TimeSeries.

Returns

Name Type Description
TimeSeries Deep copy of the TimeSeries object

equals

VerticalModelResult.equals(other)

Check if two TimeSeries are equal

sel

VerticalModelResult.sel(**kwargs)

Select data by label

to_dataframe

VerticalModelResult.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

VerticalModelResult.trim(
    start_time=None,
    end_time=None,
    buffer='1s',
    no_overlap='error',
)

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'
no_overlap Literal['ignore', 'error', 'warn'] Empty data handling. 'error'