我正在处理netCDF文件,并且在每个步骤中我都想验证我的温度变量的值是否相同.在每次修改时,我都会保存一个新文件,并使用R运行此文件:
I am working on netCDF files and at each step I want to verify that the value of my temperature variable is the same. At each modification I save a new file and with R I am running this:
for (i in 1: (dim(time1)*dim(long1)*dim(lat1))) {if(var1[i] != var2[i]) {stop(paste("Not the same values",i))}}Var1是我的第一个文件的温度,而var2是我的第二个文件(修改后的文件)的温度
Var1 is the temperature of my first file and var2 is the temperature of my second file (the modified one)
当我将温度短的文件与温度短于浮点的文件进行比较时,我收到一条消息不同的值",而该文件是相同的值(粘贴时可以看到).
I have a message "Not the same values" when I compare a file with temperature as short to a file with temperature as float whereas it is the same value (I can see it when I paste it).
这正常吗,如何验证修改后的文件中的值是否存在问题?
Is it normal and how can I verify if there is a problem of values on my modified file?
推荐答案感谢您的评论,我更改为
Thanks for the comment, I change to
for (i in 1: (dim(time1)*dim(long1)*dim(lat1))) {if(all.equal(var1[i], var2[i]) == FALSE) {stop(paste("Pas les mêmes valeurs",i))}}效果很好
更多推荐
两个netCDF文件的比较
发布评论