{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Track observations\n", "\n", "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. \n", "\n", "The track observation data may come from a file or web api. We will cover the following situations here: \n", "\n", "* File\n", " - dfs0\n", " - csv/excel\n", "* REST API\n", "\n", "modelskill has the class `TrackObservation` for working with track observations. \n", "\n", "Track observations consist of time-**position**-value (data) and *meta* data such as\n", "\n", "* data type (e.g. water level)\n", "* unit (e.g. meter)\n", "\n", "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." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import modelskill as ms" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Data from file\n", "\n", "The two first items in the file must be x- and y- coordinate values. \n", "\n", "**dfs0** files can be read directly by TrackObservation. \n", "\n", "**csv** files needs to be read by pandas first and passed to TrackObservation as a DataFrame. " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | lon | \n", "lat | \n", "surface_elevation | \n", "significant_wave_height | \n", "wind_speed | \n", "
---|---|---|---|---|---|
date | \n", "\n", " | \n", " | \n", " | \n", " | \n", " |
2017-10-26 04:37:37 | \n", "8.757272 | \n", "53.926136 | \n", "1.6449 | \n", "0.426 | \n", "6.100000 | \n", "
2017-10-26 04:37:54 | \n", "8.221631 | \n", "54.948459 | \n", "1.1200 | \n", "1.634 | \n", "9.030000 | \n", "
2017-10-26 04:37:55 | \n", "8.189390 | \n", "55.008547 | \n", "1.0882 | \n", "1.717 | \n", "9.370000 | \n", "
2017-10-26 04:37:56 | \n", "8.157065 | \n", "55.068627 | \n", "1.0309 | \n", "1.869 | \n", "9.559999 | \n", "
2017-10-26 04:37:58 | \n", "8.124656 | \n", "55.128700 | \n", "1.0369 | \n", "1.939 | \n", "9.980000 | \n", "