Last active
April 12, 2019 13:27
-
-
Save randomboolean/7cb549ce4c6a1b1cc47e9ba6d0a8d27c to your computer and use it in GitHub Desktop.
Outputs a boolean GTS with ticks labeled with true where anomalies are detected. Detection is done with a moving ZSCORETEST within a custom mapper.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
// Store the argument that will be passed to MAP | |
[ 'gts' 'pre' 'post' 'occ' 'steps' ] STORE | |
// Build the custom mapper | |
<% | |
// Make a GTS from the moving window | |
LIST-> DROP [ 'cur' 'c' 'l' 't' 'lat' 'lon' 'elev' 'v' ] STORE | |
$t [] [] [] $v MAKEGTS | |
// Apply the anomaly detection test | |
true 3.0 ZSCORETEST | |
// Output one value per anomalous tick found | |
0 'i' STORE | |
{ SWAP <% $i TOSTRING [ 3 ROLL NaN NaN NaN true ] $i 1 + 'i' STORE %> FOREACH } | |
%> | |
MACROMAPPER 3 MAXLONG STRICTMAPPER 'mapper_zscore_test' STORE | |
// call MAP to create the boolean GTS with the flagged anomalies | |
[ $gts $mapper_zscore_test $pre $post $occ $steps true ] MAP MERGE 'anomalies' RENAME | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment