NCL在执行函数tofloat的时候,得到提示:“warning:tofloat: A bad value was passed to (string) tofloat, input strings must contain numeric digits, replacing with missing value”
但是,你的字符串可能看起来是正常的:(0) "70.9333333"
这个时候,实际上是因为你的字符串有双引号。你为了转换成功,需要将里面的双引号替换成空格,方便进行转换。
替换成空格的方式是:
dq = str_get_dq()
newstring = str_sub_str(yourstring, dq," ")
welldone = tofloat(newstring)