<div dir="ltr"><div dir="ltr">Hello!! <div>I'm trying to run a loop to cross validate my IDW surfaces. The values that i try to interpolate are pH values over a small zone in Siem Reap, Cambodia. I've been using the following script:</div><div><br></div><div>from grass.pygrass.modules import Module</div><div>from subprocess import PIPE</div><div>import numpy as np</div><div>rsme = []</div><div>for i in range(1,5):</div><div>  idwout = "pH_CV"</div><div>  Module("v.extract", flags="r", input="pHsr", output="pHcalibration", where="part={}".format(i),overwrite=True)</div><div>  Module("v.extract", input="pHsr", output="pHvalidation", where="part={}".format(i),overwrite=True)</div><div> Module("v.surf.idw",input="pHcalibration",column="dbl_3",npoints=12,power=2,output="pH_CV", overwrite=True)</div><div>  Module("v.what.rast", map="pHvalidation", raster="pH_Surface", column="actual")</div><div>  Module("v.what.rast", map="pHvalidation", raster="pH_CV", column="estimated")</div><div>  sqlstat = "SELECT actual,estimated FROM pHvalidation"</div><div>  stats = Module("db.select", flags="c", sql=sqlstat,stdout_=PIPE).outputs.stdout</div><div>  stats = stats.replace("\n", "|")[:-1].split("|")</div><div>  stats = (np.asarray([float(x) for x in stats], dtype="float").reshape(len(stats)/2, 2))</div><div>  rsme = np.sqrt(np.mean(np.diff(stats, axis=1)**2))</div><div>  results = ("RSME (mean +/- stddev) = {} +/- {}".</div><div>  format(np.asarray(rsme).mean().round(2),</div><div>  np.asarray(rsme).std().round(2)))</div><div>  print results</div></div><div dir="ltr"><div><br></div><div>The script is working but at the third round of the loop i get a Value error (could not convert string to float). When i check the vector pHvalidattion, i see that for some reason i have created a blank value in the vector, that could not be used as a floating point number, of course... which is really unexpected because all the values from the input are simple numbers. (I've attached a screen of the vector with the blank value).</div><div><br></div><div>Another thing that bothers me is that the results are not printed the way i wanted, instead of the RSME and +/- st.dev, i get different results for RSME (one for each loop, i guess) +/- 0. Could be because i exchanged <span style="font-family:Consolas,Monaco,"Andale Mono","Ubuntu Mono",monospace;font-size:14px"><span style="background-color:rgb(255,255,255)"><font color="#000000">±</font></span></span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif"> </span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">with +/-?</span>  (i was getting an unicode error using the first symbol). I doubt that is the case because i think that "RSME (mean+/- stddev) = {} +/- {}" is just specifing how i want the results printed. </div><div>In attached a screen of the display of the results. </div><div><br></div><div>Thank you for any kind of help! this mailing list has been of great help to me since i started to use Gis GRASS! without your help everything would be much more difficult for a beginner like me!</div><div><br></div><div>Best regards,</div><div>FS.</div><div><span class="gmail-token gmail-string" style="background-color:initial;word-spacing:normal;box-sizing:inherit"><font color="#000000" style=""><font face="arial, helvetica, sans-serif" style=""></font></font></span></div><div><br></div></div></div>