TD_LINESPEC Function Examples | Teradata Vantage - TD_LINESPEC Examples - Teradata Vantage

Database Unbounded Array Framework Time Series Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
ncd1634149624743.ditamap
dita:ditavalPath
ruu1634160136230.ditaval
dita:id
ncd1634149624743

TD_LINESPEC Input Table TestRiver

N_SeqNo BuoyID Magnitude
0 1 54.6
1 1 325.4
2 1 509.5
3 1 99.4
4 1 55.5
5 1 25.8
... ... ...

Example: Using TD_LINESPEC to Determine River Flow Call

EXECUTE FUNCTION INTO VOLATILE ART(LineSpecRes_river)
TD_LINESPEC(
   SERIES_SPEC(TABLE_NAME(TestRiver), SERIES_ID(BuoyID),ROW_AXIS(SEQUENCE(N_SeqNo)),
      PAYLOAD( FIELDS(MAGNITUDE), CONTENT(REAL))),
   FUNC_PARAMS(FREQ_STYLE("K_PERIODICITY"))
);

TD_LINESPEC Result

SELECT * FROM LineSpecRes_river WHERE SPECTRAL_DENSITY_MAGNITUDE > 6000.0 ;
BuoyID ROW_I SPECTRAL_DENSITY_MAGNITUDE
----------- ---------------------- --------------------------
1 2.40000000000000E 000 1.04579083028839E 004
1 2.57142857142857E 000 7.39473538139365E 003
1 3.00000000000000E 000 4.82536179361111E 004
1 3.85714285714286E 000 1.20656046558290E 004
1 4.00000000000000E 000 1.59756979616667E 005
1 5.68421052631579E 000 1.97144556780696E 004
1 6.00000000000000E 000 4.07646082019445E 005
1 6.35294117647059E 000 1.22920394375720E 004
1 1.08000000000000E 001 2.38333644758514E 004
1 1.20000000000000E 001 8.55799528874894E 005
1 1.35000000000000E 001 2.04113492478960E 004
1 1.08000000000000E 002 2.39178696986751E 004

TD_PLOT Call

EXECUTE FUNCTION
TD_PLOT(
   SERIES_SPEC(TABLE_NAME(LineSpecRes_river), ROW_AXIS(SEQUENCE(ROW_I)),SERIES_ID(BuoyID),
      PAYLOAD(FIELDS(SPECTRAL_DENSITY_MAGNITUDE), CONTENT(REAL) ) ),
   FUNC_PARAMS(TITLE('River stream flow line spectrum'),
      PLOTS[( TYPE('line'),LEGEND('best'), XRANGE(0, 25) )], IMAGE('png') )
);

TD_PLOT Result

TD_PLOT of TD_LINESPEC Data