PointObservation
PointObservation(self,
data,*,
=None,
item=None,
x=None,
y=None,
z=None,
name=1.0,
weight=None,
quantity=None,
aux_items=None,
attrs )
Class for observations of fixed locations
Create a PointObservation from a dfs0 file or a pd.DataFrame.
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 |
item | (int, str) | index or name of the wanted item/column, by default None if data contains more than one item, item must be given | None |
x | float | x-coordinate of the observation point, inferred from data if not given, else None | None |
y | float | y-coordinate of the observation point, inferred from data if not given, else None | None |
z | float | z-coordinate of the observation point, inferred from data if not given, else None | None |
name | str | user-defined name for easy identification in plots etc, by default file basename | None |
quantity | Quantity | The quantity of the observation, for validation with model results For MIKE dfs files this is inferred from the EUM information | None |
aux_items | list | list of names or indices of auxiliary items, by default None | None |
attrs | dict | additional attributes to be added to the data, by default None | None |
weight | float | weighting factor for skill scores, by default 1.0 | 1.0 |
Examples
>>> import modelskill as ms
>>> o1 = ms.PointObservation("klagshamn.dfs0", item=0, x=366844, y=6154291, name="Klagshamn")
>>> o2 = ms.PointObservation("klagshamn.dfs0", item="Water Level", x=366844, y=6154291)
>>> o3 = ms.PointObservation(df, item=0, x=366844, y=6154291, name="Klagshamn")
>>> o4 = ms.PointObservation(df["Water Level"], x=366844, y=6154291)
Attributes
Name | Description |
---|---|
attrs | Attributes of the observation |
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 |
weight | Weighting factor for skill scores |
x | x-coordinate |
y | y-coordinate |
z | z-coordinate of observation point |
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
PointObservation.equals(other)
Check if two TimeSeries are equal
sel
**kwargs) PointObservation.sel(
Select data by label
to_dataframe
PointObservation.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
=None, end_time=None, buffer='1s') PointObservation.trim(start_time
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' |