2 Dimensional Array averaging

Hi, I have a 2d array coming from a Spectrometer that has 2048 wavelengths and Intensities, I need an average of every 200 values. Here is an example of what the array looks like.
image

Can someone please help me? So far I have got it right to put all this into a Table but this isn't going to help anyone since they want to be able to put those average values into a PLC for analysis and historizing.

Welcome to the forum.

Do you mean you want average the 173 value numbers and separately the1832 value numbers in blocks of 200? What do you want out? Another array of 10 elements with the averages in? What about the 48 left at the end?

Hi, The [1] values averaged in blocks of 200, The [0] values are spectrometers nm value, Which doesn't change so I don't need to worry about this, What I eventually want to get is an average intensity of the following:

173nm - 259.14nm [0-199] = ~1900
259.57nm - 346.38mn [200-399] = ~1800
....And up to 1200nm.
Here is an example of how I recieve the Array:

[[173.75,1873],[174.1755878,1821],[174.6012112,1793],[175.0268702,1770],[175.4525648,1758],[175.878295,1759],[176.3040608,1769],[176.7298622,1773],[177.1556992,1775],[177.5815718,1772],[178.00748,1769],[178.4334238,1768],[178.8594032,1759],[179.2854182,1752],[179.7114688,1757],[180.137555,1758],[180.5636768,1755],[180.9898342,1760],[181.4160272,1770],[181.8422558,1775],[182.26852,1777],[182.6948198,1774],[183.1211552,1770],[183.5475262,1765],[183.9739328,1762],[184.400375,1769],[184.8268528,1784],[185.2533662,1801],[185.6799152,1813],[186.1064998,1815],[186.53312,1809],[186.9597758,1804],[187.3864672,1800],[187.8131942,1800],[188.23995680000002,1811],[188.666755,1822],[189.0935888,1822],[189.5204582,1809],[189.94736319999998,1797],[190.3743038,1783],[190.80128,1760],[191.2282918,1740],[191.65533920000001,1737],[192.0824222,1737],[192.5095408,1735],[192.936695,1741],[193.3638848,1748],[193.7911102,1754],[194.2183712,1764],[194.6456678,1776],[195.073,1790],[195.5003678,1796],[195.9277712,1792],[196.3552102,1774],[196.7826848,1752],[197.210195,1738],[197.6377408,1741],[198.0653222,1752],[198.4929392,1773],[198.9205918,1793],[199.34828,1799],[199.7760038,1793],[200.2037632,1789],[200.6315582,1780],[201.0593888,1775],[201.487255,1784],[201.9151568,1795],[202.3430942,1798],[202.7710672,1809],[203.1990758,1820],[203.62712,1820],[204.0551998,1820],[204.4833152,1821],[204.9114662,1814],[205.3396528,1810],[205.767875,1810],[206.1961328,1813],[206.62442620000002,1819],[207.0527552,1816],[207.4811198,1802],[207.90952,1788],[208.3379558,1768],[208.7664272,1742],[209.1949342,1723],[209.6234768,1712],[210.052055,1711],[210.4806688,1717],[210.9093182,1726],[211.3380032,1737],[211.7667238,1742],[212.19548,1737],[212.6242718,1730],[213.0530992,1732],[213.4819622,1743],[213.9108608,1753],[214.339795,1769],[214.76876479999999,1786],[215.1977702,1801],[215.6268112,1807],[216.0558878,1810],[216.485,1809],[216.9141478,1809],[217.3433312,1808],[217.7725502,1805],[218.2018048,1804],[218.631095,1804],[219.0604208,1808],[219.4897822,1808],[219.9191792,1803],[220.34861180000001,1794],[220.77808,1788],[221.2075838,1783],[221.6371232,1774],[222.0666982,1773],[222.4963088,1782],[222.925955,1784],[223.3556368,1775],[223.7853542,1769],[224.2151072,1766],[224.6448958,1765],[225.07472,1770],[225.5045798,1784],[225.9344752,1810],[226.3644062,1833],[226.7943728,1850],[227.224375,1863],[227.6544128,1864],[228.08448620000001,1853],[228.5145952,1836],[228.9447398,1823],[229.37492,1819],[229.80513580000002,1815],[230.2353872,1809],[230.6656742,1799],[231.0959968,1781],[231.526355,1762],[231.9567488,1750],[232.3871782,1743],[232.8176432,1745],[233.2481438,1755],[233.67867999999999,1769],[234.1092518,1780],[234.5398592,1788],[234.9705022,1799],[235.4011808,1801],[235.831895,1797],[236.2626448,1803],[236.6934302,1816],[237.1242512,1822],[237.5551078,1824],[237.986,1816],[238.4169278,1789],[238.8478912,1756],[239.2788902,1731],[239.7099248,1720],[240.140995,1719],[240.5721008,1731],[241.0032422,1744],[241.43441919999998,1754],[241.86563180000002,1761],[242.29688,1766],[242.7281638,1768],[243.1594832,1767],[243.5908382,1767],[244.0222288,1768],[244.453655,1774],[244.8851168,1775],[245.3166142,1770],[245.7481472,1762],[246.1797158,1759],[246.61132,1754],[247.0429598,1756],[247.47463520000002,1761],[247.9063462,1768],[248.33809280000003,1776],[248.769875,1778],[249.2016928,1775],[249.6335462,1780],[250.0654352,1790],[250.4973598,1787],[250.92932,1782],[251.3613158,1780],[251.7933472,1784],[252.2254142,1787],[252.6575168,1789],[253.089655,1794],[253.52182879999998,1797],[253.9540382,1788],[254.38628319999998,1778],[254.8185638,1777],[255.25088,1775],[255.6832318,1773],[256.11561919999997,1773],[256.5480422,1779],[256.9805008,1787],[257.412995,1792],[257.8455248,1802],[258.2780902,1814],[258.7106912,1807],[259.1433278,1791],[259.576,1784],[260.0087078,1773],[260.4414512,1764],[260.8742302,1767],[261.30704479999997,1775],[261.739895,1781],[262.1727808,1788],[262.6057022,1787],[263.0386592,1778],[263.4716518,1770],[263.90468,1767],[264.3377438,1770],[264.7708432,1782],[265.2039782,1800],[265.6371488,1816],[266.070355,1828],[266.50359679999997,1832],[266.93687420000003,1826],[267.37018720000003,1823],[267.8035358,1823],[268.23692,1822],[268.6703398,1821],[269.1037952,1820],[269.53728620000004,1815],[269.9708128,1803],[270.40437499999996,1784],[270.8379728,1775],[271.2716062,1777],[271.7052752,1785],[272.1389798,1793],[272.57272,1809],[273.0064958,1822],[273.4403072,1827],[273.8741542,1822],[274.3080368,1816],[274.741955,1807],[275.1759088,1800],[275.6098982,1792],[276.0439232,1796],[276.4779838,1805],[276.91208,1800],[277.3462118,1794],[277.78037919999997,1795],[278.2145822,1785],[278.6488208,1771],[279.083095,1774],[279.5174048,1776],[279.9517502,1779],[280.3861312,1797],[280.8205478,1818],[281.255,1831],[281.6894878,1848],[282.1240112,1856],[282.5585702,1849],[282.9931648,1840],[283.427795,1835],[283.8624608,1820],[284.2971622,1809],[284.7318992,1805],[285.1666718,1803],[285.60148000000004,1800],[286.0363238,1803],[286.4712032,1805],[286.9061182,1801],[287.3410688,1788],[287.776055,1773],[288.2110768,1761],[288.6461342,1754],[289.0812272,1754],[289.5163558,1767],[289.95152,1785],[290.3867198,1792],[290.8219552,1787],[291.2572262,1780],[291.6925328,1770],[292.127875,1762],[292.5632528,1767],[292.9986662,1779],[293.4341152,1779],[293.8695998,1771],[294.30512,1761],[294.7406758,1748],[295.1762672,1737],[295.6118942,1737],[296.0475568,1742],[296.483255,1740],[296.91898879999997,1737],[297.3547582,1733],[297.7905632,1735],[298.2264038,1743],[298.66228,1757],[299.0981918,1773],[299.5341392,1790],[299.9701222,1802],[300.4061408,1810],[300.842195,1814],[301.2782848,1814],[301.7144102,1811],[302.1505712,1805],[302.58676779999996,1792],[303.023,1783],[303.4592678,1776],[303.8955712,1763],[304.33191020000004,1746],[304.7682848,1734],[305.204695,1721],[305.6411408,1711],[306.0776222,1711],[306.5141392,1724],[306.95069179999996,1739],[307.38728000000003,1751],[307.82390380000004,1755],[308.2605632,1750],[308.69725819999996,1744],[309.1339888,1739],[309.570755,1737],[310.0075568,1739],[310.44439420000003,1741],[310.8812672,1736],[311.3181758,1729],[311.75512000000003,1727],[312.1920998,1728],[312.6291152,1734],[313.0661662,1745],[313.50325280000004,1760],[313.940375,1775],[314.3775328,1788],[314.8147262,1798],[315.2519552,1806],[315.6892198,1813],[316.12652,1814],[316.5638558,1806],[317.0012272,1794],[317.4386342,1778],[317.87607679999996,1759],[318.313555,1743],[318.7510688,1745],[319.1886182,1756],[319.62620319999996,1771],[320.0638238,1786],[320.50148,1798],[320.9391718,1801],[321.3768992,1803],[321.8146622,1805],[322.2524608,1800],[322.690295,1793],[323.12816480000004,1786],[323.5660702,1780],[324.00401120000004,1768],[324.4419878,1762],[324.88,1768],[325.3180478,1776],[325.7561312,1777],[326.1942502,1776],[326.6324048,1774],[327.070595,1770],[327.50882079999997,1761],[327.9470822,1759],[328.3853792,1771],[328.82371179999996,1783],[329.26207999999997,1789],[329.70048380000003,1803],[330.1389232,1817],[330.5773982,1819],[331.01590880000003,1822],[331.45445500000005,1829],[331.8930368,1829],[332.3316542,1825],[332.7703072,1817],[333.2089958,1806],[333.64772000000005,1792],[334.0864798,1773],[334.5252752,1757],[334.9641062,1755],[335.40297280000004,1762],[335.841875,1770],[336.28081280000004,1772],[336.7197862,1757],[337.1587952,1739],[337.5978398,1718],[338.03692,1699],[338.4760358,1693],[338.9151872,1709],[339.3543742,1729],[339.7935968,1747],[340.232855,1759],[340.6721488,1764],[341.1114782,1762],[341.55084320000003,1753],[341.99024380000003,1739],[342.42967999999996,1731],[342.8691518,1726],[343.30865919999997,1727],[343.74820220000004,1733],[344.1877808,1746],[344.627395,1760],[345.0670448,1775],[345.5067302,1790],[345.94645119999996,1799],[346.3862078,1803],[346.826,1807],[347.2658278,1809],[347.7056912,1807],[348.1455902,1808],[348.58552480000003,1804],[349.025495,1797],[349.4655008,1790],[349.9055422,1788],[350.3456192,1783],[350.7857318,1776],[351.22587999999996,1772],[351.66606379999996,1771],[352.1062832,1760],[352.5465382,1748],[352.9868288,1746],[353.42715499999997,1743],[353.8675168,1743],[354.3079142,1743],[354.7483472,1744],[355.1888158,1741],[355.62932,1734],[356.0698598,1722],[356.5104352,1718],[356.9510462,1716],[357.3916928,1724],[357.832375,1742],[358.2730928,1757],[358.71384620000003,1765],[359.15463520000003,1779],[359.5954598,1784],[360.03632000000005,1776],[360.4772158,1775],[360.9181472,1781],[361.3591142,1786],[361.8001168,1790],[362.241155,1803],[362.68222879999996,1810],[363.1233382,1812],[363.56448320000004,1818],[364.0056638,1825],[364.44687999999996,1833],[364.8881318,1844],[365.3294192,1849],[365.7707422,1838],[366.21210080000003,1816],[366.653495,1786],[367.0949248,1759],[367.5363902,1736],[367.9778912,1716],[368.4194278,1708],[368.861,1706],[369.30260780000003,1697],[369.7442512,1691],[370.18593020000003,1692],[370.6276448,1696],[371.069395,1694],[371.51118080000003,1691],[371.9530022,1691],[372.3948592,1698],[372.8367518,1711],[373.27868,1730],[373.7206438,1750],[374.1626432,1772],[374.6046782,1790],[375.04674880000005,1802],[375.488855,1811],[375.9309968,1818],[376.3731742,1819],[376.81538720000003,1818],[377.2576358,1814],[377.69992,1814],[378.14223979999997,1815],[378.5845952,1816],[379.0269862,1810],[379.4694128,1804],[379.911875,1802],[380.3543728,1804],[380.79690619999997,1809],[381.2394752,1817],[381.6820798,1821],[382.12472,1816],[382.5673958,1805],[383.0101072,1790],[383.4528542,1781],[383.8956368,1776],[384.338455,1767],[384.78130880000003,1762],[385.2241982,1763],[385.6671232,1755],[386.1100838,1743],[386.55308,1734],[386.9961118,1725],[387.4391792,1720],[387.8822822,1722],[388.3254208,1734],[388.768595,1751],[389.2118048,1767],[389.6550502,1780],[390.0983312,1791],[390.54164779999996,1801],[390.985,1807],[391.4283878,1806],[391.8718112,1802],[392.3152702,1791],[392.7587648,1774],[393.202295,1763],[393.64586080000004,1757],[394.0894622,1753],[394.53309920000004,1753],[394.9767718,1763],[395.42048,1772],[395.8642238,1779],[396.30800320000003,1789],[396.7518182,1803],[397.1956688,1810],[397.639555,1814],[398.08347679999997,1816],[398.5274342,1816],[398.9714272,1808],[399.4154558,1793],[399.85952,1779],[400.3036198,1767],[400.74775520000003,1754],[401.1919262,1753],[401.63613280000004,1758],[402.080375,1756],[402.5246528,1750],[402.9689662,1745],[403.4133152,1735],[403.8576998,1726],[404.30212,1729],[404.74657579999996,1737],[405.1910672,1746],[405.6355942,1754],[406.0801568,1761],[406.524755,1768],[406.96938880000005,1774],[407.4140582,1771],[407.8587632,1768],[408.3035038,1765],[408.74828,1761],[409.19309180000005,1762],[409.6379392,1767],[410.0828222,1773],[410.5277408,1778],[410.97269500000004,1788],[411.41768479999996,1799],[411.86271020000004,1808],[412.3077712,1811],[412.7528678,1805],[413.198,1791],[413.6431678,1773],[414.0883712,1755],[414.5336102,1742],[414.9788848,1741],[415.424195,1747],[415.8695408,1756],[416.3149222,1770],[416.7603392,1783],[417.20579180000004,1792],[417.65128,1790],[418.0968038,1785],[418.5423632,1781],[418.9879582,1774],[419.4335888,1767],[419.879255,1768],[420.3249568,1772],[420.7706942,1779],[421.2164672,1794],[421.6622758,1809],[422.10812,1813],[422.55399980000004,1811],[422.99991520000003,1809],[423.44586619999995,1803],[423.89185280000004,1795],[424.337875,1792],[424.7839328,1790],[425.2300262,1784],[425.6761552,1783],[426.1223198,1793],[426.56852000000003,1805],[427.0147558,1816],[427.4610272,1827],[427.90733420000004,1833],[428.3536768,1831],[428.800055,1823],[429.2464688,1819],[429.6929182,1816],[430.1394032,1808],[430.5859238,1799],[431.03248,1797],[431.47907180000004,1792],[431.9256992,1778],[432.3723622,1767],[432.8190608,1754],[433.26579499999997,1738],[433.7125648,1724],[434.1593702,1722],[434.6062112,1725],[435.0530878,1740],[435.5,1758],[435.94694780000003,1772],[436.39393120000005,1781],[436.8409502,1788],[437.2880048,1789],[437.735095,1791],[438.1822208,1795],[438.6293822,1793],[439.07657919999997,1788],[439.5238118,1783],[439.97108,1777],[440.4183838,1780],[440.8657232,1795],[441.3130982,1811],[441.7605088,1823],[442.20795499999997,1831],[442.6554368,1824],[443.1029542,1806],[443.55050719999997,1792],[443.99809580000004,1781],[444.44572,1781],[444.8933798,1796],[445.34107520000003,1814],[445.7888062,1827],[446.2365728,1834],[446.684375,1831],[447.1322128,1823],[447.5800862,1813],[448.0279952,1803],[448.4759398,1794],[448.92392,1785],[449.3719358,1766],[449.8199872,1747],[450.2680742,1737],[450.7161968,1733],[451.164355,1735],[451.6125488,1749],[452.0607782,1761],[452.5090432,1763],[452.9573438,1760],[453.40568,1751],[453.8540518,1740],[454.3024592,1742],[454.7509022,1750],[455.1993808,1755],[455.647895,1763],[456.09644480000003,1777],[456.5450302,1791],[456.9936512,1806],[457.4423078,1817],[457.891,1829],[458.3397278,1833],[458.78849119999995,1830],[459.2372902,1821],[459.6861248,1817],[460.134995,1816],[460.58390080000004,1816],[461.0328422,1808],[461.4818192,1797],[461.93083179999996,1792],[462.37987999999996,1792],[462.8289638,1791],[463.2780832,1797],[463.72723820000004,1808],[464.1764288,1816],[464.625655,1821],[465.0749168,1834],[465.5242142,1854],[465.9735472,1863],[466.4229158,1863],[466.87232,1860],[467.3217598,1841],[467.77123520000004,1811],[468.2207462,1785],[468.6702928,1760],[469.119875,1740],[469.5694928,1732],[470.01914619999997,1733],[470.4688352,1736],[470.9185598,1739],[471.36832000000004,1742],[471.8181158,1744],[472.2679472,1745],[472.7178142,1756],[473.1677168,1769],[473.617655,1774],[474.06762879999997,1772],[474.5176382,1773],[474.9676832,1775],[475.4177638,1789],[475.86788,1812],[476.3180318,1837],[476.7682192,1853],[477.21844219999997,1860],[477.6687008,1852],[478.118995,1835],[478.5693248,1814],[479.0196902,1802],[479.4700912,1802],[479.9205278,1805],[480.371,1803],[480.8215078,1803],[481.27205119999996,1796],[481.72263019999997,1780],[482.17324479999996,1769],[482.623895,1766],[483.07458080000004,1762],[483.5253022,1755],[483.9760592,1749],[484.4268518,1739],[484.87768,1730],[485.3285438,1728],[485.7794432,1734],[486.2303782,1744],[486.6813488,1750],[487.132355,1762],[487.5833968,1776],[488.0344742,1781],[488.4855872,1774],[488.9367358,1776],[489.38792,1784],[489.8391398,1784],[490.29039520000003,1781],[490.7416862,1783],[491.1930128,1781],[491.644375,1768],[492.0957728,1757],[492.5472062,1758],[492.9986752,1768],[493.4501798,1774],[493.90172,1773],[494.3532958,1772],[494.8049072,1772],[495.2565542,1768],[495.7082368,1764],[496.15995499999997,1763],[496.6117088,1761],[497.06349819999997,1755],[497.51532319999995,1745],[497.96718380000004,1730],[498.41908,1724],[498.8710118,1725],[499.3229792,1721],[499.7749822,1725],[500.2270208,1736],[500.67909499999996,1744],[501.1312048,1746],[501.58335020000004,1746],[502.03553120000004,1746],[502.4877478,1747],[502.94,1748],[503.3922878,1757],[503.8446112,1771],[504.2969702,1778],[504.74936479999997,1785],[505.20179499999995,1796],[505.65426080000003,1803],[506.1067622,1806],[506.5592992,1815],[507.0118718,1821],[507.46448,1819],[507.9171238,1816],[508.3698032,1817],[508.8225182,1809],[509.27526880000005,1802],[509.72805500000004,1807],[510.1808768,1812],[510.6337342,1815],[511.0866272,1827],[511.5395558,1836],[511.99252,1833],[512.4455198,1825],[512.8985551999999,1805],[513.3516262,1773],[513.8047328,1746],[514.257875,1727],[514.7110528000001,1718],[515.1642661999999,1730],[515.6175152000001,1749],[516.0707998,1762],[516.52412,1776],[516.9774758000001,1787],[517.4308672,1781],[517.8842942,1777],[518.3377568000001,1774],[518.791255,1760],[519.2447887999999,1749],[519.6983582,1747],[520.1519632,1738],[520.6056037999999,1732],[521.05928,1742],[521.5129918,1744],[521.9667392,1743],[522.4205222,1752],[522.8743408,1761],[523.328195,1760],[523.7820848,1759],[524.2360102,1763],[524.6899712000001,1768],[525.1439678,1771],[525.598,1777],[526.0520678,1789],[526.5061711999999,1796],[526.9603102,1798],[527.4144848,1800],[527.868695,1799],[528.3229408,1794],[528.7772222000001,1790],[529.2315392,1787],[529.6858918,1779],[530.1402800000001,1767],[530.5947037999999,1757],[531.0491632000001,1754],[531.5036582,1753],[531.9581888,1751],[532.4127550000001,1761],[532.8673568,1773],[533.3219942000001,1783],[533.7766672,1791],[534.2313758,1798],[534.6861200000001,1796],[535.1408997999999,1789],[535.5957152,1773],[536.0505662,1751],[536.5054528000001,1740],[536.960375,1735],[537.4153328,1737],[537.8703262,1745],[538.3253552,1764],[538.7804198,1785],[539.23552,1799],[539.6906558000001,1802],[540.1458272,1800],[540.6010342,1798],[541.0562768,1781],[541.511555,1767],[541.9668687999999,1767],[542.4222182,1773],[542.8776032000001,1776],[543.3330238,1783],[543.7884799999999,1801],[544.2439718,1815],[544.6994992,1824],[545.1550622,1830],[545.6106608,1829],[546.0662950000001,1819],[546.5219648,1806],[546.9776701999999,1787],[547.4334111999999,1772],[547.8891878,1769],[548.345,1770],[548.8008478,1769],[549.2567312,1779],[549.7126502,1791],[550.1686048,1800],[550.624595,1801],[551.0806207999999,1798],[551.5366822,1793],[551.9927792000001,1788],[552.4489118,1779],[552.90508,1773],[553.3612838,1770],[553.8175232,1769],[554.2737982,1768],[554.7301087999999,1771],[555.186455,1780],[555.6428367999999,1791],[556.0992542,1798],[556.5557072,1797],[557.0121958,1795],[557.4687200000001,1801],[557.9252798,1810],[558.3818752,1814],[558.8385062,1818],[559.2951728,1813],[559.751875,1800],[560.2086128000001,1788],[560.6653862000001,1783],[561.1221952000001,1784],[561.5790397999999,1788],[562.03592,1788],[562.4928358,1790],[562.9497872,1786],[563.4067742,1783],[563.8637968,1791],[564.3208549999999,1809],[564.7779488,1818],[565.2350782000001,1827],[565.6922432,1834],[566.1494438,1830],[566.60668,1813],[567.0639518,1802],[567.5212592,1792],[567.9786022000001,1790],[568.4359808,1791],[568.893395,1789],[569.3508448,1785],[569.8083302,1778],[570.2658512,1769],[570.7234077999999,1768],[571.181,1768],[571.6386278,1765],[572.0962912,1772],[572.5539902,1785],[573.0117248,1796],[573.469495,1803],[573.9273008,1808],[574.3851422,1807],[574.8430192,1800],[575.3009318000001,1788],[575.7588800000001,1779],[576.2168638,1778],[576.6748832000001,1778],[577.1329382,1773],[577.5910288,1769],[578.0491549999999,1768],[578.5073168,1771],[578.9655141999999,1777],[579.4237472,1776],[579.8820158000001,1771],[580.34032,1775],[580.7986598,1773],[581.2570352,1765],[581.7154462,1773],[582.1738928,1792],[582.6323749999999,1800],[583.0908928,1805],[583.5494462,1812],[584.0080352,1807],[584.4666598,1793],[584.92532,1780],[585.3840158,1770],[585.8427472,1759],[586.3015141999999,1755],[586.7603168,1758],[587.219155,1774],[587.6780288,1792],[588.1369382,1798],[588.5958832,1797],[589.0548638,1790],[589.51388,1776],[589.9729318,1770],[590.4320192,1778],[590.8911422000001,1792],[591.3503008,1804],[591.809495,1807],[592.2687248,1799],[592.7279902,1796],[593.1872912,1791],[593.6466278,1789],[594.106,1794],[594.5654078,1800],[595.0248512000001,1793],[595.4843302,1795],[595.9438448000001,1805],[596.403395,1806],[596.8629808000001,1803],[597.3226022,1798],[597.7822592,1784],[598.2419517999999,1770],[598.7016799999999,1769],[599.1614438,1776],[599.6212432,1791],[600.0810782000001,1811],[600.5409488,1817],[601.000855,1808],[601.4607968,1797],[601.9207742,1783],[602.3807872,1769],[602.8408358,1755],[603.30092,1744],[603.7610397999999,1731],[604.2211952,1716],[604.6813862,1717],[605.1416128000001,1729],[605.6018750000001,1739],[606.0621728,1755],[606.5225062,1770],[606.9828752000001,1770],[607.4432798,1760],[607.90372,1752],[608.3641958000001,1744],[608.8247071999999,1740],[609.2852542,1736],[609.7458368,1734],[610.206455,1734],[610.6671088,1733],[611.1277982,1729],[611.5885232,1730],[612.0492838,1734],[612.51008,1741],[612.9709118000001,1754],[613.4317791999999,1768],[613.8926822,1781],[614.3536208,1790],[614.814595,1789],[615.2756048,1779],[615.7366502,1765],[616.1977312,1750],[616.6588478,1736]]

You can just write a small function like this

[{"id":"7a58f133.7c9708","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"6796a14f.099db","type":"inject","z":"7a58f133.7c9708","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[[173.75,1873],[174.1755878,1821],[174.6012112,1793],[175.0268702,1770],[175.4525648,1758],[175.878295,1759],[176.3040608,1769],[176.7298622,1773],[177.1556992,1775],[177.5815718,1772],[178.00748,1769],[178.4334238,1768],[178.8594032,1759],[179.2854182,1752],[179.7114688,1757],[180.137555,1758],[180.5636768,1755],[180.9898342,1760],[181.4160272,1770],[181.8422558,1775],[182.26852,1777],[182.6948198,1774],[183.1211552,1770],[183.5475262,1765],[183.9739328,1762],[184.400375,1769],[184.8268528,1784],[185.2533662,1801],[185.6799152,1813],[186.1064998,1815],[186.53312,1809],[186.9597758,1804],[187.3864672,1800],[187.8131942,1800],[188.23995680000002,1811],[188.666755,1822],[189.0935888,1822],[189.5204582,1809],[189.94736319999998,1797],[190.3743038,1783],[190.80128,1760],[191.2282918,1740],[191.65533920000001,1737],[192.0824222,1737],[192.5095408,1735],[192.936695,1741],[193.3638848,1748],[193.7911102,1754],[194.2183712,1764],[194.6456678,1776],[195.073,1790],[195.5003678,1796],[195.9277712,1792],[196.3552102,1774],[196.7826848,1752],[197.210195,1738],[197.6377408,1741],[198.0653222,1752],[198.4929392,1773],[198.9205918,1793],[199.34828,1799],[199.7760038,1793],[200.2037632,1789],[200.6315582,1780],[201.0593888,1775],[201.487255,1784],[201.9151568,1795],[202.3430942,1798],[202.7710672,1809],[203.1990758,1820],[203.62712,1820],[204.0551998,1820],[204.4833152,1821],[204.9114662,1814],[205.3396528,1810],[205.767875,1810],[206.1961328,1813],[206.62442620000002,1819],[207.0527552,1816],[207.4811198,1802],[207.90952,1788],[208.3379558,1768],[208.7664272,1742],[209.1949342,1723],[209.6234768,1712],[210.052055,1711],[210.4806688,1717],[210.9093182,1726],[211.3380032,1737],[211.7667238,1742],[212.19548,1737],[212.6242718,1730],[213.0530992,1732],[213.4819622,1743],[213.9108608,1753],[214.339795,1769],[214.76876479999999,1786],[215.1977702,1801],[215.6268112,1807],[216.0558878,1810],[216.485,1809],[216.9141478,1809],[217.3433312,1808],[217.7725502,1805],[218.2018048,1804],[218.631095,1804],[219.0604208,1808],[219.4897822,1808],[219.9191792,1803],[220.34861180000001,1794],[220.77808,1788],[221.2075838,1783],[221.6371232,1774],[222.0666982,1773],[222.4963088,1782],[222.925955,1784],[223.3556368,1775],[223.7853542,1769],[224.2151072,1766],[224.6448958,1765],[225.07472,1770],[225.5045798,1784],[225.9344752,1810],[226.3644062,1833],[226.7943728,1850],[227.224375,1863],[227.6544128,1864],[228.08448620000001,1853],[228.5145952,1836],[228.9447398,1823],[229.37492,1819],[229.80513580000002,1815],[230.2353872,1809],[230.6656742,1799],[231.0959968,1781],[231.526355,1762],[231.9567488,1750],[232.3871782,1743],[232.8176432,1745],[233.2481438,1755],[233.67867999999999,1769],[234.1092518,1780],[234.5398592,1788],[234.9705022,1799],[235.4011808,1801],[235.831895,1797],[236.2626448,1803],[236.6934302,1816],[237.1242512,1822],[237.5551078,1824],[237.986,1816],[238.4169278,1789],[238.8478912,1756],[239.2788902,1731],[239.7099248,1720],[240.140995,1719],[240.5721008,1731],[241.0032422,1744],[241.43441919999998,1754],[241.86563180000002,1761],[242.29688,1766],[242.7281638,1768],[243.1594832,1767],[243.5908382,1767],[244.0222288,1768],[244.453655,1774],[244.8851168,1775],[245.3166142,1770],[245.7481472,1762],[246.1797158,1759],[246.61132,1754],[247.0429598,1756],[247.47463520000002,1761],[247.9063462,1768],[248.33809280000003,1776],[248.769875,1778],[249.2016928,1775],[249.6335462,1780],[250.0654352,1790],[250.4973598,1787],[250.92932,1782],[251.3613158,1780],[251.7933472,1784],[252.2254142,1787],[252.6575168,1789],[253.089655,1794],[253.52182879999998,1797],[253.9540382,1788],[254.38628319999998,1778],[254.8185638,1777],[255.25088,1775],[255.6832318,1773],[256.11561919999997,1773],[256.5480422,1779],[256.9805008,1787],[257.412995,1792],[257.8455248,1802],[258.2780902,1814],[258.7106912,1807],[259.1433278,1791],[259.576,1784],[260.0087078,1773],[260.4414512,1764],[260.8742302,1767],[261.30704479999997,1775],[261.739895,1781],[262.1727808,1788],[262.6057022,1787],[263.0386592,1778],[263.4716518,1770],[263.90468,1767],[264.3377438,1770],[264.7708432,1782],[265.2039782,1800],[265.6371488,1816],[266.070355,1828],[266.50359679999997,1832],[266.93687420000003,1826],[267.37018720000003,1823],[267.8035358,1823],[268.23692,1822],[268.6703398,1821],[269.1037952,1820],[269.53728620000004,1815],[269.9708128,1803],[270.40437499999996,1784],[270.8379728,1775],[271.2716062,1777],[271.7052752,1785],[272.1389798,1793],[272.57272,1809],[273.0064958,1822],[273.4403072,1827],[273.8741542,1822],[274.3080368,1816],[274.741955,1807],[275.1759088,1800],[275.6098982,1792],[276.0439232,1796],[276.4779838,1805],[276.91208,1800],[277.3462118,1794],[277.78037919999997,1795],[278.2145822,1785],[278.6488208,1771],[279.083095,1774],[279.5174048,1776],[279.9517502,1779],[280.3861312,1797],[280.8205478,1818],[281.255,1831],[281.6894878,1848],[282.1240112,1856],[282.5585702,1849],[282.9931648,1840],[283.427795,1835],[283.8624608,1820],[284.2971622,1809],[284.7318992,1805],[285.1666718,1803],[285.60148000000004,1800],[286.0363238,1803],[286.4712032,1805],[286.9061182,1801],[287.3410688,1788],[287.776055,1773],[288.2110768,1761],[288.6461342,1754],[289.0812272,1754],[289.5163558,1767],[289.95152,1785],[290.3867198,1792],[290.8219552,1787],[291.2572262,1780],[291.6925328,1770],[292.127875,1762],[292.5632528,1767],[292.9986662,1779],[293.4341152,1779],[293.8695998,1771],[294.30512,1761],[294.7406758,1748],[295.1762672,1737],[295.6118942,1737],[296.0475568,1742],[296.483255,1740],[296.91898879999997,1737],[297.3547582,1733],[297.7905632,1735],[298.2264038,1743],[298.66228,1757],[299.0981918,1773],[299.5341392,1790],[299.9701222,1802],[300.4061408,1810],[300.842195,1814],[301.2782848,1814],[301.7144102,1811],[302.1505712,1805],[302.58676779999996,1792],[303.023,1783],[303.4592678,1776],[303.8955712,1763],[304.33191020000004,1746],[304.7682848,1734],[305.204695,1721],[305.6411408,1711],[306.0776222,1711],[306.5141392,1724],[306.95069179999996,1739],[307.38728000000003,1751],[307.82390380000004,1755],[308.2605632,1750],[308.69725819999996,1744],[309.1339888,1739],[309.570755,1737],[310.0075568,1739],[310.44439420000003,1741],[310.8812672,1736],[311.3181758,1729],[311.75512000000003,1727],[312.1920998,1728],[312.6291152,1734],[313.0661662,1745],[313.50325280000004,1760],[313.940375,1775],[314.3775328,1788],[314.8147262,1798],[315.2519552,1806],[315.6892198,1813],[316.12652,1814],[316.5638558,1806],[317.0012272,1794],[317.4386342,1778],[317.87607679999996,1759],[318.313555,1743],[318.7510688,1745],[319.1886182,1756],[319.62620319999996,1771],[320.0638238,1786],[320.50148,1798],[320.9391718,1801],[321.3768992,1803],[321.8146622,1805],[322.2524608,1800],[322.690295,1793],[323.12816480000004,1786],[323.5660702,1780],[324.00401120000004,1768],[324.4419878,1762],[324.88,1768],[325.3180478,1776],[325.7561312,1777],[326.1942502,1776],[326.6324048,1774],[327.070595,1770],[327.50882079999997,1761],[327.9470822,1759],[328.3853792,1771],[328.82371179999996,1783],[329.26207999999997,1789],[329.70048380000003,1803],[330.1389232,1817],[330.5773982,1819],[331.01590880000003,1822],[331.45445500000005,1829],[331.8930368,1829],[332.3316542,1825],[332.7703072,1817],[333.2089958,1806],[333.64772000000005,1792],[334.0864798,1773],[334.5252752,1757],[334.9641062,1755],[335.40297280000004,1762],[335.841875,1770],[336.28081280000004,1772],[336.7197862,1757],[337.1587952,1739],[337.5978398,1718],[338.03692,1699],[338.4760358,1693],[338.9151872,1709],[339.3543742,1729],[339.7935968,1747],[340.232855,1759],[340.6721488,1764],[341.1114782,1762],[341.55084320000003,1753],[341.99024380000003,1739],[342.42967999999996,1731],[342.8691518,1726],[343.30865919999997,1727],[343.74820220000004,1733],[344.1877808,1746],[344.627395,1760],[345.0670448,1775],[345.5067302,1790],[345.94645119999996,1799],[346.3862078,1803],[346.826,1807],[347.2658278,1809],[347.7056912,1807],[348.1455902,1808],[348.58552480000003,1804],[349.025495,1797],[349.4655008,1790],[349.9055422,1788],[350.3456192,1783],[350.7857318,1776],[351.22587999999996,1772],[351.66606379999996,1771],[352.1062832,1760],[352.5465382,1748],[352.9868288,1746],[353.42715499999997,1743],[353.8675168,1743],[354.3079142,1743],[354.7483472,1744],[355.1888158,1741],[355.62932,1734],[356.0698598,1722],[356.5104352,1718],[356.9510462,1716],[357.3916928,1724],[357.832375,1742],[358.2730928,1757],[358.71384620000003,1765],[359.15463520000003,1779],[359.5954598,1784],[360.03632000000005,1776],[360.4772158,1775],[360.9181472,1781],[361.3591142,1786],[361.8001168,1790],[362.241155,1803],[362.68222879999996,1810],[363.1233382,1812],[363.56448320000004,1818],[364.0056638,1825],[364.44687999999996,1833],[364.8881318,1844],[365.3294192,1849],[365.7707422,1838],[366.21210080000003,1816],[366.653495,1786],[367.0949248,1759],[367.5363902,1736],[367.9778912,1716],[368.4194278,1708],[368.861,1706],[369.30260780000003,1697],[369.7442512,1691],[370.18593020000003,1692],[370.6276448,1696],[371.069395,1694],[371.51118080000003,1691],[371.9530022,1691],[372.3948592,1698],[372.8367518,1711],[373.27868,1730],[373.7206438,1750],[374.1626432,1772],[374.6046782,1790],[375.04674880000005,1802],[375.488855,1811],[375.9309968,1818],[376.3731742,1819],[376.81538720000003,1818],[377.2576358,1814],[377.69992,1814],[378.14223979999997,1815],[378.5845952,1816],[379.0269862,1810],[379.4694128,1804],[379.911875,1802],[380.3543728,1804],[380.79690619999997,1809],[381.2394752,1817],[381.6820798,1821],[382.12472,1816],[382.5673958,1805],[383.0101072,1790],[383.4528542,1781],[383.8956368,1776],[384.338455,1767],[384.78130880000003,1762],[385.2241982,1763],[385.6671232,1755],[386.1100838,1743],[386.55308,1734],[386.9961118,1725],[387.4391792,1720],[387.8822822,1722],[388.3254208,1734],[388.768595,1751],[389.2118048,1767],[389.6550502,1780],[390.0983312,1791],[390.54164779999996,1801],[390.985,1807],[391.4283878,1806],[391.8718112,1802],[392.3152702,1791],[392.7587648,1774],[393.202295,1763],[393.64586080000004,1757],[394.0894622,1753],[394.53309920000004,1753],[394.9767718,1763],[395.42048,1772],[395.8642238,1779],[396.30800320000003,1789],[396.7518182,1803],[397.1956688,1810],[397.639555,1814],[398.08347679999997,1816],[398.5274342,1816],[398.9714272,1808],[399.4154558,1793],[399.85952,1779],[400.3036198,1767],[400.74775520000003,1754],[401.1919262,1753],[401.63613280000004,1758],[402.080375,1756],[402.5246528,1750],[402.9689662,1745],[403.4133152,1735],[403.8576998,1726],[404.30212,1729],[404.74657579999996,1737],[405.1910672,1746],[405.6355942,1754],[406.0801568,1761],[406.524755,1768],[406.96938880000005,1774],[407.4140582,1771],[407.8587632,1768],[408.3035038,1765],[408.74828,1761],[409.19309180000005,1762],[409.6379392,1767],[410.0828222,1773],[410.5277408,1778],[410.97269500000004,1788],[411.41768479999996,1799],[411.86271020000004,1808],[412.3077712,1811],[412.7528678,1805],[413.198,1791],[413.6431678,1773],[414.0883712,1755],[414.5336102,1742],[414.9788848,1741],[415.424195,1747],[415.8695408,1756],[416.3149222,1770],[416.7603392,1783],[417.20579180000004,1792],[417.65128,1790],[418.0968038,1785],[418.5423632,1781],[418.9879582,1774],[419.4335888,1767],[419.879255,1768],[420.3249568,1772],[420.7706942,1779],[421.2164672,1794],[421.6622758,1809],[422.10812,1813],[422.55399980000004,1811],[422.99991520000003,1809],[423.44586619999995,1803],[423.89185280000004,1795],[424.337875,1792],[424.7839328,1790],[425.2300262,1784],[425.6761552,1783],[426.1223198,1793],[426.56852000000003,1805],[427.0147558,1816],[427.4610272,1827],[427.90733420000004,1833],[428.3536768,1831],[428.800055,1823],[429.2464688,1819],[429.6929182,1816],[430.1394032,1808],[430.5859238,1799],[431.03248,1797],[431.47907180000004,1792],[431.9256992,1778],[432.3723622,1767],[432.8190608,1754],[433.26579499999997,1738],[433.7125648,1724],[434.1593702,1722],[434.6062112,1725],[435.0530878,1740],[435.5,1758],[435.94694780000003,1772],[436.39393120000005,1781],[436.8409502,1788],[437.2880048,1789],[437.735095,1791],[438.1822208,1795],[438.6293822,1793],[439.07657919999997,1788],[439.5238118,1783],[439.97108,1777],[440.4183838,1780],[440.8657232,1795],[441.3130982,1811],[441.7605088,1823],[442.20795499999997,1831],[442.6554368,1824],[443.1029542,1806],[443.55050719999997,1792],[443.99809580000004,1781],[444.44572,1781],[444.8933798,1796],[445.34107520000003,1814],[445.7888062,1827],[446.2365728,1834],[446.684375,1831],[447.1322128,1823],[447.5800862,1813],[448.0279952,1803],[448.4759398,1794],[448.92392,1785],[449.3719358,1766],[449.8199872,1747],[450.2680742,1737],[450.7161968,1733],[451.164355,1735],[451.6125488,1749],[452.0607782,1761],[452.5090432,1763],[452.9573438,1760],[453.40568,1751],[453.8540518,1740],[454.3024592,1742],[454.7509022,1750],[455.1993808,1755],[455.647895,1763],[456.09644480000003,1777],[456.5450302,1791],[456.9936512,1806],[457.4423078,1817],[457.891,1829],[458.3397278,1833],[458.78849119999995,1830],[459.2372902,1821],[459.6861248,1817],[460.134995,1816],[460.58390080000004,1816],[461.0328422,1808],[461.4818192,1797],[461.93083179999996,1792],[462.37987999999996,1792],[462.8289638,1791],[463.2780832,1797],[463.72723820000004,1808],[464.1764288,1816],[464.625655,1821],[465.0749168,1834],[465.5242142,1854],[465.9735472,1863],[466.4229158,1863],[466.87232,1860],[467.3217598,1841],[467.77123520000004,1811],[468.2207462,1785],[468.6702928,1760],[469.119875,1740],[469.5694928,1732],[470.01914619999997,1733],[470.4688352,1736],[470.9185598,1739],[471.36832000000004,1742],[471.8181158,1744],[472.2679472,1745],[472.7178142,1756],[473.1677168,1769],[473.617655,1774],[474.06762879999997,1772],[474.5176382,1773],[474.9676832,1775],[475.4177638,1789],[475.86788,1812],[476.3180318,1837],[476.7682192,1853],[477.21844219999997,1860],[477.6687008,1852],[478.118995,1835],[478.5693248,1814],[479.0196902,1802],[479.4700912,1802],[479.9205278,1805],[480.371,1803],[480.8215078,1803],[481.27205119999996,1796],[481.72263019999997,1780],[482.17324479999996,1769],[482.623895,1766],[483.07458080000004,1762],[483.5253022,1755],[483.9760592,1749],[484.4268518,1739],[484.87768,1730],[485.3285438,1728],[485.7794432,1734],[486.2303782,1744],[486.6813488,1750],[487.132355,1762],[487.5833968,1776],[488.0344742,1781],[488.4855872,1774],[488.9367358,1776],[489.38792,1784],[489.8391398,1784],[490.29039520000003,1781],[490.7416862,1783],[491.1930128,1781],[491.644375,1768],[492.0957728,1757],[492.5472062,1758],[492.9986752,1768],[493.4501798,1774],[493.90172,1773],[494.3532958,1772],[494.8049072,1772],[495.2565542,1768],[495.7082368,1764],[496.15995499999997,1763],[496.6117088,1761],[497.06349819999997,1755],[497.51532319999995,1745],[497.96718380000004,1730],[498.41908,1724],[498.8710118,1725],[499.3229792,1721],[499.7749822,1725],[500.2270208,1736],[500.67909499999996,1744],[501.1312048,1746],[501.58335020000004,1746],[502.03553120000004,1746],[502.4877478,1747],[502.94,1748],[503.3922878,1757],[503.8446112,1771],[504.2969702,1778],[504.74936479999997,1785],[505.20179499999995,1796],[505.65426080000003,1803],[506.1067622,1806],[506.5592992,1815],[507.0118718,1821],[507.46448,1819],[507.9171238,1816],[508.3698032,1817],[508.8225182,1809],[509.27526880000005,1802],[509.72805500000004,1807],[510.1808768,1812],[510.6337342,1815],[511.0866272,1827],[511.5395558,1836],[511.99252,1833],[512.4455198,1825],[512.8985551999999,1805],[513.3516262,1773],[513.8047328,1746],[514.257875,1727],[514.7110528000001,1718],[515.1642661999999,1730],[515.6175152000001,1749],[516.0707998,1762],[516.52412,1776],[516.9774758000001,1787],[517.4308672,1781],[517.8842942,1777],[518.3377568000001,1774],[518.791255,1760],[519.2447887999999,1749],[519.6983582,1747],[520.1519632,1738],[520.6056037999999,1732],[521.05928,1742],[521.5129918,1744],[521.9667392,1743],[522.4205222,1752],[522.8743408,1761],[523.328195,1760],[523.7820848,1759],[524.2360102,1763],[524.6899712000001,1768],[525.1439678,1771],[525.598,1777],[526.0520678,1789],[526.5061711999999,1796],[526.9603102,1798],[527.4144848,1800],[527.868695,1799],[528.3229408,1794],[528.7772222000001,1790],[529.2315392,1787],[529.6858918,1779],[530.1402800000001,1767],[530.5947037999999,1757],[531.0491632000001,1754],[531.5036582,1753],[531.9581888,1751],[532.4127550000001,1761],[532.8673568,1773],[533.3219942000001,1783],[533.7766672,1791],[534.2313758,1798],[534.6861200000001,1796],[535.1408997999999,1789],[535.5957152,1773],[536.0505662,1751],[536.5054528000001,1740],[536.960375,1735],[537.4153328,1737],[537.8703262,1745],[538.3253552,1764],[538.7804198,1785],[539.23552,1799],[539.6906558000001,1802],[540.1458272,1800],[540.6010342,1798],[541.0562768,1781],[541.511555,1767],[541.9668687999999,1767],[542.4222182,1773],[542.8776032000001,1776],[543.3330238,1783],[543.7884799999999,1801],[544.2439718,1815],[544.6994992,1824],[545.1550622,1830],[545.6106608,1829],[546.0662950000001,1819],[546.5219648,1806],[546.9776701999999,1787],[547.4334111999999,1772],[547.8891878,1769],[548.345,1770],[548.8008478,1769],[549.2567312,1779],[549.7126502,1791],[550.1686048,1800],[550.624595,1801],[551.0806207999999,1798],[551.5366822,1793],[551.9927792000001,1788],[552.4489118,1779],[552.90508,1773],[553.3612838,1770],[553.8175232,1769],[554.2737982,1768],[554.7301087999999,1771],[555.186455,1780],[555.6428367999999,1791],[556.0992542,1798],[556.5557072,1797],[557.0121958,1795],[557.4687200000001,1801],[557.9252798,1810],[558.3818752,1814],[558.8385062,1818],[559.2951728,1813],[559.751875,1800],[560.2086128000001,1788],[560.6653862000001,1783],[561.1221952000001,1784],[561.5790397999999,1788],[562.03592,1788],[562.4928358,1790],[562.9497872,1786],[563.4067742,1783],[563.8637968,1791],[564.3208549999999,1809],[564.7779488,1818],[565.2350782000001,1827],[565.6922432,1834],[566.1494438,1830],[566.60668,1813],[567.0639518,1802],[567.5212592,1792],[567.9786022000001,1790],[568.4359808,1791],[568.893395,1789],[569.3508448,1785],[569.8083302,1778],[570.2658512,1769],[570.7234077999999,1768],[571.181,1768],[571.6386278,1765],[572.0962912,1772],[572.5539902,1785],[573.0117248,1796],[573.469495,1803],[573.9273008,1808],[574.3851422,1807],[574.8430192,1800],[575.3009318000001,1788],[575.7588800000001,1779],[576.2168638,1778],[576.6748832000001,1778],[577.1329382,1773],[577.5910288,1769],[578.0491549999999,1768],[578.5073168,1771],[578.9655141999999,1777],[579.4237472,1776],[579.8820158000001,1771],[580.34032,1775],[580.7986598,1773],[581.2570352,1765],[581.7154462,1773],[582.1738928,1792],[582.6323749999999,1800],[583.0908928,1805],[583.5494462,1812],[584.0080352,1807],[584.4666598,1793],[584.92532,1780],[585.3840158,1770],[585.8427472,1759],[586.3015141999999,1755],[586.7603168,1758],[587.219155,1774],[587.6780288,1792],[588.1369382,1798],[588.5958832,1797],[589.0548638,1790],[589.51388,1776],[589.9729318,1770],[590.4320192,1778],[590.8911422000001,1792],[591.3503008,1804],[591.809495,1807],[592.2687248,1799],[592.7279902,1796],[593.1872912,1791],[593.6466278,1789],[594.106,1794],[594.5654078,1800],[595.0248512000001,1793],[595.4843302,1795],[595.9438448000001,1805],[596.403395,1806],[596.8629808000001,1803],[597.3226022,1798],[597.7822592,1784],[598.2419517999999,1770],[598.7016799999999,1769],[599.1614438,1776],[599.6212432,1791],[600.0810782000001,1811],[600.5409488,1817],[601.000855,1808],[601.4607968,1797],[601.9207742,1783],[602.3807872,1769],[602.8408358,1755],[603.30092,1744],[603.7610397999999,1731],[604.2211952,1716],[604.6813862,1717],[605.1416128000001,1729],[605.6018750000001,1739],[606.0621728,1755],[606.5225062,1770],[606.9828752000001,1770],[607.4432798,1760],[607.90372,1752],[608.3641958000001,1744],[608.8247071999999,1740],[609.2852542,1736],[609.7458368,1734],[610.206455,1734],[610.6671088,1733],[611.1277982,1729],[611.5885232,1730],[612.0492838,1734],[612.51008,1741],[612.9709118000001,1754],[613.4317791999999,1768],[613.8926822,1781],[614.3536208,1790],[614.814595,1789],[615.2756048,1779],[615.7366502,1765],[616.1977312,1750],[616.6588478,1736]]","payloadType":"json","x":200,"y":240,"wires":[["c794966c.cce33","afd77a54.5355e8"]]},{"id":"c794966c.cce33","type":"debug","z":"7a58f133.7c9708","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":550,"y":240,"wires":[]},{"id":"afd77a54.5355e8","type":"function","z":"7a58f133.7c9708","name":"","func":"// calculate mean\nconst average = arr => arr.reduce( ( p, c ) => p + c, 0 ) / arr.length;\n\n// get input array\nvar array = msg.payload;\n// get only first values\nvar array1 = array.map(function(value,index) { return value[0]; });\n// length of bins to average\nconst binsize = 200;\n// array fot the average values\nvar avg = [];\n\n// calculate the average\nfor (var n = 0; n < array1.length; n = n + binsize) {\n    avg.push(average(array1.slice(n, n + binsize)));\n}\n\n// return result\nmsg.avg = avg;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":380,"y":280,"wires":[["c794966c.cce33"]]}]

I used your values in an inject node.

Try this in a function node, it will output average for every count(200) and if last items are not 200 then averages the left over

var output = [], sum = 0, count =200;
//loop through array`
for(var i = 0; i < msg.payload.length; i++){
    sum += msg.payload[i][1]; // sum values
    if(Number.isInteger((i+1) / count)){  // output every 200
        output.push(sum/count);
        sum = 0;// reset sum
    }
}
// if last values not count of 200 out put final
if (sum > 0){
    output.push(sum/(msg.payload.length%count))
}
msg.payload = output;
return msg;
1 Like

Thank you so much, This worked, I just had to change the "return value[0];" to look at [1] for the Intensity average.

This solution also works For what I want. :grinning:

Ah, damn, I understood your question just the other way around :upside_down_face: :grin:

If you like you can even enhance the input of the function like this:
image
And
image
This way you can change your averaging outside of the function node and you are quite flexible.

Next steps would be to use a dashboard with input nodes and maybe a chart to show the results. There is so much fun you can have with node-red :smiley:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.