RAWDTW
gts
distance
The DTW
function computes a Dynamic Time Warping pseudo-distance on two Geo Time Series™.
The computation is performed on the raw Geo Time Series™, no transformation is applied to them.
RAWDTW is available since version 1.2.11.
See also
Signatures
Examples
//
// Compute the DTW distance with no threshold
//
NEWGTS 1 360 <% DUP 360.0 / 2 PI * * SIN NaN NaN NaN 4 ROLL ADDVALUE %> FOR
NEWGTS 1 360 <% DUP 360.0 / 2 PI * * COS NaN NaN NaN 4 ROLL ADDVALUE %> FOR
0.0
RAWDTW
//
// Compute the DTW distance with a threshold, computation will be aborted if the distance is above the threshold
//
NEWGTS 1 360 <% DUP 360.0 / 2 PI * * SIN NaN NaN NaN 4 ROLL ADDVALUE %> FOR
NEWGTS 1 360 <% DUP 360.0 / 2 PI * * COS NaN NaN NaN 4 ROLL ADDVALUE %> FOR
42.0 // You can try with different threshold and see the difference
RAWDTW
//
// Compute the DTW disance on locations.
//
NEWGTS
1 360
<%
'i' STORE
$i // ts
$i 360.0 / 2 PI * * COS // lat
$i 360.0 / 2 PI * * SIN // lon
NaN // elev
T // val
ADDVALUE
%>
FOR
NEWGTS
1 360
<%
'i' STORE
$i // ts
$i 360.0 / 2 PI * * SIN // lat
$i 360.0 / 2 PI * * COS // lon
NaN // elev
T // val
ADDVALUE
%>
FOR
-1
'loxodromic'
'locations'
RAWDTW
Examples
//
// Compute the DTW distance with no threshold
//
gts = NEWGTS()
FOR(1, 360, (i) -> { ADDVALUE(gts, i, NaN, NaN, NaN, i / 360.0 * 2 * PI()) } )
return RAWDTW(SIN(gts), COS(gts), 0.0)
//
// Compute the DTW distance with a threshold, computation will be aborted if the distance is above the threshold
//
gts = NEWGTS()
FOR(1, 360, (i) -> { ADDVALUE(gts, i, NaN, NaN, NaN, i / 360.0 * 2 * PI()) } )
return RAWDTW(SIN(gts), COS(gts), 42.0) // You can try with different threshold and see the difference
//
// Compute the DTW distance on locations. As the latitudes and longitudes are normalized it may not behave as you expects, prefer RAWDTW.
//
gts1 = NEWGTS()
gts2 = NEWGTS()
FOR(1, 360, (i) -> {
tmp = i / 360.0 * 2 * PI()
ADDVALUE(gts1, i, COS(tmp), SIN(tmp), NaN, true)
ADDVALUE(gts2, i, SIN(tmp), COS(tmp), NaN, true)
}
)
return RAWDTW(gts1, gts2, -1, 'loxodromic', 'locations')