https://www.geecoders.com/2020/10/martix-calc.html