Loading

ZDTW

gts distance

The DTW function computes a Dynamic Time Warping pseudo-distance on two Geo Time Series™.

The Geo Time Series™ will be Z-normalized prior to the computation.

ZDTW 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 ZDTW
// // 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 ZDTW
// // Compute the DTW distance on locations. As the latitudes and longitudes are z-normalized it may not behave as you expects, prefer RAWDTW. // 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' ZDTW

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 ZDTW(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 ZDTW(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 ZDTW(gts1, gts2, -1, 'loxodromic', 'locations')