observation

observation(data, *, gtype=None, **kwargs)

Create an appropriate observation object.

A factory function for creating an appropriate observation object based on the data and args.

If ‘x’ or ‘y’ is given, a PointObservation is created. If ‘x_item’ or ‘y_item’ is given, a TrackObservation is created.

Parameters

Name Type Description Default
data DataInputType The data to be used for creating the Observation object. required
gtype Optional[Literal['point', 'track']] The geometry type of the data. If not specified, it will be guessed from the data. None
**kwargs Additional keyword arguments to be passed to the Observation constructor. {}

Examples

>>> import modelskill as ms
>>> o_pt = ms.observation(df, item=0, x=366844, y=6154291, name="Klagshamn")
>>> o_tr = ms.observation("lon_after_lat.dfs0", item="wl", x_item=1, y_item=0)