-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo.js
39 lines (29 loc) · 12.9 KB
/
info.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//example spectra from DB
//{0.00262833096353,0.00260203239355,0.00253197027387,0.00254809140718,0.00254553936253,0.00247900847312,0.0025581035233,0.00266947764835,0.0026997839828,0.00266749814403,0.00274577357885,0.00283524362112,0.0028678299206,0.0029500195804,0.00310981225814,0.00314336996124,0.00315065139018,0.00319379623131,0.00324108072962,0.00327878926198,0.00331609083054,0.00333862178188,0.00337463688649,0.00343541025636,0.0035167040397,0.00355273252916,0.00361960166819,0.00369542314303,0.0037593280355,0.0038163375136,0.00388521888633,0.00396912176021,0.00405014502268,0.00412510511246,0.00419049950338,0.00428082492774,0.00432602386453,0.00439903139111,0.00447593649057,0.00455627104605,0.00467022932194,0.00476800044254,0.00484249743478,0.00495993022782,0.00500925956739,0.00507584999879,0.00511389959801,0.00516984567418,0.00519018138139,0.00520146302056,0.00521228207445,0.0052112229992,0.00518686074304,0.00513490231773,0.00518986639999,0.00529737674691,0.00535327233657,0.00539053349388,0.00540068904445,0.00541445286882,0.00539764670605,0.0053769200324,0.00535812809035,0.00530925503619,0.00526935551919,0.00523026876013,0.00520480042144,0.00518742034283,0.00515398549817,0.0050407189926,0.00492012598417,0.00473498082512,0.00448801092288,0.00417555870893,0.00384103130464,0.0035002741287,0.00317448432419,0.00289576616083,0.00259593532945,0.00234473053199,0.00217376150953,0.00206078337871,0.00198121049242,0.0019121570824,0.00189613814305,0.00187781385633,0.00183655602281,0.00183004721892,0.00176213322168,0.00163273948878,0.00158423316191,0.00157191100418,0.00152600702652,0.00151030999863,0.00148640240691,0.00144382989242,0.0013882946983,0.00133035348191,0.00128536413836,0.00127679526816,0.00130015872494,0.00130620581741,0.00132362090136,0.00131440284533,0.00129232180725,0.00126804814463,0.001236355251,0.00115871923921,0.00109530037325,0.00101413095229,0.0009316411831,0.000863884822937,0.000786911811982,0.00071409562605,0.000663701114966,0.000618055708434,0.000568619867594,0.000523718196565,0.00046252522469,0.000418068897955,0.000391803963499,0.000363503051284,0.000359283953641,0.000360129829415,0.000356537412302,0.000330870162952,0.000328621002989,0.000346481210862,0.000365387231219,0.000342934664858,0.000386328044279,0.000382354273544,0.000351715573474,0.000341583711809,0.000342540786991,0.000335522293622,0.000340040580273,0.000328818067091,0.000349640021213,0.000343339326943,0.0003364876937,0.000336252446597,0.000343344235706,0.000350570206084,0.000345133225427,0.000336343843351,0.000322543560841,0.000301922566754,0.000316145784415,0.000313501679424,0.000285892270232,0.000274204333498,0.000243937799803,0.00022974848231,0.00021294405578,0.000197709440764,0.000185527925363,0.000209415808917,0.000246041653501,0.00023104394322,0.000234323790192,0.00025266152913,0.000241884904959,0.000225918132888,0.000236145365756,0.000211285403191,0.000189709283581,0.000147838986033,0.000159917340753,0.000158056429241}
//a full-ish record
//"timestamp","latitude","longitude","nbands","rrs","ed","geog_point"
//"2017-04-21 12:00:54.4284","50.350716666700002","-4.1356333333300004","170","{0.00262833096353,0.0026020323935500001,0.0025319702738700002,0.0025480914071799999,0.0025455393625299998,0.0024790084731200002,0.0025581035233000001,0.00266947764835,0.0026997839828000001,0.0026674981440300001,0.00274577357885,0.0028352436211199999,0.0028678299206,0.0029500195804000001,0.0031098122581399998,0.0031433699612399999,0.0031506513901799998,0.0031937962313099998,0.0032410807296200002,0.00327878926198,0.0033160908305399999,0.0033386217818799999,0.0033746368864900002,0.0034354102563599999,0.0035167040397000001,0.00355273252916,0.0036196016681899999,0.0036954231430299999,0.0037593280354999998,0.0038163375136000001,0.00388521888633,0.0039691217602099999,0.00405014502268,0.0041251051124600001,0.0041904995033800003,0.0042808249277400002,0.0043260238645299997,0.0043990313911099997,0.0044759364905700002,0.0045562710460500004,0.0046702293219400004,0.00476800044254,0.0048424974347799996,0.0049599302278200003,0.0050092595673899998,0.0050758499987899998,0.0051138995980099999,0.0051698456741800002,0.0051901813813899998,0.0052014630205599998,0.0052122820744500004,0.0052112229992000002,0.0051868607430399999,0.0051349023177299996,0.0051898663999899999,0.0052973767469100003,0.0053532723365700002,0.0053905334938799997,0.0054006890444500003,0.0054144528688199996,0.0053976467060499996,0.0053769200323999997,0.0053581280903500002,0.0053092550361900004,0.0052693555191899999,0.0052302687601300003,0.00520480042144,0.0051874203428300004,0.0051539854981699999,0.0050407189926,0.0049201259841699999,0.0047349808251199998,0.0044880109228799996,0.00417555870893,0.0038410313046399998,0.0035002741287000001,0.0031744843241899999,0.0028957661608300001,0.00259593532945,0.00234473053199,0.00217376150953,0.0020607833787100001,0.0019812104924199999,0.0019121570824000001,0.0018961381430499999,0.0018778138563300001,0.00183655602281,0.00183004721892,0.00176213322168,0.00163273948878,0.0015842331619099999,0.0015719110041799999,0.00152600702652,0.0015103099986299999,0.00148640240691,0.0014438298924200001,0.0013882946983000001,0.00133035348191,0.0012853641383600001,0.0012767952681599999,0.00130015872494,0.0013062058174100001,0.0013236209013600001,0.0013144028453299999,0.0012923218072500001,0.00126804814463,0.001236355251,0.00115871923921,0.0010953003732499999,0.0010141309522899999,0.00093164118309999999,0.000863884822937,0.00078691181198200003,0.00071409562605000002,0.00066370111496599998,0.000618055708434,0.00056861986759400003,0.00052371819656500001,0.00046252522468999998,0.00041806889795500003,0.00039180396349900001,0.00036350305128399999,0.000359283953641,0.000360129829415,0.00035653741230199997,0.00033087016295200002,0.00032862100298900002,0.000346481210862,0.000365387231219,0.00034293466485800001,0.00038632804427899997,0.00038235427354400001,0.00035171557347400001,0.00034158371180899999,0.00034254078699099999,0.00033552229362200002,0.00034004058027300001,0.000328818067091,0.00034964002121300002,0.00034333932694299998,0.00033648769370000001,0.00033625244659699999,0.000343344235706,0.00035057020608399999,0.000345133225427,0.000336343843351,0.000322543560841,0.000301922566754,0.00031614578441500001,0.00031350167942400002,0.00028589227023200002,0.000274204333498,0.00024393779980300001,0.00022974848231000001,0.00021294405577999999,0.00019770944076399999,0.00018552792536300001,0.00020941580891699999,0.00024604165350100002,0.00023104394321999999,0.00023432379019200001,0.00025266152913000001,0.00024188490495900001,0.000225918132888,0.000236145365756,0.000211285403191,0.000189709283581,0.000147838986033,0.00015991734075299999,0.00015805642924100001}","{32.987207246300002,35.219372468800003,37.169458964699999,39.504868230900001,41.008762563200001,41.844618379700002,43.639007854100001,47.90909997,52.404416413100002,53.958890413100001,53.480341389800003,54.831953482499998,54.489166845100002,51.991468353000002,52.498456460100002,55.589193129199998,57.839112955799997,65.117581232000006,79.592839190700005,90.909065028800001,94.928078995099995,97.545104460299996,100.470610394,102.189621344,101.90702355099999,101.789455397,98.491245534599997,96.426022540600002,99.971890543000001,106.44545632400001,112.082589113,117.54227577899999,122.957480909,127.668145021,130.36920115699999,131.62260530399999,133.379881963,134.24342708099999,133.78179888299999,133.75295982599999,134.635011389,136.502390233,137.94804099800001,136.08663811400001,132.97634902300001,131.78824081600001,133.61239675100001,134.855804939,134.265597603,133.31375949400001,133.57625774100001,133.95808413899999,132.154452115,129.131024078,127.91431921,129.35527446899999,131.38457092600001,132.79965826099999,133.95943778,134.11696298300001,133.357093338,132.995220101,133.33322151600001,133.78413337000001,133.53526399899999,132.66799751400001,131.45881089100001,130.623694583,130.25495773399999,129.88488667799999,129.60338871299999,129.249122941,129.353196126,130.00968627200001,129.594604129,127.69683472299999,126.340679216,126.21995597900001,126.50118245100001,126.496450153,126.602535954,126.25580137199999,125.088069064,124.055257647,123.475096368,123.634003006,122.80835837799999,121.970323514,121.37802059800001,121.892826172,122.65956688199999,122.255357811,121.565578233,119.900610692,118.112807162,115.941264334,115.063884728,116.900710645,119.035564686,119.33778681699999,119.04509078700001,118.55215889500001,117.956264945,116.631386624,111.827785295,106.014074209,103.836267041,105.415111142,106.99310126100001,107.98341897900001,108.381913036,108.79038073,108.616054898,105.088506772,99.026797411499999,94.062995178799994,92.121948895700001,92.137076867900007,94.251109194400001,97.840681910800001,100.987571133,102.77433505899999,103.594042195,103.94978091500001,103.79743381599999,101.189515388,90.575787383299996,74.300929506700001,66.574318142500005,74.059607403499996,86.847973050299998,95.163912097799994,97.993745946900006,98.418934023099993,98.113505971600006,96.997406214999998,95.459781446400001,94.039883720700004,93.057096299400001,92.338489559099997,91.562157409899996,90.713485792200004,88.4194959764,83.703232309300006,78.721001477300007,76.011460229099995,75.843025594899999,77.042793110000005,78.2652260781,79.745888988600001,81.946491564599995,83.971429750799999,85.013585826400003,84.728510966200005,83.391867076799997,81.639004088500002,80.998126410699996,81.711640795099996,81.860814083099996,81.259910022699998,80.449067729999996,80.357793724199993,80.237640115399998,79.712874451199994,79.131910608599995,78.356332982400005,77.100675343800006,74.262843137000004,69.298082355199995,63.739765745600003}","0101000020E61000006A99EB76E38A10C0BFD1A248E42C4940"
const PLOTLY_KEY = "d2r90DUO7klS4cjjrhuv";
const PLOTLY_USERNAME = 'doclements';
const plotly = require('plotly')(PLOTLY_USERNAME,PLOTLY_KEY)
const data = [0.00262833096353,0.00260203239355,0.00253197027387,0.00254809140718,0.00254553936253,0.00247900847312,0.0025581035233,0.00266947764835,0.0026997839828,0.00266749814403,0.00274577357885,0.00283524362112,0.0028678299206,0.0029500195804,0.00310981225814,0.00314336996124,0.00315065139018,0.00319379623131,0.00324108072962,0.00327878926198,0.00331609083054,0.00333862178188,0.00337463688649,0.00343541025636,0.0035167040397,0.00355273252916,0.00361960166819,0.00369542314303,0.0037593280355,0.0038163375136,0.00388521888633,0.00396912176021,0.00405014502268,0.00412510511246,0.00419049950338,0.00428082492774,0.00432602386453,0.00439903139111,0.00447593649057,0.00455627104605,0.00467022932194,0.00476800044254,0.00484249743478,0.00495993022782,0.00500925956739,0.00507584999879,0.00511389959801,0.00516984567418,0.00519018138139,0.00520146302056,0.00521228207445,0.0052112229992,0.00518686074304,0.00513490231773,0.00518986639999,0.00529737674691,0.00535327233657,0.00539053349388,0.00540068904445,0.00541445286882,0.00539764670605,0.0053769200324,0.00535812809035,0.00530925503619,0.00526935551919,0.00523026876013,0.00520480042144,0.00518742034283,0.00515398549817,0.0050407189926,0.00492012598417,0.00473498082512,0.00448801092288,0.00417555870893,0.00384103130464,0.0035002741287,0.00317448432419,0.00289576616083,0.00259593532945,0.00234473053199,0.00217376150953,0.00206078337871,0.00198121049242,0.0019121570824,0.00189613814305,0.00187781385633,0.00183655602281,0.00183004721892,0.00176213322168,0.00163273948878,0.00158423316191,0.00157191100418,0.00152600702652,0.00151030999863,0.00148640240691,0.00144382989242,0.0013882946983,0.00133035348191,0.00128536413836,0.00127679526816,0.00130015872494,0.00130620581741,0.00132362090136,0.00131440284533,0.00129232180725,0.00126804814463,0.001236355251,0.00115871923921,0.00109530037325,0.00101413095229,0.0009316411831,0.000863884822937,0.000786911811982,0.00071409562605,0.000663701114966,0.000618055708434,0.000568619867594,0.000523718196565,0.00046252522469,0.000418068897955,0.000391803963499,0.000363503051284,0.000359283953641,0.000360129829415,0.000356537412302,0.000330870162952,0.000328621002989,0.000346481210862,0.000365387231219,0.000342934664858,0.000386328044279,0.000382354273544,0.000351715573474,0.000341583711809,0.000342540786991,0.000335522293622,0.000340040580273,0.000328818067091,0.000349640021213,0.000343339326943,0.0003364876937,0.000336252446597,0.000343344235706,0.000350570206084,0.000345133225427,0.000336343843351,0.000322543560841,0.000301922566754,0.000316145784415,0.000313501679424,0.000285892270232,0.000274204333498,0.000243937799803,0.00022974848231,0.00021294405578,0.000197709440764,0.000185527925363,0.000209415808917,0.000246041653501,0.00023104394322,0.000234323790192,0.00025266152913,0.000241884904959,0.000225918132888,0.000236145365756,0.000211285403191,0.000189709283581,0.000147838986033,0.000159917340753,0.000158056429241];
const trace = {
x : [],
y : []
}
for (let x = 0; x < data.length; x++) {
const element = data[x];
trace['x'].push(x);
trace['y'].push(element);
}
const plot_data = (data) => {
const graph_options = {
filename : "spectra test",
fileopt : "overwrite"
}
console.log(data.x.length);
//plotly.plot([trace], graph_options, function(err,msg){
// console.log(msg)
//})
}
plot_data(trace)