Dear sir,<br> <br> I am have 2 mxn numpy array say "obs" & "fcst". I have to calculate <b> sum of squre of (obs[i, j]-fcst[i, j])</b> using <span style="background-color: rgb(255, 0, 0);">from cdms2 import MV2 as MV</span> in CDAT without using "for" loop. <br>
<br>For example: <br>obs=<br>[0.6 1.1 0.02 0.2 0.2 <br>0.8 0. 0. 0.4 0.8 <br>0.5 5.5 1.5 0.5 1.5 <br>3.5 0.5 1.5 5.0 2.6 <br>5.1 4.1 3.2 2.3 1.5 <br>4.4 0.9 1.5 2. 2.3 <br>
1.1 1.1 1.5 12.6 1.3 <br>2.2 12 1.7 1.6 15 <br>1.9 1.5 0.9 2.5 5.5 ]<br><br><br><br>fcst=<br><br>[0.7 0.1 0.2 0.2 0.2 <br>0.3 0.8 0. 0. 0. <br>0.5 0.5 0.5 0.5 0.5 <br>
0.7 1. 1.5 2. 2.6 <br>5.1 4.1 3.2 2.3 1.5 <br>0.7 1. 1.5 2. 2.3 <br>1.1 1.1 1.1 12.7 1.3 <br>2.2 2. 1.7 1.6 1.5 <br>1.9 1.5 0.9 0.5 7.5]<br><br>
here "obs" and "fcst" are numpy array<br>I give <br><br>obs=MV.array(obs)<br>fcst=MV.array(fcst)<br><br>Then it become<br><br><br>sbst=obs-fcst<br><br>>> subst=<br>[[ -0.1 1. -0.18 0. 0. ]<br>
[ 0.5 -0.8 0. 0.4 0.8 ]<br> [ 0. 5. 1. 0. 1. ]<br> [ 2.8 -0.5 0. 3. 0. ]<br> [ 0. 0. 0. 0. 0. ]<br> [ 3.7 -0.1 0. 0. 0. ]<br> [ 0. 0. 0.4 -0.1 0. ]<br>
[ 0. 10. 0. 0. 13.5 ]<br> [ 0. 0. 0. 2. -2. ]]<br><br>But i dont know how to find sum of squre of each term....(Actually my aim is to finding MEAN SQUARED ERROR) <br> <br><br><br><br>Thanking you...................<br clear="all">
<br>-- <br>DILEEPKUMAR. R<br>J R F, IIT DELHI<br><div style="display: inline;"></div><br>