PointModelResult
PointModelResult(
data,
*,
name=None,
x=None,
y=None,
z=None,
item=None,
quantity=None,
aux_items=None,
)Model result for a single point location.
Construct a PointModelResult from a 0d data source: dfs0 file, mikeio.Dataset/DataArray, pandas.DataFrame/Series or xarray.Dataset/DataArray
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| data | (str, Path, mikeio.Dataset, mikeio.DataArray, pd.DataFrame, pd.Series, xr.Dataset or xr.DataArray) | filename (.dfs0 or .nc) or object with the data | required |
| name | Optional[str] | The name of the model result, by default None (will be set to file name or item name) | None |
| x | float | first coordinate of point position, inferred from data if not given, else None | None |
| y | float | second coordinate of point position, inferred from data if not given, else None | None |
| z | float | third coordinate of point position, inferred from data if not given, else None | 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 |
| quantity | Quantity | Model quantity, for MIKE files this is inferred from the EUM information | None |
| 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 |
| interp_time | Interpolate model result to the time of the observation |
| sel | Select data by label |
| to_dataframe | Convert matched data to pandas DataFrame |
| trim | Trim observation data to a given time interval |
equals
PointModelResult.equals(other)Check if two TimeSeries are equal
interp_time
PointModelResult.interp_time(observation, **kwargs)Interpolate model result to the time of the observation
wrapper around xarray.Dataset.interp()
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| observation | Observation | The observation to interpolate to | required |
| **kwargs | Any | Additional keyword arguments passed to xarray.interp | {} |
Returns
| Name | Type | Description |
|---|---|---|
| PointModelResult | Interpolated model result |
sel
PointModelResult.sel(**kwargs)Select data by label
to_dataframe
PointModelResult.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
PointModelResult.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' |