@senx/discovery-plugin-marauder
Version:
Discovery plugin - Marauder's map
2 lines • 5.19 kB
JavaScript
System.register(["./p-bd1c239e.system.js","./p-7abe607e.system.js","./p-10584f3b.system.js"],(function(t){"use strict";var n,e;return{setters:[function(t){n=t.L},function(){},function(t){e=t.P}],execute:function(){var a={version:"1.2.19",name:"@senx/discovery-widgets",description:"Discovery Widgets Elements",author:"SenX <contact@senx.io>",license:"Apache-2.0",homepage:"https://discovery.warp10.io/"};var s=function(){var t=new n({name:"Discovery by SenX"});t.info(["Version"],a.version);t.info(["Info"],a.homepage)};var l=function(){function t(t){this.type=t.type;this.name=t.name;this.tag=t.tag;this.author=t.author;this.description=t.description;this.version=t.version;this.scriptWrapper=t.scriptWrapper}t.prototype.toString=function(){return"".concat(this.name,":").concat(this.version," by ").concat(this.author)};return t}();var o="@senx/discovery-plugin-marauder";var i="SenX <contact@senx.io>";var r="0.0.10";var u="Discovery plugin - Marauder's map";var c=function(){e.getInstance().register(new l({type:"marauder",name:o,tag:"discovery-plugin-marauder",author:i,description:u,version:r,scriptWrapper:function(t){return"\n ".concat(t,"\n'dataStruct' STORE\n$dataStruct 'data' GET 'data' STORE\n$dataStruct 'globalParams' GET 'globalParams' STORE\n<% $globalParams ISNULL %> <% { } 'globalParams' STORE %> IFT\n$globalParams 'map' GET 'map' STORE\n<% $map ISNULL %> <% { 'step' 10 m } 'map' STORE %> IFT\n$map 'step' GET 'b' STORE\n$data LASTTICK 'last' STORE\n$data FIRSTTICK 'first' STORE\n\n[ $data bucketizer.mean $last 0 1 ] BUCKETIZE\n[ SWAP [] reducer.mean ] REDUCE 0 GET LOCATIONS 2 ->LIST FLATTEN LIST-> DROP [ 'lat' 'long' ] STORE\n\n[ $data bucketizer.last $last $b 0 ] BUCKETIZE 'gts' STORE\n$b 5 * 5 [ 'quietperiod' 'minvalues' ] STORE\n// Force minvalues to be at leas 2\n2 $minvalues MAX 'minvalues' STORE\n// Now compute the overall bounding box\n$data BBOX\n// Zip extrema together\nZIP\n// Compute global extrema\nLIST-> DROP MAX 4 ROLL MIN 4 ROLL MIN 4 ROLL MAX 4 ROLL\n// store lower left / upper right coordinates\n[ 'lllat' 'lllon' 'urlat' 'urlon' ] STORE\n// Compute per unit offset in both lat and lon so we get the finest\n// resolution when storing lat/lon offset from ll corner on 32 bits\n$urlat $lllat - 65535.0 / 'latstep' STORE\n$urlon $lllon - 65535.0 / 'lonstep' STORE\n// Check that all GTS are bucketized with the same parameters\n$gts 0 GET BUCKETSPAN 'bucketspan' STORE\n$gts 0 GET LASTBUCKET 'lastbucket' STORE\n$gts 0 GET BUCKETCOUNT 'bucketcount' STORE\n$bucketspan 0 != $lastbucket 0 != && 'GTS MUST be bucketized' ASSERTMSG\n// Replace values with 0\n[ $gts 0.0 mapper.replace 0 0 0 ] MAP 'gts' STORE\n$gts <%\n 'g' STORE\n $g BUCKETSPAN $bucketspan ==\n $g LASTBUCKET $lastbucket ==\n && 'GTS MUST all have the same bucketization parameters' ASSERTMSG\n // update bucketcount\n $bucketcount $g BUCKETCOUNT MAX 'bucketcount' STORE\n // Split 'gts' according to 'quietperiod'\n $g $quietperiod $minvalues '.split' TIMESPLIT\n // Now iterate over the splits, bucketizing them with the same parameters\n // as the GTS they come from and interpolating missing values\n <%\n [ SWAP NULL $lastbucket $bucketspan 0 ] BUCKETIZE\n INTERPOLATE\n %> F LMAP\n // Merge the splits back\n MERGE\n // Rebucketize\n [ SWAP NULL $lastbucket $bucketspan 0 ] BUCKETIZE\n%> F LMAP\nFLATTEN 'gts' STORE\n// Now set the value of each data point to 32 bits representing offset\n// of the position from the ll corner\n[ $gts UNBUCKETIZE\n <%\n [ 4 5 ] SUBLIST FLATTEN\n DUP SIZE 2 ==\n <%\n LIST-> DROP\n $lllon - TODOUBLE $lonstep / ROUND TOLONG 0xFFFF & SWAP\n $lllat - TODOUBLE $latstep / ROUND TOLONG 0xFFFF & 16 << SWAP |\n 0 NaN NaN NaN 5 ROLL\n %> <% DROP 0 NaN NaN NaN NULL %> IFTE\n %> MACROMAPPER 0 0 0 ] MAP\nNONEMPTY 'data' STORE\n$data <% LABELS %> F LMAP 'infos' STORE\n//\n// Now shift and scale the ticks so we end up with indices\n//\n$data $lastbucket $bucketcount 1 - $bucketspan * - -1 * TIMESHIFT\n1.0 $bucketspan / TIMESCALE 'gts' STORE\n//\n// Create image\n//\n$bucketcount $gts SIZE '2D' PGraphics\nPpixels\n\n// Update the pixels with the GTS values\n$gts\n<%\n 'y' STORE\n <%\n LIST-> [ 'x' NULL NULL NULL 'v' NULL ] STORE\n $v $y $bucketcount * $x + SET\n %> FOREACH\n%> T FOREACH\n// Count null elements\n0 POPR0\nDUP <% 0 == <% PUSHR0 1 + POPR0 %> IFT %> FOREACH\nPupdatePixels\n{\n 'iTXt' [\n {\n 'keyword' 'Discovery'\n 'text' {\n 'type' 'MM'\n 'v' 0\n 'lllat' $lllat\n 'lllon' $lllon\n 'urlat' $urlat\n 'urlon' $urlon\n 'latstep' $latstep\n 'lonstep' $lonstep\n 'lastbucket' $lastbucket\n 'bucketspan' $bucketspan MSTU TODOUBLE /\n 'bucketcount' $bucketcount\n 'gts' $gts SIZE\n 'positions' $gts SIZE $bucketcount * PUSHR0 -\n 'infos' $infos\n 'last' $last\n 'first' $first\n } ->JSON\n 'compressionFlag' true\n }\n ]\n}\nPencode 'img' STORE\n{ 'data' [ $img $lat $long ] 'globalParams' $globalParams }")}}))};var T=t("g",(function(){return Promise.all([c(),s()])}))}}}));
//# sourceMappingURL=p-80e27b63.system.js.map