Track observations

Contents

Track observations#

Track observations are point observations for moving points. The index therefore consists of time, x- and y-positions. Altimetry data acquired from satellite is an example of track observations; data obtained from boat is another example.

The track observation data may come from a file or web api. We will cover the following situations here:

  • File

    • dfs0

    • csv/excel

  • REST API

modelskill has the class TrackObservation for working with track observations.

Track observations consist of time-position-value (data) and meta data such as

  • data type (e.g. water level)

  • unit (e.g. meter)

ModelSkill is agnostic to the coordinate reference system (CRS) and it is therefore the responsibility of the user to make sure that all data (observations and model) use the same CRS.

import pandas as pd
import modelskill as ms

Data from file#

The two first items in the file must be x- and y- coordinate values.

dfs0 files can be read directly by TrackObservation.

csv files needs to be read by pandas first and passed to TrackObservation as a DataFrame.

df = pd.read_csv("data/SW/altimetry_NorthSea_20171027.csv", index_col=0, parse_dates=True)  # step 1: create DataFrame
df.head()
lon lat surface_elevation significant_wave_height wind_speed
date
2017-10-26 04:37:37 8.757272 53.926136 1.6449 0.426 6.100000
2017-10-26 04:37:54 8.221631 54.948459 1.1200 1.634 9.030000
2017-10-26 04:37:55 8.189390 55.008547 1.0882 1.717 9.370000
2017-10-26 04:37:56 8.157065 55.068627 1.0309 1.869 9.559999
2017-10-26 04:37:58 8.124656 55.128700 1.0369 1.939 9.980000
o1 = ms.TrackObservation(df, item="surface_elevation")  # step 2: create TrackObservation
o1
/opt/hostedtoolcache/Python/3.13.11/x64/lib/python3.13/site-packages/modelskill/timeseries/_track.py:136: UserWarning: Removed 22 duplicate timestamps with keep=first
  warnings.warn(
<TrackObservation>: surface_elevation
Time: 2017-10-26 04:37:37 - 2017-10-30 20:54:47
Quantity:  []