PointObservation
modelskill.PointObservation
Bases: Observation
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, Dataset, DataArray, DataFrame, Series, Dataset or 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)
Source code in modelskill/obs.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
plot
instance-attribute
equals
sel
to_dataframe
Convert matched data to pandas DataFrame
Include x, y coordinates only if gtype=track
Returns:
Type | Description |
---|---|
DataFrame
|
data as a pandas DataFrame |
Source code in modelskill/timeseries/_timeseries.py
trim
Trim observation data to a given time interval
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_time |
Timestamp
|
start time |
None
|
end_time |
Timestamp
|
end time |
None
|
buffer |
str
|
buffer time around start and end time, by default "1s" |
'1s'
|
Source code in modelskill/timeseries/_timeseries.py
modelskill.timeseries._plotter.MatplotlibTimeSeriesPlotter
Bases: TimeSeriesPlotter
Source code in modelskill/timeseries/_plotter.py
hist
Plot histogram of timeseries values
Wraps pandas.DataFrame hist() method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bins |
int
|
specification of bins, by default 100 |
100
|
title |
str
|
plot title, default: observation name |
None
|
color |
str
|
plot color, by default "#d62728" |
None
|
**kwargs |
other keyword arguments to df.hist() |
{}
|
Returns:
Type | Description |
---|---|
matplotlib axes
|
|
Source code in modelskill/timeseries/_plotter.py
timeseries
Plot timeseries
Wraps pandas.DataFrame plot() method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title |
str
|
plot title, default: [name] |
None
|
color |
str
|
plot color, by default '#d62728' |
None
|
marker |
str
|
plot marker, by default '.' |
'.'
|
linestyle |
str
|
line style, by default None |
'None'
|
**kwargs |
other keyword arguments to df.plot() |
{}
|