爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 10465|回复: 7

NCL if语句出错:The result of the conditional expression yields

[复制链接]

新浪微博达人勋

发表于 2016-12-15 15:37:28 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x

NCL脚本如下:

do i=0,240
            do l=0,26
                if (ismissing(va_c(l,i))) then  
                    mva(l,i)=mva@_FillValue
                end if
                if((.not.ismissing(va_c(l,i))).and.(mva(l,i).eq.0)) then
                    mva(l,i)=mva@_FillValue
                end if
            end do
        end do
提示错误:The result of the conditional expression yields a missing value. NCL can not determine branch, see ismissing function。

对照官网相关如下:
Sample code that causes the error:
    x = new(1,float)   ; x is assigned a missing value    if(x.gt.5) then      print("x > 5")    end if

Cause: Using a missing value in an "if" statement or some other conditional statement.

Fix: If there's a chance your variable could be missing, then use ismissing to test for missing values.


    x = new(1,float)    if(.not.ismissing(x).and.x.gt.5) then      print("x > 5")    end if
感觉我的脚本跟官网一样= =不知为啥错误,求大神解答。

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2020-4-10 14:57:30 | 显示全部楼层
因为数据中有缺测。

在该if语句中,逻辑表达式的值将是missing,所以引发异常。 正确的判断是否为缺测的方式是使用 ismissing 函数。

参考:https://ncl.readthedocs.io/zh_CN/latest/language/loop.html
密码修改失败请联系微信:mofangbao
回复 支持 1 反对 0

使用道具 举报

新浪微博达人勋

发表于 2017-6-29 09:41:44 | 显示全部楼层
同问啊,我也是这样报错,有没有大神知道是怎么回事啊?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-6-29 09:41:49 | 显示全部楼层
同问啊,我也是这样报错,有没有大神知道是怎么回事啊?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-10-24 11:30:18 | 显示全部楼层
WOYESHI
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

发表于 2017-10-24 13:26:39 | 显示全部楼层
请问大神解决了吗?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-3-25 15:10:08 | 显示全部楼层
tongwen ya
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

发表于 2018-5-22 16:55:20 | 显示全部楼层
数据格式问题
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表